Belle II Software  release-08-01-10
GeoVXDCreator.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 #ifndef GEOVXDCREATOR_H
10 #define GEOVXDCREATOR_H
11 
12 #include <vxd/geometry/GeoVXDComponents.h>
13 #include <vxd/geometry/GeoVXDAssembly.h>
14 #include <vxd/geometry/SensorInfoBase.h>
15 #include <vxd/geometry/GeoVXDRadiationSensors.h>
16 #include <vxd/simulation/SensitiveDetectorBase.h>
17 #include <geometry/CreatorBase.h>
18 #include <framework/gearbox/GearDir.h>
19 #include <framework/logging/Logger.h>
20 #include <string>
21 #include <vector>
22 #include <map>
23 
24 
25 #include <framework/database/DBObjPtr.h>
26 #include <framework/database/DBImportObjPtr.h>
27 #include <framework/database/IntervalOfValidity.h>
28 #include <vxd/dbobjects/VXDGeometryPar.h>
29 
30 
31 #include <G4Transform3D.hh>
32 #include <G4Polycone.hh>
33 class G4LogicalVolume;
34 class G4AssemblyVolume;
35 class G4VSolid;
36 class G4Material;
37 class G4UserLimits;
38 
39 namespace Belle2 {
45  namespace VXD {
46 
49 
50  public:
52  explicit GeoVXDCreator(const std::string& prefix);
53 
55  virtual ~GeoVXDCreator();
56 
61  virtual SensorInfoBase* createSensorInfo(const VXDGeoSensorPar& sensor) = 0;
62 
70  const VXDGeoSensorPlacement& placement) = 0;
71 
75  virtual void setCurrentLayer(int layer, const VXDGeometryPar& parameters);
76 
81  G4Transform3D placeLadder(int ladderID, double phi, G4LogicalVolume* volume, const G4Transform3D& placement,
82  const VXDGeometryPar& parameters);
83 
92  G4Transform3D getPosition(const VXDGeoComponent& mother, const VXDGeoComponent& daughter, const VXDGeoPlacement& placement,
93  bool originCenter);
94 
100  G4Transform3D getAlignment(const VXDAlignmentPar& params);
101 
119  GeoVXDAssembly createSubComponents(const std::string& name, VXDGeoComponent& component,
120  std::vector<VXDGeoPlacement> placements,
121  bool originCenter = true, bool allowOutside = false);
122 
137  G4VSolid* createTrapezoidal(const std::string& name, double width, double
138  width2, double length, double& height, double angle = 0);
139 
141  void createDiamonds(const VXDGeoRadiationSensorsPar& params, G4LogicalVolume& topVolume, G4LogicalVolume& envelopeVolume);
142 
146  std::vector<VXDGeoPlacementPar> getSubComponents(const GearDir& path);
147 
152  virtual void readLadder(int layer, GearDir components, VXDGeometryPar& geoparameters);
153 
158  virtual void readLadderComponents(int layerID, int ladderID, GearDir content, VXDGeometryPar& vxdGeometryPar);
159 
167  void readComponent(const std::string& name, GearDir components, VXDGeometryPar& vxdGeometryPar);
168 
176  void readSubComponents(const std::vector<VXDGeoPlacementPar>& placements, const GearDir& componentsDir,
177  VXDGeometryPar& vxdGeometryPar);
178 
179  protected:
181  std::string m_prefix;
186 
188  std::map<std::string, VXDGeoComponent> m_componentCache;
190  std::map<std::string, VXDGeoSensor> m_sensorMap;
194  std::vector<Simulation::SensitiveDetectorBase*> m_sensitive;
197 
199  std::string m_defaultMaterial;
201  float m_distanceTolerance {(float)(5 * Unit::um)};
203  float m_electronTolerance {100};
205  float m_minimumElectrons {10};
209  bool m_activeChips {false};
211  bool m_seeNeutrons {false};
213  bool m_onlyPrimaryTrueHits {false};
216  bool m_onlyActiveMaterial {false};
218  std::vector<G4UserLimits*> m_UserLimits;
220  std::string m_currentHalfShell {""};
222  std::map<std::string, Belle2::VxdID> m_halfShellVxdIDs {
223  {{"PXD.Ying"}, {Belle2::VxdID(1, 0, 0, 1)}},
224  {{"PXD.Yang"}, {Belle2::VxdID(1, 0, 0, 2)}},
225  {{"SVD.Pat"}, {Belle2::VxdID(3, 0, 0, 1)}},
226  {{"SVD.Mat"}, {Belle2::VxdID(3, 0, 0, 2)}}
227  };
228 
229  }; // class GeoVXDCreator
230 
231  } // namespace VXD
233 } //namespace Belle2
234 
235 #endif /* GEOVXDCREATOR_H */
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
class to create the diamond radiation sensor geometry if defined
static const double um
[micrometers]
Definition: Unit.h:71
The Class for VXD Alignment payload.
Class holding all parameters for an VXD geometry component.
Struct containing all parameters of one ladder.
Class holding all parameters to place a VXD geometry subcomponent.
The Class for VXD Radiation Sensor parameters.
The Class for VXD Sensor payload.
Struct holding the information where a sensor should be placed inside the ladder.
Struct holding all parameters for a completeVXD Sensor.
The Class for VXD geometry.
Class to group some Geant4 volumes and place them all at once with a given transformation matrix.
The creator for the VXD geometry of the Belle II detector.
Definition: GeoVXDCreator.h:48
std::map< std::string, VXDGeoSensor > m_sensorMap
Map containing Information about all defined sensor types.
float m_minimumElectrons
minimum number of electrons to be deposited by a particle to be saved
G4VSolid * createTrapezoidal(const std::string &name, double width, double width2, double length, double &height, double angle=0)
Create a trapezoidal solid.
virtual void readLadderComponents(int layerID, int ladderID, GearDir content, VXDGeometryPar &vxdGeometryPar)
Read parameters for ladder components and their alignment corresponding to the given ladder id.
void createDiamonds(const VXDGeoRadiationSensorsPar &params, G4LogicalVolume &topVolume, G4LogicalVolume &envelopeVolume)
Create diamond radiation sensors.
GearDir m_components
GearDir pointing to the toplevel of the components.
GeoVXDRadiationSensors m_radiationsensors
Diamond radiation sensor "sub creator".
std::vector< Simulation::SensitiveDetectorBase * > m_sensitive
List to all created sensitive detector instances.
std::string m_prefix
Prefix to prepend to all volume names.
bool m_onlyActiveMaterial
If this is true, only active Materials will be placed for tracking studies.
double m_activeStepSize
Stepsize to be used inside active volumes.
float m_distanceTolerance
tolerance for Geant4 steps to be merged to a single step
virtual void readLadder(int layer, GearDir components, VXDGeometryPar &geoparameters)
Read parameters for a ladder in layer with given ID from gearbox and layer store them in payload.
VXDGeoLadder m_ladder
Parameters of the currently active ladder.
std::map< std::string, Belle2::VxdID > m_halfShellVxdIDs
Used for translation of half-shell name into a VxdID to consitently handle it in hierarchy.
bool m_onlyPrimaryTrueHits
If true only create TrueHits from primary particles and ignore secondaries.
G4Transform3D getPosition(const VXDGeoComponent &mother, const VXDGeoComponent &daughter, const VXDGeoPlacement &placement, bool originCenter)
Return the position where a daughter component is to be placed.
float m_electronTolerance
tolerance for the energy deposition in electrons to be merged in a single step
std::vector< G4UserLimits * > m_UserLimits
Vector of G4UserLimit pointers.
G4Transform3D getAlignment(const VXDAlignmentPar &params)
Get Alignment from paylead object.
void readComponent(const std::string &name, GearDir components, VXDGeometryPar &vxdGeometryPar)
Read parameters for component name from Gearbox into geometry payload.
virtual ~GeoVXDCreator()
The destructor of the GeoVXDCreator class.
GeoVXDAssembly createSubComponents(const std::string &name, VXDGeoComponent &component, std::vector< VXDGeoPlacement > placements, bool originCenter=true, bool allowOutside=false)
Place a list of subcomponents into an component.
void readSubComponents(const std::vector< VXDGeoPlacementPar > &placements, const GearDir &componentsDir, VXDGeometryPar &vxdGeometryPar)
Read parameters for all components in placement container from Gearbox into payload.
std::map< std::string, VXDGeoComponent > m_componentCache
Cache of all previously created components.
G4Transform3D placeLadder(int ladderID, double phi, G4LogicalVolume *volume, const G4Transform3D &placement, const VXDGeometryPar &parameters)
Place ladder corresponding to the given ladder id into volume setLayer has to be called first to set ...
virtual void setCurrentLayer(int layer, const VXDGeometryPar &parameters)
Read parameters for given layer and store in m_ladder.
std::vector< VXDGeoPlacementPar > getSubComponents(const GearDir &path)
Return vector of VXDGeoPlacements with all the components defined inside a given path.
virtual SensitiveDetectorBase * createSensitiveDetector(VxdID sensorID, const VXDGeoSensor &sensor, const VXDGeoSensorPlacement &placement)=0
Return a SensitiveDetector implementation for a given sensor.
virtual SensorInfoBase * createSensorInfo(const VXDGeoSensorPar &sensor)=0
Read the sensor definitions from the database.
bool m_seeNeutrons
Make sensitive detectors also see neutrons.
std::string m_defaultMaterial
Name of the Material to be used for Air.
bool m_activeChips
Make also chips sensitive.
std::string m_currentHalfShell
Current half-shell being processed (need to know ladder parent for hierarchy)
GearDir m_alignment
GearDir pointing to the alignment parameters.
GeoVXDCreator(const std::string &prefix)
Constructor of the GeoVXDCreator class.
Base class for Sensitive Detector implementation of PXD and SVD.
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:28
Abstract base class for different kinds of events.