Belle II Software  release-08-01-10
HitPatternVXD.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 #include <bitset>
12 #include <utility>
13 #include <list>
14 
15 namespace Belle2 {
37  class HitPatternVXD {
38  friend class HitPatternVXDTest_General_Test;
39  friend class HitPatternVXDTest_NumberingScheme_Test;
40  friend class HitPatternVXDTest_SVDSetterAndGetter_Test;
41  friend class HitPatternVXDTest_PXDSetterAndGetter_Test;
42 
43  public:
44 
46  enum class PXDMode : unsigned short { normal = static_cast<unsigned short>(0), gated = 1 };
47 
50 
52  explicit HitPatternVXD(const unsigned int initValue) : m_pattern(initValue) {}
53 
58  unsigned int getInteger() const { return m_pattern.to_ulong(); }
59 
65  unsigned short getNdf() const;
66 
74  unsigned short getNVXDLayers(const PXDMode& pxdmode = PXDMode::normal) const;
75 
76  // ----------------------------------------------------------------
77  // ---------------- SVD LAYER FUNCTIONS ---------------------------
78  // ----------------------------------------------------------------
79 
86  void setSVDLayer(const unsigned short layerId, unsigned short uHits, unsigned short vHits);
87 
93  std::pair<const unsigned short, const unsigned short> getSVDLayer(const unsigned short layerId) const;
94 
99  void resetSVDLayer(const unsigned short layerId);
100 
105  unsigned short getNSVDHits() const;
106 
111  unsigned short getNSVDLayers() const;
112 
118  short getFirstSVDLayer() const;
119 
125  short getLastSVDLayer() const;
126 
127  // ----------------------------------------------------------------
128  // ---------------- PXD LAYER FUNCTIONS ---------------------------
129  // ----------------------------------------------------------------
130 
138  void setPXDLayer(const unsigned short layerId, unsigned short nHits, const PXDMode& mode = PXDMode::normal);
139 
147  unsigned short getPXDLayer(const unsigned short layerId, const PXDMode& mode = PXDMode::normal) const;
148 
155  void resetPXDLayer(const unsigned short layerId, const PXDMode& mode = PXDMode::normal);
156 
161  unsigned short getNPXDHits() const;
162 
169  unsigned short getNPXDLayers(const PXDMode& mode = PXDMode::normal) const;
170 
178  short getFirstPXDLayer(const PXDMode& mode = PXDMode::normal) const;
179 
186  short getLastPXDLayer(const PXDMode& mode = PXDMode::normal) const;
187 
188  // ----------------------------------------------------------------
189  // ---------------- V0DAUGHTER FUNCTIONS --------------------------
190  // ----------------------------------------------------------------
191 
196  void setInnermostHitShareStatus(const unsigned short innermostHitShareStatus);
197 
202  unsigned short getInnermostHitShareStatus() const;
203 
208 
210  std::string __str__() const;
211 
212  private:
218  std::bitset<32> m_pattern;
219 
220  static const std::bitset<32> s_LayerMasks[6];
221  static const std::bitset<32> s_PXDModeMasks[2];
222  static const std::bitset<32> s_SVDuvMasks[2];
223  static const std::bitset<32> s_V0DaughterMask;
224  static const std::bitset<32> s_infoLayerMask;
226  static const std::list<unsigned short> s_PXDLayerNumbers;
227  static const std::list<unsigned short> s_SVDLayerNumbers;
229  static const unsigned int s_svdUshift = 8;
230  static const unsigned int s_svdVshift = 10;
233  std::bitset<32> getBitset() const { return m_pattern; }
234 
236  std::bitset<32> getLayerMask(const unsigned short layerId) const { return HitPatternVXD::s_LayerMasks[layerId - 1]; }
237 
238  };
240 }
Hit pattern of the VXD within a track.
Definition: HitPatternVXD.h:37
short getLastSVDLayer() const
Get the last activated SVD layer index.
static const std::list< unsigned short > s_SVDLayerNumbers
For iterating through layers.
void resetSVDLayer(const unsigned short layerId)
Reset the number of hits in a specific layer of the SVD.
std::bitset< 32 > m_pattern
Storing of actual hit pattern.
std::string __str__() const
String for printing in python.
unsigned short getNSVDLayers() const
Returns the total number of activated layers of the SVD.
unsigned short getNPXDLayers(const PXDMode &mode=PXDMode::normal) const
Returns the total number of activated layers of the PXD.
static const std::bitset< 32 > s_PXDModeMasks[2]
Mask to zero out all bits from other layers.
unsigned int getInteger() const
Getter for the underlying integer.
Definition: HitPatternVXD.h:58
static const std::bitset< 32 > s_V0DaughterMask
Mask to zero out all bits from other layers.
static const std::bitset< 32 > s_SVDuvMasks[2]
Mask to zero out all bits from other layers.
short getFirstSVDLayer() const
Get the first activated SVD layer index.
HitPatternVXD(const unsigned int initValue)
Initialize the pattern with an integer.
Definition: HitPatternVXD.h:52
void setSVDLayer(const unsigned short layerId, unsigned short uHits, unsigned short vHits)
Set the number of hits in a specific layer of the SVD.
unsigned short getNVXDLayers(const PXDMode &pxdmode=PXDMode::normal) const
Return the total number of activated layers in the VXD depending on the mode of the PXD.
void resetPXDLayer(const unsigned short layerId, const PXDMode &mode=PXDMode::normal)
Reset the number of hits in a specific layer of the PXD.
static const std::list< unsigned short > s_PXDLayerNumbers
For iterating through layers.
unsigned short getNPXDHits() const
Get total number of hits in the PXD.
unsigned short getNSVDHits() const
Get total number of hits in the SVD.
void setInnermostHitShareStatus(const unsigned short innermostHitShareStatus)
Set the innermost hit share flags for V0 daughters.
void setPXDLayer(const unsigned short layerId, unsigned short nHits, const PXDMode &mode=PXDMode::normal)
Set the number of hits in a specific layer of the PXD.
HitPatternVXD()
Create empty pattern.
Definition: HitPatternVXD.h:49
short getLastPXDLayer(const PXDMode &mode=PXDMode::normal) const
Returns the last activated layer of the PXD depending on the mode.
void resetInnermostHitShareStatus()
Reset the innermost hit share flags for V0 daughters.
static const std::bitset< 32 > s_infoLayerMask
Mask to zero out all bits from other layers.
static const std::bitset< 32 > s_LayerMasks[6]
Masks to zero out all bits from other layers.
unsigned short getPXDLayer(const unsigned short layerId, const PXDMode &mode=PXDMode::normal) const
Get the number of hits in a specific layer of the PXD.
static const unsigned int s_svdVshift
for internal shifting to the SVD bits.
static const unsigned int s_svdUshift
for internal shifting to the SVD bits.
std::bitset< 32 > getBitset() const
Getter for underlying bitset.
short getFirstPXDLayer(const PXDMode &mode=PXDMode::normal) const
Returns the first activated layer of the PXD depending on the mode.
unsigned short getNdf() const
Get degrees of freedom in PXD and SVD.
std::pair< const unsigned short, const unsigned short > getSVDLayer(const unsigned short layerId) const
Get the number of hits in a specific layer of the SVD.
std::bitset< 32 > getLayerMask(const unsigned short layerId) const
Getter for the proper layer masks.
unsigned short getInnermostHitShareStatus() const
Get the innermost hit share flags for V0 daughters.
Abstract base class for different kinds of events.