Belle II Software development
GeoCryostatCreator.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#pragma once
10
11#include <geometry/CreatorBase.h>
12#include <framework/gearbox/GearDir.h>
13#include <framework/logging/Logger.h>
14#include <framework/database/DBObjPtr.h>
15#include <framework/database/DBImportObjPtr.h>
16#include <framework/database/IntervalOfValidity.h>
17#include <ir/dbobjects/CryostatGeo.h>
18#include <string>
19
20#include <G4Transform3D.hh>
21#include <G4VSolid.hh>
22class G4LogicalVolume;
23
24namespace Belle2 {
29 namespace ir {
33 G4Transform3D transform;
35 G4VSolid* geo;
37 G4LogicalVolume* logi;
38 };
39
41
44
45 private:
48 {
49 CryostatGeo CryostatGeoConfig;
50 CryostatGeoConfig.initialize(param);
51 return CryostatGeoConfig;
52 }
53
59 void createGeometry(G4LogicalVolume& topVolume, geometry::GeometryTypes type);
60
61
62 public:
63
66
68 virtual ~GeoCryostatCreator();
69
72
75
84 virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
85 {
87
88 // override geometry configuration from the DB
90
91 createGeometry(topVolume, type);
92 }
93
95 virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
96 {
98 importObj.construct(createConfiguration(content));
99 importObj.import(iov);
100 }
101
103 virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
104 {
106 if (!dbObj) {
107 // Check that we found the object and if not report the problem
108 B2FATAL("No configuration for " << name << " found.");
109 }
110 m_config = *dbObj;
111 createGeometry(topVolume, type);
112 }
113
114
115 protected:
119 };
120
121 }
123}
Geometry parameters of Cryostat.
Definition: CryostatGeo.h:23
void initialize(const GearDir &content)
Initialize from gearbox (xml file)
Definition: CryostatGeo.cc:15
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.
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:28
The creator for the Cryostat geometry of the Belle II detector.
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
creates DB payload for CryostatGeo class
GeoCryostatCreator()
Constructor of the GeoCryostatCreator class.
virtual ~GeoCryostatCreator()
The destructor of the GeoCryostatCreator class.
GeoCryostatCreator(const GeoCryostatCreator &)=delete
Do not want a copy constructor.
CryostatGeo m_config
geometry parameters object
GeoCryostatCreator & operator=(const GeoCryostatCreator &)=delete
Do not want an assignment operator.
void createGeometry(G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create detector geometry.
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creates the ROOT Objects for the Cryostat geometry.
CryostatGeo createConfiguration(const GearDir &param)
Reads IR geometry parameters from the xml files and createst DB class CryostatGeo.
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
SensitiveDetector * m_sensitive
Sensitive detector.
The IR Sensitive Detector class.
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:28
void addConstantOverride(const std::string &name, TObject *obj, bool oneRun=false)
Add constant override payload.
Definition: DBStore.cc:204
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.
The struct for CryostatElement.
G4LogicalVolume * logi
Logical volume.
G4VSolid * geo
Solid volume.
G4Transform3D transform
Transformation.