Belle II Software  release-05-01-25
GeoBKLMCreator.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Leo Piilonen *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 /* KLM headers. */
14 #include <klm/bklm/geometry/GeometryPar.h>
15 #include <klm/dbobjects/bklm/BKLMGeometryPar.h>
16 
17 /* Belle 2 headers. */
18 #include <framework/database/DBImportObjPtr.h>
19 #include <framework/database/DBObjPtr.h>
20 #include <framework/database/IntervalOfValidity.h>
21 #include <framework/logging/Logger.h>
22 #include <geometry/CreatorBase.h>
23 
24 class G4VSolid;
25 class G4Box;
26 class G4Tubs;
27 class G4Polyhedra;
28 class G4LogicalVolume;
29 class G4VSensitiveDetector;
30 class G4String;
31 class G4VisAttributes;
32 
33 namespace Belle2 {
39  class GearDir;
40 
41  namespace bklm {
42 
44 
46 
47  public:
48 
51 
53  GeoBKLMCreator(GeoBKLMCreator&) = delete;
54 
57 
59  virtual ~GeoBKLMCreator();
60 
63  virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
64  {
65  BKLMGeometryPar config = createConfiguration(content);
66  createGeometry(config, topVolume, type);
67  }
68 
70  virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
71  {
73  importObj.construct(createConfiguration(content));
74  importObj.import(iov);
75  }
76 
78  virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
79  {
81  if (!dbObj) {
83  B2FATAL("No configuration for " << name << " found.");
84  }
85  createGeometry(*dbObj, topVolume, type);
86  }
87 
88  protected:
89 
90  private:
91 
94  {
95  BKLMGeometryPar bklmGeometryPar;
96  //bklmGeometryPar.setVersion(0);
97  bklmGeometryPar.read(param);
98  return bklmGeometryPar;
99  };
100 
102  void createGeometry(const BKLMGeometryPar& parameters, G4LogicalVolume& topVolume, geometry::GeometryTypes type);
103 
105  void putEndsInEnvelope(G4LogicalVolume*);
106 
108  void putSectorsInEnd(G4LogicalVolume*, int);
109 
111  void putCapInSector(G4LogicalVolume*, bool);
112 
114  void putInnerRegionInSector(G4LogicalVolume*, bool, bool);
115 
117  void putVoidInInnerRegion(G4LogicalVolume*, bool, bool);
118 
120  void putLayer1SupportInInnerVoid(G4LogicalVolume*, bool);
121 
123  void putLayer1BracketsInInnerVoid(G4LogicalVolume*, bool);
124 
126  void putLayersInSector(G4LogicalVolume*, int, int, bool);
127 
129  void putChimneyInLayer(G4LogicalVolume*, int);
130 
132  void putModuleInLayer(G4LogicalVolume*, int, int, int, bool, bool, int);
133 
135  void putRPCsInInterior(G4LogicalVolume*, int, bool);
136 
138  void putScintsInInterior(G4LogicalVolume*, int, int, int, bool);
139 
141  G4LogicalVolume* getScintLogical(double, double, double, double);
142 
144  G4LogicalVolume* getMPPCHousingLogical(void);
145 
147  G4LogicalVolume* getReadoutContainerLogical(void);
148 
150  G4Tubs* getSolenoidTube(void);
151 
153  G4String logicalName(G4VSolid*);
154 
156  G4String physicalName(G4LogicalVolume*);
157 
160 
162  G4VSensitiveDetector* m_Sensitive;
163 
165  double m_SectorDphi;
166 
168  double m_SectorDz;
169 
171  double m_RibShift;
172 
174  G4Polyhedra* m_CapSolid;
175 
177  G4LogicalVolume* m_CapLogical[2];
178 
180  G4VSolid* m_InnerIronSolid;
181 
183  G4LogicalVolume* m_InnerIronLogical[4];
184 
186  G4VSolid* m_InnerAirSolid;
187 
189  G4LogicalVolume* m_InnerAirLogical[4];
190 
192  G4LogicalVolume* m_SupportLogical[2];
193 
195  G4LogicalVolume* m_BracketLogical;
196 
199 
202 
205 
208 
211 
213  G4Tubs* m_SectorTube;
214 
217 
219  G4LogicalVolume* m_MPPCHousingLogical;
220 
222  G4LogicalVolume* m_ReadoutContainerLogical;
223 
225  G4Tubs* m_SolenoidTube;
226 
228  std::vector<G4LogicalVolume*> m_ScintLogicals;
229 
231  std::vector<G4VisAttributes*> m_VisAttributes;
232 
234  std::vector<G4String*> m_Names;
235 
236  };
237 
238  } // end of namespace bklm
239 
241 } // end of namespace Belle2
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::bklm::GeoBKLMCreator::createConfiguration
BKLMGeometryPar createConfiguration(const GearDir &param)
Create a parameter object from the Gearbox XML parameters.
Definition: GeoBKLMCreator.h:93
Belle2::bklm::GeoBKLMCreator::putLayersInSector
void putLayersInSector(G4LogicalVolume *, int, int, bool)
Put the layers into each sector.
Definition: GeoBKLMCreator.cc:503
Belle2::bklm::GeoBKLMCreator::m_CapSolid
G4Polyhedra * m_CapSolid
Pointer to solid for cap.
Definition: GeoBKLMCreator.h:174
Belle2::bklm::GeoBKLMCreator::m_BracketLogical
G4LogicalVolume * m_BracketLogical
Pointer to logical volume for bracket.
Definition: GeoBKLMCreator.h:195
Belle2::bklm::GeoBKLMCreator::m_SupportLogical
G4LogicalVolume * m_SupportLogical[2]
Pointer to logical volumes for support structure [hasChimney].
Definition: GeoBKLMCreator.h:192
Belle2::BKLMGeometryPar::read
void read(const GearDir &)
Get geometry parameters from Gearbox.
Definition: BKLMGeometryPar.cc:32
Belle2::bklm::GeoBKLMCreator::m_InnerIronSolid
G4VSolid * m_InnerIronSolid
Pointer to solid for inner iron [hasInnerSupport | hasChimney].
Definition: GeoBKLMCreator.h:180
Belle2::bklm::GeoBKLMCreator::m_LayerModuleLogical
G4LogicalVolume * m_LayerModuleLogical[2 *BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to logical volumes for detector modules in each layer's air gap [hasChimney | layer-1].
Definition: GeoBKLMCreator.h:210
Belle2::bklm::GeoBKLMCreator::getReadoutContainerLogical
G4LogicalVolume * getReadoutContainerLogical(void)
Get pointer to readout-container logical volume.
Definition: GeoBKLMCreator.cc:1117
Belle2::bklm::GeoBKLMCreator::putVoidInInnerRegion
void putVoidInInnerRegion(G4LogicalVolume *, bool, bool)
Put the air void into the inner-radius region.
Definition: GeoBKLMCreator.cc:327
Belle2::bklm::GeoBKLMCreator::putInnerRegionInSector
void putInnerRegionInSector(G4LogicalVolume *, bool, bool)
Put the inner-radius region into each sector.
Definition: GeoBKLMCreator.cc:285
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::bklm::GeoBKLMCreator::getSolenoidTube
G4Tubs * getSolenoidTube(void)
Get shape corresponding to the solenoid (for subtraction)
Definition: GeoBKLMCreator.cc:1201
Belle2::bklm::GeoBKLMCreator::m_GeoPar
GeometryPar * m_GeoPar
Pointer to the BKLM geometry accessor.
Definition: GeoBKLMCreator.h:159
Belle2::DBImportBase::import
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:38
Belle2::bklm::GeoBKLMCreator::createPayloads
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Create the configuration objects and save them in the Database.
Definition: GeoBKLMCreator.h:70
Belle2::bklm::GeoBKLMCreator::putSectorsInEnd
void putSectorsInEnd(G4LogicalVolume *, int)
Put each sector into the forward or backward end.
Definition: GeoBKLMCreator.cc:180
Belle2::BKLMElementNumbers::getMaximalSectorNumber
static constexpr int getMaximalSectorNumber()
Get maximal sector number (1-based).
Definition: BKLMElementNumbers.h:243
Belle2::bklm::GeometryPar
Provides BKLM geometry parameters for simulation, reconstruction etc (from Gearbox or DataBase)
Definition: GeometryPar.h:48
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::bklm::GeoBKLMCreator::m_InnerAirLogical
G4LogicalVolume * m_InnerAirLogical[4]
Pointer to logical volumes for inner air [hasInnerSupport | hasChimney].
Definition: GeoBKLMCreator.h:189
Belle2::bklm::GeoBKLMCreator::putRPCsInInterior
void putRPCsInInterior(G4LogicalVolume *, int, bool)
Put the RPCs into each detector module's interior (module is itself in an air gap)
Definition: GeoBKLMCreator.cc:800
Belle2::bklm::GeoBKLMCreator::m_InnerAirSolid
G4VSolid * m_InnerAirSolid
Pointer to solid for inner air.
Definition: GeoBKLMCreator.h:186
Belle2::bklm::GeoBKLMCreator::physicalName
G4String physicalName(G4LogicalVolume *)
convert G4LogicalVolume's name to corresponding G4PhysicalVolume name
Definition: GeoBKLMCreator.cc:1224
Belle2::bklm::GeoBKLMCreator
This class creates the BKLM geometry of the Belle II detector.
Definition: GeoBKLMCreator.h:45
Belle2::bklm::GeoBKLMCreator::GeoBKLMCreator
GeoBKLMCreator()
Constructor of the GeoBKLMCreator class.
Definition: GeoBKLMCreator.cc:43
Belle2::bklm::GeoBKLMCreator::m_SectorDz
double m_SectorDz
Half-length of one sector.
Definition: GeoBKLMCreator.h:168
Belle2::bklm::GeoBKLMCreator::operator=
GeoBKLMCreator & operator=(GeoBKLMCreator &)=delete
Assignment operator is disabled.
Belle2::bklm::GeoBKLMCreator::createGeometry
void createGeometry(const BKLMGeometryPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
Definition: GeoBKLMCreator.cc:97
Belle2::bklm::GeoBKLMCreator::m_SectorTube
G4Tubs * m_SectorTube
Pointer to solid for sector's enclosing tube.
Definition: GeoBKLMCreator.h:213
Belle2::bklm::GeoBKLMCreator::m_SolenoidTube
G4Tubs * m_SolenoidTube
Pointer to solid for solenoid.
Definition: GeoBKLMCreator.h:225
Belle2::BKLMElementNumbers::getMaximalLayerNumber
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
Definition: BKLMElementNumbers.h:251
Belle2::bklm::GeoBKLMCreator::putLayer1BracketsInInnerVoid
void putLayer1BracketsInInnerVoid(G4LogicalVolume *, bool)
Put the layer-0 support plate's brackets into the inner region's air void (sectors 1....
Definition: GeoBKLMCreator.cc:405
Belle2::bklm::GeoBKLMCreator::putLayer1SupportInInnerVoid
void putLayer1SupportInInnerVoid(G4LogicalVolume *, bool)
Put the layer-0 support plate into the inner region's air void (sectors 1..5 only)
Definition: GeoBKLMCreator.cc:374
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::bklm::GeoBKLMCreator::m_LayerIronSolid
G4Polyhedra * m_LayerIronSolid[BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to solids for iron in each layer [layer-1].
Definition: GeoBKLMCreator.h:198
Belle2::bklm::GeoBKLMCreator::getScintLogical
G4LogicalVolume * getScintLogical(double, double, double, double)
Get pointer to scintillator logical volume.
Definition: GeoBKLMCreator.cc:986
Belle2::bklm::GeoBKLMCreator::m_SectorDphi
double m_SectorDphi
Angular extent of one sector.
Definition: GeoBKLMCreator.h:165
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::bklm::GeoBKLMCreator::putScintsInInterior
void putScintsInInterior(G4LogicalVolume *, int, int, int, bool)
Put the scintillators into each detector module's interior (module is itself in an air gap)
Definition: GeoBKLMCreator.cc:861
Belle2::bklm::GeoBKLMCreator::m_ReadoutContainerLogical
G4LogicalVolume * m_ReadoutContainerLogical
Pointer to logical volume for scint preamplifier/carrier container.
Definition: GeoBKLMCreator.h:222
Belle2::BKLMGeometryPar
The Class for BKLM geometry.
Definition: BKLMGeometryPar.h:42
Belle2::bklm::GeoBKLMCreator::putCapInSector
void putCapInSector(G4LogicalVolume *, bool)
Put the cap (at maximum |z|) into each sector.
Definition: GeoBKLMCreator.cc:218
Belle2::bklm::GeoBKLMCreator::create
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creates the objects for the BKLM geometry virtual void create(const GearDir&, G4LogicalVolume&,...
Definition: GeoBKLMCreator.h:63
Belle2::bklm::GeoBKLMCreator::m_SectorLogical
G4LogicalVolume * m_SectorLogical[2][BKLMElementNumbers::getMaximalSectorNumber()]
Pointers to logical volumes for each sector [fb-1][sector-1].
Definition: GeoBKLMCreator.h:216
Belle2::bklm::GeoBKLMCreator::m_Sensitive
G4VSensitiveDetector * m_Sensitive
Pointer to the BKLM SensitiveDetector processor.
Definition: GeoBKLMCreator.h:162
Belle2::bklm::GeoBKLMCreator::putChimneyInLayer
void putChimneyInLayer(G4LogicalVolume *, int)
Put the solenoid's cooling chimney into the backward top sector.
Definition: GeoBKLMCreator.cc:562
Belle2::bklm::GeoBKLMCreator::m_VisAttributes
std::vector< G4VisAttributes * > m_VisAttributes
Vector of pointers to G4VisAttributes objects.
Definition: GeoBKLMCreator.h:231
Belle2::bklm::GeoBKLMCreator::m_MPPCHousingLogical
G4LogicalVolume * m_MPPCHousingLogical
Pointer to logical volume for MPPC housing.
Definition: GeoBKLMCreator.h:219
Belle2::bklm::GeoBKLMCreator::m_LayerGapLogical
G4LogicalVolume * m_LayerGapLogical[12 *BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to logical volumes for air gap in each layer [side/bottom/top | isFlipped | hasChimney | lay...
Definition: GeoBKLMCreator.h:207
Belle2::geometry::CreatorBase
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:31
Belle2::bklm::GeoBKLMCreator::m_LayerIronLogical
G4LogicalVolume * m_LayerIronLogical[12 *BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to logical volumes for iron in each layer [side/bottom/top | isFlipped | hasChimney | layer-...
Definition: GeoBKLMCreator.h:201
Belle2::bklm::GeoBKLMCreator::m_LayerGapSolid
G4Box * m_LayerGapSolid[2 *BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to solids for air gap in each layer [hasChimney | layer-1].
Definition: GeoBKLMCreator.h:204
Belle2::bklm::GeoBKLMCreator::m_Names
std::vector< G4String * > m_Names
Vector of pointers to G4String objects (volume names)
Definition: GeoBKLMCreator.h:234
Belle2::bklm::GeoBKLMCreator::getMPPCHousingLogical
G4LogicalVolume * getMPPCHousingLogical(void)
Get pointer to MPPC-container logical volume.
Definition: GeoBKLMCreator.cc:1072
Belle2::bklm::GeoBKLMCreator::logicalName
G4String logicalName(G4VSolid *)
convert G4VSolid's name to corresponding G4LogicalVolume name
Definition: GeoBKLMCreator.cc:1217
Belle2::bklm::GeoBKLMCreator::createFromDB
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
Definition: GeoBKLMCreator.h:78
Belle2::bklm::GeoBKLMCreator::putEndsInEnvelope
void putEndsInEnvelope(G4LogicalVolume *)
Put the forward and backward ends into the BKLM envelope.
Definition: GeoBKLMCreator.cc:137
Belle2::bklm::GeoBKLMCreator::~GeoBKLMCreator
virtual ~GeoBKLMCreator()
Destructor of the GeoBKLMCreator class.
Definition: GeoBKLMCreator.cc:83
Belle2::bklm::GeoBKLMCreator::m_ScintLogicals
std::vector< G4LogicalVolume * > m_ScintLogicals
Pointers to logical volumes for scintillator strips.
Definition: GeoBKLMCreator.h:228
Belle2::geometry::GeometryTypes
GeometryTypes
Flag indiciating the type of geometry to be used.
Definition: GeometryManager.h:39
Belle2::bklm::GeoBKLMCreator::m_CapLogical
G4LogicalVolume * m_CapLogical[2]
Pointer to logical volumes for cap [hasChimney].
Definition: GeoBKLMCreator.h:177
Belle2::bklm::GeoBKLMCreator::m_RibShift
double m_RibShift
Radial displacement of polygon to create an azimuthal iron rib.
Definition: GeoBKLMCreator.h:171
Belle2::bklm::GeoBKLMCreator::m_InnerIronLogical
G4LogicalVolume * m_InnerIronLogical[4]
Pointer to logical volumes for inner iron [hasInnerSupport | hasChimney].
Definition: GeoBKLMCreator.h:183
Belle2::bklm::GeoBKLMCreator::putModuleInLayer
void putModuleInLayer(G4LogicalVolume *, int, int, int, bool, bool, int)
Put the module (and enclosing air gap) into each layer.
Definition: GeoBKLMCreator.cc:699