10 #include <top/modules/TOPGeometryParInitializer/TOPGeometryParInitializerModule.h>
11 #include <top/geometry/TOPGeometryPar.h>
14 #include <framework/logging/Logger.h>
15 #include <framework/gearbox/GearDir.h>
41 setDescription(
"Class for initializing TOPGeometryPar. "
42 "This class is by default initialized when Geant geometry is created. "
43 "Useful if Geant geometry is not needed. Be carefull when using!");
44 setPropertyFlags(c_ParallelProcessingCertified);
47 addParam(
"useDB", m_useDB,
48 "If true load the Geometry from the database instead of the gearbox",
true);
51 void TOPGeometryParInitializerModule::initialize()
53 auto* gp = TOPGeometryPar::Instance();
55 B2WARNING(
"TOPGeometryPar has already been initialized");
63 GearDir detectorDir(
"/Detector");
64 for (
const GearDir& component : detectorDir.
getNodes(
"DetectorComponent")) {
65 if (component.getString(
"@name") ==
"TOP") {
66 gp->Initialize(
GearDir(component,
"Content"));
71 if (not found) B2ERROR(
"Component TOP does not exist or is empty");
GearDir is the basic class used for accessing the parameter store.
Class for initializing TOPGeometryPar.
std::vector< GearDir > getNodes(const std::string &path="") const
Get vector of GearDirs which point to all the nodes the given path evaluates to.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.