enable rebinding to the current G4 engine#127
Merged
mnovak42 merged 1 commit intomnovak42:masterfrom Sep 9, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In Gaussino, the rng engine is reset for every single event.
This lead to reproducibility issues with G4HepEm, as the thread order of initializing (when the G4HepEm
fRandomEngineis set in the constructor) is not the same when the events are run. This led to different events seeing a different rng between runs. To fix the issue, this PR proposes to add a function in theG4HepEmTrackingManagerthat re-binds thefRandomEngineto the current G4 random engine. As Gaussino requires a custom derivedG4HepEmTrackingManagerdue to custom cuts anyway, I can add a derivedHandOverOneTrackcall, which also calls theRebindG4RandomEngine()as soon as the event id between tracks changes.@mnovak42 @hahnjo This is just a suggestion how to fix this issue, if you see a better solution or a different implementation, feel free to close the PR or adjust it.