9 #include "tracking/dataobjects/FullSecID.h"
10 #include <framework/logging/Logger.h>
13 #include <boost/format.hpp>
16 #include <boost/algorithm/string.hpp>
25 const int FullSecID::LayerBits = 4;
26 const int FullSecID::SubLayerBits = 1;
27 const int FullSecID::VxdIDBits = 16;
28 const int FullSecID::SectorBits = 11;
29 const int FullSecID::Bits = LayerBits + SubLayerBits + VxdIDBits + SectorBits;
30 const int FullSecID::MaxLayer = (1 << LayerBits) - 1;
31 const int FullSecID::MaxSubLayer = (1 << SubLayerBits) - 1;
32 const int FullSecID::MaxVxdID = (1 << VxdIDBits) - 1;
33 const int FullSecID::MaxSector = (1 << SectorBits) - 1;
34 const int FullSecID::MaxID = std::numeric_limits<unsigned int>::max();
35 const int FullSecID::LayerBitShift = SubLayerBits + VxdIDBits + SectorBits;
36 const int FullSecID::SubLayerBitShift = VxdIDBits + SectorBits;
37 const int FullSecID::VxdIDBitShift = SectorBits;
38 const int FullSecID::SubLayerMask = MaxSubLayer << SubLayerBitShift;
39 const int FullSecID::VxdIDMask = MaxVxdID << VxdIDBitShift;
40 const int FullSecID::SectorMask = MaxSector;
44 FullSecID::FullSecID(std::string sid)
46 vector<string> stringSegments;
47 boost::split(stringSegments, sid, boost::is_any_of(
"_"));
49 unsigned int LayerID = stringSegments[0][0] -
51 unsigned int SubLayerID = 0;
52 if (stringSegments[0].size() > 1) {
53 SubLayerID = stringSegments[0][1] -
'0';
56 unsigned int UniID = std::stoi(stringSegments[1]);
57 unsigned int sectorNumber = std::stoi(stringSegments[2]);
58 B2DEBUG(1000,
"FullSecID-constructor: Value before converting: " << sid <<
", after converting: layerID " << LayerID <<
59 ", subLayerID " << SubLayerID <<
", UniID " << UniID <<
", secID " << sectorNumber);
60 assert(LayerID < MaxLayer + 1);
61 assert(SubLayerID < MaxSubLayer + 1);
62 assert(UniID < MaxVxdID + 1);
63 assert(sectorNumber < MaxSector + 1);
65 LayerID <<= LayerBitShift;
66 SubLayerID <<= SubLayerBitShift;
67 UniID <<= VxdIDBitShift;
68 m_fullSecID = LayerID | SubLayerID | UniID | sectorNumber;
73 FullSecID::FullSecID(
VxdID vxdID,
bool subLayerID,
unsigned int sectorNumber):
77 unsigned int SubLayerID = subLayerID;
78 unsigned int UniID = vxdID;
80 B2DEBUG(175,
"FullSecID-constructor: LayerID " << LayerID <<
", MaxLayer " <<
MaxLayer <<
", SubLayerID " << SubLayerID <<
81 ", MaxSubLayer " <<
MaxSubLayer <<
", UniID " << UniID <<
", MaxVxdID " <<
MaxVxdID <<
", sectorNumber " << sectorNumber <<
91 m_fullSecID = LayerID | SubLayerID | UniID | sectorNumber;
97 FullSecID::FullSecID(
unsigned int layerID,
bool subLayerID,
unsigned int sensorID,
unsigned int sectorNumber)
99 unsigned int SubLayerID = subLayerID;
100 B2DEBUG(175,
"FullSecID-constructor: LayerID " << layerID <<
", MaxLayer " <<
MaxLayer <<
", SubLayerID " << subLayerID <<
101 ", MaxSubLayer " <<
MaxSubLayer <<
", UniID " << sensorID <<
", MaxVxdID " <<
MaxVxdID <<
", sectorNumber " << sectorNumber <<
111 m_fullSecID = layerID | SubLayerID | sensorID | sectorNumber;
112 B2DEBUG(175,
" m_fullSecID/binary: " <<
m_fullSecID <<
"/" << std::bitset<32>(
m_fullSecID) <<
"\n, secID/binary: " << sectorNumber
113 <<
"/" << std::bitset<32>(sectorNumber) <<
", layerID-binary: " << std::bitset<32>(layerID) <<
"\n, SubLayerID-binary: " <<
114 std::bitset<32>(SubLayerID) <<
", sensorID-binary: " << std::bitset<32>(sensorID));
std::string getFullSecString() const
returns the FullSecID coded as string compatible to secIDs stored in the xml-sectormaps
static const int MaxVxdID
Maximum valid Sensor ID.
static const int MaxSubLayer
Maximum valid Ladder ID.
unsigned short int getUniID() const
returns uniID of sensor (basically the same as VxdID (can simply converted to vxdID(uniID)) but a tri...
static const int MaxSector
Maximum valid Segment ID.
static const int LayerBitShift
Number of bits to shift for storing a LayerID.
static const int SubLayerBitShift
Number of bits to shift for storing a SubLayerID.
short int getLayerID() const
returns LayerID compatible with basf2 standards.
BaseType m_fullSecID
contains full info of current SecID.
bool getSubLayerID() const
returns SubLayerID which tells you whether it is useful to search for compatible sectors in the same ...
static const int MaxLayer
Maximum valid Layer ID.
FullSecID(const FullSecID &secID)
Copy constructor.
static const int VxdIDBitShift
Number of bits shift for storing a full vxdID.
short int getSecID() const
returns SecID of current FullSecID (only unique for each sensor).
Class to uniquely identify a any structure of the PXD and SVD.
baseType getLayerNumber() const
Get the layer id.
Abstract base class for different kinds of events.