Belle II Software  release-05-02-19
Module.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Leo Piilonen *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 /* CLHEP headers. */
14 #include <CLHEP/Geometry/Transform3D.h>
15 #include <CLHEP/Vector/Rotation.h>
16 #include <CLHEP/Vector/ThreeVector.h>
17 
18 /* C++ headers. */
19 #include <vector>
20 
21 namespace Belle2 {
27  namespace bklm {
28 
78  class Module {
79 
80  public:
81 
83  Module(void);
84 
86  Module(double phiStripWidth,
87  int phiStripMin,
88  int phiStripMax,
89  double zStripWidth,
90  int zStripNumber,
91  const CLHEP::Hep3Vector& globalOrigin,
92  const CLHEP::Hep3Vector& localReconstructionShift,
93  const CLHEP::HepRotation& rotation);
94 
96  Module(double stripWidth,
97  int phiStripNumber,
98  int phiSensorSide,
99  int zStripNumber,
100  const CLHEP::Hep3Vector& globalOrigin,
101  const CLHEP::Hep3Vector& localReconstructionShift,
102  const CLHEP::HepRotation& rotation,
103  bool isFlipped);
104 
106  Module(const Module& m);
107 
109  Module& operator=(const Module& m);
110 
112  ~Module();
113 
115  bool isFlipped() const
116  {
117  return m_IsFlipped;
118  }
119 
121  bool hasRPCs() const
122  {
123  return m_HasRPCs;
124  }
125 
127  int getPhiStripMin() const
128  {
130  }
131 
133  int getPhiStripMax() const
134  {
136  }
137 
139  double getPhiStripWidth() const
140  {
142  }
143 
145  int getZStripMin() const
146  {
147  return m_ZStripMin;
148  }
149 
151  int getZStripMax() const
152  {
153  return m_ZStripMax;
154  }
155 
157  double getZStripWidth() const
158  {
160  }
161 
163  void addPhiScint(int scint, double length, double offset, double position);
164 
166  void addZScint(int scint, double length, double offset, double position);
167 
169  double getPhiScintHalfLength(int scint) const
170  {
171  return 0.5 * m_PhiScintLengths[scint];
172  }
173 
175  double getPhiScintOffset(int scint) const
176  {
177  return m_PhiScintOffsets[scint];
178  }
179 
181  double getPhiScintPosition(int scint) const
182  {
183  return m_PhiScintPositions[scint];
184  }
185 
187  double getZScintHalfLength(int scint) const
188  {
189  return 0.5 * m_ZScintLengths[scint];
190  }
191 
193  double getZScintOffset(int scint) const
194  {
195  return m_ZScintOffsets[scint];
196  }
197 
199  double getZScintPosition(int scint) const
200  {
201  return m_ZScintPositions[scint];
202  }
203 
205  const CLHEP::Hep3Vector getLocalPosition(double phiStripAve, double zStripAve) const;
206 
209  const CLHEP::Hep3Vector getPropagationDistance(const CLHEP::Hep3Vector&) const;
210 
213  double getPropagationDistance(const CLHEP::Hep3Vector& local,
214  int strip, bool phiReadout) const;
215 
218  const CLHEP::Hep3Vector getPropagationTimes(const CLHEP::Hep3Vector&) const;
219 
222  double getPropagationTime(const CLHEP::Hep3Vector& local,
223  int strip, bool phiReadout) const;
224 
227  const CLHEP::Hep3Vector getPropagationTimes(
228  const CLHEP::Hep3Vector&, int stripZ, int stripPhi) const;
229 
231  double getPhiStrip(const CLHEP::Hep3Vector& p) const
232  {
233  return p.y() / m_PhiStripWidth + m_PhiPositionBase;
234  }
235 
237  double getZStrip(const CLHEP::Hep3Vector& p) const
238  {
239  return p.z() / m_ZStripWidth + m_ZPositionBase;
240  }
241 
244  int getPhiStripNumber(const CLHEP::Hep3Vector& p) const;
245 
248  int getZStripNumber(const CLHEP::Hep3Vector& p) const;
249 
253  const CLHEP::Hep3Vector localToGlobal(const CLHEP::Hep3Vector& v, bool reco = false) const;
254 
256  const CLHEP::Hep3Vector RotateToLocal(const CLHEP::Hep3Vector& v) const
257  {
258  return m_RotationInverse * v;
259  }
260 
262  const CLHEP::Hep3Vector RotateToGlobal(const CLHEP::Hep3Vector& v) const
263  {
264  return m_Rotation * v;
265  }
266 
270  const CLHEP::Hep3Vector globalToLocal(const CLHEP::Hep3Vector& v, bool reco = false) const;
271 
273  const CLHEP::Hep3Vector getLocalReconstructionShift() const
274  {
276  }
277 
279  const CLHEP::Hep3Vector getGlobalOrigin() const
280  {
282  }
283 
285  void setAlignment(const HepGeom::Transform3D& moduleAlignment);
286 
288  void setDisplacedGeo(const HepGeom::Transform3D& moduleDisplacedGeo);
289 
291  const HepGeom::Transform3D getAlignment() const
292  {
293  return m_Alignment;
294  }
295 
297  const HepGeom::Transform3D getDisplacedGeo() const
298  {
300  }
301 
303  const CLHEP::HepRotation getRotationFromTransform3D(const HepGeom::Transform3D& trans) const;
304 
306  const CLHEP::Hep3Vector getTranslationFromTransform3D(const HepGeom::Transform3D& trans) const;
307 
308  private:
309 
311  bool m_HasRPCs;
312 
314  bool m_IsFlipped;
315 
317  double m_PhiStripWidth;
318 
320  int m_PhiStripMin;
321 
323  int m_PhiStripMax;
324 
326  double m_PhiPositionBase;
327 
329  double m_ZStripWidth;
330 
332  int m_ZStripMin;
333 
335  int m_ZStripMax;
336 
338  double m_ZPositionBase;
339 
341  int m_PhiSensorSide;
342 
344  double m_SignalSpeed;
345 
347  CLHEP::Hep3Vector m_GlobalOrigin;
348 
350  CLHEP::Hep3Vector m_LocalReconstructionShift;
351 
353  CLHEP::HepRotation m_Rotation;
354 
356  CLHEP::HepRotation m_RotationInverse;
357 
359  HepGeom::Transform3D m_Alignment;
360 
362  CLHEP::HepRotation m_AlignmentRotation;
363 
365  CLHEP::Hep3Vector m_AlignmentTranslation;
366 
368  HepGeom::Transform3D m_AlignmentInverse;
369 
371  CLHEP::HepRotation m_AlignmentRotationInverse;
372 
374  HepGeom::Transform3D m_DisplacedGeo;
375 
377  CLHEP::HepRotation m_DisplacedGeoRotation;
378 
380  CLHEP::Hep3Vector m_DisplacedGeoTranslation;
381 
383  HepGeom::Transform3D m_DisplacedGeoInverse;
384 
386  CLHEP::HepRotation m_DisplacedGeoRotationInverse;
387 
389  std::vector<double> m_PhiScintLengths;
390 
392  std::vector<double> m_PhiScintPositions;
393 
395  std::vector<double> m_PhiScintOffsets;
396 
398  std::vector<double> m_ZScintLengths;
399 
401  std::vector<double> m_ZScintPositions;
402 
404  std::vector<double> m_ZScintOffsets;
405 
406  };
407 
408  } // end of namespace bklm
409 
411 } // end of namespace Belle2
Belle2::bklm::Module::m_SignalSpeed
double m_SignalSpeed
to store the signal-propagation speed (cm/ns) along the strip
Definition: Module.h:352
Belle2::bklm::Module::m_PhiStripWidth
double m_PhiStripWidth
to store the width (in cm) of each phi strip this module
Definition: Module.h:325
Belle2::bklm::Module::m_PhiStripMin
int m_PhiStripMin
to store the minimum phi strip number in this module
Definition: Module.h:328
Belle2::bklm::Module::m_DisplacedGeo
HepGeom::Transform3D m_DisplacedGeo
displaced geometry w.r.t the nominal geometry, as transformation (rotation + shift)
Definition: Module.h:382
Belle2::bklm::Module::~Module
~Module()
Destructor.
Definition: Module.cc:225
Belle2::bklm::Module::getAlignment
const HepGeom::Transform3D getAlignment() const
Get the alignment Transformation.
Definition: Module.h:299
Belle2::bklm::Module::getZScintOffset
double getZScintOffset(int scint) const
Get the longitudinal offset (within the scintillator envelope) of a given z-measuring scintillator.
Definition: Module.h:201
Belle2::bklm::Module::addZScint
void addZScint(int scint, double length, double offset, double position)
Add one z-measuring scintillator strip to the module.
Definition: Module.cc:241
Belle2::bklm::Module::getPropagationDistance
const CLHEP::Hep3Vector getPropagationDistance(const CLHEP::Hep3Vector &) const
Convert local coordinates to signal-propagation distance (cm).
Definition: Module.cc:278
Belle2::bklm::Module::getLocalReconstructionShift
const CLHEP::Hep3Vector getLocalReconstructionShift() const
Return the local-coordinate real-vs-ideal translation of this module's sensitive volume; nominally (0...
Definition: Module.h:281
Belle2::bklm::Module::m_PhiPositionBase
double m_PhiPositionBase
to store the base position (in strip
Definition: Module.h:334
Belle2::bklm::Module::m_PhiStripMax
int m_PhiStripMax
to store the maximum phi strip number in this module
Definition: Module.h:331
Belle2::bklm::Module::m_HasRPCs
bool m_HasRPCs
flag to indicate whether this module contains RPCs (true) or scintillators (false)
Definition: Module.h:319
Belle2::bklm::Module::m_ZPositionBase
double m_ZPositionBase
to store the base position (in strip
Definition: Module.h:346
Belle2::bklm::Module::getPhiStripMin
int getPhiStripMin() const
Get module's phi-strip minimum index.
Definition: Module.h:135
Belle2::bklm::Module::getRotationFromTransform3D
const CLHEP::HepRotation getRotationFromTransform3D(const HepGeom::Transform3D &trans) const
Get the rotation from Transform3D.
Definition: Module.cc:374
Belle2::bklm::Module::getDisplacedGeo
const HepGeom::Transform3D getDisplacedGeo() const
Get the displaced geometry Transformation.
Definition: Module.h:305
Belle2::bklm::Module::getZStripMin
int getZStripMin() const
Get module's z-strip minimum index.
Definition: Module.h:153
Belle2::bklm::Module::Module
Module(void)
Empty constructor does nothing.
Definition: Module.cc:23
Belle2::bklm::Module::getPropagationTimes
const CLHEP::Hep3Vector getPropagationTimes(const CLHEP::Hep3Vector &) const
Convert local coordinates to signal-propagation time (ns) Version for RPCs.
Definition: Module.cc:285
Belle2::bklm::Module::addPhiScint
void addPhiScint(int scint, double length, double offset, double position)
Add one phi-measuring scintillator strip to the module.
Definition: Module.cc:229
Belle2::bklm::Module::getPhiStripWidth
double getPhiStripWidth() const
Get phi-strip width.
Definition: Module.h:147
Belle2::bklm::Module::getPhiStripNumber
int getPhiStripNumber(const CLHEP::Hep3Vector &p) const
Get phi strip corresponding to local phi coordinate.
Definition: Module.cc:330
Belle2::bklm::Module::m_AlignmentRotation
CLHEP::HepRotation m_AlignmentRotation
rotation of the alignment transformation
Definition: Module.h:370
Belle2::bklm::Module::m_PhiSensorSide
int m_PhiSensorSide
to store the sensor side for phi scintillators
Definition: Module.h:349
Belle2::bklm::Module
Define the geometry of a BKLM module Each sector [octant] contains Modules.
Definition: Module.h:86
Belle2::bklm::Module::getPhiStrip
double getPhiStrip(const CLHEP::Hep3Vector &p) const
Return phi strip (including fractional part) corresponding to local phi coordinate.
Definition: Module.h:239
Belle2::bklm::Module::getZStrip
double getZStrip(const CLHEP::Hep3Vector &p) const
Return z strip (including fractional part) corresponding to local z coordinate.
Definition: Module.h:245
Belle2::bklm::Module::getZScintPosition
double getZScintPosition(int scint) const
Get the transverse position (within the scintillator envelope) of a given z-measuring scintillator.
Definition: Module.h:207
Belle2::bklm::Module::m_DisplacedGeoInverse
HepGeom::Transform3D m_DisplacedGeoInverse
inverse of displaced geometry transformation
Definition: Module.h:391
Belle2::bklm::Module::getGlobalOrigin
const CLHEP::Hep3Vector getGlobalOrigin() const
Return the position (in global coordinates) of this module's sensitive-volume origin.
Definition: Module.h:287
Belle2::bklm::Module::getPhiScintOffset
double getPhiScintOffset(int scint) const
Get the longitudinal offset (within the scintillator envelope) of a given phi-measuring scintillator.
Definition: Module.h:183
Belle2::bklm::Module::getTranslationFromTransform3D
const CLHEP::Hep3Vector getTranslationFromTransform3D(const HepGeom::Transform3D &trans) const
Get the translation from Transform3D.
Definition: Module.cc:364
Belle2::bklm::Module::m_DisplacedGeoRotation
CLHEP::HepRotation m_DisplacedGeoRotation
rotation of the displaced geometry transformation
Definition: Module.h:385
Belle2::bklm::Module::m_ZScintLengths
std::vector< double > m_ZScintLengths
to store the length of each z-measuring scintillator
Definition: Module.h:406
Belle2::bklm::Module::m_AlignmentTranslation
CLHEP::Hep3Vector m_AlignmentTranslation
translation of the alignment transformation
Definition: Module.h:373
Belle2::bklm::Module::getZScintHalfLength
double getZScintHalfLength(int scint) const
Get the half-length (within the scintillator envelope) of a given z-measuring scintillator.
Definition: Module.h:195
Belle2::bklm::Module::m_AlignmentInverse
HepGeom::Transform3D m_AlignmentInverse
inverse of alignment transformation
Definition: Module.h:376
Belle2::bklm::Module::m_RotationInverse
CLHEP::HepRotation m_RotationInverse
to store the inverse of the rotation matrix (in global coordinates) of this module's sector
Definition: Module.h:364
Belle2::bklm::Module::m_Rotation
CLHEP::HepRotation m_Rotation
to store the rotation matrix (in global coordinates) of this module's sector
Definition: Module.h:361
Belle2::bklm::Module::globalToLocal
const CLHEP::Hep3Vector globalToLocal(const CLHEP::Hep3Vector &v, bool reco=false) const
Transform space-point within this module from global to local coordinates.
Definition: Module.cc:320
Belle2::bklm::Module::m_ZStripWidth
double m_ZStripWidth
to store the width (in cm) of each z strip in this module
Definition: Module.h:337
Belle2::bklm::Module::operator=
Module & operator=(const Module &m)
Assignment operator: utilizes copy constructor.
Definition: Module.cc:186
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::bklm::Module::m_ZStripMin
int m_ZStripMin
to store the minimum z strip number in this module
Definition: Module.h:340
Belle2::bklm::Module::RotateToLocal
const CLHEP::Hep3Vector RotateToLocal(const CLHEP::Hep3Vector &v) const
Rotate a vector from global to local system.
Definition: Module.h:264
Belle2::bklm::Module::m_ZStripMax
int m_ZStripMax
to store the maximum z strip number in this module
Definition: Module.h:343
Belle2::bklm::Module::getPhiScintHalfLength
double getPhiScintHalfLength(int scint) const
Get the half-length (within the scintillator envelope) of a given phi-measuring scintillator.
Definition: Module.h:177
Belle2::bklm::Module::getLocalPosition
const CLHEP::Hep3Vector getLocalPosition(double phiStripAve, double zStripAve) const
Convert 2D strip position (0..nStrips along each axis) to local coordinates.
Definition: Module.cc:253
Belle2::bklm::Module::getZStripNumber
int getZStripNumber(const CLHEP::Hep3Vector &p) const
Get z strip corresponding to local z coordinate.
Definition: Module.cc:338
Belle2::bklm::Module::m_Alignment
HepGeom::Transform3D m_Alignment
alignment transformation (rotation + shift)
Definition: Module.h:367
Belle2::bklm::Module::m_AlignmentRotationInverse
CLHEP::HepRotation m_AlignmentRotationInverse
inverse of the rotation of the alignment transformation
Definition: Module.h:379
Belle2::bklm::Module::setDisplacedGeo
void setDisplacedGeo(const HepGeom::Transform3D &moduleDisplacedGeo)
Set the displaced geometry Transformation.
Definition: Module.cc:355
Belle2::bklm::Module::m_PhiScintPositions
std::vector< double > m_PhiScintPositions
to store the transverse position (within scintillator envelope) of each phi-measuring scintillator
Definition: Module.h:400
Belle2::bklm::Module::m_LocalReconstructionShift
CLHEP::Hep3Vector m_LocalReconstructionShift
to store the local-coordinate real-vs-ideal translation of this module's sensitive volume
Definition: Module.h:358
Belle2::bklm::Module::getPropagationTime
double getPropagationTime(const CLHEP::Hep3Vector &local, int strip, bool phiReadout) const
Convert local coordinates to signal-propagation time (ns) Version for scintillators.
Definition: Module.cc:291
Belle2::bklm::Module::m_ZScintOffsets
std::vector< double > m_ZScintOffsets
to store the longitudinal offset (within scintillator envelope) of each z-measuring scintillator
Definition: Module.h:412
Belle2::bklm::Module::localToGlobal
const CLHEP::Hep3Vector localToGlobal(const CLHEP::Hep3Vector &v, bool reco=false) const
Transform space-point within this module from local to global coordinates.
Definition: Module.cc:306
Belle2::bklm::Module::m_DisplacedGeoTranslation
CLHEP::Hep3Vector m_DisplacedGeoTranslation
translation of the displaced geometry transformation
Definition: Module.h:388
Belle2::bklm::Module::RotateToGlobal
const CLHEP::Hep3Vector RotateToGlobal(const CLHEP::Hep3Vector &v) const
Rotate a vector from local to global system.
Definition: Module.h:270
Belle2::bklm::Module::m_DisplacedGeoRotationInverse
CLHEP::HepRotation m_DisplacedGeoRotationInverse
inverse of the rotation of displaced geometry transformation
Definition: Module.h:394
Belle2::bklm::Module::isFlipped
bool isFlipped() const
Determine if this module is flipped by 180 degrees about z axis within its air gap.
Definition: Module.h:123
Belle2::bklm::Module::getPhiStripMax
int getPhiStripMax() const
Get module's phi-strip maximum index.
Definition: Module.h:141
Belle2::bklm::Module::m_PhiScintOffsets
std::vector< double > m_PhiScintOffsets
to store the longitudinal offset (within scintillator envelope) of each phi-measuring scintillator
Definition: Module.h:403
Belle2::bklm::Module::m_IsFlipped
bool m_IsFlipped
flag to indicate if this module is flipped by 180 degrees about z axis within its air gap
Definition: Module.h:322
Belle2::bklm::Module::getZStripWidth
double getZStripWidth() const
Get z-strip width.
Definition: Module.h:165
Belle2::bklm::Module::m_GlobalOrigin
CLHEP::Hep3Vector m_GlobalOrigin
to store the position (in global coordinates) of this module's sensitive-volume origin
Definition: Module.h:355
Belle2::bklm::Module::hasRPCs
bool hasRPCs() const
Determine if this module contains RPCs (true) or scintillators (false)
Definition: Module.h:129
Belle2::bklm::Module::m_PhiScintLengths
std::vector< double > m_PhiScintLengths
to store the length of each phi-measuring scintillator
Definition: Module.h:397
Belle2::bklm::Module::setAlignment
void setAlignment(const HepGeom::Transform3D &moduleAlignment)
Set the alignment Transformation.
Definition: Module.cc:346
Belle2::bklm::Module::getPhiScintPosition
double getPhiScintPosition(int scint) const
Get the transverse position (within the scintillator envelope) of a given phi-measuring scintillator.
Definition: Module.h:189
Belle2::bklm::Module::getZStripMax
int getZStripMax() const
Get module's z-strip maximum index.
Definition: Module.h:159
Belle2::bklm::Module::m_ZScintPositions
std::vector< double > m_ZScintPositions
to store the transverse position (within scintillator envelope) of each z-measuring scintillator
Definition: Module.h:409