# To get all the interaction and trajectory information of a single charged primary

I’m creating a box of length 1m with a medium and aims to simulate the interaction of proton irrespective of secondary particles. Being focused on only the primary particle, I want to get all its interaction with position, stopping power Vs Range at different energies. I’m a beginner and not able to figure out how to get all this information. I’ll appreciate any guidance on how to proceed further. Let me know if you need more details

Use a SteppingAction. That class will have a function that gets called for every step of every track, in every volume. You will want to record as much information as possible (e.g., into an N-tuple), so that you can filter it, make histograms, etc. in your analysis, rather than having to recompile and rerun the simulation every time.

Can you please share an example so that I can understand well?

Dear,

Keep in mind that if you want to calculate the SP, you have to switch off the multiple scattering, the energy loss fluctuations and have a high cut not to produce secondary particles. For the range, it depends if you want to calculate the CSDA range or other definitions of the range. Usually, if not calculating the CSDA range, we look at the “range” at the 80% fall-off of the Bragg Peak.
Look at the extended/electromagnetic example TestEM1 .

for the CSDA range:pRange.mac
For the stopping power (in the same configuration of pRange.mac), retrieve the energy deposition in the first step and divide it by the length of the step. The maximum step needs to be small (small depends on the energy of the incident projectile, try few values of the max step, e.g. 1 micrometer, 10 micrometers). Probably there is an extended example to do this.

Cheers
Susanna

I didn’t get it. I’m elaborating what I aim to do and how I’m proceeding. Please guide me if I’m not going in the right direction.
I’m generating a proton of energy 100GeV and transporting it in a medium filled in a box of length 1m. I want to get the trajectory of the proton in that medium. The physics processes I’m considering are G4EmStandardPhysics and Hadronic Elastic and inelastic processes. and after constructing the processes in SteppingAction class I aim to track proton’s step. The track is all I’m aiming for. And to get that I’m not sure what to do. Please guide me how to do that step by step.
I’m looking forward the guidance.