9#include <geometry/modules/ExportGeometryModule.h>
11#include <framework/utilities/FileSystem.h>
12#include <geometry/GeometryManager.h>
13#include <TGeoManager.h>
15#include <G4GDMLParser.hh>
33 setDescription(
"Saves the Belle II detector geometry to a root or GDML file. "
34 "GDML support is only available if Geant4 has been compiled with "
35 "GDML enabled. This requires the xerces XML parser headers to "
36 "be installed when compiling the externals");
43 "will be unique by adding their pointer address. This makes checking "
44 "for differences problematic but would allow to use the Geometry directly",
56 B2ERROR(
"Parameter <Filename>: The path of the filename " <<
m_filenameROOT <<
" does not exist !");
60 B2ERROR(
"This Geant4 version does not have GDML support, please recompile the externals with the xerces headers installed");
69 B2ERROR(
"No Geometry found, cannot export anything");
76 B2ERROR(
"Cannot export Geometry to GDML: file '" <<
m_filenameROOT <<
"' already exists");
83 B2FATAL(
"This Geant4 version does not have GDML support, please recompile the externals with the xerces headers installed");
virtual void initialize() override
Checks the validity of the module parameters.
std::string m_filenameROOT
The filename of the ROOT file into which the geometry is saved.
bool m_exportAsGDML
Export the geometry as GDML format.
ExportGeometryModule()
Constructor.
virtual void beginRun() override
Saves the geometry to a root file for every run.
bool m_gdmlAdresses
If true make the xml names unique by prepending the pointer address.
virtual ~ExportGeometryModule()
Destructor.
static bool fileDirExists(const std::string &filename)
Check if the dir containing the filename exists.
static bool fileExists(const std::string &filename)
Check if the file with given filename exists.
void setDescription(const std::string &description)
Sets the description of the module.
static GeometryManager & getInstance()
Return a reference to the instance.
void createTGeoRepresentation()
Create a TGeo representation of the native geometry description.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.