From 8b8354e91ad0b7d4291bb6a9295d11933db6cc60 Mon Sep 17 00:00:00 2001 From: Andre Sailer Date: Fri, 29 Jul 2022 17:17:32 +0200 Subject: [PATCH] GeoSvc: only create VolumeManager if not existing yet --- Detector/DetComponents/src/GeoConstruction.cpp | 4 +++- Detector/DetComponents/src/GeoSvc.cpp | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Detector/DetComponents/src/GeoConstruction.cpp b/Detector/DetComponents/src/GeoConstruction.cpp index 7c03340..5bbca28 100644 --- a/Detector/DetComponents/src/GeoConstruction.cpp +++ b/Detector/DetComponents/src/GeoConstruction.cpp @@ -76,7 +76,9 @@ G4VPhysicalVolume* GeoConstruction::Construct() { g4map.attach(geo_info); // All volumes are deleted in ~G4PhysicalVolumeStore() G4VPhysicalVolume* m_world = geo_info->world(); - m_lcdd.apply("DD4hepVolumeManager", 0, 0); + if(not m_lcdd.volumeManager().isValid()) { + m_lcdd.apply("DD4hepVolumeManager", 0, 0); + } // Create Geant4 volume manager g4map.volumeManager(); return m_world; diff --git a/Detector/DetComponents/src/GeoSvc.cpp b/Detector/DetComponents/src/GeoSvc.cpp index 2583523..a8bf06b 100644 --- a/Detector/DetComponents/src/GeoSvc.cpp +++ b/Detector/DetComponents/src/GeoSvc.cpp @@ -53,8 +53,9 @@ StatusCode GeoSvc::buildDD4HepGeo() { info() << "loading geometry from file: '" << filename << "'" << endmsg; m_dd4hepgeo->fromCompact(filename); } - m_dd4hepgeo->volumeManager(); - m_dd4hepgeo->apply("DD4hepVolumeManager", 0, 0); + if(not m_dd4hepgeo->volumeManager().isValid()) { + m_dd4hepgeo->apply("DD4hepVolumeManager", 0, 0); + } return StatusCode::SUCCESS; }