Get the particle type of parent

dear geant4 experts:
I want to get the particle type of parent, such as, In my problem, proton is the primary particle and it can interaction with material, then the second proton will be produced by the hard collection, at the same time, the secondary proton continue to transport in the material, let’s assumption that this step produces electron, if energy of the electron large enough, new electron will be produced by the delta-electron.
my problem is how could I distinguish the electron comes from, as discribd above, whether the electron produced by secondary protons or delta-electron?
Thanks for your attention.