Belle II Software development
GeoCDCCreator.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
13#include <framework/gearbox/GearDir.h>
14#include <framework/logging/Logger.h>
15#include <framework/database/DBObjPtr.h>
16#include <framework/database/IntervalOfValidity.h>
17#include <framework/database/DBImportObjPtr.h>
18
19#include <cdc/simulation/CDCSensitiveDetector.h>
20#include <cdc/dbobjects/CDCGeometry.h>
21
22class G4LogicalVolume;
23class G4VPhysicalVolume;
24class G4VisAttributes;
25class G4UserLimits;
26
27namespace Belle2 {
32
34
35 namespace CDC {
36
38
42
43 public:
44
47
49 ~GeoCDCCreator() override;
51 GeoCDCCreator(const GeoCDCCreator&) = delete;
52
55
57
62 virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
63 {
64 CDCGeometry config = createConfiguration(content);
65 createGeometry(config, topVolume, type);
66 }
67
71 virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
72 {
74 if (!geo) {
75 B2FATAL("No configuration for " << name << " found.");
76 }
77 createGeometry(*geo, topVolume, type);
78 }
79
83 virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
84 {
86 importObj.construct(createConfiguration(content));
87 importObj.import(iov);
88 }
89
93 void createCovers(const GearDir& content);
94
98 void createCovers(const CDCGeometry& geom);
99
103 void createNeutronShields(const GearDir& content);
104
105
109 void createNeutronShields(const CDCGeometry& geom);
110
114 void createCover2s(const GearDir& content);
115
119 void createCover2s(const CDCGeometry& geom);
120
124 void createCone(const double rmin1, const double rmax1,
125 const double rmin2, const double rmax2,
126 const double thick, const double posz,
127 const int id, G4Material* med, const std::string& name);
131 void createBox(const double length, const double height,
132 const double thick, const double x,
133 const double y, const double z,
134 const int id, G4Material* med,
135 const std::string& name);
139 void createTube(const double rmin, const double rmax,
140 const double thick, const double posZ,
141 const int id, G4Material* med,
142 const std::string& name);
146 void createTorus(const double rmin1, const double rmax1,
147 const double thick, const double posZ,
148 const int id, G4Material* med,
149 const std::string& name);
150
154 void createTube2(const double rmin, const double rmax,
155 const double phis, const double phie,
156 const double thick, const double posZ,
157 const int id, G4Material* med,
158 const std::string& name);
159
160 protected:
161
162 private:
167 {
168 CDCGeometry cdcGeometry;
169 cdcGeometry.read(param);
170 return cdcGeometry;
171 }
172
175 void createGeometry(const CDCGeometry& parameters, G4LogicalVolume& topVolume,
180 void createMapper(G4LogicalVolume& topVolume);
181
203 virtual bool getEndplateInformation(const CDCGeometry& geo, const uint iSLayer,
204 double& rMinLeft, double& rMaxLeft, double& zBackLeft, double& zForLeft,
205 double& rMinMiddle, double& rMaxMiddle, double& zBackMiddle, double& zForMiddle,
206 double& rMinRight, double& rMaxRight, double& zBackRight, double& zForRight) const;
207
209 G4LogicalVolume* m_logicalCDC;
210
212 G4VPhysicalVolume* m_physicalCDC;
213
216
219
221 std::vector<BkgSensitiveDetector*> m_BkgSensitiveRib4 = {};
222
224 std::vector<G4VisAttributes*> m_VisAttributes;
225
227 std::vector<G4UserLimits*> m_userLimits;
228
229 };
230
231 } // end of cdc namespace
233} // end of Belle2 namespace
The Class for BeamBackground Sensitive Detector.
The Class for CDC geometry.
Definition CDCGeometry.h:27
void read(const GearDir &)
Get geometry parameters from Gearbox.
The Class for CDC Sensitive Detector.
void createBox(const double length, const double height, const double thick, const double x, const double y, const double z, const int id, G4Material *med, const std::string &name)
Create G4Box.
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Create payloads.
std::vector< G4VisAttributes * > m_VisAttributes
Vector of pointers to G4VisAttributes.
std::vector< G4UserLimits * > m_userLimits
Vector of pointers to G4UserLimits.
BkgSensitiveDetector * m_bkgsensitive
Sensitive detector for background studies.
virtual bool getEndplateInformation(const CDCGeometry &geo, const uint iSLayer, double &rMinLeft, double &rMaxLeft, double &zBackLeft, double &zForLeft, double &rMinMiddle, double &rMaxMiddle, double &zBackMiddle, double &zForMiddle, double &rMinRight, double &rMaxRight, double &zBackRight, double &zForRight) const
Get endplate information.
GeoCDCCreator & operator=(const GeoCDCCreator &)=delete
Operator = (disabled).
void createGeometry(const CDCGeometry &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create G4 geometry of CDC.
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creates the ROOT Objects for the CDC geometry.
void createTube2(const double rmin, const double rmax, const double phis, const double phie, const double thick, const double posZ, const int id, G4Material *med, const std::string &name)
Create G4Tube2.
~GeoCDCCreator() override
The destructor of the GeoCDCCreator class.
void createTube(const double rmin, const double rmax, const double thick, const double posZ, const int id, G4Material *med, const std::string &name)
Create G4Tube.
GeoCDCCreator(const GeoCDCCreator &)=delete
Copy constructor (disabled).
GeoCDCCreator()
Constructor of the GeoCDCCreator class.
void createNeutronShields(const GearDir &content)
Create neutron shield from gearbox.
G4VPhysicalVolume * m_physicalCDC
CDC G4 physical volume.
void createTorus(const double rmin1, const double rmax1, const double thick, const double posZ, const int id, G4Material *med, const std::string &name)
Create G4Torus.
std::vector< BkgSensitiveDetector * > m_BkgSensitiveRib4
Sensitive detectors for background studies (rib4).
static CDCGeometry createConfiguration(const GearDir &param)
Create DB object of CDC geometry from gearbox.
void createCone(const double rmin1, const double rmax1, const double rmin2, const double rmax2, const double thick, const double posz, const int id, G4Material *med, const std::string &name)
Create G4Cone.
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create geometry from DB.
void createCover2s(const GearDir &content)
Create CDC cover2s from gear box.
void createMapper(G4LogicalVolume &topVolume)
Create the B-field mapper geometry (tentative function)
G4LogicalVolume * m_logicalCDC
CDC G4 logical volume.
void createCovers(const GearDir &content)
Create CDC covers from gear box.
CDCSensitiveDetector * m_sensitive
Sensitive detector.
bool import(const IntervalOfValidity &iov)
Import the object to database.
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
GeometryTypes
Flag indicating the type of geometry to be used.
Abstract base class for different kinds of events.