Belle II Software  release-05-01-25
GeoVXDCreator.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2014 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Andreas Moll, Christian Oswald, Zbynek Drasal, *
7  * Martin Ritter, Jozef Koval, Benjamin Schwenker *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #ifndef GEOVXDCREATOR_H
13 #define GEOVXDCREATOR_H
14 
15 #include <vxd/geometry/GeoVXDComponents.h>
16 #include <vxd/geometry/GeoVXDAssembly.h>
17 #include <vxd/geometry/SensorInfoBase.h>
18 #include <vxd/geometry/GeoVXDRadiationSensors.h>
19 #include <vxd/simulation/SensitiveDetectorBase.h>
20 #include <geometry/CreatorBase.h>
21 #include <framework/gearbox/GearDir.h>
22 #include <framework/logging/Logger.h>
23 #include <string>
24 #include <vector>
25 #include <map>
26 
27 
28 #include <framework/database/DBObjPtr.h>
29 #include <framework/database/DBImportObjPtr.h>
30 #include <framework/database/IntervalOfValidity.h>
31 #include <vxd/dbobjects/VXDGeometryPar.h>
32 
33 
34 #include <G4Transform3D.hh>
35 #include <G4Polycone.hh>
36 class G4LogicalVolume;
37 class G4AssemblyVolume;
38 class G4VSolid;
39 class G4Material;
40 class G4UserLimits;
41 
42 namespace Belle2 {
48  namespace VXD {
49 
52 
53  public:
55  explicit GeoVXDCreator(const std::string& prefix);
56 
58  virtual ~GeoVXDCreator();
59 
64  virtual SensorInfoBase* createSensorInfo(const VXDGeoSensorPar& sensor) = 0;
65 
71  virtual SensitiveDetectorBase* createSensitiveDetector(VxdID sensorID, const VXDGeoSensor& sensor,
72  const VXDGeoSensorPlacement& placement) = 0;
73 
77  virtual void setCurrentLayer(int layer, const VXDGeometryPar& parameters);
78 
83  G4Transform3D placeLadder(int ladderID, double phi, G4LogicalVolume* volume, const G4Transform3D& placement,
84  const VXDGeometryPar& parameters);
85 
92  G4Transform3D getPosition(const VXDGeoComponent& mother, const VXDGeoComponent& daughter, const VXDGeoPlacement& placement,
93  bool originCenter);
94 
100  G4Transform3D getAlignment(const VXDAlignmentPar& params);
101 
121  GeoVXDAssembly createSubComponents(const std::string& name, VXDGeoComponent&
122  component, std::vector<VXDGeoPlacement> placements,
123  bool originCenter = true, bool allowOutside = false);
124 
138  G4VSolid* createTrapezoidal(const std::string& name, double width, double
139  width2, double length, double& height, double angle = 0);
140 
142  void createDiamonds(const VXDGeoRadiationSensorsPar& params, G4LogicalVolume& topVolume, G4LogicalVolume& envelopeVolume);
143 
147  std::vector<VXDGeoPlacementPar> getSubComponents(const GearDir& path);
148 
153  virtual void readLadder(int layer, GearDir components, VXDGeometryPar& geoparameters);
154 
159  virtual void readLadderComponents(int layerID, int ladderID, GearDir content, VXDGeometryPar& vxdGeometryPar);
160 
167  void readComponent(const std::string& name, GearDir components, VXDGeometryPar& vxdGeometryPar);
168 
175  void readSubComponents(const std::vector<VXDGeoPlacementPar>& placements, const GearDir& componentsDir,
176  VXDGeometryPar& vxdGeometryPar);
177 
178  protected:
180  std::string m_prefix;
185 
187  std::map<std::string, VXDGeoComponent> m_componentCache;
189  std::map<std::string, VXDGeoSensor> m_sensorMap;
193  std::vector<Simulation::SensitiveDetectorBase*> m_sensitive;
196 
198  std::string m_defaultMaterial;
200  float m_distanceTolerance {(float)(5 * Unit::um)};
202  float m_electronTolerance {100};
204  float m_minimumElectrons {10};
208  bool m_activeChips {false};
210  bool m_seeNeutrons {false};
212  bool m_onlyPrimaryTrueHits {false};
215  bool m_onlyActiveMaterial {false};
217  std::vector<G4UserLimits*> m_UserLimits;
219  std::string m_currentHalfShell {""};
221  std::map<std::string, Belle2::VxdID> m_halfShellVxdIDs {
222  {{"PXD.Ying"}, {Belle2::VxdID(1, 0, 0, 1)}},
223  {{"PXD.Yang"}, {Belle2::VxdID(1, 0, 0, 2)}},
224  {{"SVD.Pat"}, {Belle2::VxdID(3, 0, 0, 1)}},
225  {{"SVD.Mat"}, {Belle2::VxdID(3, 0, 0, 2)}}
226  };
227 
228  }; // class GeoVXDCreator
229 
230  } // namespace VXD
232 } //namespace Belle2
233 
234 #endif /* GEOVXDCREATOR_H */
Belle2::VXD::GeoVXDCreator::getAlignment
G4Transform3D getAlignment(const VXDAlignmentPar &params)
Get Alignment from paylead object.
Definition: GeoVXDCreator.cc:174
Belle2::VXDGeometryPar
The Class for VXD geometry.
Definition: VXDGeometryPar.h:46
Belle2::VXDGeoSensorPlacement
Struct holding the information where a sensor should be placed inside the ladder.
Definition: GeoVXDComponents.h:154
Belle2::VXD::GeoVXDCreator::getPosition
G4Transform3D getPosition(const VXDGeoComponent &mother, const VXDGeoComponent &daughter, const VXDGeoPlacement &placement, bool originCenter)
Return the position where a daughter component is to be placed.
Definition: GeoVXDCreator.cc:181
Belle2::VXD::GeoVXDCreator::placeLadder
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 ...
Definition: GeoVXDCreator.cc:282
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::VXDAlignmentPar
The Class for VXD Alignment payload.
Definition: VXDAlignmentPar.h:33
Belle2::VXD::GeoVXDCreator::createSubComponents
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.
Definition: GeoVXDCreator.cc:76
Belle2::VXD::GeoVXDCreator::getSubComponents
std::vector< VXDGeoPlacementPar > getSubComponents(const GearDir &path)
Return vector of VXDGeoPlacements with all the components defined inside a given path.
Definition: GeoVXDCreator.cc:607
Belle2::VXDGeoPlacement
Class holding all parameters to place a VXD geometry subcomponent.
Definition: GeoVXDComponents.h:28
Belle2::VXD::GeoVXDCreator::createSensorInfo
virtual SensorInfoBase * createSensorInfo(const VXDGeoSensorPar &sensor)=0
Read the sensor definitions from the database.
Belle2::VXD::GeoVXDCreator::readComponent
void readComponent(const std::string &name, GearDir components, VXDGeometryPar &vxdGeometryPar)
Read parameters for component name from Gearbox into geometry payload.
Definition: GeoVXDCreator.cc:534
Belle2::VXDGeoSensorPar
The Class for VXD Sensor payload.
Definition: VXDGeoSensorPar.h:39
Belle2::VXD::SensitiveDetectorBase
Base class for Sensitive Detector implementation of PXD and SVD.
Definition: SensitiveDetectorBase.h:47
Belle2::VXD::SensorInfoBase
Base class to provide Sensor Information for PXD and SVD.
Definition: SensorInfoBase.h:40
Belle2::VXD::GeoVXDCreator::m_componentCache
std::map< std::string, VXDGeoComponent > m_componentCache
Cache of all previously created components.
Definition: GeoVXDCreator.h:187
Belle2::VXD::GeoVXDCreator::m_onlyActiveMaterial
bool m_onlyActiveMaterial
If this is true, only active Materials will be placed for tracking studies.
Definition: GeoVXDCreator.h:215
Belle2::VXD::GeoVXDCreator::m_sensorMap
std::map< std::string, VXDGeoSensor > m_sensorMap
Map containing Information about all defined sensor types.
Definition: GeoVXDCreator.h:189
Belle2::VXD::GeoVXDCreator::createDiamonds
void createDiamonds(const VXDGeoRadiationSensorsPar &params, G4LogicalVolume &topVolume, G4LogicalVolume &envelopeVolume)
Create diamond radiation sensors.
Definition: GeoVXDCreator.cc:211
Belle2::VXD::GeoVXDAssembly
Class to group some Geant4 volumes and place them all at once with a given transformation matrix.
Definition: GeoVXDAssembly.h:31
Belle2::VXD::GeoVXDCreator::GeoVXDCreator
GeoVXDCreator(const std::string &prefix)
Constructor of the GeoVXDCreator class.
Definition: GeoVXDCreator.cc:56
Belle2::VXDGeoRadiationSensorsPar
The Class for VXD Radiation Sensor parameters.
Definition: VXDGeoRadiationSensorsPar.h:77
Belle2::VXD::GeoVXDCreator::m_minimumElectrons
float m_minimumElectrons
minimum number of electrons to be deposited by a particle to be saved
Definition: GeoVXDCreator.h:204
Belle2::VXD::GeoVXDCreator::m_ladder
VXDGeoLadder m_ladder
Parameters of the currently active ladder.
Definition: GeoVXDCreator.h:191
Belle2::VXD::GeoVXDCreator::m_sensitive
std::vector< Simulation::SensitiveDetectorBase * > m_sensitive
List to all created sensitive detector instances.
Definition: GeoVXDCreator.h:193
Belle2::VXD::GeoVXDCreator::m_electronTolerance
float m_electronTolerance
tolerance for the energy deposition in electrons to be merged in a single step
Definition: GeoVXDCreator.h:202
Belle2::VXD::GeoVXDCreator::readLadder
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.
Definition: GeoVXDCreator.cc:576
Belle2::VXD::GeoVXDCreator::m_onlyPrimaryTrueHits
bool m_onlyPrimaryTrueHits
If true only create TrueHits from primary particles and ignore secondaries.
Definition: GeoVXDCreator.h:212
Belle2::VXD::GeoVXDCreator::m_seeNeutrons
bool m_seeNeutrons
Make sensitive detectors also see neutrons.
Definition: GeoVXDCreator.h:210
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VXD::GeoVXDCreator::createSensitiveDetector
virtual SensitiveDetectorBase * createSensitiveDetector(VxdID sensorID, const VXDGeoSensor &sensor, const VXDGeoSensorPlacement &placement)=0
Return a SensitiveDetector implementation for a given sensor.
Belle2::GearDir
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:41
Belle2::VXD::GeoVXDCreator::m_distanceTolerance
float m_distanceTolerance
tolerance for Geant4 steps to be merged to a single step
Definition: GeoVXDCreator.h:200
Belle2::VXD::GeoVXDCreator::m_defaultMaterial
std::string m_defaultMaterial
Name of the Material to be used for Air.
Definition: GeoVXDCreator.h:198
Belle2::VXDGeoLadder
Struct containing all parameters of one ladder.
Definition: GeoVXDComponents.h:188
Belle2::VXD::GeoVXDCreator::m_prefix
std::string m_prefix
Prefix to prepend to all volume names.
Definition: GeoVXDCreator.h:180
Belle2::VXD::GeoVXDCreator::m_activeStepSize
double m_activeStepSize
Stepsize to be used inside active volumes.
Definition: GeoVXDCreator.h:206
Belle2::VXDGeoSensor
Struct holding all parameters for a completeVXD Sensor.
Definition: GeoVXDComponents.h:112
Belle2::VXD::GeoVXDCreator::m_components
GearDir m_components
GearDir pointing to the toplevel of the components.
Definition: GeoVXDCreator.h:184
Belle2::VXD::GeoVXDCreator::m_UserLimits
std::vector< G4UserLimits * > m_UserLimits
Vector of G4UserLimit pointers.
Definition: GeoVXDCreator.h:217
Belle2::geometry::CreatorBase
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:31
Belle2::VXD::GeoVXDCreator::createTrapezoidal
G4VSolid * createTrapezoidal(const std::string &name, double width, double width2, double length, double &height, double angle=0)
Create a trapezoidal solid.
Definition: GeoVXDCreator.cc:256
Belle2::VXD::GeoVXDCreator::m_activeChips
bool m_activeChips
Make also chips sensitive.
Definition: GeoVXDCreator.h:208
Belle2::VXD::GeoVXDCreator::setCurrentLayer
virtual void setCurrentLayer(int layer, const VXDGeometryPar &parameters)
Read parameters for given layer and store in m_ladder.
Definition: GeoVXDCreator.cc:443
Belle2::VXD::GeoVXDCreator::m_halfShellVxdIDs
std::map< std::string, Belle2::VxdID > m_halfShellVxdIDs
Used for translation of half-shell name into a VxdID to consitently handle it in hierarchy.
Definition: GeoVXDCreator.h:221
Belle2::VXD::GeoVXDCreator::~GeoVXDCreator
virtual ~GeoVXDCreator()
The destructor of the GeoVXDCreator class.
Definition: GeoVXDCreator.cc:61
Belle2::VXD::GeoVXDCreator::readSubComponents
void readSubComponents(const std::vector< VXDGeoPlacementPar > &placements, const GearDir &componentsDir, VXDGeometryPar &vxdGeometryPar)
Read parameters for all components in placement container from Gearbox into payload.
Definition: GeoVXDCreator.cc:525
Belle2::VXD::GeoVXDCreator::m_radiationsensors
GeoVXDRadiationSensors m_radiationsensors
Diamond radiation sensor "sub creator".
Definition: GeoVXDCreator.h:195
Belle2::VXD::GeoVXDCreator
The creator for the VXD geometry of the Belle II detector.
Definition: GeoVXDCreator.h:51
Belle2::VXDGeoComponent
Class holding all parameters for an VXD geometry component.
Definition: GeoVXDComponents.h:65
Belle2::VXD::GeoVXDCreator::m_currentHalfShell
std::string m_currentHalfShell
Current half-shell being processed (need to know ladder parent for hierarchy)
Definition: GeoVXDCreator.h:219
Belle2::VXD::GeoVXDCreator::readLadderComponents
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.
Definition: GeoVXDCreator.cc:472
Belle2::GeoVXDRadiationSensors
class to create the diamond radiation sensor geometry if defined
Definition: GeoVXDRadiationSensors.h:28
Belle2::Unit::um
static const double um
[micrometers]
Definition: Unit.h:81
Belle2::VXD::GeoVXDCreator::m_alignment
GearDir m_alignment
GearDir pointing to the alignment parameters.
Definition: GeoVXDCreator.h:182