Belle II Software  release-05-01-25
GeoCryostatCreator.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: *
7  * *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 #include <geometry/CreatorBase.h>
15 #include <framework/gearbox/GearDir.h>
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 #include <ir/dbobjects/CryostatGeo.h>
21 #include <string>
22 
23 #include <G4Transform3D.hh>
24 #include <G4VSolid.hh>
25 class G4LogicalVolume;
26 
27 namespace Belle2 {
32  namespace ir {
34  struct CryostatElement {
36  G4Transform3D transform;
38  G4VSolid* geo;
40  G4LogicalVolume* logi;
41  };
42 
43  class SensitiveDetector;
44 
47 
48  private:
51  {
52  CryostatGeo CryostatGeoConfig;
53  CryostatGeoConfig.initialize(param);
54  return CryostatGeoConfig;
55  }
56 
58  void createGeometry(G4LogicalVolume& topVolume, geometry::GeometryTypes type);
59 
60 
61  public:
62 
65 
67  virtual ~GeoCryostatCreator();
68 
70  GeoCryostatCreator(const GeoCryostatCreator&) = delete;
71 
74 
81  virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
82  {
83  m_config = createConfiguration(content);
84 
85  // override geometry configuration from the DB
87 
88  createGeometry(topVolume, type);
89  }
90 
92  virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
93  {
95  importObj.construct(createConfiguration(content));
96  importObj.import(iov);
97  }
98 
100  virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
101  {
102  DBObjPtr<CryostatGeo> dbObj;
103  if (!dbObj) {
104  // Check that we found the object and if not report the problem
105  B2FATAL("No configuration for " << name << " found.");
106  }
107  m_config = *dbObj;
108  createGeometry(topVolume, type);
109  }
110 
111 
112  protected:
116  };
117 
118  }
120 }
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::ir::GeoCryostatCreator::operator=
GeoCryostatCreator & operator=(const GeoCryostatCreator &)=delete
Do not want an assignment operator.
Belle2::ir::GeoCryostatCreator::~GeoCryostatCreator
virtual ~GeoCryostatCreator()
The destructor of the GeoCryostatCreator class.
Definition: GeoCryostatCreator.cc:66
Belle2::ir::CryostatElement::transform
G4Transform3D transform
Transformation.
Definition: GeoCryostatCreator.h:36
Belle2::DBStore::addConstantOverride
void addConstantOverride(const std::string &name, TObject *obj, bool oneRun=false)
Add constant override payload.
Definition: DBStore.cc:204
Belle2::ir::CryostatElement
The struct for CryostatElement.
Definition: GeoCryostatCreator.h:34
Belle2::ir::GeoCryostatCreator::create
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creates the ROOT Objects for the Cryostat geometry.
Definition: GeoCryostatCreator.h:81
Belle2::ir::GeoCryostatCreator::createPayloads
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
creates DB payload for CryostatGeo class
Definition: GeoCryostatCreator.h:92
Belle2::ir::GeoCryostatCreator::createConfiguration
CryostatGeo createConfiguration(const GearDir &param)
Reads IR geometry parameters from the xml files and createst DB class CryostatGeo.
Definition: GeoCryostatCreator.h:50
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::ir::GeoCryostatCreator::createGeometry
void createGeometry(G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create detector geometry.
Definition: GeoCryostatCreator.cc:71
Belle2::ir::GeoCryostatCreator::createFromDB
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
Definition: GeoCryostatCreator.h:100
Belle2::ir::CryostatElement::logi
G4LogicalVolume * logi
Logical volume.
Definition: GeoCryostatCreator.h:40
Belle2::CryostatGeo
Geometry parameters of Cryostat.
Definition: CryostatGeo.h:33
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::ir::GeoCryostatCreator::m_sensitive
SensitiveDetector * m_sensitive
Sensitive detector.
Definition: GeoCryostatCreator.h:114
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ir::GeoCryostatCreator::GeoCryostatCreator
GeoCryostatCreator()
Constructor of the GeoCryostatCreator class.
Definition: GeoCryostatCreator.cc:61
Belle2::CryostatGeo::initialize
void initialize(const GearDir &content)
Initialize from gearbox (xml file)
Definition: CryostatGeo.cc:17
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::DBStore::Instance
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:36
Belle2::ir::GeoCryostatCreator::m_config
CryostatGeo m_config
geometry parameters object
Definition: GeoCryostatCreator.h:115
Belle2::ir::SensitiveDetector
The IR Sensitive Detector class.
Definition: SensitiveDetector.h:54
Belle2::ir::GeoCryostatCreator
The creator for the Cryostat geometry of the Belle II detector.
Definition: GeoCryostatCreator.h:46
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::ir::CryostatElement::geo
G4VSolid * geo
Solid volume.
Definition: GeoCryostatCreator.h:38