Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the RNG handling in 3 ways:
the initial seed was depending only on the AdePT initial seed, the event id, and the track id. Thus, if a particle left the GPU region and was injected again, it would have received the same seed. This is fixed by generating the seed by scrambling the original seed with the kinetic energy and the global time.
When the new ID was generated from the rng state without advancing it, there must have been some truncation because multiple collisions in the trackIds were observed at a rate way too high. This is solved by advancing the state.
When a positron fell below the tracking cut, it would annihilate to two gammas. However, this could happen after the first interaction, meaning the newRNG was already used on the first generated secondary. This would lead to collisions of state.
There are still too many collisions observed, which are currently under investigation.
The failing of the CI was just a random fluctuation, the accuracy is not impacted by this PR.