Belle II Software development
Module.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#pragma once
10
11/* CLHEP headers. */
12#include <CLHEP/Geometry/Transform3D.h>
13#include <CLHEP/Vector/Rotation.h>
14#include <CLHEP/Vector/ThreeVector.h>
15
16/* C++ headers. */
17#include <vector>
18
19namespace Belle2 {
25 namespace bklm {
26
76 class Module {
77
78 public:
79
81 Module(void);
82
84 Module(double phiStripWidth,
85 int phiStripMin,
86 int phiStripMax,
87 double zStripWidth,
88 int zStripNumber,
89 const CLHEP::Hep3Vector& globalOrigin,
90 const CLHEP::Hep3Vector& localReconstructionShift,
91 const CLHEP::HepRotation& rotation);
92
94 Module(double stripWidth,
95 int phiStripNumber,
96 int phiSensorSide,
97 int zStripNumber,
98 const CLHEP::Hep3Vector& globalOrigin,
99 const CLHEP::Hep3Vector& localReconstructionShift,
100 const CLHEP::HepRotation& rotation,
101 bool isFlipped);
102
104 Module(const Module& m);
105
107 Module& operator=(const Module& m);
108
110 ~Module();
111
113 bool isFlipped() const
114 {
115 return m_IsFlipped;
116 }
117
119 bool hasRPCs() const
120 {
121 return m_HasRPCs;
122 }
123
125 int getPhiStripMin() const
126 {
127 return m_PhiStripMin;
128 }
129
131 int getPhiStripMax() const
132 {
133 return m_PhiStripMax;
134 }
135
137 double getPhiStripWidth() const
138 {
139 return m_PhiStripWidth;
140 }
141
143 int getZStripMin() const
144 {
145 return m_ZStripMin;
146 }
147
149 int getZStripMax() const
150 {
151 return m_ZStripMax;
152 }
153
155 double getZStripWidth() const
156 {
157 return m_ZStripWidth;
158 }
159
161 void addPhiScint(int scint, double length, double offset, double position);
162
164 void addZScint(int scint, double length, double offset, double position);
165
167 double getPhiScintHalfLength(int scint) const
168 {
169 return 0.5 * m_PhiScintLengths[scint];
170 }
171
173 double getPhiScintOffset(int scint) const
174 {
175 return m_PhiScintOffsets[scint];
176 }
177
179 double getPhiScintPosition(int scint) const
180 {
181 return m_PhiScintPositions[scint];
182 }
183
185 double getZScintHalfLength(int scint) const
186 {
187 return 0.5 * m_ZScintLengths[scint];
188 }
189
191 double getZScintOffset(int scint) const
192 {
193 return m_ZScintOffsets[scint];
194 }
195
197 double getZScintPosition(int scint) const
198 {
199 return m_ZScintPositions[scint];
200 }
201
203 double getStripLength(int plane, int strip) const;
204
206 const CLHEP::Hep3Vector getLocalPosition(double phiStripAve, double zStripAve) const;
207
210 const CLHEP::Hep3Vector getPropagationDistance(const CLHEP::Hep3Vector&) const;
211
214 double getPropagationDistance(const CLHEP::Hep3Vector& local,
215 int strip, bool phiReadout) const;
216
219 const CLHEP::Hep3Vector getPropagationDistance(
220 const CLHEP::Hep3Vector&, int stripZ, int stripPhi) const;
221
224 const CLHEP::Hep3Vector getPropagationTimes(const CLHEP::Hep3Vector&) const;
225
228 double getPropagationTime(const CLHEP::Hep3Vector& local,
229 int strip, bool phiReadout) const;
230
233 const CLHEP::Hep3Vector getPropagationTimes(
234 const CLHEP::Hep3Vector&, int stripZ, int stripPhi) const;
235
237 double getPhiStrip(const CLHEP::Hep3Vector& p) const
238 {
239 return p.y() / m_PhiStripWidth + m_PhiPositionBase;
240 }
241
243 double getZStrip(const CLHEP::Hep3Vector& p) const
244 {
245 return p.z() / m_ZStripWidth + m_ZPositionBase;
246 }
247
250 int getPhiStripNumber(const CLHEP::Hep3Vector& p) const;
251
254 int getZStripNumber(const CLHEP::Hep3Vector& p) const;
255
259 const CLHEP::Hep3Vector localToGlobal(const CLHEP::Hep3Vector& v, bool reco = false) const;
260
262 const CLHEP::Hep3Vector RotateToLocal(const CLHEP::Hep3Vector& v) const
263 {
264 return m_RotationInverse * v;
265 }
266
268 const CLHEP::Hep3Vector RotateToGlobal(const CLHEP::Hep3Vector& v) const
269 {
270 return m_Rotation * v;
271 }
272
276 const CLHEP::Hep3Vector globalToLocal(const CLHEP::Hep3Vector& v, bool reco = false) const;
277
279 const CLHEP::Hep3Vector getLocalReconstructionShift() const
280 {
282 }
283
285 const CLHEP::Hep3Vector getGlobalOrigin() const
286 {
287 return m_GlobalOrigin;
288 }
289
291 void setAlignment(const HepGeom::Transform3D& moduleAlignment);
292
294 void setDisplacedGeo(const HepGeom::Transform3D& moduleDisplacedGeo);
295
297 const HepGeom::Transform3D getAlignment() const
298 {
299 return m_Alignment;
300 }
301
303 const HepGeom::Transform3D getDisplacedGeo() const
304 {
305 return m_DisplacedGeo;
306 }
307
309 const CLHEP::HepRotation getRotationFromTransform3D(const HepGeom::Transform3D& trans) const;
310
312 const CLHEP::Hep3Vector getTranslationFromTransform3D(const HepGeom::Transform3D& trans) const;
313
314 private:
315
318
321
324
327
330
333
336
339
342
345
348
351
353 CLHEP::Hep3Vector m_GlobalOrigin;
354
356 CLHEP::Hep3Vector m_LocalReconstructionShift;
357
359 CLHEP::HepRotation m_Rotation;
360
362 CLHEP::HepRotation m_RotationInverse;
363
365 HepGeom::Transform3D m_Alignment;
366
368 CLHEP::HepRotation m_AlignmentRotation;
369
371 CLHEP::Hep3Vector m_AlignmentTranslation;
372
374 HepGeom::Transform3D m_AlignmentInverse;
375
377 CLHEP::HepRotation m_AlignmentRotationInverse;
378
380 HepGeom::Transform3D m_DisplacedGeo;
381
383 CLHEP::HepRotation m_DisplacedGeoRotation;
384
386 CLHEP::Hep3Vector m_DisplacedGeoTranslation;
387
389 HepGeom::Transform3D m_DisplacedGeoInverse;
390
393
395 std::vector<double> m_PhiScintLengths;
396
398 std::vector<double> m_PhiScintPositions;
399
401 std::vector<double> m_PhiScintOffsets;
402
404 std::vector<double> m_ZScintLengths;
405
407 std::vector<double> m_ZScintPositions;
408
410 std::vector<double> m_ZScintOffsets;
411
412 };
413
414 } // end of namespace bklm
415
417} // end of namespace Belle2
Define the geometry of a BKLM module Each sector [octant] contains Modules.
Definition: Module.h:76
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:339
std::vector< double > m_ZScintPositions
to store the transverse position (within scintillator envelope) of each z-measuring scintillator
Definition: Module.h:407
const CLHEP::HepRotation getRotationFromTransform3D(const HepGeom::Transform3D &trans) const
Get the rotation from Transform3D.
Definition: Module.cc:393
CLHEP::HepRotation m_DisplacedGeoRotationInverse
inverse of the rotation of displaced geometry transformation
Definition: Module.h:392
CLHEP::HepRotation m_RotationInverse
to store the inverse of the rotation matrix (in global coordinates) of this module's sector
Definition: Module.h:362
CLHEP::Hep3Vector m_AlignmentTranslation
translation of the alignment transformation
Definition: Module.h:371
int m_PhiStripMin
to store the minimum phi strip number in this module
Definition: Module.h:326
CLHEP::Hep3Vector m_DisplacedGeoTranslation
translation of the displaced geometry transformation
Definition: Module.h:386
double m_ZPositionBase
to store the base position (in strip
Definition: Module.h:344
double m_PhiStripWidth
to store the width (in cm) of each phi strip this module
Definition: Module.h:323
int getZStripMax() const
Get module's z-strip maximum index.
Definition: Module.h:149
double getPhiStripWidth() const
Get phi-strip width.
Definition: Module.h:137
std::vector< double > m_ZScintLengths
to store the length of each z-measuring scintillator
Definition: Module.h:404
double getZScintHalfLength(int scint) const
Get the half-length (within the scintillator envelope) of a given z-measuring scintillator.
Definition: Module.h:185
const CLHEP::Hep3Vector getLocalReconstructionShift() const
Return the local-coordinate real-vs-ideal translation of this module's sensitive volume; nominally (0...
Definition: Module.h:279
HepGeom::Transform3D m_DisplacedGeo
displaced geometry w.r.t the nominal geometry, as transformation (rotation + shift)
Definition: Module.h:380
double getPhiScintOffset(int scint) const
Get the longitudinal offset (within the scintillator envelope) of a given phi-measuring scintillator.
Definition: Module.h:173
bool m_IsFlipped
flag to indicate if this module is flipped by 180 degrees about z axis within its air gap
Definition: Module.h:320
int getZStripNumber(const CLHEP::Hep3Vector &p) const
Get z strip corresponding to local z coordinate.
Definition: Module.cc:357
const CLHEP::Hep3Vector RotateToGlobal(const CLHEP::Hep3Vector &v) const
Rotate a vector from local to global system.
Definition: Module.h:268
CLHEP::HepRotation m_AlignmentRotationInverse
inverse of the rotation of the alignment transformation
Definition: Module.h:377
Module(void)
Empty constructor does nothing.
Definition: Module.cc:24
HepGeom::Transform3D m_Alignment
alignment transformation (rotation + shift)
Definition: Module.h:365
~Module()
Destructor.
Definition: Module.cc:227
const HepGeom::Transform3D getDisplacedGeo() const
Get the displaced geometry Transformation.
Definition: Module.h:303
const CLHEP::Hep3Vector getPropagationTimes(const CLHEP::Hep3Vector &) const
Convert local coordinates to signal-propagation time (ns) Version for RPCs.
Definition: Module.cc:305
const CLHEP::Hep3Vector getTranslationFromTransform3D(const HepGeom::Transform3D &trans) const
Get the translation from Transform3D.
Definition: Module.cc:383
const CLHEP::Hep3Vector getGlobalOrigin() const
Return the position (in global coordinates) of this module's sensitive-volume origin.
Definition: Module.h:285
HepGeom::Transform3D m_AlignmentInverse
inverse of alignment transformation
Definition: Module.h:374
double getZStrip(const CLHEP::Hep3Vector &p) const
Return z strip (including fractional part) corresponding to local z coordinate.
Definition: Module.h:243
HepGeom::Transform3D m_DisplacedGeoInverse
inverse of displaced geometry transformation
Definition: Module.h:389
const CLHEP::Hep3Vector getPropagationDistance(const CLHEP::Hep3Vector &) const
Convert local coordinates to signal-propagation distance (cm).
Definition: Module.cc:290
std::vector< double > m_ZScintOffsets
to store the longitudinal offset (within scintillator envelope) of each z-measuring scintillator
Definition: Module.h:410
double m_ZStripWidth
to store the width (in cm) of each z strip in this module
Definition: Module.h:335
double getPhiScintPosition(int scint) const
Get the transverse position (within the scintillator envelope) of a given phi-measuring scintillator.
Definition: Module.h:179
bool hasRPCs() const
Determine if this module contains RPCs (true) or scintillators (false)
Definition: Module.h:119
double getZScintOffset(int scint) const
Get the longitudinal offset (within the scintillator envelope) of a given z-measuring scintillator.
Definition: Module.h:191
int m_PhiSensorSide
to store the sensor side for phi scintillators
Definition: Module.h:347
int getPhiStripMin() const
Get module's phi-strip minimum index.
Definition: Module.h:125
std::vector< double > m_PhiScintPositions
to store the transverse position (within scintillator envelope) of each phi-measuring scintillator
Definition: Module.h:398
int m_PhiStripMax
to store the maximum phi strip number in this module
Definition: Module.h:329
std::vector< double > m_PhiScintLengths
to store the length of each phi-measuring scintillator
Definition: Module.h:395
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:311
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:326
CLHEP::HepRotation m_Rotation
to store the rotation matrix (in global coordinates) of this module's sector
Definition: Module.h:359
int m_ZStripMin
to store the minimum z strip number in this module
Definition: Module.h:338
void addZScint(int scint, double length, double offset, double position)
Add one z-measuring scintillator strip to the module.
Definition: Module.cc:243
double m_PhiPositionBase
to store the base position (in strip
Definition: Module.h:332
CLHEP::HepRotation m_DisplacedGeoRotation
rotation of the displaced geometry transformation
Definition: Module.h:383
const HepGeom::Transform3D getAlignment() const
Get the alignment Transformation.
Definition: Module.h:297
double getZScintPosition(int scint) const
Get the transverse position (within the scintillator envelope) of a given z-measuring scintillator.
Definition: Module.h:197
const CLHEP::Hep3Vector RotateToLocal(const CLHEP::Hep3Vector &v) const
Rotate a vector from global to local system.
Definition: Module.h:262
double m_SignalSpeed
to store the signal-propagation speed (cm/ns) along the strip
Definition: Module.h:350
double getPhiStrip(const CLHEP::Hep3Vector &p) const
Return phi strip (including fractional part) corresponding to local phi coordinate.
Definition: Module.h:237
int getZStripMin() const
Get module's z-strip minimum index.
Definition: Module.h:143
CLHEP::Hep3Vector m_LocalReconstructionShift
to store the local-coordinate real-vs-ideal translation of this module's sensitive volume
Definition: Module.h:356
int m_ZStripMax
to store the maximum z strip number in this module
Definition: Module.h:341
const CLHEP::Hep3Vector getLocalPosition(double phiStripAve, double zStripAve) const
Convert 2D strip position (0..nStrips along each axis) to local coordinates.
Definition: Module.cc:265
double getStripLength(int plane, int strip) const
Get scintillator length.
Definition: Module.cc:255
CLHEP::Hep3Vector m_GlobalOrigin
to store the position (in global coordinates) of this module's sensitive-volume origin
Definition: Module.h:353
int getPhiStripMax() const
Get module's phi-strip maximum index.
Definition: Module.h:131
void setDisplacedGeo(const HepGeom::Transform3D &moduleDisplacedGeo)
Set the displaced geometry Transformation.
Definition: Module.cc:374
Module & operator=(const Module &m)
Assignment operator: utilizes copy constructor.
Definition: Module.cc:188
void addPhiScint(int scint, double length, double offset, double position)
Add one phi-measuring scintillator strip to the module.
Definition: Module.cc:231
CLHEP::HepRotation m_AlignmentRotation
rotation of the alignment transformation
Definition: Module.h:368
double getZStripWidth() const
Get z-strip width.
Definition: Module.h:155
bool m_HasRPCs
flag to indicate whether this module contains RPCs (true) or scintillators (false)
Definition: Module.h:317
int getPhiStripNumber(const CLHEP::Hep3Vector &p) const
Get phi strip corresponding to local phi coordinate.
Definition: Module.cc:349
double getPhiScintHalfLength(int scint) const
Get the half-length (within the scintillator envelope) of a given phi-measuring scintillator.
Definition: Module.h:167
std::vector< double > m_PhiScintOffsets
to store the longitudinal offset (within scintillator envelope) of each phi-measuring scintillator
Definition: Module.h:401
bool isFlipped() const
Determine if this module is flipped by 180 degrees about z axis within its air gap.
Definition: Module.h:113
void setAlignment(const HepGeom::Transform3D &moduleAlignment)
Set the alignment Transformation.
Definition: Module.cc:365
Abstract base class for different kinds of events.