Data output of the secondary particles

Hello colleagues,

And how to create a data output of the secondary particles in case of the primary photon beams?
Maybe there is some kind of example to navigate?

for example, the output of such information:

  1. type of particle, (Compton electrons, ionization electrons, photoelectrons, secondary photons ?)
  2. The energy of this particle,
  3. Type of physical process (photoelectric effect or Compton effect ?)

Thanks to all!

If you need this for all interactions in all volumes, the easiest way to do this is with a SteppingAction. For the step, check if the track’s ParentID() is zero, meaning it’s a primary. Then you can collect information from the step, including the energy, the post-step GetProcessDefinedStep().

If you are only interested in primary photons’ secondaries in a particular target volume, you can do the same thing with a SensitiveDetector attached to that volume.

You could either accumulate this stuff in a HitsCollection, or push it directly into an N-tuple.

Thank you for the answer!
I’m not an expert in geant4
Can you tell me where I can see an example in more detail?