Repository navigation
Conversation
This adds o2::base::simRandom(), the generator used for seeding and drawing during transport, and moves the simulation to it. - simRandom() returns a generator installed for the calling thread, and gRandom otherwise, so the sequential simulation is unchanged. - Sub-event, per-track and stack seeding and the stepping draws in CPV, FDD, FT0, HMPID, PHOS, TPC, TRD and ZDC use it. - VMCSeederService seeds Geant4 from it directly, with the recipe of TG4RunManager::SetRandomSeed, which reads gRandom. - A unit test checks the default and that threads keep separate sequences. This prepares the simulation for multithreaded Geant4, where gRandom would be shared by all workers. https://its.cern.ch/jira/browse/O2-7305 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sawenzel
requested review from
a team,
afurs,
andreasmolander,
bazinski,
coppedis,
davidrohr,
f3sch,
gvolpe79,
jotwinow,
kharlov,
peressounko,
sahilupadhyaya92,
shahor02,
wiechula and
wille10
as code owners
November 5, 2026 20:22
This replaces the just-in-time compiled Geant4 seeding with a function that the Geant4 configuration installs. - The JIT code needed CLHEP/Random/Random.h on ROOT_INCLUDE_PATH, which the alienv module environment does not provide. - g4Config.C links Geant4 and installs the same seeding recipe through VMCSeederService::setGeant4Seeder. https://its.cern.ch/jira/browse/O2-7305 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cave::BeginPrimary seeded gRandom directly; it now uses o2::base::simRandom() like the other transport-time seeding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
This introduces
o2::base::simRandom(), the random number generator used for seeding and drawing during particle transport. A thread can install its own generator witho2::base::setSimRandom(); a thread that has none getsgRandom. This prepares the simulation for multithreaded Geant4, where a singlegRandomwould be shared, and raced on, by all worker threads.Everything that seeds or draws during transport now goes through it: the sub-event seeding in
O2SimDevice, the per-track seeding inPreTrackand in the stack, and the stepping draws in CPV, FDD, FT0, HMPID, PHOS, TPC, TRD and ZDC. This includes the draws that went throughfMC->GetRandom()orTH1::GetRandom(), since both end up ingRandom.VMCSeederServicenow seeds Geant4 directly from the transport generator, with the same recipe as geant4_vmc'sSetRandomSeed, which always readsgRandom. The seeder is set up once on the main thread inInitGeometry.Note that this does not change anything for the current simulation, since no thread installs its own generator yet. A seeded
o2-simrun (10 Pythia8 pp events, all detectors, Geant4,-j 8) gives identical kinematics and hits compared withdev. A unit test checks the default and that threads keep separate, reproducible sequences.Relates to https://its.cern.ch/jira/browse/O2-7305
Assisted by Claude Code.