Belle II Software  release-08-01-10
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 
22 class G4LogicalVolume;
23 class G4VPhysicalVolume;
24 class G4VisAttributes;
25 class G4UserLimits;
26 
27 namespace Belle2 {
33  class BkgSensitiveDetector;
34 
35  namespace CDC {
36 
38 
42 
43  public:
44 
46  GeoCDCCreator();
47 
50 
52 
57  virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
58  {
59  CDCGeometry config = createConfiguration(content);
60  createGeometry(config, topVolume, type);
61  }
62 
66  virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
67  {
69  if (!geo) {
70  B2FATAL("No configuration for " << name << " found.");
71  }
72  createGeometry(*geo, topVolume, type);
73  }
74 
78  virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
79  {
81  importObj.construct(createConfiguration(content));
82  importObj.import(iov);
83  }
84 
88  void createCovers(const GearDir& content);
89 
93  void createCovers(const CDCGeometry& geom);
94 
98  void createNeutronShields(const GearDir& content);
99 
100 
104  void createNeutronShields(const CDCGeometry& geom);
105 
109  void createCover2s(const GearDir& content);
110 
114  void createCover2s(const CDCGeometry& geom);
115 
119  void createCone(const double rmin1, const double rmax1,
120  const double rmin2, const double rmax2,
121  const double thick, const double posz,
122  const int id, G4Material* med, const std::string& name);
126  void createBox(const double length, const double height,
127  const double thick, const double x,
128  const double y, const double z,
129  const int id, G4Material* med,
130  const std::string& name);
134  void createTube(const double rmin, const double rmax,
135  const double thick, const double posZ,
136  const int id, G4Material* med,
137  const std::string& name);
141  void createTorus(const double rmin1, const double rmax1,
142  const double thick, const double posZ,
143  const int id, G4Material* med,
144  const std::string& name);
145 
149  void createTube2(const double rmin, const double rmax,
150  const double phis, const double phie,
151  const double thick, const double posZ,
152  const int id, G4Material* med,
153  const std::string& name);
154 
155  protected:
156 
157  private:
162  {
163  CDCGeometry cdcGeometry;
164  cdcGeometry.read(param);
165  return cdcGeometry;
166  }
170  void createGeometry(const CDCGeometry& parameters, G4LogicalVolume& topVolume,
175  void createMapper(G4LogicalVolume& topVolume);
176 
178  G4LogicalVolume* m_logicalCDC;
179 
181  G4VPhysicalVolume* m_physicalCDC;
182 
185 
188 
190  std::vector<BkgSensitiveDetector*> m_BkgSensitiveRib4 = {};
191 
193  std::vector<G4VisAttributes*> m_VisAttributes;
194 
196  std::vector<G4UserLimits*> m_userLimits;
197 
198  };
199 
200  } // end of cdc namespace
202 } // 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.
Definition: CDCGeometry.cc:34
The Class for CDC Sensitive Detector.
The GeoCDCCreator class.
Definition: GeoCDCCreator.h:41
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.
Definition: GeoCDCCreator.h:78
CDCGeometry createConfiguration(const GearDir &param)
Create DB object of CDC geometry from gearbox.
~GeoCDCCreator()
The destructor of the GeoCDCCreator class.
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.
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.
Definition: GeoCDCCreator.h:57
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.
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()
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).
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.
Definition: GeoCDCCreator.h:66
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.
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
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.