Belle II Software  release-05-01-25
GeoVXDServiceCreator.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter, Benjamin Schwenker *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef GEOVXDSERVICECREATOR_H
12 #define GEOVXDSERVICECREATOR_H
13 
14 #include <geometry/CreatorBase.h>
15 
16 #include <framework/logging/Logger.h>
17 #include <framework/database/DBObjPtr.h>
18 #include <framework/database/DBImportObjPtr.h>
19 #include <framework/database/IntervalOfValidity.h>
20 
21 #include <vxd/dbobjects/VXDServiceGeometryPar.h>
22 
23 class G4Material;
24 
25 namespace Belle2 {
31  namespace VXD {
32 
35  private:
38 
40  void createGeometry(const VXDServiceGeometryPar& parameters, G4LogicalVolume& topVolume, geometry::GeometryTypes type);
41  public:
43  GeoVXDServiceCreator() = default;
44 
47  virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
48  {
50  createGeometry(config, topVolume, type);
51  }
52 
55  virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
56  {
58  importObj.construct(createConfiguration(content));
59  importObj.import(iov);
60  }
61 
63  virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
64  {
66  if (!dbObj) {
67  // Check that we found the object and if not report the problem
68  B2FATAL("No configuration for " << name << " found.");
69  }
70  createGeometry(*dbObj, topVolume, type);
71  }
72 
73  private:
74 
76  G4Material* m_defaultMaterial {0};
77  };
78  } // namespace VXD
80 } //namespace Belle2
81 
82 #endif /* GEOVXDSERVICECREATOR_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::VXD::GeoVXDServiceCreator
The creator for the VXD Service geometry of the Belle II detector.
Definition: GeoVXDServiceCreator.h:34
Belle2::VXD::GeoVXDServiceCreator::createConfiguration
VXDServiceGeometryPar createConfiguration(const GearDir &param)
Create a parameter object from the Gearbox XML parameters.
Definition: GeoVXDServiceCreator.cc:45
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::VXD::GeoVXDServiceCreator::createGeometry
void createGeometry(const VXDServiceGeometryPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
Definition: GeoVXDServiceCreator.cc:87
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::VXD::GeoVXDServiceCreator::createFromDB
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
Definition: GeoVXDServiceCreator.h:63
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VXD::GeoVXDServiceCreator::m_defaultMaterial
G4Material * m_defaultMaterial
Default Material, inherited from topVolume.
Definition: GeoVXDServiceCreator.h:76
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::VXD::GeoVXDServiceCreator::create
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
The old create member: create the configuration object(s) on the fly and call the geometry creation r...
Definition: GeoVXDServiceCreator.h:47
Belle2::VXDServiceGeometryPar
The Class for VXD service geometry.
Definition: VXDServiceGeometryPar.h:146
Belle2::VXD::GeoVXDServiceCreator::createPayloads
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Create the configuration objects and save them in the Database.
Definition: GeoVXDServiceCreator.h:55
Belle2::geometry::CreatorBase
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:31
Belle2::geometry::GeometryTypes
GeometryTypes
Flag indiciating the type of geometry to be used.
Definition: GeometryManager.h:39
Belle2::VXD::GeoVXDServiceCreator::GeoVXDServiceCreator
GeoVXDServiceCreator()=default
Default constructor is sufficient in this case.