Belle II Software  release-05-02-19
FullSecID.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jakob Lettenbichler *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 
12 #pragma once
13 
14 #include <vxd/dataobjects/VxdID.h>
15 #include <string>
16 #include <ostream>
17 
18 
19 
20 namespace Belle2 {
35  class FullSecID {
36  public:
37 
38 
40  typedef unsigned int BaseType;
41 
42 
43  // starting with operator overloading...
45  bool operator<(const FullSecID& secID) const { return m_fullSecID < secID.m_fullSecID; }
46 
47 
49  bool operator==(const FullSecID& secID) const { return m_fullSecID == secID.m_fullSecID; }
50 
52  bool equalIgnoreSubLayerID(const FullSecID& secID)
53  {
54  return ((~FullSecID::SubLayerMask)&m_fullSecID) == ((~FullSecID::SubLayerMask)&secID.m_fullSecID);
55  }
56 
58  FullSecID& operator=(const FullSecID& secID) { m_fullSecID = secID.m_fullSecID; return *this; }
59 
60 
62  operator unsigned int() const { return m_fullSecID; }
63 
64 
66  operator std::string(void) const { return getFullSecString(); }
67 
68 
70  friend std::ostream& operator<< (std::ostream& out, const FullSecID& secID) { out << secID.getFullSecString(); return out; }
71 
72 
73  // constructors...
75  FullSecID(const FullSecID& secID): m_fullSecID(secID.m_fullSecID) {}
76 
77 
84  explicit FullSecID(unsigned int id = 0):
85  m_fullSecID(id) {}
86 
87 
93  explicit FullSecID(std::string sid);
94 
95 
103  explicit FullSecID(VxdID vxdID, bool subLayerID = false, unsigned int sectorNumber = 0);
104 
105 
112  FullSecID(unsigned int layerID, bool subLayerID, unsigned int sensorID, unsigned int sectorNumber);
113 
114 
116  ~FullSecID() {}
117 
118 
120  short int getLayerID() const { return getLayerNumber(); }
121 
122 
124  short int getLayerNumber() const { return m_fullSecID >> LayerBitShift; }
125 
126 
128  int getLadderID() const { return getLadderNumber(); }
129 
130 
132  int getLadderNumber() const { return getVxdID().getLadderNumber(); }
133 
134 
136  bool getSubLayerID() const { return (m_fullSecID bitand SubLayerMask) >> SubLayerBitShift; }
137 
138 
140  VxdID getVxdID() const { return VxdID((m_fullSecID bitand VxdIDMask) >> VxdIDBitShift); }
141 
142 
144  unsigned short int getUniID() const { return (m_fullSecID bitand VxdIDMask) >> VxdIDBitShift; }
145 
146 
148  short int getSecID() const { return (m_fullSecID bitand SectorMask); }
149 
150 
152  unsigned int getFullSecID() const { return m_fullSecID; }
153 
154 
156  std::string getFullSecString() const;
157 
158  protected:
160  const static int LayerBits;
161 
162 
164  const static int SubLayerBits;
165 
166 
168  const static int VxdIDBits;
169 
170 
172  const static int SectorBits;
173 
174 
176  const static int Bits;
177 
178 
180  const static int MaxLayer;
181 
182 
184  const static int MaxSubLayer;
185 
186 
188  const static int MaxVxdID;
189 
190 
192  const static int MaxSector;
193 
194 
196  const static int MaxID;
197 
198 
200  const static int LayerBitShift;
201 
202 
204  const static int SubLayerBitShift;
205 
206 
208  const static int VxdIDBitShift;
209 
210 
212  const static int SubLayerMask;
213 
214 
216  const static int VxdIDMask;
217 
218 
220  const static int SectorMask;
221 
224 
225  }; //end class SecID
227 } //end namespace Belle2
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::FullSecID::operator==
bool operator==(const FullSecID &secID) const
overloaded '=='-operator for sorting algorithms
Definition: FullSecID.h:57
Belle2::FullSecID::operator<<
friend std::ostream & operator<<(std::ostream &out, const FullSecID &secID)
overloaded '<<' stream operator.
Definition: FullSecID.h:78
Belle2::FullSecID::SubLayerBits
const static 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:172
Belle2::VxdID::getLadderNumber
baseType getLadderNumber() const
Get the ladder id.
Definition: VxdID.h:108
Belle2::FullSecID::getUniID
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:152
Belle2::FullSecID::VxdIDMask
const static int VxdIDMask
mask to get VxdID from fullSecID
Definition: FullSecID.h:224
Belle2::FullSecID::getVxdID
VxdID getVxdID() const
returns VxdID of sensor.
Definition: FullSecID.h:148
Belle2::FullSecID::getSubLayerID
bool getSubLayerID() const
returns SubLayerID which tells you whether it is useful to search for compatible sectors in the same ...
Definition: FullSecID.h:144
Belle2::FullSecID::operator=
FullSecID & operator=(const FullSecID &secID)
overloaded assignment operator
Definition: FullSecID.h:66
Belle2::FullSecID::MaxSubLayer
const static int MaxSubLayer
Maximum valid Ladder ID.
Definition: FullSecID.h:192
Belle2::FullSecID::LayerBitShift
const static int LayerBitShift
Number of bits to shift for storing a LayerID.
Definition: FullSecID.h:208
Belle2::FullSecID::VxdIDBits
const static int VxdIDBits
Number of bits available to store a full vxdID.
Definition: FullSecID.h:176
Belle2::FullSecID::SectorBits
const static int SectorBits
Number of bits available to represent a sector.
Definition: FullSecID.h:180
Belle2::FullSecID::m_fullSecID
BaseType m_fullSecID
contains full info of current SecID.
Definition: FullSecID.h:231
Belle2::FullSecID::equalIgnoreSubLayerID
bool equalIgnoreSubLayerID(const FullSecID &secID)
comparison which ignores the sublayer ID
Definition: FullSecID.h:60
Belle2::FullSecID::getFullSecID
unsigned int getFullSecID() const
returns the FullSecID coded as integer for further use (can be reconverted to FullSecID by using Full...
Definition: FullSecID.h:160
Belle2::FullSecID::VxdIDBitShift
const static int VxdIDBitShift
Number of bits shift for storing a full vxdID.
Definition: FullSecID.h:216
Belle2::FullSecID
Class to identify a sector inside of the VXD.
Definition: FullSecID.h:43
Belle2::FullSecID::LayerBits
const static int LayerBits
Number of bits available to represent a layer.
Definition: FullSecID.h:168
Belle2::FullSecID::BaseType
unsigned int BaseType
defines the base type used for FullSecID
Definition: FullSecID.h:48
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::FullSecID::SubLayerBitShift
const static int SubLayerBitShift
Number of bits to shift for storing a SubLayerID.
Definition: FullSecID.h:212
Belle2::FullSecID::getSecID
short int getSecID() const
returns SecID of current FullSecID (only unique for each sensor).
Definition: FullSecID.h:156
Belle2::FullSecID::SectorMask
const static int SectorMask
mask to get SectorID from fullSecID
Definition: FullSecID.h:228
Belle2::FullSecID::getLayerNumber
short int getLayerNumber() const
returns LayerID compatible with basf2 standards.
Definition: FullSecID.h:132
Belle2::FullSecID::Bits
const static int Bits
Total bit size of the VxdID.
Definition: FullSecID.h:184
Belle2::FullSecID::operator<
bool operator<(const FullSecID &secID) const
overloaded '<'-operator for sorting algorithms
Definition: FullSecID.h:53
Belle2::FullSecID::SubLayerMask
const static int SubLayerMask
mask to get subLayerID from fullSecID
Definition: FullSecID.h:220
Belle2::FullSecID::getLadderID
int getLadderID() const
returns LadderID compatible with basf2 standards
Definition: FullSecID.h:136
Belle2::FullSecID::FullSecID
FullSecID(const FullSecID &secID)
Copy constructor.
Definition: FullSecID.h:83
Belle2::FullSecID::getLayerID
short int getLayerID() const
returns LayerID compatible with basf2 standards.
Definition: FullSecID.h:128
Belle2::FullSecID::getLadderNumber
int getLadderNumber() const
returns LadderID compatible with basf2 standards
Definition: FullSecID.h:140
Belle2::FullSecID::MaxSector
const static int MaxSector
Maximum valid Segment ID.
Definition: FullSecID.h:200
Belle2::FullSecID::MaxVxdID
const static int MaxVxdID
Maximum valid Sensor ID.
Definition: FullSecID.h:196
Belle2::FullSecID::getFullSecString
std::string getFullSecString() const
returns the FullSecID coded as string compatible to secIDs stored in the xml-sectormaps
Definition: FullSecID.cc:119
Belle2::FullSecID::MaxID
const static int MaxID
Maximum value for ID.
Definition: FullSecID.h:204
Belle2::FullSecID::~FullSecID
~FullSecID()
Destructor.
Definition: FullSecID.h:124
Belle2::FullSecID::MaxLayer
const static int MaxLayer
Maximum valid Layer ID.
Definition: FullSecID.h:188