Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[geant4] gdml schema validation now optional #423

Merged
merged 1 commit into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 */