Skip to content

Commit 86cd189

Browse files
authored
More VecGeom v2.x compatibility (#15821)
1 parent 1b917c4 commit 86cd189

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎Detectors/Base/src/GeometryManager.cxx‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,11 @@ void ensureVecGeomWorldBuilt()
586586
tgeo2vecgeom::RootGeoManager::Instance().LoadRootGeometry();
587587

588588
// Acceleration structures must be built before the navigators/locators reference them.
589+
#if VECGEOM_VERSION < 0x020000
590+
// VecGeom 2 has no ABBoxManager: the BVH below is built directly.
589591
vecgeom::ABBoxManager::Instance().InitABBoxesForCompleteGeometry();
590-
// Builds a BVH per logical volume from the ABBoxes computed above.
592+
#endif
593+
// Builds a BVH per logical volume.
591594
vecgeom::BVHManager::Init();
592595

593596
// For each logical volume, set both a navigator (used for ComputeStep) and a matched
@@ -752,9 +755,15 @@ bool GeometryManager::vecGeomLocate(double x, double y, double z, std::vector<TG
752755
chain.clear();
753756
#ifdef O2_WITH_VECGEOM
754757
ensureVecGeomWorldBuilt();
755-
// One state per thread, as for the material budget above.
758+
// One state per thread, as for the material budget above, and allocated the
759+
// same way: see the comment there on NavStatePath vs NavStateIndex.
760+
#if VECGEOM_VERSION >= 0x020000
761+
thread_local vecgeom::NavigationState stateStorage;
762+
thread_local vecgeom::NavigationState* state = &stateStorage;
763+
#else
756764
thread_local vecgeom::NavigationState* state =
757765
vecgeom::NavigationState::MakeInstance(vecgeom::GeoManager::Instance().getMaxDepth());
766+
#endif
758767
state->Clear();
759768
const vecgeom::Vector3D<vecgeom::Precision> point(x, y, z);
760769
if (vecgeom::GlobalLocator::LocateGlobalPoint(vecgeom::GeoManager::Instance().GetWorld(), point, *state, true) ==

0 commit comments

Comments
 (0)