Is there a way to change a given secondary particle into a primary particle

I’d like to use a radioactive decay (89Zr) to subsequently change the 909 keV gamma and the b+ to be primary particles so that I can score tracks in an SD to be from these two primaries rather than from 89Zr. Is there a way to capture the given trackID from 89Zr and then create a primary at that point?

Hi Okeefegj,

Could you explain why you need the gamma and b+ to be primary particles? Your sensitive detector should measure energy depositions from both of them regardless of whether they are primary or secondary particles.


Hello Joseph,

I’d like to be able to determine the degree of spectral contamination from the 909 keV coincident gamma as a result of scatter to the 511 keV window (typically 350 - 600 keV).

I guess what I’d like to do is in the UserSteppingAction (or is it UserTrackingAction?) is to check the trackID (it’s 2 for the decay gamma and 4 & 5 for the annihilation gammas).
Then, collect the DynamicParticle information, kill the tracks and define a primary track at from the secondary position / kinematics.
Is that possible?


Hi Graeme,

I think what you want to do is possible, but the means of implementing it that seem easiest to me involve running separate Geant4 simulations. I assume you want to compare the flux or energy deposition that follows from the decay gamma and all its secondaries, and compare that to the flux from the positron and annihilation gammas it yields.

The way I would go about this is with a UserStackingAction. In the ClassifyNewTrack function you could run a simulation where any decay gammas are immediately killed and not added to the stack. In a separate simulation you would do the opposite, immediately killing any positrons and tracking your decay gammas (and their secondaries) instead. Then you could take a ratio of the energy deposition / flux / your parameter of interest yielded by the two simulations to determine the spectral contamination.

If you were going to take this approach I would recommend coding a StackingActionMessenger class, so that you can communicate with your StackingAction from a macro file, rather than having to recompile your code entirely for the two different configurations I have described above.

I hope I have understood what you want to do correctly and that this is helpful,


Hi Joseph,

Thank you for your very helpful directions and yes, you have interpreted my goals correctly.

I have started experimenting with fStopAndKill in a UserSteppingAction method.
I apply this to particle == “e+” and also processName == “annihil” in my sample volume, that way I can also quantify the amount of e+'s that escape the volume.

As you point out, this involves recompilations for differing scenarios, so I’ll follow your suggestion and look at implementing the StackingAction Messenger + StackingAction.

thanks again.