11 #include "tracking/dataobjects/FullSecID.h"
12 #include <framework/logging/Logger.h>
15 #include <boost/format.hpp>
18 #include <boost/algorithm/string.hpp>
27 const int FullSecID::LayerBits = 4;
28 const int FullSecID::SubLayerBits = 1;
29 const int FullSecID::VxdIDBits = 16;
30 const int FullSecID::SectorBits = 11;
31 const int FullSecID::Bits = LayerBits + SubLayerBits + VxdIDBits + SectorBits;
32 const int FullSecID::MaxLayer = (1 << LayerBits) - 1;
33 const int FullSecID::MaxSubLayer = (1 << SubLayerBits) - 1;
34 const int FullSecID::MaxVxdID = (1 << VxdIDBits) - 1;
35 const int FullSecID::MaxSector = (1 << SectorBits) - 1;
36 const int FullSecID::MaxID = std::numeric_limits<unsigned int>::max();
37 const int FullSecID::LayerBitShift = SubLayerBits + VxdIDBits + SectorBits;
38 const int FullSecID::SubLayerBitShift = VxdIDBits + SectorBits;
39 const int FullSecID::VxdIDBitShift = SectorBits;
40 const int FullSecID::SubLayerMask = MaxSubLayer << SubLayerBitShift;
41 const int FullSecID::VxdIDMask = MaxVxdID << VxdIDBitShift;
42 const int FullSecID::SectorMask = MaxSector;
46 FullSecID::FullSecID(std::string sid)
48 vector<string> stringSegments;
49 boost::split(stringSegments, sid, boost::is_any_of(
"_"));
51 unsigned int LayerID = stringSegments[0][0] -
53 unsigned int SubLayerID = 0;
54 if (stringSegments[0].size() > 1) {
55 SubLayerID = stringSegments[0][1] -
'0';
58 unsigned int UniID = std::stoi(stringSegments[1]);
59 unsigned int sectorNumber = std::stoi(stringSegments[2]);
60 B2DEBUG(1000,
"FullSecID-constructor: Value before converting: " << sid <<
", after converting: layerID " << LayerID <<
61 ", subLayerID " << SubLayerID <<
", UniID " << UniID <<
", secID " << sectorNumber);
62 assert(LayerID < MaxLayer + 1);
63 assert(SubLayerID < MaxSubLayer + 1);
64 assert(UniID < MaxVxdID + 1);
65 assert(sectorNumber < MaxSector + 1);
67 LayerID <<= LayerBitShift;
68 SubLayerID <<= SubLayerBitShift;
69 UniID <<= VxdIDBitShift;
70 m_fullSecID = LayerID | SubLayerID | UniID | sectorNumber;
75 FullSecID::FullSecID(
VxdID vxdID,
bool subLayerID,
unsigned int sectorNumber):
79 unsigned int SubLayerID = subLayerID;
80 unsigned int UniID = vxdID;
82 B2DEBUG(175,
"FullSecID-constructor: LayerID " << LayerID <<
", MaxLayer " <<
MaxLayer <<
", SubLayerID " << SubLayerID <<
83 ", MaxSubLayer " <<
MaxSubLayer <<
", UniID " << UniID <<
", MaxVxdID " <<
MaxVxdID <<
", sectorNumber " << sectorNumber <<
93 m_fullSecID = LayerID | SubLayerID | UniID | sectorNumber;
99 FullSecID::FullSecID(
unsigned int layerID,
bool subLayerID,
unsigned int sensorID,
unsigned int sectorNumber)
101 unsigned int SubLayerID = subLayerID;
102 B2DEBUG(175,
"FullSecID-constructor: LayerID " << layerID <<
", MaxLayer " <<
MaxLayer <<
", SubLayerID " << subLayerID <<
103 ", MaxSubLayer " <<
MaxSubLayer <<
", UniID " << sensorID <<
", MaxVxdID " <<
MaxVxdID <<
", sectorNumber " << sectorNumber <<
113 m_fullSecID = layerID | SubLayerID | sensorID | sectorNumber;
114 B2DEBUG(175,
" m_fullSecID/binary: " <<
m_fullSecID <<
"/" << std::bitset<32>(
m_fullSecID) <<
"\n, secID/binary: " << sectorNumber
115 <<
"/" << std::bitset<32>(sectorNumber) <<
", layerID-binary: " << std::bitset<32>(layerID) <<
"\n, SubLayerID-binary: " <<
116 std::bitset<32>(SubLayerID) <<
", sensorID-binary: " << std::bitset<32>(sensorID));