10 #include <klm/bklm/geometry/Module.h>
13 #include <klm/dataobjects/bklm/BKLMElementNumbers.h>
16 #include <framework/gearbox/Const.h>
17 #include <framework/logging/Logger.h>
23 using namespace Belle2::bklm;
31 m_PhiPositionBase(0.0),
38 m_GlobalOrigin(CLHEP::Hep3Vector()),
39 m_LocalReconstructionShift(CLHEP::Hep3Vector()),
40 m_Rotation(CLHEP::HepRotation()),
41 m_Alignment(HepGeom::Transform3D()),
42 m_AlignmentRotation(CLHEP::HepRotation()),
43 m_AlignmentTranslation(CLHEP::Hep3Vector()),
44 m_AlignmentInverse(HepGeom::Transform3D()),
45 m_AlignmentRotationInverse(CLHEP::HepRotation()),
46 m_DisplacedGeo(HepGeom::Transform3D()),
47 m_DisplacedGeoRotation(CLHEP::HepRotation()),
48 m_DisplacedGeoTranslation(CLHEP::Hep3Vector()),
49 m_DisplacedGeoInverse(HepGeom::Transform3D()),
50 m_DisplacedGeoRotationInverse(CLHEP::HepRotation())
67 const CLHEP::Hep3Vector& globalOrigin,
68 const CLHEP::Hep3Vector& localReconstructionShift,
69 const CLHEP::HepRotation& rotation) :
72 m_PhiStripWidth(phiStripWidth),
73 m_PhiStripMin(phiStripMin),
74 m_PhiStripMax(phiStripMax),
75 m_PhiPositionBase(0.5 * (phiStripMin + phiStripMax - 1) + 1.0),
76 m_ZStripWidth(zStripWidth),
78 m_ZStripMax(zStripNumber),
81 m_SignalSpeed(0.5 *
Const::speedOfLight),
82 m_GlobalOrigin(globalOrigin),
83 m_LocalReconstructionShift(localReconstructionShift),
85 m_Alignment(HepGeom::Transform3D()),
86 m_AlignmentRotation(CLHEP::HepRotation()),
87 m_AlignmentTranslation(CLHEP::Hep3Vector()),
88 m_AlignmentInverse(HepGeom::Transform3D()),
89 m_AlignmentRotationInverse(CLHEP::HepRotation()),
90 m_DisplacedGeo(HepGeom::Transform3D()),
91 m_DisplacedGeoRotation(CLHEP::HepRotation()),
92 m_DisplacedGeoTranslation(CLHEP::Hep3Vector()),
93 m_DisplacedGeoInverse(HepGeom::Transform3D()),
94 m_DisplacedGeoRotationInverse(CLHEP::HepRotation())
110 const CLHEP::Hep3Vector& globalOrigin,
111 const CLHEP::Hep3Vector& localReconstructionShift,
112 const CLHEP::HepRotation& rotation,
115 m_IsFlipped(isFlipped),
116 m_PhiStripWidth(stripWidth),
118 m_PhiStripMax(phiStripNumber),
119 m_PhiPositionBase(0.5 * phiStripNumber + 1.0),
120 m_ZStripWidth(stripWidth),
122 m_ZStripMax(zStripNumber),
123 m_ZPositionBase(1.0),
124 m_PhiSensorSide(phiSensorSide),
125 m_SignalSpeed(0.5671 *
Const::speedOfLight),
126 m_GlobalOrigin(globalOrigin),
127 m_LocalReconstructionShift(localReconstructionShift),
128 m_Rotation(rotation),
129 m_Alignment(HepGeom::Transform3D()),
130 m_AlignmentRotation(CLHEP::HepRotation()),
131 m_AlignmentTranslation(CLHEP::Hep3Vector()),
132 m_AlignmentInverse(HepGeom::Transform3D()),
133 m_AlignmentRotationInverse(CLHEP::HepRotation()),
134 m_DisplacedGeo(HepGeom::Transform3D()),
135 m_DisplacedGeoRotation(CLHEP::HepRotation()),
136 m_DisplacedGeoTranslation(CLHEP::Hep3Vector()),
137 m_DisplacedGeoInverse(HepGeom::Transform3D()),
138 m_DisplacedGeoRotationInverse(CLHEP::HepRotation())
153 m_HasRPCs(m.m_HasRPCs),
154 m_IsFlipped(m.m_IsFlipped),
155 m_PhiStripWidth(m.m_PhiStripWidth),
156 m_PhiStripMin(m.m_PhiStripMin),
157 m_PhiStripMax(m.m_PhiStripMax),
158 m_PhiPositionBase(m.m_PhiPositionBase),
159 m_ZStripWidth(m.m_ZStripWidth),
160 m_ZStripMin(m.m_ZStripMin),
161 m_ZStripMax(m.m_ZStripMax),
162 m_ZPositionBase(m.m_ZPositionBase),
163 m_PhiSensorSide(m.m_PhiSensorSide),
164 m_SignalSpeed(m.m_SignalSpeed),
165 m_GlobalOrigin(m.m_GlobalOrigin),
166 m_LocalReconstructionShift(m.m_LocalReconstructionShift),
167 m_Rotation(m.m_Rotation),
168 m_RotationInverse(m.m_RotationInverse),
169 m_Alignment(m.m_Alignment),
170 m_AlignmentRotation(m.m_AlignmentRotation),
171 m_AlignmentTranslation(m.m_AlignmentTranslation),
172 m_AlignmentInverse(m.m_AlignmentInverse),
173 m_AlignmentRotationInverse(m.m_AlignmentRotationInverse),
174 m_DisplacedGeo(m.m_DisplacedGeo),
175 m_DisplacedGeoRotation(m.m_DisplacedGeoRotation),
176 m_DisplacedGeoTranslation(m.m_DisplacedGeoTranslation),
177 m_DisplacedGeoInverse(m.m_DisplacedGeoInverse),
178 m_DisplacedGeoRotationInverse(m.m_DisplacedGeoRotationInverse),
179 m_PhiScintLengths(m.m_PhiScintLengths),
180 m_PhiScintPositions(m.m_PhiScintPositions),
181 m_PhiScintOffsets(m.m_PhiScintOffsets),
182 m_ZScintLengths(m.m_ZScintLengths),
183 m_ZScintPositions(m.m_ZScintPositions),
184 m_ZScintOffsets(m.m_ZScintOffsets)
263 B2FATAL(
"Incorrect plane number.");
269 return CLHEP::Hep3Vector(0.0,
275 int strip,
bool phiReadout)
const
295 return CLHEP::Hep3Vector(0.0, dz, dy);
299 const CLHEP::Hep3Vector& local,
int stripZ,
int stripPhi)
const
303 return CLHEP::Hep3Vector(0.0, distancePhi, distanceZ);
313 bool phiReadout)
const
320 const CLHEP::Hep3Vector& local,
int stripZ,
int stripPhi)
const
329 CLHEP::Hep3Vector vlocal(v.x(), v.y(), v.z());
386 HepGeom::Scale3D scale;
387 HepGeom::Rotate3D rotation;
388 HepGeom::Translate3D translation;
389 trans.getDecomposition(scale, rotation, translation);
390 CLHEP::Hep3Vector t(translation.dx(), translation.dy(), translation.dz());
396 HepGeom::Scale3D scale;
397 HepGeom::Rotate3D rotation;
398 HepGeom::Translate3D translation;
399 trans.getDecomposition(scale, rotation, translation);
400 CLHEP::HepRep3x3 rRep(rotation.xx(), rotation.xy(), rotation.xz(),
401 rotation.yx(), rotation.yy(), rotation.yz(),
402 rotation.zx(), rotation.zy(), rotation.zz()
404 CLHEP::HepRotation r;
This class provides a set of constants for the framework.
Define the geometry of a BKLM module Each sector [octant] contains Modules.
const CLHEP::Hep3Vector globalToLocal(const CLHEP::Hep3Vector &v, bool reco=false) const
Transform space-point within this module from global to local coordinates.
std::vector< double > m_ZScintPositions
to store the transverse position (within scintillator envelope) of each z-measuring scintillator
const CLHEP::HepRotation getRotationFromTransform3D(const HepGeom::Transform3D &trans) const
Get the rotation from Transform3D.
CLHEP::HepRotation m_DisplacedGeoRotationInverse
inverse of the rotation of displaced geometry transformation
CLHEP::HepRotation m_RotationInverse
to store the inverse of the rotation matrix (in global coordinates) of this module's sector
CLHEP::Hep3Vector m_AlignmentTranslation
translation of the alignment transformation
int m_PhiStripMin
to store the minimum phi strip number in this module
CLHEP::Hep3Vector m_DisplacedGeoTranslation
translation of the displaced geometry transformation
double m_ZPositionBase
to store the base position (in strip
double m_PhiStripWidth
to store the width (in cm) of each phi strip this module
std::vector< double > m_ZScintLengths
to store the length of each z-measuring scintillator
HepGeom::Transform3D m_DisplacedGeo
displaced geometry w.r.t the nominal geometry, as transformation (rotation + shift)
bool m_IsFlipped
flag to indicate if this module is flipped by 180 degrees about z axis within its air gap
int getZStripNumber(const CLHEP::Hep3Vector &p) const
Get z strip corresponding to local z coordinate.
CLHEP::HepRotation m_AlignmentRotationInverse
inverse of the rotation of the alignment transformation
Module(void)
Empty constructor does nothing.
HepGeom::Transform3D m_Alignment
alignment transformation (rotation + shift)
const CLHEP::Hep3Vector getPropagationTimes(const CLHEP::Hep3Vector &) const
Convert local coordinates to signal-propagation time (ns) Version for RPCs.
const CLHEP::Hep3Vector getTranslationFromTransform3D(const HepGeom::Transform3D &trans) const
Get the translation from Transform3D.
HepGeom::Transform3D m_AlignmentInverse
inverse of alignment transformation
double getZStrip(const CLHEP::Hep3Vector &p) const
Return z strip (including fractional part) corresponding to local z coordinate.
HepGeom::Transform3D m_DisplacedGeoInverse
inverse of displaced geometry transformation
const CLHEP::Hep3Vector getPropagationDistance(const CLHEP::Hep3Vector &) const
Convert local coordinates to signal-propagation distance (cm).
std::vector< double > m_ZScintOffsets
to store the longitudinal offset (within scintillator envelope) of each z-measuring scintillator
double m_ZStripWidth
to store the width (in cm) of each z strip in this module
int m_PhiSensorSide
to store the sensor side for phi scintillators
std::vector< double > m_PhiScintPositions
to store the transverse position (within scintillator envelope) of each phi-measuring scintillator
int m_PhiStripMax
to store the maximum phi strip number in this module
std::vector< double > m_PhiScintLengths
to store the length of each phi-measuring scintillator
double getPropagationTime(const CLHEP::Hep3Vector &local, int strip, bool phiReadout) const
Convert local coordinates to signal-propagation time (ns) Version for scintillators.
const CLHEP::Hep3Vector localToGlobal(const CLHEP::Hep3Vector &v, bool reco=false) const
Transform space-point within this module from local to global coordinates.
CLHEP::HepRotation m_Rotation
to store the rotation matrix (in global coordinates) of this module's sector
int m_ZStripMin
to store the minimum z strip number in this module
void addZScint(int scint, double length, double offset, double position)
Add one z-measuring scintillator strip to the module.
double m_PhiPositionBase
to store the base position (in strip
CLHEP::HepRotation m_DisplacedGeoRotation
rotation of the displaced geometry transformation
double m_SignalSpeed
to store the signal-propagation speed (cm/ns) along the strip
double getPhiStrip(const CLHEP::Hep3Vector &p) const
Return phi strip (including fractional part) corresponding to local phi coordinate.
CLHEP::Hep3Vector m_LocalReconstructionShift
to store the local-coordinate real-vs-ideal translation of this module's sensitive volume
int m_ZStripMax
to store the maximum z strip number in this module
const CLHEP::Hep3Vector getLocalPosition(double phiStripAve, double zStripAve) const
Convert 2D strip position (0..nStrips along each axis) to local coordinates.
double getStripLength(int plane, int strip) const
Get scintillator length.
CLHEP::Hep3Vector m_GlobalOrigin
to store the position (in global coordinates) of this module's sensitive-volume origin
void setDisplacedGeo(const HepGeom::Transform3D &moduleDisplacedGeo)
Set the displaced geometry Transformation.
Module & operator=(const Module &m)
Assignment operator: utilizes copy constructor.
void addPhiScint(int scint, double length, double offset, double position)
Add one phi-measuring scintillator strip to the module.
CLHEP::HepRotation m_AlignmentRotation
rotation of the alignment transformation
bool m_HasRPCs
flag to indicate whether this module contains RPCs (true) or scintillators (false)
int getPhiStripNumber(const CLHEP::Hep3Vector &p) const
Get phi strip corresponding to local phi coordinate.
std::vector< double > m_PhiScintOffsets
to store the longitudinal offset (within scintillator envelope) of each phi-measuring scintillator
bool isFlipped() const
Determine if this module is flipped by 180 degrees about z axis within its air gap.
void setAlignment(const HepGeom::Transform3D &moduleAlignment)
Set the alignment Transformation.