diff --git a/Sim/SimG4Common/SimG4Common/GdmlDetectorConstruction.h b/Sim/SimG4Common/SimG4Common/GdmlDetectorConstruction.h index 3b15b7c0f..5271c082c 100644 --- a/Sim/SimG4Common/SimG4Common/GdmlDetectorConstruction.h +++ b/Sim/SimG4Common/SimG4Common/GdmlDetectorConstruction.h @@ -23,7 +23,7 @@ class GdmlDetectorConstruction : public G4VUserDetectorConstruction { /** Constructor. * @param[in] aFileName Name of the GDML file with the detector description. */ - explicit GdmlDetectorConstruction(const std::string& aFileName); + explicit GdmlDetectorConstruction(const std::string& aFileName, bool validate=false); virtual ~GdmlDetectorConstruction(); /** Create volumes using the GDML parser. * @return World wolume. diff --git a/Sim/SimG4Common/src/GdmlDetectorConstruction.cpp b/Sim/SimG4Common/src/GdmlDetectorConstruction.cpp index afc0e30f5..5c6dc822e 100644 --- a/Sim/SimG4Common/src/GdmlDetectorConstruction.cpp +++ b/Sim/SimG4Common/src/GdmlDetectorConstruction.cpp @@ -2,11 +2,11 @@ #include "G4SDManager.hh" namespace sim { -GdmlDetectorConstruction::GdmlDetectorConstruction(const std::string& aFileName) +GdmlDetectorConstruction::GdmlDetectorConstruction(const std::string& aFileName, bool validate) : m_msgSvc("MessageSvc", "GdmlDetectorConstruction"), m_log(&(*m_msgSvc), "GdmlDetectorConstruction"), m_fileName(aFileName) { - m_parser.Read(m_fileName); + m_parser.Read(m_fileName, validate); } GdmlDetectorConstruction::~GdmlDetectorConstruction() {} diff --git a/Sim/SimG4Components/src/SimG4GdmlDetector.cpp b/Sim/SimG4Components/src/SimG4GdmlDetector.cpp index 91e40df0e..6157a972d 100644 --- a/Sim/SimG4Components/src/SimG4GdmlDetector.cpp +++ b/Sim/SimG4Components/src/SimG4GdmlDetector.cpp @@ -19,5 +19,5 @@ StatusCode SimG4GdmlDetector::initialize() { return AlgTool::initialize(); } StatusCode SimG4GdmlDetector::finalize() { return AlgTool::finalize(); } G4VUserDetectorConstruction* SimG4GdmlDetector::detectorConstruction() { - return new sim::GdmlDetectorConstruction(m_gdmlFile); + return new sim::GdmlDetectorConstruction(m_gdmlFile, m_validate); } diff --git a/Sim/SimG4Components/src/SimG4GdmlDetector.h b/Sim/SimG4Components/src/SimG4GdmlDetector.h index 82364062a..2e1f76ef8 100644 --- a/Sim/SimG4Components/src/SimG4GdmlDetector.h +++ b/Sim/SimG4Components/src/SimG4GdmlDetector.h @@ -38,6 +38,8 @@ class SimG4GdmlDetector : public AlgTool, virtual public ISimG4DetectorConstruct private: /// name of the GDML file Gaudi::Property m_gdmlFile{this, "gdml", "", "name of the GDML file"}; + // validate gdml schema + Gaudi::Property m_validate{this, "validateGDMLSchema", false, "try to validate the GDML schema"}; }; #endif /* SIMG4COMPONENTS_G4GDMLDETECTOR_H */