Finding all particles that were born from particular interaction

Hello Dear Experts,
In my simulation i have ions bumping into thick target. Having multiple interactions. I am intrested in finding daugher particles from fisrt interaction of each ion. How can i access daughter particles from step of my primary ion?

If you have a G4SteppingAction or “sensitive detector” (SD) implemented in your application, then you can access the secondaries via either of two methods,

G4TrackVector* G4Step::GetSecondary() returns all of the secondaries produced for the whole track, from all the steps that track has taken.

const std::vector<const G4Track*>* GetSecondaryInCurrentStep() returns only the secondaries created by this specific step.

See $G4INCLUDE/G4Step.hh for the full interface to G4Step.

1 Like

Thank you very much for your answer