I wanted to know whether ordering or tracks will affect the final result of the simulation? Generally, one track is followed by the secondaries that are generated followed by the next primary track.
If this order is changed would it affect the result and is there any specific reason to follow such a scheme(secondaries followed by track)?
Thanks in advance!!
Changing the track ordering will not statistically affect your results(*). If you simulate the same event (i.e., the same starting random seed) with different track ordering, then you will see different specific results. That’s because the random numbers will be applied to different tracks and different processes. But for a large run (many events), your final distributions will be the same within statistical uncertainties.
Geant4 processes do not maintain a memory of the tracks in an event, nor does it retain a memory between events in a run. The geometry and material properties are fixed, and each track sees exactly the same geometry.
(*) It is possible to write special, custom user event actions where you create a “memory” across tracks or events. For instance, you might write a UserEventAction where you measure the flux through a volume, and use that flux to compute and then change the set temperature of a material between events. This is not a “natural” part of Geant4, but hooks are available for user code to do it.