In my user routine, I added “trackr.inc” which allows me to obtain the particle position at the beginning and end of the step via XTRACK(0) XTRACK(NTRACK), and the same with YTRACK and ZTRACK.
I can access the kinetic energy using Etrack - AM(Jtrack). However, it seems to be the kinetic energy at the end of the step. How can I get the kinetic energy at the beginning of the step?
To get the energy at the beginning of the step you can use the DTRACK(MTRACK) variable, what prints the energy deposition at each deposition event. Therefore, by adding to the kinetic energy at the end of the step the energy deposited along the step, you will be able to retrieve the kinetic energy at the beginning of the step: Etrack - AM(Jtrack) + DTRACK(MTRACK)
Important: be sure that you are calling this variable in the main body of the mgdraw.f routine, i.e., at the MGDRAW entry since it is the sub-function that writes the collision tape.
Thank you Marta for your response.
As I am using USIMBS routine, I am now considering the kinetic energy at the beginning of the step being ETRACK - AM(JTRACK) + DTRACK(1). I am not using DTRACK(MTRACK) because USIMBS is called at each step hence, only 1 value exists in DTRACK. It seems to work in most of the cases.
However, I’ve observed an unusual behavior in rare instances, particularly when dealing with photons. To illustrate this behavior, I have provided a table below that presents the results of 15 successive steps for a single photon.
In each step, you will notice that the photon’s final position (Xf, Yf, Zf) coincides with its initial position (Xi, Yi, Zi) for subsequent step, suggesting that these steps are indeed consecutive. To further analyze the situation, I have included the polar and azimuthal angles (Thetai, Thetaf, Phii, Phif, in degrees) for the direction of the photon. Interestingly, we observe a pattern where steps 2 to 6 share the same initial direction, and steps 7 to 15 also share a common initial direction. However, despite this pattern, the final direction in each step does not align with the initial direction of the next step. This could be coming from multiple scattering maybe but it is not the real issue here.
Also note the steplength being always the same.
The real issue is the following: the energy values at the beginning and end of each step appear to be very strange. It seems as though the photon is regaining energy at each step, as the final energy does not match the initial energy of the subsequent step. This raises a significant question: Why is this behavior occurring, and is there a plausible explanation for it?
The issue you observe is due to the fact that photons have no charge, they do not lose energy when taking a particle step (there’s no “dE/dx” for neutral particles).
Therefore, there is no point in calling DTRACK for photons. In this case, the value of DTRACK remains from the last value of the last call for charged particles, which is completely unrelated to that photon. In your routine, you may restrict the use of DTRACK only to charged particles.
Thank you for your clarification regarding the use of DTRACK for photons. I know that photons do not experience energy loss due to dE/dx, as they are neutral particles. However, photons can indeed undergo energy-altering processes such as Compton scattering, the photoelectric effect, pair production, inelastic scattering, bremsstrahlung, and Cherenkov radiation.
What I understand:
When photons undergo processes that modify their energy (such as the ones mentioned above), DTRACK becomes relevant, and ETRACK + DTRACK can be used to determine the photon’s energy at the beginning of the step.
For steps where photons do not experience any energy changes, the energy at the beginning of the step remains the same as the energy at the end of the previous step. In this case, the correct value to use is ETRACK for energy at the beginning and end of the step. However, I am wondering why DTRACK is not 0.
To identify whether a step involves an energy change or not, how can I proceed in my routine? How can I evaluate the photon’s energy change during the step and then decide whether to add DTRACK to ETRACK based on the outcome of this evaluation?
Also, could you please provide an explanation of why the steplength is the same for groups of photons and the directions of photons at the end of a step do not coincide with the direction at the beginning of the next step? I have been thinking the interaction occurs at the end of the step in the code and then the direction at the beginning of the subsequent step should be the same?
no, these processes - as any discrete process, opposite to ionization (DTRACK refers to) and multiple scattering, which apply only to charged particles - do no take place along the step, rather at the end of the step. The photon direction may change as a result of them.
In case of neutral particles, you should not use DTRACK (photons do not regain energy).
Is there a way in USIMBS to differentiate a step with discrete processes and a step with continuous processes ?
What about the strange behavior I noticed for the direction angles? Is the direction from UOLD/VOLD/WOLD also refering to a previous continuous step when the current one describes a discrete process ?
USIMBS is not called at the end of a particle step if a discrete process is going to take place there (otherwise, instead of leading to particle splitting, it should lead to multiply its interaction).
Therefore, you should not care about discrete processes, rather consider that a charged particle may have lost energy along the step due to continuous processes, while a neutral particle did not.
Concerning the direction of the photon, which naturally did not undergo multiple scattering either, you refer to inappropriate variables (as earlier with DTRACK). Through trackr.inc, you can find the final direction in CX/Y/ZTRCK and you can retrieve the initial one from the knowledge of the initial and final point coordinates.