Belle II Software development
HitPatternCDC.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#pragma once
9
10#include <RtypesCore.h>
11
12#include <bitset>
13#include <map>
14#include <utility>
15#include <string>
16
17namespace Belle2 {
36 friend class HitPatternCDCTest_settersNGetters_Test;
37 friend class HitPatternCDCTest_getFirstLastLayer_Test;
38
39 public:
42
44 explicit HitPatternCDC(ULong64_t initValue) : m_pattern(initValue) {}
45
47 ULong64_t getInteger() const;
48
56 unsigned short getNHits() const;
57
64 void setNHits(unsigned short nHits);
65
66 // ----------------------------------------------------------------
67 // ---------------- LAYER FUNCTIONS -------------------------------
68 // ----------------------------------------------------------------
69
75 void setLayer(const unsigned short layer);
76
82 void resetLayer(const unsigned short layer);
83
89 bool hasLayer(const unsigned short layer) const;
90
96 short getFirstLayer() const;
97
103 short getLastLayer() const;
104
105 // ----------------------------------------------------------------
106 // ---------------- SUPER LAYER FUNCTIONS -------------------------
107 // ----------------------------------------------------------------
108
113 bool hasSLayer(const unsigned short sLayer) const;
114
119 void resetSLayer(const unsigned short sLayer);
120
126 std::bitset<64> getSLayerPattern(const unsigned short sLayer);
127
135 unsigned short getSLayerNHits(const unsigned short sLayer) const;
136
142 unsigned short getLongestContRunInSL(const unsigned short sLayer) const;
143
144 // ----------------------------------------------------------------
145 // ---------------- Others ----------------------------------------
146 // ----------------------------------------------------------------
147
149 bool hasAxialLayer() const;
150
152 bool hasStereoLayer() const;
153
155 std::string __str__() const;
156
157 private:
158 std::bitset<64> m_pattern;
159 static const std::bitset<64> s_sLayerMasks[9];
160 static const std::bitset<64> s_infoLayerMask;
163 static const std::map<unsigned short, std::pair<unsigned short, unsigned short>> s_superLayerIndices;
164
166 std::bitset<64> getBitSet() const { return m_pattern; }
167
169 void resetPattern() { m_pattern.reset(); }
170
171 };
173}
Hit pattern of CDC hits within a track.
Definition: HitPatternCDC.h:35
HitPatternCDC()
Create empty pattern.
Definition: HitPatternCDC.h:41
std::string __str__() const
String for printing in python.
unsigned short getSLayerNHits(const unsigned short sLayer) const
Getter for the number of hits in one super-layer.
std::bitset< 64 > getBitSet() const
Getter for underlying bit set.
short getLastLayer() const
Returns the index of the last layer with a hit.
std::bitset< 64 > getSLayerPattern(const unsigned short sLayer)
Get the bit pattern in a specific super layer.
std::bitset< 64 > m_pattern
Saves the actual pattern.
static const std::map< unsigned short, std::pair< unsigned short, unsigned short > > s_superLayerIndices
Holds the indices for super layer access.
bool hasSLayer(const unsigned short sLayer) const
Getter for super-layer match.
bool hasAxialLayer() const
True, if at least one axial layer is true.
void setNHits(unsigned short nHits)
Sets the 8 MSBs to the total number of hits in the CDC.
void setLayer(const unsigned short layer)
Set bit corresponding to layer to true.
void resetPattern()
Reset the complete hit pattern.
ULong64_t getInteger() const
Getter for underlying integer type.
bool hasLayer(const unsigned short layer) const
Getter for single layer.
unsigned short getNHits() const
Get the total Number of CDC hits in the fit.
static const std::bitset< 64 > s_sLayerMasks[9]
Masks to zero out all bits from other layers.
short getFirstLayer() const
Returns the index of the first layer with a hit.
void resetLayer(const unsigned short layer)
Set bit corresponding to layer to false.
void resetSLayer(const unsigned short sLayer)
Reset complete superLayer, e.g.
unsigned short getLongestContRunInSL(const unsigned short sLayer) const
Getter for longest run of consecutive layers with hits within the given Super-layer.
HitPatternCDC(ULong64_t initValue)
Initialize the pattern with an integer.
Definition: HitPatternCDC.h:44
bool hasStereoLayer() const
True, if at least one axial layer is true.
static const std::bitset< 64 > s_infoLayerMask
Mask to zero out all bits from other layers.
Abstract base class for different kinds of events.