Track All Daughters in Decay Chain

_Geant4 Version: 4-11.2
_Operating System: Windows 11
_Compiler/Version: Visual Studio 17.9
_CMake Version: 3.29.2


Trying to ask this question in a different way, in the hopes of getting a response (more in depth forum post is here (https://geant4-forum.web.cern.ch/t/radioactive-decay-of-222rn/13887.

I am trying to model the decay chain of 222Rn, and by default Geant4 simulates the entire decay chain in a single event. The output from running the simulation shows all of the decay products like the alphas, betas, etc, and the lone 206Pb stable daughter and the parentID for all of these is 1, which is the 222Rn.

What I am trying to do is to properly track ALL of the daughters and their corresponding decay products. e.g. the first daughter 218Po should have an alpha associated directly to its decay, the 214Pb should have a beta, and so on. I have tried looking extensively throughout the forum and also the extended examples for radioactive decay, but I can’t seem to find anything that does what I am looking for. I’ve tried using /process/had/rdm/timeWindow (and setTimeWindow) based on tutorials I’ve been looking, but neither of these work.

Any help at all with this would be greatly appreciated!

What is it that you want from the daughters? I assume you mean the heavy ions since technically every single particle will be a “secondary” of the initial decay. If you want static properties like number or time then you could populate a histogram that is refreshed in the event action of any of those properties and is reset for each event. You would likely use your own PreUserTrackingAction or PostUserTrackingAction both for speed and because it will poll those properties once and only once for each particle.

For dynamic quantities (like total energy deposited) the idea would be the same but to create either many histograms for each particle type that are populated in the stepping action or fields in an ntuple for sensitive volumes.

In any case, I suspect the Activation example would lead to inspiration and does a lot of this at a very large and general scale.

Thank you for response! I will take a look at the activation example. Essentially, I would want the secondary (non-heavy ion) energy spectrum but be able to associate the alphas, gammas, betas to the specific heavy ion.

The end goal is to simulate a known activity level of underground radon (150 Bq/m^3), to extract the energy spectrum of the secondaries (again non-heavy ions), which would be used to help information shielding needs, etc. I have never used geant4 for this, so maybe I am going about it the wrong way.

How “far” do you want to do this? A gamma can, in turn, create another electron with compton scattering for example. Would you want to follow that electron as well? If not, then you can just check the parent is a heavy ion in the stepping action and record the info with the methods I described or in the Activation example. If you would want subsequent secondaries (such as that electron), you’ll need a little more since Geant4 doesn’t let you see grandparents, great grandparents, etc. out of the box.

In that case, you might be able to combine a lot of the implementation of the Activation example with RE01, specifically creating your own custom TrackingUserInfo that is then passed to all subsequent secondaries in the PostUserTrackingAction. You’d create info for a particle in the PreUserTrackingInfo if its parent is a heavy ion and record what it is. Then whenever you are histogramming or recording the energy of a particle in your SteppingAction you just check if that field exists (in your case it should but this will handle weird edge cases) and, if so, what it is. This can then be recorded in an ntuple field or used as a key for a map for post processing.