Skip to content

Give every Geant4 worker thread its own VecGeom navigator - #16183

Merged
sawenzel merged 1 commit into
AliceO2Group:devfrom
sawenzel:swenzel/o2sim-vecgeom-mt
Nov 23, 2026
Merged

sawenzel merged 1 commit into
AliceO2Group:devfrom
sawenzel:swenzel/o2sim-vecgeom-mt

Conversation

@sawenzel

Copy link
Copy Markdown
Collaborator

This makes G4.navmode=kVecGeom usable with o2-sim --isMT.

  • Before, g4Config.C stopped with a fatal error for kVecGeom in multithreaded mode.
  • The master still builds the VecGeom geometry, the map and the parallel world once; they are read-only afterwards.
  • A new MTWorkerHooks::initOnWorker hook creates one navigator per worker thread, after geant4_vmc has cloned the g4root navigation and before Geant4 builds the worker's transportation, which caches the navigator.

With 8 threads, 2 x 200 pp events agree with kTGeo in multithreaded mode within 2 sigma in every detector, also with the aligned ITS and the parallel world, and run at 0.88 of its wall time. Sequential and multi-process runs are unchanged.

https://its.cern.ch/jira/browse/O2-7362

Assisted by Claude Code.

This makes G4.navmode=kVecGeom usable with o2-sim --isMT.

- Before, g4Config.C stopped with a fatal error for kVecGeom in multithreaded mode.
- The master still builds the VecGeom geometry, the map and the parallel world once; they are read-only afterwards.
- A new MTWorkerHooks::initOnWorker hook creates one navigator per worker thread, after geant4_vmc has cloned the g4root navigation and before Geant4 builds the worker's transportation, which caches the navigator.

https://its.cern.ch/jira/browse/O2-7362

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawenzel
sawenzel requested review from a team and shahor02 as code owners November 23, 2026 17:17
@sawenzel
sawenzel merged commit f67b1f0 into AliceO2Group:dev Nov 23, 2026
11 of 12 checks passed
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.

1 participant