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>
22using namespace Belle2::bklm;
30 m_PhiPositionBase(0.0),
37 m_GlobalOrigin(CLHEP::Hep3Vector()),
38 m_LocalReconstructionShift(CLHEP::Hep3Vector()),
39 m_Rotation(CLHEP::HepRotation()),
40 m_Alignment(HepGeom::Transform3D()),
41 m_AlignmentRotation(CLHEP::HepRotation()),
42 m_AlignmentTranslation(CLHEP::Hep3Vector()),
43 m_AlignmentInverse(HepGeom::Transform3D()),
44 m_AlignmentRotationInverse(CLHEP::HepRotation()),
45 m_DisplacedGeo(HepGeom::Transform3D()),
46 m_DisplacedGeoRotation(CLHEP::HepRotation()),
47 m_DisplacedGeoTranslation(CLHEP::Hep3Vector()),
48 m_DisplacedGeoInverse(HepGeom::Transform3D()),
49 m_DisplacedGeoRotationInverse(CLHEP::HepRotation())
66 const CLHEP::Hep3Vector& globalOrigin,
67 const CLHEP::Hep3Vector& localReconstructionShift,
68 const CLHEP::HepRotation& rotation) :
71 m_PhiStripWidth(phiStripWidth),
72 m_PhiStripMin(phiStripMin),
73 m_PhiStripMax(phiStripMax),
74 m_PhiPositionBase(0.5 * (phiStripMin + phiStripMax - 1) + 1.0),
75 m_ZStripWidth(zStripWidth),
77 m_ZStripMax(zStripNumber),
80 m_SignalSpeed(0.5 *
Const::speedOfLight),
81 m_GlobalOrigin(globalOrigin),
82 m_LocalReconstructionShift(localReconstructionShift),
84 m_Alignment(HepGeom::Transform3D()),
85 m_AlignmentRotation(CLHEP::HepRotation()),
86 m_AlignmentTranslation(CLHEP::Hep3Vector()),
87 m_AlignmentInverse(HepGeom::Transform3D()),
88 m_AlignmentRotationInverse(CLHEP::HepRotation()),
89 m_DisplacedGeo(HepGeom::Transform3D()),
90 m_DisplacedGeoRotation(CLHEP::HepRotation()),
91 m_DisplacedGeoTranslation(CLHEP::Hep3Vector()),
92 m_DisplacedGeoInverse(HepGeom::Transform3D()),
93 m_DisplacedGeoRotationInverse(CLHEP::HepRotation())
109 const CLHEP::Hep3Vector& globalOrigin,
110 const CLHEP::Hep3Vector& localReconstructionShift,
111 const CLHEP::HepRotation& rotation,
114 m_IsFlipped(isFlipped),
115 m_PhiStripWidth(stripWidth),
117 m_PhiStripMax(phiStripNumber),
118 m_PhiPositionBase(0.5 * phiStripNumber + 1.0),
119 m_ZStripWidth(stripWidth),
121 m_ZStripMax(zStripNumber),
122 m_ZPositionBase(1.0),
123 m_PhiSensorSide(phiSensorSide),
124 m_SignalSpeed(0.5671 *
Const::speedOfLight),
125 m_GlobalOrigin(globalOrigin),
126 m_LocalReconstructionShift(localReconstructionShift),
127 m_Rotation(rotation),
128 m_Alignment(HepGeom::Transform3D()),
129 m_AlignmentRotation(CLHEP::HepRotation()),
130 m_AlignmentTranslation(CLHEP::Hep3Vector()),
131 m_AlignmentInverse(HepGeom::Transform3D()),
132 m_AlignmentRotationInverse(CLHEP::HepRotation()),
133 m_DisplacedGeo(HepGeom::Transform3D()),
134 m_DisplacedGeoRotation(CLHEP::HepRotation()),
135 m_DisplacedGeoTranslation(CLHEP::Hep3Vector()),
136 m_DisplacedGeoInverse(HepGeom::Transform3D()),
137 m_DisplacedGeoRotationInverse(CLHEP::HepRotation())
152 m_HasRPCs(m.m_HasRPCs),
153 m_IsFlipped(m.m_IsFlipped),
154 m_PhiStripWidth(m.m_PhiStripWidth),
155 m_PhiStripMin(m.m_PhiStripMin),
156 m_PhiStripMax(m.m_PhiStripMax),
157 m_PhiPositionBase(m.m_PhiPositionBase),
158 m_ZStripWidth(m.m_ZStripWidth),
159 m_ZStripMin(m.m_ZStripMin),
160 m_ZStripMax(m.m_ZStripMax),
161 m_ZPositionBase(m.m_ZPositionBase),
162 m_PhiSensorSide(m.m_PhiSensorSide),
163 m_SignalSpeed(m.m_SignalSpeed),
164 m_GlobalOrigin(m.m_GlobalOrigin),
165 m_LocalReconstructionShift(m.m_LocalReconstructionShift),
166 m_Rotation(m.m_Rotation),
167 m_RotationInverse(m.m_RotationInverse),
168 m_Alignment(m.m_Alignment),
169 m_AlignmentRotation(m.m_AlignmentRotation),
170 m_AlignmentTranslation(m.m_AlignmentTranslation),
171 m_AlignmentInverse(m.m_AlignmentInverse),
172 m_AlignmentRotationInverse(m.m_AlignmentRotationInverse),
173 m_DisplacedGeo(m.m_DisplacedGeo),
174 m_DisplacedGeoRotation(m.m_DisplacedGeoRotation),
175 m_DisplacedGeoTranslation(m.m_DisplacedGeoTranslation),
176 m_DisplacedGeoInverse(m.m_DisplacedGeoInverse),
177 m_DisplacedGeoRotationInverse(m.m_DisplacedGeoRotationInverse),
178 m_PhiScintLengths(m.m_PhiScintLengths),
179 m_PhiScintPositions(m.m_PhiScintPositions),
180 m_PhiScintOffsets(m.m_PhiScintOffsets),
181 m_ZScintLengths(m.m_ZScintLengths),
182 m_ZScintPositions(m.m_ZScintPositions),
183 m_ZScintOffsets(m.m_ZScintOffsets)
262 B2FATAL(
"Incorrect plane number.");
268 return CLHEP::Hep3Vector(0.0,
274 int strip,
bool phiReadout)
const
294 return CLHEP::Hep3Vector(0.0, dz, dy);
298 const CLHEP::Hep3Vector& local,
int stripZ,
int stripPhi)
const
302 return CLHEP::Hep3Vector(0.0, distancePhi, distanceZ);
312 bool phiReadout)
const
319 const CLHEP::Hep3Vector& local,
int stripZ,
int stripPhi)
const
328 CLHEP::Hep3Vector vlocal(v.x(), v.y(), v.z());
385 HepGeom::Scale3D scale;
386 HepGeom::Rotate3D rotation;
387 HepGeom::Translate3D translation;
388 trans.getDecomposition(scale, rotation, translation);
389 CLHEP::Hep3Vector t(translation.dx(), translation.dy(), translation.dz());
395 HepGeom::Scale3D scale;
396 HepGeom::Rotate3D rotation;
397 HepGeom::Translate3D translation;
398 trans.getDecomposition(scale, rotation, translation);
399 CLHEP::HepRep3x3 rRep(rotation.xx(), rotation.xy(), rotation.xz(),
400 rotation.yx(), rotation.yy(), rotation.yz(),
401 rotation.zx(), rotation.zy(), rotation.zz()
403 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.