How to get the the name of parent particle that created the current track?

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_4.11.0
_Operating System:_ubuntu
Compiler/Version:
CMake Version:


You cannot, in general. Tracks are killed and deleted from memory once they finish. New secondaries do not start tracking (in general) until the parent track stops and is killed and deleted. There are a couple of special cases where that is not true, but you should not be writing your code for those special cases.

If you want to keep track of details about a parent, a safe way to do that is in either your SD or your SteppingAction class. Define a UserTrackInformation (TrackInfo) class in your code, with data members for whatever you want to remember (particle type, track ID, energy, momentum, whatever). In your SteppingAction or SD, look to see whether the current track (the future parent) has created secondaries. If it has, then attach one of your TrackInfo objects to that secondary, and populate it with information from the current track.
Later, in your SD or Stepping action, when you go to fill N-tuples, you can pull information out of the TrackInfo object and store it for analysis.

Another approach is to simply store all the steps into your N-tuple directly, including TrackID, StepNumber, and ParentID along with kinematics info. In your analysis code, you can use the ParentID to find the row(s) associated with that (parent) track.