Skip to content

o2-sim: Make the lean crossing locate the VecGeom default - #16166

Open
sawenzel wants to merge 5 commits into
AliceO2Group:devfrom
sawenzel:swenzel/o2sim-vecgeom-lean-default
Open

sawenzel wants to merge 5 commits into
AliceO2Group:devfrom
sawenzel:swenzel/o2sim-vecgeom-lean-default

Conversation

@sawenzel

Copy link
Copy Markdown
Collaborator

This makes the lean crossing locate the default of G4.navmode=kVecGeom and moves the choice of VecGeom navigator for small mothers into the geometry setup. G4.vecgeomLeanLocate=false keeps the previous locate as a fallback for one release.

The effect on the event loop, serial pp, 6 seeds, same build and node:

CPU time
lean / previous locate 0.967 ± 0.003
lean / kPropagated 0.991 ± 0.004
lean / TGeo 0.809 ± 0.004

The physics agrees with TGeo as well as the previous locate does: 1 GeV photons in EMCAL 0.9999 ± 0.0007 of TGeo; pp (8 × 3000 events), Pb-Pb (2 × 20) and the aligned ITS with the parallel world (2 × 600, ITS hits 1.007 ± 0.005) within 2σ in every detector; no aborts. MID in pp is 0.948 ± 0.026 of TGeo over 8 seeds and 0.986 ± 0.032 over the 6 seeds after the first observation; a pion gun into the muon arm gives 1.006 ± 0.023.

This sits on top of #16165.

Assisted by Claude Code.

sawenzel and others added 5 commits November 21, 2026 11:56
This makes the VecGeom navigator start a new run of zero steps when a stuck-track push moved the track into a volume the run did not alternate between.

- The new run counts from zero and decides again between chords and momentum steps.
- A run restarts only if the track moved by at least half the push, and at most three times until the next finite step, so a track cannot be held forever.
- The volumes of a run are recorded from its eighth zero step only.
- The 10 um cap and the chord/momentum rule are unchanged.
- This changes the output of the current locate too.
- Two unit test cases cover the restart, the two conditions that prevent it, and the abort after the fourth run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This makes both VecGeom navigators update the Geant4 history incrementally for the three common transitions.

- Entering a daughter of the current volume adds that placement's chain of Geant4 levels.
- Leaving to the mother removes it, and moving into a sibling replaces it.
- Every other change still goes through historyFromState, which walked every level on every crossing.
- The update lives in the base class, so the relocating and the propagating navigator share it.
- The history is the same as before: the levels and their transforms are made by the same NewLevel calls.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This adds a run-time switch G4.vecgeomLeanLocate (default off) that locates a boundary crossing of the relocating VecGeom navigator the way VecGeom relocates.

- The point is pushed 1e-6 cm along the step direction, VecGeom's own push, instead of one tolerance across the face.
- No face normal is computed for the push, and the flush-volume loop is not run: at that depth containment pops every flush mother.
- An exit no longer records a block for the next step. Every mother with daughters is stepped with BVHNavigatorV, which refuses at zero distance a daughter the ray leaves.
- A parallel world node just left is still refused while the direction leaves it, with the normal computed only for that node.
- The navigator unit test runs every case with both locates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This fixes the safety of the propagating VecGeom navigator (G4.vecgeomNavigator=kPropagated) and adds unit tests.

- ComputeSafety answered 0 at every point until the next within-volume locate after a crossing, so the end point of the first step in a new volume had no safety.
- It now answers 0 only at the point where the crossing was located and at the end point of a step that ends on a boundary, as VecGeomG4Navigator does.
- The locate now consumes fWasLimitedByGeometry as G4Navigator does, so a new track is no longer taken for a crossing with the previous track's flags.
- ResetHierarchyAndLocate now clears the crossing state left by the previous track.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This makes the lean crossing locate the default of the relocating VecGeom navigator and moves its navigator choice into the geometry setup.

- G4.vecgeomLeanLocate now defaults to true; false keeps the previous locate as a fallback for one release.
- GeometryManager::setVecGeomBvhForSmallMothers gives volumes with one or two daughters BVHNavigatorV, replacing the per-step choice in the navigator.
- Those volumes also get BVHSafetyEstimator, the estimator BVHNavigatorV uses in the step, so ComputeSafety and the step agree.
- Their level locators are unchanged; kPropagated and the previous locate keep the simple navigator and estimator.
- The BVH navigator is installed under the same O2_VECGEOM_HAS_BVH_VNAVIGATOR guard as in buildVecGeomGeometry.
- The lean navigator checks this setting at every new track, and every caller of its constructor states the locate.
- The unit test sets the geometry up for each navigator as o2-sim does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sawenzel
sawenzel requested review from a team and shahor02 as code owners November 21, 2026 10:56
@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2/fullCI_slc9 for c1c1773 at 2026-11-21 14:29:

## sw/BUILD/O2-full-system-test-latest/log
command /sw/slc9_x86-64/O2/slc9_x86-64-slc9_x86-64-local2/prodtests/full-system-test/dpl-workflow.sh had nonzero exit code 1
[6318:internal-dpl-injected-dummy-sink]: [14:28:50][ERROR] Failed binding socket internal-dpl-injected-dummy-sink.metric-feedback[0].push, address: ipc://@metric-feedback-0, reason: Address already in use
[6318:internal-dpl-injected-dummy-sink]: [14:28:50][ERROR] failed to attach channel metric-feedback[0] (bind on ipc://@metric-feedback-0)
[6318:internal-dpl-injected-dummy-sink]: [14:28:50][ERROR] 1 of the binding channels could not initialize. Initial configuration incomplete.
[6318:internal-dpl-injected-dummy-sink]: [14:28:50][FATAL] error while setting up workflow in o2-raw-file-reader-workflow: 1 of the binding channels could not initialize. Initial configuration incomplete.
[ERROR] Workflow crashed - PID 6318 (internal-dpl-injected-dummy-sink) did not exit correctly however it's not clear why. Exit code forced to 128.
[ERROR]  - Device internal-dpl-injected-dummy-sink: pid 6318 (exit 128)
[INFO]    - First error: [14:28:50][FATAL] error while setting up workflow in o2-raw-file-reader-workflow: 1 of the binding channels could not initialize. Initial configuration incomplete.
[ERROR] SEVERE: Device internal-dpl-injected-dummy-sink (6318) had at least one message above severity 7: error while setting up workflow in o2-raw-file-reader-workflow: 1 of the binding channels could not initialize. Initial configuration incomplete.


## sw/BUILD/o2checkcode-latest/log
--
========== List of errors found ==========
++ echo 'Found 0 errors and 0 warnings.'
Found 0 errors and 0 warnings.
++ [[ 0 -gt 0 ]]
++ [[ 0 -gt 0 ]]
++ [[ 0 -gt 0 ]]
++ mkdir -p /sw/INSTALLROOT/d832b1ee2cc3b935e2ae44494746c0892ac4ee40/slc9_x86-64/o2checkcode/1.0-local3/etc/modulefiles
++ alibuild-generate-module
+ HAS_BIN=
+ HAS_LIB=
+ HAS_CMAKE=
+ HAS_ROOT=
+ '[' 0 '!=' 0 ']'
+ cat
+ printf 'if ![ is-loaded '\''BASE/1.0'\'' ] {\n module load BASE/1.0\n}'
+ echo 'BUILD_REQUIRES=CMake alibuild-recipe-tools defaults-release'
BUILD_REQUIRES=CMake alibuild-recipe-tools defaults-release
+ FULL_BUILD_REQUIRES='Python-modules-list json-c MPFR FairCMakeModules ninja googlebenchmark pytorch_cpuinfo CMake O2-customization safe_int defaults-release Alice-GRID-Utils double-conversion alibuild-recipe-tools bz2 UUID date ninja-fortran'
+ echo 'FULL_BUILD_REQUIRES=Python-modules-list json-c MPFR FairCMakeModules ninja googlebenchmark pytorch_cpuinfo CMake O2-customization safe_int defaults-release Alice-GRID-Utils double-conversion alibuild-recipe-tools bz2 UUID date ninja-fortran'
FULL_BUILD_REQUIRES=Python-modules-list json-c MPFR FairCMakeModules ninja googlebenchmark pytorch_cpuinfo CMake O2-customization safe_int defaults-release Alice-GRID-Utils double-conversion alibuild-recipe-tools bz2 UUID date ninja-fortran
++ env
++ cut -f1 -d=
++ grep -v '^DEFAULT_'
++ grep -v PKGREVISION
++ grep -v ALIBUILD_RECIPE_TOOLS
++ grep REVISION
++ sed -e s/_REVISION//
+ for x in $(env | cut -f1 -d= | grep -v "^DEFAULT_" | grep -v PKGREVISION | grep -v ALIBUILD_RECIPE_TOOLS | grep REVISION | sed -e 's/_REVISION//')
++ eval 'echo $LIBFFI_REVISION'
+++ echo 14
+ REVISION_VALUE=14
++ eval 'echo $LIBFFI_VERSION'
+++ echo v3.2.1-alice1
+ VERSION_VALUE=v3.2.1-alice1
++ eval 'echo $LIBFFI_ROOT'
[0 more errors; see full log]

Full log here.

This branch has not been deployed

No deployments
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