Skip to content

enable rebinding to the current G4 engine#127

Merged
mnovak42 merged 1 commit intomnovak42:masterfrom
SeverinDiederichs:enable_rebinding_G4_rng
Sep 9, 2025
Merged

enable rebinding to the current G4 engine#127
mnovak42 merged 1 commit intomnovak42:masterfrom
SeverinDiederichs:enable_rebinding_G4_rng

Conversation

@SeverinDiederichs
Copy link
Copy Markdown
Contributor

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 fRandomEngine is 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 the G4HepEmTrackingManager that re-binds the fRandomEngine to the current G4 random engine. As Gaussino requires a custom derived G4HepEmTrackingManager due to custom cuts anyway, I can add a derived HandOverOneTrack call, which also calls the RebindG4RandomEngine() 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.

@mnovak42 mnovak42 merged commit 2f051ee into mnovak42:master Sep 9, 2025
5 checks passed
@SeverinDiederichs SeverinDiederichs deleted the enable_rebinding_G4_rng branch September 9, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants