Belle II Software  release-08-01-10
GeoBKLMCreator.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 /* KLM headers. */
12 #include <klm/bklm/geometry/GeometryPar.h>
13 #include <klm/dbobjects/bklm/BKLMGeometryPar.h>
14 
15 /* Basf2 headers. */
16 #include <framework/database/DBImportObjPtr.h>
17 #include <framework/database/DBObjPtr.h>
18 #include <framework/database/IntervalOfValidity.h>
19 #include <framework/logging/Logger.h>
20 #include <geometry/CreatorBase.h>
21 
22 class G4VSolid;
23 class G4Box;
24 class G4Tubs;
25 class G4Polyhedra;
26 class G4LogicalVolume;
27 class G4VSensitiveDetector;
28 class G4String;
29 class G4VisAttributes;
30 
31 namespace Belle2 {
37  class GearDir;
38 
39  namespace bklm {
40 
42 
44 
45  public:
46 
49 
52 
55 
58 
61  void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
62  {
63  BKLMGeometryPar config = createConfiguration(content);
64  createGeometry(config, topVolume, type);
65  }
66 
68  void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
69  {
71  importObj.construct(createConfiguration(content));
72  importObj.import(iov);
73  }
74 
76  void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
77  {
79  if (!dbObj) {
81  B2FATAL("No configuration for " << name << " found.");
82  }
83  createGeometry(*dbObj, topVolume, type);
84  }
85 
86  protected:
87 
88  private:
89 
92  {
93  BKLMGeometryPar bklmGeometryPar;
94  //bklmGeometryPar.setVersion(0);
95  bklmGeometryPar.read(param);
96  return bklmGeometryPar;
97  };
98 
100  void createGeometry(const BKLMGeometryPar& parameters, G4LogicalVolume& topVolume, geometry::GeometryTypes type);
101 
103  void putEndsInEnvelope(G4LogicalVolume*);
104 
106  void putSectorsInEnd(G4LogicalVolume*, int);
107 
109  void putCapInSector(G4LogicalVolume*, bool);
110 
112  void putInnerRegionInSector(G4LogicalVolume*, bool, bool);
113 
115  void putVoidInInnerRegion(G4LogicalVolume*, bool, bool);
116 
118  void putLayer1SupportInInnerVoid(G4LogicalVolume*, bool);
119 
121  void putLayer1BracketsInInnerVoid(G4LogicalVolume*, bool);
122 
124  void putLayersInSector(G4LogicalVolume*, int, int, bool);
125 
127  void putChimneyInLayer(G4LogicalVolume*, int);
128 
130  void putModuleInLayer(G4LogicalVolume*, int, int, int, bool, bool, int);
131 
133  void putRPCsInInterior(G4LogicalVolume*, int, bool);
134 
136  void putScintsInInterior(G4LogicalVolume*, int, int, int, bool);
137 
139  G4LogicalVolume* getScintLogical(double, double, double, double);
140 
142  G4LogicalVolume* getMPPCHousingLogical(void);
143 
145  G4LogicalVolume* getReadoutContainerLogical(void);
146 
148  G4Tubs* getSolenoidTube(void);
149 
151  G4String logicalName(G4VSolid*);
152 
154  G4String physicalName(G4LogicalVolume*);
155 
158 
160  G4VSensitiveDetector* m_Sensitive;
161 
163  double m_SectorDphi;
164 
166  double m_SectorDz;
167 
169  double m_RibShift;
170 
172  G4Polyhedra* m_CapSolid;
173 
175  G4LogicalVolume* m_CapLogical[2];
176 
178  G4VSolid* m_InnerIronSolid;
179 
181  G4LogicalVolume* m_InnerIronLogical[4];
182 
184  G4VSolid* m_InnerAirSolid;
185 
187  G4LogicalVolume* m_InnerAirLogical[4];
188 
190  G4LogicalVolume* m_SupportLogical[2];
191 
193  G4LogicalVolume* m_BracketLogical;
194 
197 
200 
203 
206 
209 
211  G4Tubs* m_SectorTube;
212 
215 
217  G4LogicalVolume* m_MPPCHousingLogical;
218 
220  G4LogicalVolume* m_ReadoutContainerLogical;
221 
223  G4Tubs* m_SolenoidTube;
224 
226  std::vector<G4LogicalVolume*> m_ScintLogicals;
227 
229  std::vector<G4VisAttributes*> m_VisAttributes;
230 
232  std::vector<G4String*> m_Names;
233 
234  };
235 
236  } // end of namespace bklm
237 
239 } // end of namespace Belle2
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
static constexpr int getMaximalSectorNumber()
Get maximal sector number (1-based).
The Class for BKLM geometry.
void read(const GearDir &)
Get geometry parameters from Gearbox.
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.
This class creates the BKLM geometry of the Belle II detector.
void putLayer1SupportInInnerVoid(G4LogicalVolume *, bool)
Put the layer-0 support plate into the inner region's air void (sectors 1..5 only)
void putChimneyInLayer(G4LogicalVolume *, int)
Put the solenoid's cooling chimney into the backward top sector.
G4LogicalVolume * m_LayerGapLogical[12 *BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to logical volumes for air gap in each layer [side/bottom/top | isFlipped | hasChimney | lay...
BKLMGeometryPar createConfiguration(const GearDir &param)
Create a parameter object from the Gearbox XML parameters.
G4LogicalVolume * m_SupportLogical[2]
Pointer to logical volumes for support structure [hasChimney].
G4Tubs * m_SolenoidTube
Pointer to solid for solenoid.
GeoBKLMCreator & operator=(GeoBKLMCreator &)=delete
Assignment operator is disabled.
G4LogicalVolume * m_ReadoutContainerLogical
Pointer to logical volume for scint preamplifier/carrier container.
void putScintsInInterior(G4LogicalVolume *, int, int, int, bool)
Put the scintillators into each detector module's interior (module is itself in an air gap)
G4LogicalVolume * m_BracketLogical
Pointer to logical volume for bracket.
G4Polyhedra * m_CapSolid
Pointer to solid for cap.
G4LogicalVolume * m_SectorLogical[2][BKLMElementNumbers::getMaximalSectorNumber()]
Pointers to logical volumes for each sector [fb-1][sector-1].
void createGeometry(const BKLMGeometryPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
double m_SectorDphi
Angular extent of one sector.
G4Tubs * m_SectorTube
Pointer to solid for sector's enclosing tube.
~GeoBKLMCreator()
Destructor of the GeoBKLMCreator class.
void putEndsInEnvelope(G4LogicalVolume *)
Put the forward and backward ends into the BKLM envelope.
void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
G4Box * m_LayerGapSolid[2 *BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to solids for air gap in each layer [hasChimney | layer-1].
double m_RibShift
Radial displacement of polygon to create an azimuthal iron rib.
G4LogicalVolume * getReadoutContainerLogical(void)
Get pointer to readout-container logical volume.
void putLayersInSector(G4LogicalVolume *, int, int, bool)
Put the layers into each sector.
std::vector< G4VisAttributes * > m_VisAttributes
Vector of pointers to G4VisAttributes objects.
G4LogicalVolume * m_MPPCHousingLogical
Pointer to logical volume for MPPC housing.
GeoBKLMCreator()
Constructor of the GeoBKLMCreator class.
G4VSolid * m_InnerIronSolid
Pointer to solid for inner iron [hasInnerSupport | hasChimney].
void putSectorsInEnd(G4LogicalVolume *, int)
Put each sector into the forward or backward end.
void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Create the configuration objects and save them in the Database.
G4Tubs * getSolenoidTube(void)
Get shape corresponding to the solenoid (for subtraction)
double m_SectorDz
Half-length of one sector.
G4Polyhedra * m_LayerIronSolid[BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to solids for iron in each layer [layer-1].
G4LogicalVolume * m_InnerAirLogical[4]
Pointer to logical volumes for inner air [hasInnerSupport | hasChimney].
G4LogicalVolume * m_CapLogical[2]
Pointer to logical volumes for cap [hasChimney].
void putCapInSector(G4LogicalVolume *, bool)
Put the cap (at maximum |z|) into each sector.
G4LogicalVolume * m_InnerIronLogical[4]
Pointer to logical volumes for inner iron [hasInnerSupport | hasChimney].
void putVoidInInnerRegion(G4LogicalVolume *, bool, bool)
Put the air void into the inner-radius region.
G4String logicalName(G4VSolid *)
convert G4VSolid's name to corresponding G4LogicalVolume name
G4VSensitiveDetector * m_Sensitive
Pointer to the BKLM SensitiveDetector processor.
G4LogicalVolume * getScintLogical(double, double, double, double)
Get pointer to scintillator logical volume.
std::vector< G4LogicalVolume * > m_ScintLogicals
Pointers to logical volumes for scintillator strips.
G4LogicalVolume * m_LayerIronLogical[12 *BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to logical volumes for iron in each layer [side/bottom/top | isFlipped | hasChimney | layer-...
GeometryPar * m_GeoPar
Pointer to the BKLM geometry accessor.
G4String physicalName(G4LogicalVolume *)
convert G4LogicalVolume's name to corresponding G4PhysicalVolume name
void putRPCsInInterior(G4LogicalVolume *, int, bool)
Put the RPCs into each detector module's interior (module is itself in an air gap)
void putModuleInLayer(G4LogicalVolume *, int, int, int, bool, bool, int)
Put the module (and enclosing air gap) into each layer.
void putLayer1BracketsInInnerVoid(G4LogicalVolume *, bool)
Put the layer-0 support plate's brackets into the inner region's air void (sectors 1....
void putInnerRegionInSector(G4LogicalVolume *, bool, bool)
Put the inner-radius region into each sector.
void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creates the objects for the BKLM geometry virtual void create(const GearDir&, G4LogicalVolume&,...
GeoBKLMCreator(GeoBKLMCreator &)=delete
Copy constructor is disabled.
G4VSolid * m_InnerAirSolid
Pointer to solid for inner air.
std::vector< G4String * > m_Names
Vector of pointers to G4String objects (volume names)
G4LogicalVolume * getMPPCHousingLogical(void)
Get pointer to MPPC-container logical volume.
G4LogicalVolume * m_LayerModuleLogical[2 *BKLMElementNumbers::getMaximalLayerNumber()]
Pointers to logical volumes for detector modules in each layer's air gap [hasChimney | layer-1].
Provides BKLM geometry parameters for simulation, reconstruction etc (from Gearbox or DataBase)
Definition: GeometryPar.h:37
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.