Skip to content

o2-sim: Improvements for media initialization order and strong track-seeding for Geant4 - #15663

Open
sawenzel wants to merge 3 commits into
AliceO2Group:devfrom
sawenzel:fix/track-seeding-pretrack
Open

o2-sim: Improvements for media initialization order and strong track-seeding for Geant4#15663
sawenzel wants to merge 3 commits into
AliceO2Group:devfrom
sawenzel:fix/track-seeding-pretrack

Conversation

@sawenzel

@sawenzel sawenzel commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

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).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants