How to add a mark for secondries generating during a certain track?

Hi! I have a problem about particle tracking.
During simulation, a track may generates many secondaries. How can I add a mark(like a G4bool) to these secondries for later use?

Hi @Song_Yuanpeng

you can iterate over all secondaries using G4TrackVector
e.g.

const G4TrackVector* temp = step.GetSecondary();
    for (G4int i = 0; i < (int)temp->size(); i++) {
    G4String str = temp->at(i)->GetDefinition()->GetParticleName(); 
}

Full detailed example is given examples/advanced/radioprotection/steppingAction.CC

VRS

Thank you for your suggestions!
I have followed your suggestion and using this trick in my tracking action along with trackinformation class to achieve my purpose. :grinning: