Skip to content

Commit

Permalink
GeoSvc: only create VolumeManager if not existing yet
Browse files Browse the repository at this point in the history
  • Loading branch information
andresailer authored and vvolkl committed Jul 31, 2022
1 parent 0eb6d82 commit 8b8354e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Detector/DetComponents/src/GeoConstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions Detector/DetComponents/src/GeoSvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8b8354e

Please sign in to comment.