Simulating radioactive decay using GPS and /run/beamOn

I’m simulating Ba139 decay using GeneralParticleSource and /run/beamOn. I use a scoring volume with stepping class to detect the gamma rays from the decay, but I was unsure about the counts I was getting. When I generate a number of particles using /run/beamOn (let’s say, 10^9), am I generating 10^9 decay events? Does Geant4 simulate all of these decays at once, or does it take the half-life into account? I did not include anything related to time, but I can’t seem to find more information about how G4 actually simulates decay events. Any help would be appreciated!


_Geant4 Version: v11.0.2

Yes, that’s exactly right. The argument to beamOn is the number of events you want in your output. You might have multiple tracks, multiple energy deposits per event. If you’re saving the individual outputs to an N-tuple, I’d recommend including the eventID as one of the columns of the tuple.

If you’ve configured GPS to create a Ba-139 ion as the primary, then yes, Geant4 will take the half-life into account. The secondary tracks (electron, neutrino, and La-139) will be created with their track->GetGlobalTime() set randomly according to the half-life.

Thank you for the reply! This cleared up a lot.

Hi mkelsey, there’s one last thing I’m still unsure about. Would GetGlobalTime() tell me the time (in minutes) of each decay event? Is there a way of getting the overall time it took for all decays to happen?
Thanks again for your help.

track->GetGlobalTime() (or step->GetGlobalTime()) tells you the timestamp assigned to that particular step at that moment. If you set up your code to record position and time information for all steps along a track, you’ll see that the time increases from one step to the next, by an amount equivalent to the flight time of the track (in the lab frame) during the step.

So yes, it gives you the instantaneous value. If you want to learn how long in the simulated universe, a whole event took, then you would want to record the timestamps for when every track in the event stopped, and within the event, find the largest one of those.