o2-sim: VecGeom navigation mode for Geant4 - #15865
Merged
sawenzel merged 5 commits intoOct 1, 2026
Merged
Conversation
This lets GeometryManager set up VecGeom for Geant4 navigation as well as for the material budget. - buildVecGeomGeometry() converts once and takes the assembly flattening as a parameter; the material budget keeps flattening. - With a VecGeom that has BVHNavigatorV, volumes with more than two daughters get the BVH navigator and level locator, and every volume gets an explicit safety estimator. - Without it the VecGeom v2 setup is unchanged. https://gitlab.cern.ch/VecGeom/VecGeom/-/merge_requests/1547 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This adds G4.navmode=kVecGeom, in which Geant4 answers every navigation query from VecGeom. - The geometry, materials and touchables stay the ones g4root builds from TGeo. - VecGeomG4Map pairs each VecGeom placement with the chain of g4root volumes it stands for, so volume ids, copy numbers and CurrentVolOffID are unchanged. - VecGeomG4Navigator relocates at the boundary locate, with the volume just left blocked for the next step and the point pushed across the face by a small depth, as G4VecGeomNav's TG4VecGeomNavigator does. - G4.vecgeomCheckRays, vecgeomCheckLocation and vecgeomCheckVolumes compare VecGeom with TGeo before transport. - It is built only when TGeo2VecGeom and a VecGeom with BVHNavigatorV are found. https://gitlab.cern.ch/VecGeom/g4vecgeomnav/-/merge_requests/25 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This adds G4.vecgeomNavigator=kPropagated, a second VecGeom navigator kept for comparison. - It adopts the state VecGeom propagated during the step instead of relocating at the boundary. - It returns zero safety for the step after a crossing and nudges stuck steps forward. - The default navigator becomes G4.vecgeomNavigator=kRelocating. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 29, 2026
sawenzel
marked this pull request as ready for review
September 30, 2026 05:58
sawenzel
added a commit
to sawenzel/alidist
that referenced
this pull request
Sep 30, 2026
This enables the VecGeom and TGeo2VecGeom dependencies of O2 on macOS and stops requiring Vc where the Scalar backend is used. - VecGeom and TGeo2VecGeom were excluded from O2 on macOS because Vc was not available there. - vecgeom.sh already builds the Scalar backend on osx_arm64 and aarch64, so Vc is now only required on the other architectures. - The macOS build can then compile the G4.navmode=kVecGeom code of AliceO2Group/AliceO2#15865.
sawenzel
added a commit
to alisw/alidist
that referenced
this pull request
Sep 30, 2026
This enables the VecGeom and TGeo2VecGeom dependencies of O2 on macOS and stops requiring Vc where the Scalar backend is used. - VecGeom and TGeo2VecGeom were excluded from O2 on macOS because Vc was not available there. - vecgeom.sh already builds the Scalar backend on osx_arm64 and aarch64, so Vc is now only required on the other architectures. - The macOS build can then compile the G4.navmode=kVecGeom code of AliceO2Group/AliceO2#15865.
This fixes tracks entering the volume they just left without seeing its boundary. - Both VecGeom navigators kept the volume just left blocked for every following step, whatever the direction. - A track turned back into it at the exit point, as by multiple scattering, crossed it unseen in the mother. - In the hollow RB24 copper tubes this let shower electrons pass the wall and gave about 10 % more FDD-A hits. - The volume is now blocked only in the first step after the exit, and only while the direction points away from it, as in G4NormalNavigation. This follows the same fix in G4VecGeomNav. https://gitlab.cern.ch/swenzel/g4vecgeomnav/-/tree/fix/block-and-reflection Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
sawenzel
enabled auto-merge (squash)
October 1, 2026 09:22
sawenzel
disabled auto-merge
October 1, 2026 09:22
sawenzel
added a commit
to alisw/alidist
that referenced
this pull request
Oct 1, 2026
This fixes a problem where o2checkcode passed although clang-tidy reported errors. - error-log.txt sometimes contains runs of NUL bytes from the clang-tidy output. - GNU grep then treats it as binary, prints nothing and the check passes. - grep -a makes both greps read the file as text. AliceO2Group/AliceO2#15865 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sawenzel
added a commit
to alisw/alidist
that referenced
this pull request
Oct 1, 2026
This makes o2checkcode report the same on every PR checker. - PR builds with ALIBUILD_O2_TESTS add -Werror to the compile flags. - clang-tidy then reports compiler warnings as errors that -checks cannot filter. - This is why the aarch64 checker failed on warnings the x86 fullCI checker suppressed. - --extra-arg=-Wno-error restores the filtering. - --gcc-install-dir was always empty because find got the path with literal quotes. AliceO2Group/AliceO2#15865 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 PR achieves a long-standing goal of navigating ALICE simulations with VecGeom instead of TGeo. With
G4.navmode=kVecGeom, Geant4 answers every navigation query from a VecGeom geometry converted from TGeo, while the Geant4 geometry, the materials and the touchables remain those built by g4root, so hits, volume ids and copy numbers are produced as before.Each VecGeom placement is paired with the chain of g4root volumes it stands for, which keeps the Geant4 touchable and every detector's volume lookup unchanged although assemblies are flattened in VecGeom. Two navigators are provided.
kRelocating, the default, relocates at each boundary with the volume just left blocked for the next step, as the navigator of G4VecGeomNav does (https://gitlab.cern.ch/VecGeom/g4vecgeomnav/-/merge_requests/25).kPropagatedadopts the state VecGeom propagated during the step, does less work per crossing, and is kept for comparison.In full pp simulation the VecGeom mode transports faster than TGeo:
This costs 5.7 s of initialisation and 0.23 GB of memory.
Note that the physics is not intended to change. 500 paired Pythia8 pp events give the TGeo hit counts and energy deposits within statistics in every detector except FDD, where both VecGeom navigators register about 10 % more hits on the A side; this is being followed up. The mode relies on the geometry stability fixes submitted separately, without which FT0 and TOF lose hits.
The mode is built when TGeo2VecGeom and a VecGeom with the BVH navigator of the VNavigator family (https://gitlab.cern.ch/VecGeom/VecGeom/-/merge_requests/1547) are found; otherwise it is compiled out.
Overall, o2-sim can now be run with VecGeom navigation, reproducing the TGeo-mode hits and saving about 9 % of the transport time.
Assisted by Claude Code.