Belle II Software  release-05-01-25
GeoSTRCreator.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: beaulieu *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef GEOSTRCREATOR_H
12 #define GEOSTRCREATOR_H
13 
14 #include <geometry/CreatorBase.h>
15 #include <framework/gearbox/GearDir.h>
16 #include <framework/logging/Logger.h>
17 
18 #include <framework/database/DBObjPtr.h>
19 #include <framework/database/DBImportObjPtr.h>
20 #include <framework/database/IntervalOfValidity.h>
21 
22 #include <structure/dbobjects/STRGeometryPar.h>
23 
24 #include <string>
25 
26 class G4LogicalVolume;
27 
28 namespace Belle2 {
34  namespace structure {
35 
37 
41 
42  public:
43 
45  GeoSTRCreator();
46 
48  virtual ~GeoSTRCreator();
49 
51 
55  virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
56  {
57  STRGeometryPar config = createConfiguration(content);
58  createGeometry(config, topVolume, type);
59  }
60 
63  virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
64  {
66  importObj.construct(createConfiguration(content));
67  importObj.import(iov);
68  }
69 
71  virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type)\
72  override
73  {
75  if (!dbObj) {
76  // Check that we found the object and if not report the problem
77  B2FATAL("No configuration for " << name << " found.");
78  }
79  createGeometry(*dbObj, topVolume, type);
80  }
81 
82 
83  protected:
84 
85  private:
90 
91 
95  void createGeometry(const STRGeometryPar& parameters, G4LogicalVolume& topVolume,
97 
98 
102  void readShield(const GearDir& content, STRGeometryPar& parameters, std::string side);
103 
104 
108  void readPole(const GearDir& content, STRGeometryPar& parameters, std::string side);
109 
110 
111  };
112  }
114 }
115 
116 #endif /* GEOSTRCREATOR_H */
Belle2::IntervalOfValidity
A class that describes the interval of experiments/runs for which an object in the database is valid.
Definition: IntervalOfValidity.h:35
Belle2::STRGeometryPar
The Class for STR geometry.
Definition: STRGeometryPar.h:35
Belle2::structure::GeoSTRCreator::createConfiguration
STRGeometryPar createConfiguration(const GearDir &param)
Create a parameter object from the Gearbox XML parameters.
Definition: GeoSTRCreator.cc:151
Belle2::DBImportObjPtr::construct
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
Definition: DBImportObjPtr.h:57
Belle2::DBImportBase::import
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:38
Belle2::structure::GeoSTRCreator::createGeometry
void createGeometry(const STRGeometryPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
Definition: GeoSTRCreator.cc:65
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::structure::GeoSTRCreator::createFromDB
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
Definition: GeoSTRCreator.h:71
Belle2::structure::GeoSTRCreator
The GeoSTRCreator class to create the Belle2 structure geometry.
Definition: GeoSTRCreator.h:40
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::GearDir
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:41
Belle2::DBImportObjPtr
Class for importing a single object to the database.
Definition: DBImportObjPtr.h:33
Belle2::structure::GeoSTRCreator::~GeoSTRCreator
virtual ~GeoSTRCreator()
The destructor of the GeoSTRCreator class.
Definition: GeoSTRCreator.cc:58
Belle2::structure::GeoSTRCreator::createPayloads
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Create the configuration objects and save them in the Database.
Definition: GeoSTRCreator.h:63
Belle2::structure::GeoSTRCreator::create
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creates the Geant4 objects for the structure geometry from Gearbox.
Definition: GeoSTRCreator.h:55
Belle2::geometry::CreatorBase
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:31
Belle2::structure::GeoSTRCreator::readShield
void readShield(const GearDir &content, STRGeometryPar &parameters, std::string side)
Read xml files from GearDir for one of the ECL shields.
Definition: GeoSTRCreator.cc:200
Belle2::structure::GeoSTRCreator::readPole
void readPole(const GearDir &content, STRGeometryPar &parameters, std::string side)
Read xml files from GearDir for one of the Pole Pieces.
Definition: GeoSTRCreator.cc:165
Belle2::geometry::GeometryTypes
GeometryTypes
Flag indiciating the type of geometry to be used.
Definition: GeometryManager.h:39
Belle2::structure::GeoSTRCreator::GeoSTRCreator
GeoSTRCreator()
The Constructor of the GeoSTRCreator class.
Definition: GeoSTRCreator.cc:52