Belle II Software  release-08-01-10
GeoSTRCreator.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #ifndef GEOSTRCREATOR_H
10 #define GEOSTRCREATOR_H
11 
12 #include <geometry/CreatorBase.h>
13 #include <framework/gearbox/GearDir.h>
14 #include <framework/logging/Logger.h>
15 
16 #include <framework/database/DBObjPtr.h>
17 #include <framework/database/DBImportObjPtr.h>
18 #include <framework/database/IntervalOfValidity.h>
19 
20 #include <structure/dbobjects/STRGeometryPar.h>
21 
22 #include <string>
23 
24 class G4LogicalVolume;
25 
26 namespace Belle2 {
32  namespace structure {
33 
35 
39 
40  public:
41 
43  GeoSTRCreator();
44 
46  virtual ~GeoSTRCreator();
47 
49 
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 */
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:36
Class for importing a single object to the database.
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
A class that describes the interval of experiments/runs for which an object in the database is valid.
The Class for STR geometry.
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:28
The GeoSTRCreator class to create the Belle2 structure geometry.
Definition: GeoSTRCreator.h:38
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Create the configuration objects and save them in the Database.
Definition: GeoSTRCreator.h:63
void createGeometry(const STRGeometryPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
STRGeometryPar createConfiguration(const GearDir &param)
Create a parameter object from the Gearbox XML parameters.
void readPole(const GearDir &content, STRGeometryPar &parameters, std::string side)
Read xml files from GearDir for one of the Pole Pieces.
void readShield(const GearDir &content, STRGeometryPar &parameters, std::string side)
Read xml files from GearDir for one of the ECL shields.
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
GeoSTRCreator()
The Constructor of the GeoSTRCreator class.
virtual ~GeoSTRCreator()
The destructor of the GeoSTRCreator class.
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
Definition: GeoSTRCreator.h:71
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.