Belle II Software  release-06-02-00
BKLMHit2d.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 /* KLM headers. */
12 #include <klm/dataobjects/bklm/BKLMElementNumbers.h>
13 #include <klm/dataobjects/bklm/BKLMHit1d.h>
14 #include <klm/dataobjects/bklm/BKLMStatus.h>
15 
16 /* Belle 2 headers. */
17 #include <framework/datastore/RelationsObject.h>
18 
19 /* ROOT headers. */
20 #include <TVector3.h>
21 
22 /* CLHEP headers. */
23 #include <CLHEP/Vector/ThreeVector.h>
24 
25 namespace Belle2 {
32  class BKLMHit2d : public RelationsObject {
33 
34  public:
35 
37  BKLMHit2d();
38 
44  BKLMHit2d(const BKLMHit1d* hitPhi, const BKLMHit1d* hitZ, const CLHEP::Hep3Vector& globalPos, double time);
45 
47  BKLMHit2d(const BKLMHit2d&);
48 
50  BKLMHit2d& operator=(const BKLMHit2d&);
51 
54  {
55  }
56 
59  bool inRPC() const
60  {
62  }
63 
66  int getSection() const
67  {
69  }
70 
73  int getSector() const
74  {
76  }
77 
80  int getLayer() const
81  {
83  }
84 
87  int getPhiStripMin() const
88  {
90  }
91 
94  int getPhiStripMax() const
95  {
97  }
98 
101  double getPhiStripAve() const
102  {
103  return 0.5 * (getPhiStripMin() + getPhiStripMax());
104  }
105 
108  int getZStripMin() const
109  {
110  return (((m_ZStrips & BKLM_ZSTRIP_MASK) >> BKLM_ZSTRIP_BIT) + 1);
111  }
112 
115  int getZStripMax() const
116  {
117  return (((m_ZStrips & BKLM_ZMAXSTRIP_MASK) >> BKLM_ZMAXSTRIP_BIT) + 1);
118  }
119 
122  double getZStripAve() const
123  {
124  return 0.5 * (getZStripMin() + getZStripMax());
125  }
126 
130  int getModuleID() const
131  {
132  return m_ModuleID;
133  }
134 
137  bool isOutOfTime()
138  {
139  return (m_ModuleID & BKLM_OUTOFTIME_MASK) != 0;
140  }
141 
144  bool isOnTrack()
145  {
146  return (m_ModuleID & BKLM_ONTRACK_MASK) != 0;
147  }
148 
152  {
153  return (m_ModuleID & BKLM_ONSTATRACK_MASK) != 0;
154  }
155 
158  float getGlobalPositionX(void) const
159  {
160  return m_GlobalPosition[0];
161  }
162 
165  float getGlobalPositionY(void) const
166  {
167  return m_GlobalPosition[1];
168  }
169 
172  float getGlobalPositionZ(void) const
173  {
174  return m_GlobalPosition[2];
175  }
176 
179  TVector3 getGlobalPosition(void) const
180  {
181  return TVector3(m_GlobalPosition[0], m_GlobalPosition[1], m_GlobalPosition[2]);
182  }
183 
186  float getTime() const
187  {
188  return m_Time;
189  }
190 
193  float getEnergyDeposit() const
194  {
195  return m_EnergyDeposit;
196  }
197 
200  bool match(const BKLMHit2d* h) const
201  {
202  return BKLMElementNumbers::hitsFromSameModule(m_ModuleID, h->getModuleID());
203  }
204 
207  void isOutOfTime(bool flag)
208  {
209  if (flag)
210  m_ModuleID |= BKLM_OUTOFTIME_MASK;
211  else
212  m_ModuleID &= ~BKLM_OUTOFTIME_MASK;
213  }
214 
217  void isOnTrack(bool flag)
218  {
219  if (flag)
220  m_ModuleID |= BKLM_ONTRACK_MASK;
221  else
222  m_ModuleID &= ~BKLM_ONTRACK_MASK;
223  }
224 
227  void isOnStaTrack(bool flag)
228  {
229  if (flag)
230  m_ModuleID |= BKLM_ONSTATRACK_MASK;
231  else
232  m_ModuleID &= ~BKLM_ONSTATRACK_MASK;
233  }
234 
235  private:
236 
238  static constexpr int BKLM_ZSTRIP_BIT = 0;
239 
241  static constexpr int BKLM_ZMAXSTRIP_BIT = 6;
242 
244  static constexpr int BKLM_ZSTRIP_MASK = (63 << BKLM_ZSTRIP_BIT);
245 
247  static constexpr int BKLM_ZMAXSTRIP_MASK = (63 << BKLM_ZMAXSTRIP_BIT);
248 
252 
256 
259 
261  float m_Time;
262 
265 
267  ClassDef(BKLMHit2d, 6)
268 
269  };
270 
272 } // end of namespace Belle2
static int getSectorByModule(int module)
Get sector number by module identifier.
static int getStripByModule(int module)
Get strip number by module identifier.
@ c_FirstRPCLayer
First RPC layer.
static int getLayerByModule(int module)
Get layer number by module identifier.
static int getSectionByModule(int module)
Get section number by module identifier.
static bool hitsFromSameModule(int module1, int module2)
Check whether the hits are from the same module.
Store one reconstructed BKLM 1D hit as a ROOT object.
Definition: BKLMHit1d.h:30
Store one BKLM strip hit as a ROOT object.
Definition: BKLMHit2d.h:32
~BKLMHit2d()
Destructor.
Definition: BKLMHit2d.h:53
float m_GlobalPosition[3]
position of the 2D hit in global coordinates (cm)
Definition: BKLMHit2d.h:258
bool inRPC() const
Determine whether this 2D hit is in RPC or scintillator.
Definition: BKLMHit2d.h:59
bool isOnStaTrack()
Determine whether this 2D hit is associated with a BKLM-stand-alone track.
Definition: BKLMHit2d.h:151
void isOnTrack(bool flag)
Set or clear the OnTrack flag.
Definition: BKLMHit2d.h:217
static constexpr int BKLM_ZMAXSTRIP_BIT
BKLMHit2d Zstrips bit position for maxStrip-1 [0..47].
Definition: BKLMHit2d.h:241
int getLayer() const
Get layer number.
Definition: BKLMHit2d.h:80
double getZStripAve() const
Get average z-measuring strip number.
Definition: BKLMHit2d.h:122
double getPhiStripAve() const
Get average phi-measuring strip number.
Definition: BKLMHit2d.h:101
float m_Time
reconstructed hit time relative to trigger (ns)
Definition: BKLMHit2d.h:261
float getTime() const
Get reconstructed hit time.
Definition: BKLMHit2d.h:186
float getGlobalPositionY(void) const
Get 3D hit position's y coordinate in global coordinates.
Definition: BKLMHit2d.h:165
int getZStripMax() const
Get highest z-measuring strip number.
Definition: BKLMHit2d.h:115
bool isOutOfTime()
Determine whether this 2D hit is outside the trigger-coincidence window.
Definition: BKLMHit2d.h:137
static constexpr int BKLM_ZSTRIP_BIT
BKLMHit2d Zstrips bit position for strip-1 [0..47].
Definition: BKLMHit2d.h:238
int getSection() const
Get section number.
Definition: BKLMHit2d.h:66
float m_EnergyDeposit
reconstructed pulse height (MeV)
Definition: BKLMHit2d.h:264
int getSector() const
Get sector number.
Definition: BKLMHit2d.h:73
int getModuleID() const
Get detector-module identifier.
Definition: BKLMHit2d.h:130
int m_ModuleID
detector-module identifier
Definition: BKLMHit2d.h:251
int getPhiStripMin() const
Get lowest phi-measuring strip number.
Definition: BKLMHit2d.h:87
void isOutOfTime(bool flag)
Set or clear the OutOfTime flag.
Definition: BKLMHit2d.h:207
int m_ZStrips
z-measuring strip numbers of the 2D hit
Definition: BKLMHit2d.h:255
void isOnStaTrack(bool flag)
Set or clear the On-BKLM-stand-alone-track flag.
Definition: BKLMHit2d.h:227
BKLMHit2d & operator=(const BKLMHit2d &)
Assignment operator.
Definition: BKLMHit2d.cc:66
int getZStripMin() const
Get lowest z-measuring strip number.
Definition: BKLMHit2d.h:108
static constexpr int BKLM_ZMAXSTRIP_MASK
BKLMHit2d Zstrips bit mask for maxStrip-1 [0..47].
Definition: BKLMHit2d.h:247
bool isOnTrack()
Determine whether this 2D hit is associated with a muid-extrapolated track.
Definition: BKLMHit2d.h:144
int getPhiStripMax() const
Get highest phi-measuring strip number.
Definition: BKLMHit2d.h:94
TVector3 getGlobalPosition(void) const
Get 3D hit position in global coordinates.
Definition: BKLMHit2d.h:179
BKLMHit2d()
Empty constructor for ROOT IO (needed to make the class storable)
Definition: BKLMHit2d.cc:21
float getEnergyDeposit() const
Get reconstructed energy deposition.
Definition: BKLMHit2d.h:193
float getGlobalPositionX(void) const
Get 3D hit position's x coordinate in global coordinates.
Definition: BKLMHit2d.h:158
static constexpr int BKLM_ZSTRIP_MASK
BKLMHit2d Zstrips bit mask for strip-1 [0..47].
Definition: BKLMHit2d.h:244
bool match(const BKLMHit2d *h) const
Determine whether the two BKLMHit2ds are in the same module.
Definition: BKLMHit2d.h:200
float getGlobalPositionZ(void) const
Get 3D hit position's z coordinate in global coordinates.
Definition: BKLMHit2d.h:172
static int getMaximalStrip(int module)
Get maximal strip number.
Definition: BKLMStatus.h:85
Defines interface for accessing relations of objects in StoreArray.
ClassDef(RelationsInterface, 0)
defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.