How to store the information history of a particle from its birth from the source to its destination?
It is not an easy question as particles produce secondaries, sometimes the same particle species, and it is quite non-trivial to decide which to follow. What is your research idea?
The research idea is:
I have defined a geometry which is a rectangular cube. The upper surface of this source cube is a plane where particles with a certain energy distribution and angular distribution are emitted from that source. The source particles, travel the height of the cube and reach the detector after some attenuation. The detector is located under the cube geometry. The goal is to record the history of the particles from the point of birth from the source until they reach the detectors. We only want this history for primary particles and secondary particles are not important.
Use a SteppingAction, then. In the SteppingAction, apply cuts (if statements) to select which particles you want to record, and then fill an N-tuple row with the information for each step.
Thank you for your reply.
What variable in Ntuple can print the final energy of a particle when it reaches the detector?
Whatever N-tuple variable you want it to be. If you’re using a SteppingAction, you can get the kinetic energy of the post-step point.
Is it also possible to save just “everything” like all steps of all occuring particles? I don’t have to “cut” out some particles, energies and so on or?
A SteppingAction is something you write yourself (Geant4 does not provide any version). So you can save anything you want, with whatever cuts or extra calculations you like.