Skip to content

Commit

Permalink
[geant4] gdml schema validation now optional
Browse files Browse the repository at this point in the history
  • Loading branch information
vvolkl committed Nov 6, 2020
1 parent c1c4b44 commit a3c040e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sim/SimG4Common/SimG4Common/GdmlDetectorConstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Sim/SimG4Common/src/GdmlDetectorConstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down
2 changes: 1 addition & 1 deletion Sim/SimG4Components/src/SimG4GdmlDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 2 additions & 0 deletions Sim/SimG4Components/src/SimG4GdmlDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class SimG4GdmlDetector : public AlgTool, virtual public ISimG4DetectorConstruct
private:
/// name of the GDML file
Gaudi::Property<std::string> m_gdmlFile{this, "gdml", "", "name of the GDML file"};
// validate gdml schema
Gaudi::Property<bool> m_validate{this, "validateGDMLSchema", false, "try to validate the GDML schema"};
};

#endif /* SIMG4COMPONENTS_G4GDMLDETECTOR_H */

0 comments on commit a3c040e

Please sign in to comment.