Belle II Software development
FullSecID Class Reference

Class to identify a sector inside of the VXD. More...

#include <FullSecID.h>

Public Types

typedef unsigned int BaseType
 defines the base type used for FullSecID
 

Public Member Functions

bool operator< (const FullSecID &secID) const
 overloaded '<'-operator for sorting algorithms
 
bool operator== (const FullSecID &secID) const
 overloaded '=='-operator for sorting algorithms
 
bool equalIgnoreSubLayerID (const FullSecID &secID)
 comparison which ignores the sublayer ID
 
FullSecIDoperator= (const FullSecID &secID)
 overloaded assignment operator
 
 operator unsigned int () const
 overloaded int cast
 
 operator std::string (void) const
 overloaded string cast
 
 FullSecID (const FullSecID &secID)
 Copy constructor.
 
 FullSecID (unsigned int id=0)
 Constructor taking the encoded full Sec ID (int).
 
 FullSecID (std::string sid)
 Constructor taking the encoded full Sec ID (string).
 
 FullSecID (VxdID vxdID, bool subLayerID=false, unsigned int sectorNumber=0)
 Constructor.
 
 FullSecID (unsigned int layerID, bool subLayerID, unsigned int sensorID, unsigned int sectorNumber)
 Another contstructor which does not need a VxdID nor another coded valid FullSecID.
 
 ~FullSecID ()
 Destructor.
 
short int getLayerID () const
 returns LayerID compatible with basf2 standards.
 
short int getLayerNumber () const
 returns LayerID compatible with basf2 standards.
 
int getLadderID () const
 returns LadderID compatible with basf2 standards
 
int getLadderNumber () const
 returns LadderID compatible with basf2 standards
 
bool getSubLayerID () const
 returns SubLayerID which tells you whether it is useful to search for compatible sectors in the same layer as well.
 
VxdID getVxdID () const
 returns VxdID of sensor.
 
unsigned short int getUniID () const
 returns uniID of sensor (basically the same as VxdID (can simply converted to vxdID(uniID)) but a trifle faster when only the short int value storing the VxdID information is wanted).
 
short int getSecID () const
 returns SecID of current FullSecID (only unique for each sensor).
 
unsigned int getFullSecID () const
 returns the FullSecID coded as integer for further use (can be reconverted to FullSecID by using FullSecID(value))
 
std::string getFullSecString () const
 returns the FullSecID coded as string compatible to secIDs stored in the xml-sectormaps
 

Protected Attributes

BaseType m_fullSecID
 contains full info of current SecID.
 

Static Protected Attributes

static const int LayerBits = 4
 Number of bits available to represent a layer.
 
static const int SubLayerBits = 1
 Number of bits available to represent a subLayer (a sublayer is 1 if current sector on sensor is in an overlapping region, where it is possible that an inner hit of the same track could be on the same layer)
 
static const int VxdIDBits = 16
 Number of bits available to store a full vxdID.
 
static const int SectorBits = 11
 Number of bits available to represent a sector.
 
static const int Bits = LayerBits + SubLayerBits + VxdIDBits + SectorBits
 Total bit size of the VxdID.
 
static const int MaxLayer = (1 << LayerBits) - 1
 Maximum valid Layer ID.
 
static const int MaxSubLayer = (1 << SubLayerBits) - 1
 Maximum valid Ladder ID.
 
static const int MaxVxdID = (1 << VxdIDBits) - 1
 Maximum valid Sensor ID.
 
static const int MaxSector = (1 << SectorBits) - 1
 Maximum valid Segment ID.
 
static const int MaxID = std::numeric_limits<unsigned int>::max()
 Maximum value for ID.
 
static const int LayerBitShift = SubLayerBits + VxdIDBits + SectorBits
 Number of bits to shift for storing a LayerID.
 
static const int SubLayerBitShift = VxdIDBits + SectorBits
 Number of bits to shift for storing a SubLayerID.
 
static const int VxdIDBitShift = SectorBits
 Number of bits shift for storing a full vxdID.
 
static const int SubLayerMask = MaxSubLayer << SubLayerBitShift
 mask to get subLayerID from fullSecID
 
static const int VxdIDMask = MaxVxdID << VxdIDBitShift
 mask to get VxdID from fullSecID
 
static const int SectorMask = MaxSector
 mask to get SectorID from fullSecID
 

Friends

std::ostream & operator<< (std::ostream &out, const FullSecID &secID)
 overloaded '<<' stream operator.
 

Detailed Description

Class to identify a sector inside of the VXD.

It allows to uniquely identify a SecID within the Vxd-SectorMap: The following information is coded into the FullSecID: Layer: bits 0 - 3 (Values 0-15, calculated using shift: 28) SubLayer: bits 4 (Values 0,1, calculated using: 27) VxdID: bits 5 - 21 (Values: whole range of VxdIDs, calculated using: 11) SecID: bits 22 - 32 ( Values: 0 up to 2047)

Definition at line 33 of file FullSecID.h.

Member Typedef Documentation

◆ BaseType

typedef unsigned int BaseType

defines the base type used for FullSecID

Definition at line 38 of file FullSecID.h.

Constructor & Destructor Documentation

◆ FullSecID() [1/5]

FullSecID ( const FullSecID secID)
inline

Copy constructor.

Definition at line 73 of file FullSecID.h.

73: m_fullSecID(secID.m_fullSecID) {}
BaseType m_fullSecID
contains full info of current SecID.
Definition: FullSecID.h:221

◆ FullSecID() [2/5]

FullSecID ( unsigned int  id = 0)
inlineexplicit

Constructor taking the encoded full Sec ID (int).

use this one if you have got an already existing integer storing the FullSecID information and you want the possibility to extract its entries (layer, sublayer, vxdID, secID)

Parameters
idNumber of the SecID using the encoded format. Careful - SecIDs are not continuously within the encoded number. The default is set to zero which represents the secID of the IP

Definition at line 82 of file FullSecID.h.

82 :
83 m_fullSecID(id) {}

◆ FullSecID() [3/5]

FullSecID ( std::string  sid)
explicit

Constructor taking the encoded full Sec ID (string).

use this one if you want to convert a string-encoded sector into the internal version (e.g. provided by the xml-files storing a sectormap) into the internal version. This constructor should be dispensable after changing from xml-based data storage to sql-storage

Parameters
sidglobal secID encoded in a string file eg "41_12345_3" 41 means layer 4, sublayer 1, 12345 is a dummy for the integer-version of the VxdID and the last digit is the local secID on the sensor

Definition at line 43 of file FullSecID.cc.

44{
45 std::vector<std::string> stringSegments;
46 boost::split(stringSegments, sid, boost::is_any_of("_"));
47
48 unsigned int LayerID = stringSegments[0][0] -
49 '0'; // since chars are (compared to strings) very problematic to convert to ints, this solution is very dirty but at least it's short and easy to read.
50 unsigned int SubLayerID = 0;
51 if (stringSegments[0].size() > 1) {
52 SubLayerID = stringSegments[0][1] - '0';
53 }
54// unsigned int SubLayerID = stringSegments[0][1] - '0';
55 unsigned int UniID = std::stoi(stringSegments[1]); // C++03: atoi(stringSegments[1].c_str());
56 unsigned int sectorNumber = std::stoi(stringSegments[2]); // atoi(stringSegments[2].c_str());
57 B2DEBUG(29, "FullSecID-constructor: Value before converting: " << sid << ", after converting: layerID " << LayerID <<
58 ", subLayerID " << SubLayerID << ", UniID " << UniID << ", secID " << sectorNumber);
59 assert(LayerID < MaxLayer + 1);
60 assert(SubLayerID < MaxSubLayer + 1);
61 assert(UniID < MaxVxdID + 1);
62 assert(sectorNumber < MaxSector + 1);
63
64 LayerID <<= LayerBitShift;
65 SubLayerID <<= SubLayerBitShift;
66 UniID <<= VxdIDBitShift;
67 m_fullSecID = LayerID | SubLayerID | UniID | sectorNumber;
68}
static const int MaxVxdID
Maximum valid Sensor ID.
Definition: FullSecID.h:186
static const int MaxSubLayer
Maximum valid Ladder ID.
Definition: FullSecID.h:182
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 MaxLayer
Maximum valid Layer ID.
Definition: FullSecID.h:178
static const int VxdIDBitShift
Number of bits shift for storing a full vxdID.
Definition: FullSecID.h:206

◆ FullSecID() [4/5]

FullSecID ( VxdID  vxdID,
bool  subLayerID = false,
unsigned int  sectorNumber = 0 
)
explicit

Constructor.

If you want to create a new Full Sec ID using the information which shall be stored there (e.g. layer, sublayer, vxdID, secID)

Parameters
vxdIDfull VxdID of sensor of current sector.
subLayerID0 if not in overlapping area of sensor, 1 if within overlap.
sectorNumbernumber of sector at current sensor/vxdID.

Definition at line 72 of file FullSecID.cc.

72 :
73 m_fullSecID(0) // setting to 0 to be sure that value is 0 when using it within the brackets
74{
75 unsigned int LayerID = vxdID.getLayerNumber();
76 unsigned int SubLayerID = subLayerID; // converting to int
77 unsigned int UniID = vxdID;
78
79 B2DEBUG(28, "FullSecID-constructor: LayerID " << LayerID << ", MaxLayer " << MaxLayer << ", SubLayerID " << SubLayerID <<
80 ", MaxSubLayer " << MaxSubLayer << ", UniID " << UniID << ", MaxVxdID " << MaxVxdID << ", sectorNumber " << sectorNumber <<
81 ", MaxSector " << MaxSector);
82 assert(LayerID < MaxLayer + 1);
83 assert(SubLayerID < MaxSubLayer + 1);
84 assert(UniID < MaxVxdID + 1);
85 assert(sectorNumber < MaxSector + 1);
86
87 LayerID <<= LayerBitShift;
88 SubLayerID <<= SubLayerBitShift;
89 UniID <<= VxdIDBitShift;
90 m_fullSecID = LayerID | SubLayerID | UniID | sectorNumber; // should be the same as below
91// m_fullSecID = LayerID + SubLayerID + UniID + sectorNumber; // should be the same as above
92}
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:96

◆ FullSecID() [5/5]

FullSecID ( unsigned int  layerID,
bool  subLayerID,
unsigned int  sensorID,
unsigned int  sectorNumber 
)

Another contstructor which does not need a VxdID nor another coded valid FullSecID.

Parameters
layerIDset here the layer number as an ID...
subLayerID0 if not in overlapping area of sensor, 1 if within overlap.
sensorIDan ID representing the sensorID (e.g. uniID/vxdID).
sectorNumbernumber of sector at current sensor/vxdID.

Definition at line 96 of file FullSecID.cc.

97{
98 unsigned int SubLayerID = subLayerID; // converting to int
99 B2DEBUG(28, "FullSecID-constructor: LayerID " << layerID << ", MaxLayer " << MaxLayer << ", SubLayerID " << subLayerID <<
100 ", MaxSubLayer " << MaxSubLayer << ", UniID " << sensorID << ", MaxVxdID " << MaxVxdID << ", sectorNumber " << sectorNumber <<
101 ", MaxSector " << MaxSector);
102 assert(layerID < MaxLayer + 1);
103 assert(SubLayerID < MaxSubLayer + 1);
104 assert(sensorID < MaxVxdID + 1);
105 assert(sectorNumber < MaxSector + 1);
106
107 layerID <<= LayerBitShift;
108 SubLayerID <<= SubLayerBitShift;
109 sensorID <<= VxdIDBitShift;
110 m_fullSecID = layerID | SubLayerID | sensorID | sectorNumber;
111 B2DEBUG(28, " m_fullSecID/binary: " << m_fullSecID << "/" << std::bitset<32>(m_fullSecID) << "\n, secID/binary: " << sectorNumber
112 << "/" << std::bitset<32>(sectorNumber) << ", layerID-binary: " << std::bitset<32>(layerID) << "\n, SubLayerID-binary: " <<
113 std::bitset<32>(SubLayerID) << ", sensorID-binary: " << std::bitset<32>(sensorID));
114}

◆ ~FullSecID()

~FullSecID ( )
inline

Destructor.

Definition at line 114 of file FullSecID.h.

114{}

Member Function Documentation

◆ equalIgnoreSubLayerID()

bool equalIgnoreSubLayerID ( const FullSecID secID)
inline

comparison which ignores the sublayer ID

Definition at line 50 of file FullSecID.h.

51 {
52 return ((~FullSecID::SubLayerMask)&m_fullSecID) == ((~FullSecID::SubLayerMask)&secID.m_fullSecID);
53 }
static const int SubLayerMask
mask to get subLayerID from fullSecID
Definition: FullSecID.h:210
~FullSecID()
Destructor.
Definition: FullSecID.h:114

◆ getFullSecID()

unsigned int getFullSecID ( ) const
inline

returns the FullSecID coded as integer for further use (can be reconverted to FullSecID by using FullSecID(value))

Definition at line 150 of file FullSecID.h.

150{ return m_fullSecID; }

◆ getFullSecString()

std::string getFullSecString ( ) const

returns the FullSecID coded as string compatible to secIDs stored in the xml-sectormaps

Definition at line 116 of file FullSecID.cc.

117{
118 if (getLayerID() == 0) {
119 return (boost::format("0%1%_000_%2%") % getLayerID() % getSecID()).str();
120 }
121 return (boost::format("%1%%2%_%3%_%4%") % getLayerID() % getSubLayerID() % getUniID() %
122 getSecID()).str(); // WARNING this bypasses the following code - intended?
123// if (getLayerID() == 0) {
124// return (boost::format("%1%%2%_0.0.0_%3%") % getLayerID() % getSubLayerID() % getSecID()).str();
125// }
126// return (boost::format("%1%%2%_%3%.%4%.%5%_%6%") % getLayerID() % getSubLayerID() % getVxdID().getLayerNumber() % getVxdID().getLadderNumber() % getVxdID().getSensorNumber() % getSecID()).str();
127}
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
short int getLayerID() const
returns LayerID compatible with basf2 standards.
Definition: FullSecID.h:118
bool getSubLayerID() const
returns SubLayerID which tells you whether it is useful to search for compatible sectors in the same ...
Definition: FullSecID.h:134
short int getSecID() const
returns SecID of current FullSecID (only unique for each sensor).
Definition: FullSecID.h:146

◆ getLadderID()

int getLadderID ( ) const
inline

returns LadderID compatible with basf2 standards

Definition at line 126 of file FullSecID.h.

126{ return getLadderNumber(); }
int getLadderNumber() const
returns LadderID compatible with basf2 standards
Definition: FullSecID.h:130

◆ getLadderNumber()

int getLadderNumber ( ) const
inline

returns LadderID compatible with basf2 standards

Definition at line 130 of file FullSecID.h.

130{ return getVxdID().getLadderNumber(); }
VxdID getVxdID() const
returns VxdID of sensor.
Definition: FullSecID.h:138
baseType getLadderNumber() const
Get the ladder id.
Definition: VxdID.h:98

◆ getLayerID()

short int getLayerID ( ) const
inline

returns LayerID compatible with basf2 standards.

Definition at line 118 of file FullSecID.h.

118{ return getLayerNumber(); }
short int getLayerNumber() const
returns LayerID compatible with basf2 standards.
Definition: FullSecID.h:122

◆ getLayerNumber()

short int getLayerNumber ( ) const
inline

returns LayerID compatible with basf2 standards.

Definition at line 122 of file FullSecID.h.

122{ return m_fullSecID >> LayerBitShift; }

◆ getSecID()

short int getSecID ( ) const
inline

returns SecID of current FullSecID (only unique for each sensor).

Definition at line 146 of file FullSecID.h.

146{ return (m_fullSecID bitand SectorMask); }
static const int SectorMask
mask to get SectorID from fullSecID
Definition: FullSecID.h:218

◆ getSubLayerID()

bool getSubLayerID ( ) const
inline

returns SubLayerID which tells you whether it is useful to search for compatible sectors in the same layer as well.

Definition at line 134 of file FullSecID.h.

134{ return (m_fullSecID bitand SubLayerMask) >> SubLayerBitShift; }

◆ getUniID()

unsigned short int getUniID ( ) const
inline

returns uniID of sensor (basically the same as VxdID (can simply converted to vxdID(uniID)) but a trifle faster when only the short int value storing the VxdID information is wanted).

Definition at line 142 of file FullSecID.h.

142{ return (m_fullSecID bitand VxdIDMask) >> VxdIDBitShift; }
static const int VxdIDMask
mask to get VxdID from fullSecID
Definition: FullSecID.h:214

◆ getVxdID()

VxdID getVxdID ( ) const
inline

returns VxdID of sensor.

Definition at line 138 of file FullSecID.h.

138{ return VxdID((m_fullSecID bitand VxdIDMask) >> VxdIDBitShift); }

◆ operator std::string()

operator std::string ( void  ) const
inline

overloaded string cast

Definition at line 64 of file FullSecID.h.

64{ return getFullSecString(); }
std::string getFullSecString() const
returns the FullSecID coded as string compatible to secIDs stored in the xml-sectormaps
Definition: FullSecID.cc:116

◆ operator unsigned int()

operator unsigned int ( ) const
inline

overloaded int cast

Definition at line 60 of file FullSecID.h.

60{ return m_fullSecID; }

◆ operator<()

bool operator< ( const FullSecID secID) const
inline

overloaded '<'-operator for sorting algorithms

Definition at line 43 of file FullSecID.h.

43{ return m_fullSecID < secID.m_fullSecID; }

◆ operator=()

FullSecID & operator= ( const FullSecID secID)
inline

overloaded assignment operator

Definition at line 56 of file FullSecID.h.

56{ m_fullSecID = secID.m_fullSecID; return *this; }

◆ operator==()

bool operator== ( const FullSecID secID) const
inline

overloaded '=='-operator for sorting algorithms

Definition at line 47 of file FullSecID.h.

47{ return m_fullSecID == secID.m_fullSecID; }

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const FullSecID secID 
)
friend

overloaded '<<' stream operator.

Print secID to stream by converting it to string

Definition at line 68 of file FullSecID.h.

68{ out << secID.getFullSecString(); return out; }

Member Data Documentation

◆ Bits

const int Bits = LayerBits + SubLayerBits + VxdIDBits + SectorBits
staticprotected

Total bit size of the VxdID.

Definition at line 174 of file FullSecID.h.

◆ LayerBits

const int LayerBits = 4
staticprotected

Number of bits available to represent a layer.

Definition at line 158 of file FullSecID.h.

◆ LayerBitShift

const int LayerBitShift = SubLayerBits + VxdIDBits + SectorBits
staticprotected

Number of bits to shift for storing a LayerID.

Definition at line 198 of file FullSecID.h.

◆ m_fullSecID

BaseType m_fullSecID
protected

contains full info of current SecID.

Check class definition for detailed description

Definition at line 221 of file FullSecID.h.

◆ MaxID

const int MaxID = std::numeric_limits<unsigned int>::max()
staticprotected

Maximum value for ID.

Definition at line 194 of file FullSecID.h.

◆ MaxLayer

const int MaxLayer = (1 << LayerBits) - 1
staticprotected

Maximum valid Layer ID.

Definition at line 178 of file FullSecID.h.

◆ MaxSector

const int MaxSector = (1 << SectorBits) - 1
staticprotected

Maximum valid Segment ID.

Definition at line 190 of file FullSecID.h.

◆ MaxSubLayer

const int MaxSubLayer = (1 << SubLayerBits) - 1
staticprotected

Maximum valid Ladder ID.

Definition at line 182 of file FullSecID.h.

◆ MaxVxdID

const int MaxVxdID = (1 << VxdIDBits) - 1
staticprotected

Maximum valid Sensor ID.

Definition at line 186 of file FullSecID.h.

◆ SectorBits

const int SectorBits = 11
staticprotected

Number of bits available to represent a sector.

Definition at line 170 of file FullSecID.h.

◆ SectorMask

const int SectorMask = MaxSector
staticprotected

mask to get SectorID from fullSecID

Definition at line 218 of file FullSecID.h.

◆ SubLayerBits

const int SubLayerBits = 1
staticprotected

Number of bits available to represent a subLayer (a sublayer is 1 if current sector on sensor is in an overlapping region, where it is possible that an inner hit of the same track could be on the same layer)

Definition at line 162 of file FullSecID.h.

◆ SubLayerBitShift

const int SubLayerBitShift = VxdIDBits + SectorBits
staticprotected

Number of bits to shift for storing a SubLayerID.

Definition at line 202 of file FullSecID.h.

◆ SubLayerMask

const int SubLayerMask = MaxSubLayer << SubLayerBitShift
staticprotected

mask to get subLayerID from fullSecID

Definition at line 210 of file FullSecID.h.

◆ VxdIDBits

const int VxdIDBits = 16
staticprotected

Number of bits available to store a full vxdID.

Definition at line 166 of file FullSecID.h.

◆ VxdIDBitShift

const int VxdIDBitShift = SectorBits
staticprotected

Number of bits shift for storing a full vxdID.

Definition at line 206 of file FullSecID.h.

◆ VxdIDMask

const int VxdIDMask = MaxVxdID << VxdIDBitShift
staticprotected

mask to get VxdID from fullSecID

Definition at line 214 of file FullSecID.h.


The documentation for this class was generated from the following files: