From 24b03b68a2c2d4a93e368b5c563733d87aecb131 Mon Sep 17 00:00:00 2001 From: Dave Casper <dcasper@uci.edu> Date: Sun, 19 Dec 2021 18:30:09 -0800 Subject: [PATCH] Add option to dump GDML --- Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx | 14 ++++++++------ Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.h | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx index 45b30b96..69ff7cfd 100644 --- a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx +++ b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx @@ -200,12 +200,14 @@ void G4FaserAlg::initializeOnce() if(m_userLimitsSvc.retrieve().isFailure()) { throw std::runtime_error("Could not initialize ATLAS UserLimitsSvc!"); } - - G4LogicalVolumeStore* store = G4LogicalVolumeStore::GetInstance(); - G4LogicalVolume* world = store->GetVolume("Faser::Faser"); - G4GDMLParser parser {}; - parser.Write("Faser.gdml", world); - ATH_MSG_ALWAYS("Wrote detector geometry to GDML file"); + + if (!m_gdmlFilename.empty()) + { + G4LogicalVolumeStore* store = G4LogicalVolumeStore::GetInstance(); + G4LogicalVolume* world = store->GetVolume("Faser::Faser"); + G4GDMLParser parser {}; + parser.Write(m_gdmlFilename.value(), world); + } if (m_activateParallelGeometries) { G4VModularPhysicsList* thePhysicsList=dynamic_cast<G4VModularPhysicsList*>(m_physListSvc->GetPhysicsList()); diff --git a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.h b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.h index 420e23f7..1dbadf47 100644 --- a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.h +++ b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.h @@ -120,6 +120,8 @@ private: /// Activate multi-threading configuration Gaudi::Property<bool> m_useMT{this,"MultiThreading", false, "Multi-threading specific settings"}; Gaudi::Property<bool> m_activateParallelGeometries{this, "ActivateParallelWorlds", false, "Toggle on/off the G4 parallel geometry system"}; + /// Dump GDML file + Gaudi::Property<std::string> m_gdmlFilename{this, "GDMLfile", "", "GDML geometry file to write"}; /// Random number service ServiceHandle<IAthRNGSvc> m_rndmGenSvc{this, "AtRndmGenSvc", "AthRNGSvc", ""}; // TODO rename property /// Random Stream Name -- GitLab