11 namespace CDCTrigger {
12 constexpr
int tsInfoWidth = 21;
14 using tsOut = std::array<unsigned, 4>;
16 tsOut decodeTSHit(std::string tsIn)
18 constexpr
unsigned lenID = 8;
19 constexpr
unsigned lenPriorityTime = 9;
20 constexpr
unsigned lenLR = 2;
21 constexpr
unsigned lenPriorityPosition = 2;
22 constexpr std::array<unsigned, 4> tsLens = {lenID, lenPriorityTime, lenLR, lenPriorityPosition};
23 std::array<unsigned, 5> tsPos = { 0 };
24 std::partial_sum(tsLens.begin(), tsLens.end(), tsPos.begin() + 1);
26 tsOutput[0] = std::bitset<tsLens[0]>(tsIn.substr(tsPos[0], tsLens[0])).to_ulong();
27 tsOutput[1] = std::bitset<tsLens[1]>(tsIn.substr(tsPos[1], tsLens[1])).to_ulong();
28 tsOutput[2] = std::bitset<tsLens[2]>(tsIn.substr(tsPos[2], tsLens[2])).to_ulong();
29 tsOutput[3] = std::bitset<tsLens[3]>(tsIn.substr(tsPos[3], tsLens[3])).to_ulong();
33 static constexpr std::array<int, 9> nWiresInSuperLayer = {160, 160, 192, 224, 256, 288, 320, 352, 384};
35 static constexpr
int nTrackers = 4;
44 unsigned short globalSegmentID(
unsigned short localID,
unsigned short iSL)
46 auto itr = nWiresInSuperLayer.begin();
47 unsigned short globalID = std::accumulate(itr, itr + iSL, 0);