In this case, the target is 1.0cm thick aluminium. Do this for electrons, gammas, muons, pions, neutrons, and protons, at 50 MeV. No magnetic fields. The geometry is shown schematically below. You will need to modify ugeom.f accordingly.
In this case, the energy loss is defined by the difference in energy before entering the target and after. Note, this is not the same thing as the energy deposited in the target because energy can be lost to a reaction product which in turn exits the target. So the idea is to extract the energy of the particle as it enters the region to the right of the target, or at some point after entering the region to the right of the target. You will need to work out what routine to modify and how, probably gustep.f or guout.f. The more useful variables are in common blocks /GCKINE/, /GCTRAK/, and /GCVOLU/. Consult the CERN documentation for GEANT Common blocks for a complete list. Be aware that the variables IKINE and PKINE set by the KINE command store information from the initialization of the event, and do not represent the current status at any point of tracking. Also, be aware that the input energy is kinetic energy, not total energy. Remember that often more than one particle exits a medium, so consider how that will affect your results and if there is anything that should be done about it.
At first, do this one event (trig) at a time, for 10 events, printing the energies for each event. This should provide some idea of the energy scale in question as well as the range.
Then, set up a histogram to look for the peak energy (in 'uhinit.f' and gustep.f), and run it for 200 events. Look at the energy spectrum (see Viewing Histograms). You should see a peak NOT at the energy you input. Consider the energy range of interest, and set the lower and upper limits accordingly. On the otherhand, you can overspecify the histogram range and number of bins (larger range, higher number of bins) and use the HI/ZOOM command to examine histograms more closely. Some of the existing histograms are obviously poorly defined, so consider redefining them, as they may be useful for comparison. You need to be able to resolve at least 0.25 MeV. You should not need to know how to code energy deposition histograms for this exercise.
Now run for 1000 events. Use GEANT reaction tables to calculate an expected mean energy loss. There should already be a histogram that corresponds to energy deposited in the aluminium target, so use that to compare the simulated energy deposited with the simulated energy loss. Note, "peak energy" does not have to be the same as "mean energy". Use the PAW 'ZONE' command to plot one histogram above the other.
You should find that for photons there is no energy loss,
as neutral particles cannot continuous experience energy loss, at least
not the way charged particles do.
Charged particles not only lose energy, they lose varying
amounts of energy, resulting in a finite width peak. This is an
effect that real experiments must take into account (for which
simulations like this are often used).
Measure the width of the peaks (full width at half maximum).
Conversely, since photons
don't experience this energy loss, their peaks actually have
zero width (what you see is the single bin resolution of your
Protons lose a lot more energy than the other particles. Determine
how thick the target needs to be to reduce the energy loss to 10 MeV.