Belle II Software  release-08-01-10
FullSecID.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 
10 #pragma once
11 
12 #include <vxd/dataobjects/VxdID.h>
13 #include <string>
14 #include <ostream>
15 
16 
17 
18 namespace Belle2 {
33  class FullSecID {
34  public:
35 
36 
38  typedef unsigned int BaseType;
39 
40 
41  // starting with operator overloading...
43  bool operator<(const FullSecID& secID) const { return m_fullSecID < secID.m_fullSecID; }
44 
45 
47  bool operator==(const FullSecID& secID) const { return m_fullSecID == secID.m_fullSecID; }
48 
50  bool equalIgnoreSubLayerID(const FullSecID& secID)
51  {
53  }
54 
56  FullSecID& operator=(const FullSecID& secID) { m_fullSecID = secID.m_fullSecID; return *this; }
57 
58 
60  operator unsigned int() const { return m_fullSecID; }
61 
62 
64  operator std::string(void) const { return getFullSecString(); }
65 
66 
68  friend std::ostream& operator<< (std::ostream& out, const FullSecID& secID) { out << secID.getFullSecString(); return out; }
69 
70 
71  // constructors...
73  FullSecID(const FullSecID& secID): m_fullSecID(secID.m_fullSecID) {}
74 
75 
82  explicit FullSecID(unsigned int id = 0):
83  m_fullSecID(id) {}
84 
85 
91  explicit FullSecID(std::string sid);
92 
93 
101  explicit FullSecID(VxdID vxdID, bool subLayerID = false, unsigned int sectorNumber = 0);
102 
103 
110  FullSecID(unsigned int layerID, bool subLayerID, unsigned int sensorID, unsigned int sectorNumber);
111 
112 
115 
116 
118  short int getLayerID() const { return getLayerNumber(); }
119 
120 
122  short int getLayerNumber() const { return m_fullSecID >> LayerBitShift; }
123 
124 
126  int getLadderID() const { return getLadderNumber(); }
127 
128 
130  int getLadderNumber() const { return getVxdID().getLadderNumber(); }
131 
132 
134  bool getSubLayerID() const { return (m_fullSecID bitand SubLayerMask) >> SubLayerBitShift; }
135 
136 
138  VxdID getVxdID() const { return VxdID((m_fullSecID bitand VxdIDMask) >> VxdIDBitShift); }
139 
140 
142  unsigned short int getUniID() const { return (m_fullSecID bitand VxdIDMask) >> VxdIDBitShift; }
143 
144 
146  short int getSecID() const { return (m_fullSecID bitand SectorMask); }
147 
148 
150  unsigned int getFullSecID() const { return m_fullSecID; }
151 
152 
154  std::string getFullSecString() const;
155 
156  protected:
158  const static int LayerBits;
159 
160 
162  const static int SubLayerBits;
163 
164 
166  const static int VxdIDBits;
167 
168 
170  const static int SectorBits;
171 
172 
174  const static int Bits;
175 
176 
178  const static int MaxLayer;
179 
180 
182  const static int MaxSubLayer;
183 
184 
186  const static int MaxVxdID;
187 
188 
190  const static int MaxSector;
191 
192 
194  const static int MaxID;
195 
196 
198  const static int LayerBitShift;
199 
200 
202  const static int SubLayerBitShift;
203 
204 
206  const static int VxdIDBitShift;
207 
208 
210  const static int SubLayerMask;
211 
212 
214  const static int VxdIDMask;
215 
216 
218  const static int SectorMask;
219 
222 
223  }; //end class SecID
225 } //end namespace Belle2
Class to identify a sector inside of the VXD.
Definition: FullSecID.h:33
int getLadderNumber() const
returns LadderID compatible with basf2 standards
Definition: FullSecID.h:130
static const int VxdIDBits
Number of bits available to store a full vxdID.
Definition: FullSecID.h:166
int getLadderID() const
returns LadderID compatible with basf2 standards
Definition: FullSecID.h:126
static const int SectorBits
Number of bits available to represent a sector.
Definition: FullSecID.h:170
std::string getFullSecString() const
returns the FullSecID coded as string compatible to secIDs stored in the xml-sectormaps
Definition: FullSecID.cc:116
static const int Bits
Total bit size of the VxdID.
Definition: FullSecID.h:174
static const int MaxVxdID
Maximum valid Sensor ID.
Definition: FullSecID.h:186
bool operator<(const FullSecID &secID) const
overloaded '<'-operator for sorting algorithms
Definition: FullSecID.h:43
bool operator==(const FullSecID &secID) const
overloaded '=='-operator for sorting algorithms
Definition: FullSecID.h:47
VxdID getVxdID() const
returns VxdID of sensor.
Definition: FullSecID.h:138
static const int MaxSubLayer
Maximum valid Ladder ID.
Definition: FullSecID.h:182
static const int SubLayerMask
mask to get subLayerID from fullSecID
Definition: FullSecID.h:210
bool equalIgnoreSubLayerID(const FullSecID &secID)
comparison which ignores the sublayer ID
Definition: FullSecID.h:50
short int getLayerNumber() const
returns LayerID compatible with basf2 standards.
Definition: FullSecID.h:122
unsigned int getFullSecID() const
returns the FullSecID coded as integer for further use (can be reconverted to FullSecID by using Full...
Definition: FullSecID.h:150
unsigned short int getUniID() const
returns uniID of sensor (basically the same as VxdID (can simply converted to vxdID(uniID)) but a tri...
Definition: FullSecID.h:142
static const int LayerBits
Number of bits available to represent a layer.
Definition: FullSecID.h:158
FullSecID(unsigned int id=0)
Constructor taking the encoded full Sec ID (int).
Definition: FullSecID.h:82
static const int SectorMask
mask to get SectorID from fullSecID
Definition: FullSecID.h:218
static const int MaxSector
Maximum valid Segment ID.
Definition: FullSecID.h:190
static const int LayerBitShift
Number of bits to shift for storing a LayerID.
Definition: FullSecID.h:198
static const int SubLayerBitShift
Number of bits to shift for storing a SubLayerID.
Definition: FullSecID.h:202
static const int MaxID
Maximum value for ID.
Definition: FullSecID.h:194
short int getLayerID() const
returns LayerID compatible with basf2 standards.
Definition: FullSecID.h:118
BaseType m_fullSecID
contains full info of current SecID.
Definition: FullSecID.h:221
bool getSubLayerID() const
returns SubLayerID which tells you whether it is useful to search for compatible sectors in the same ...
Definition: FullSecID.h:134
static const int VxdIDMask
mask to get VxdID from fullSecID
Definition: FullSecID.h:214
static const int MaxLayer
Maximum valid Layer ID.
Definition: FullSecID.h:178
~FullSecID()
Destructor.
Definition: FullSecID.h:114
static const int SubLayerBits
Number of bits available to represent a subLayer (a sublayer is 1 if current sector on sensor is in a...
Definition: FullSecID.h:162
FullSecID(const FullSecID &secID)
Copy constructor.
Definition: FullSecID.h:73
static const int VxdIDBitShift
Number of bits shift for storing a full vxdID.
Definition: FullSecID.h:206
FullSecID & operator=(const FullSecID &secID)
overloaded assignment operator
Definition: FullSecID.h:56
short int getSecID() const
returns SecID of current FullSecID (only unique for each sensor).
Definition: FullSecID.h:146
unsigned int BaseType
defines the base type used for FullSecID
Definition: FullSecID.h:38
friend std::ostream & operator<<(std::ostream &out, const FullSecID &secID)
overloaded '<<' stream operator.
Definition: FullSecID.h:68
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
baseType getLadderNumber() const
Get the ladder id.
Definition: VxdID.h:98
Abstract base class for different kinds of events.