o2-sim: Improvements for media initialization order and strong track-seeding for Geant4 - #15663
Open
sawenzel wants to merge 3 commits into
Open
o2-sim: Improvements for media initialization order and strong track-seeding for Geant4#15663sawenzel wants to merge 3 commits into
sawenzel wants to merge 3 commits into
Conversation
Fixing a long standing error message about "No magnetic field found" when initializing tracking media. Fixed by reordering of initializations.
SimCutParams.trackSeed was so far a no-op with Geant4 because seeding only occurred in the Geant3 stack-pop path. Add the missing seeding hook in O2MCApplicationBase::PreTrack(), which Geant4 invokes for both primary and secondary tracks on their first step. Geant3 continues to seed at stack-pop time. This preserves existing behaviour and avoids moving seeding to a later hook, which measurably reduces reproducibility. The PreTrack seed is derived from the engine track state rather than Stack::GetCurrentTrack(), which is only reliable for Geant4 primaries. Also add diagnostics to detect missing seed propagation by counting successful seed applications and warning at the end of the event if track seeding was requested but never performed. Verified on both Geant3 and Geant4: per-track seeding now works as intended and existing Geant3 behaviour remains unchanged.
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.
Fixing a long standing bug in the order of initialization between magnetic field and media (harmless).
Providing strong track seeding and better reproducibility for Geant4 (so far only worked for Geant3).