ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrkrDefs.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrkrDefs.cc
1 #include "TrkrDefs.h"
2 
3 #include <bitset>
4 
5 
6 void TrkrDefs::printBits(const TrkrDefs::hitsetkey key, std::ostream& os)
7 {
8  os << "key: " << std::bitset<32>(key) << std::endl;
9 }
10 
11 void TrkrDefs::printBits(const TrkrDefs::cluskey key, std::ostream& os)
12 {
13  os << "key: " << std::bitset<64>(key) << std::endl;
14 }
15 
16 uint8_t
18 {
19  TrkrDefs::hitsetkey tmp = (key >> kBitShiftTrkrId);
20  return tmp;
21 }
22 
23 uint8_t
25 {
26  TrkrDefs::hitsetkey tmp = (key >> kBitShiftClusId);
27  return getTrkrId(tmp);
28 }
29 
30 uint8_t
32 {
33  TrkrDefs::hitsetkey tmp = (key >> kBitShiftLayer);
34  return tmp;
35 }
36 
37 uint8_t
39 {
40  TrkrDefs::hitsetkey tmp = (key >> kBitShiftClusId);
41  return getLayer(tmp);
42 }
43 
44 uint32_t
46 {
47  return key;
48 }
49 
50 uint32_t
52 {
53  return (key >> kBitShiftClusId);
54 }
55 
58 {
59  return genHitSetKey(trkrId, 0);
60 }
61 
64 {
65  return genHitSetKey(static_cast<TrkrDefs::TrkrId>(trkrId + 1), 0) - 1;
66 }
67 
69 TrkrDefs::getHitSetKeyLo(const TrkrDefs::TrkrId trkrId, const uint8_t lyr)
70 {
71  return genHitSetKey(trkrId, lyr);
72 }
73 
75 TrkrDefs::getHitSetKeyHi(const TrkrDefs::TrkrId trkrId, const uint8_t lyr)
76 {
77  return genHitSetKey(trkrId, lyr + 1) - 1;
78 }
79 
82 {
83  TrkrDefs::cluskey tmp = genHitSetKey(trkrId, 0);
84  return (tmp << kBitShiftClusId);
85 }
86 
89 {
90  TrkrDefs::cluskey tmp = genHitSetKey(static_cast<TrkrDefs::TrkrId>(trkrId + 1), 0);
91  return (tmp << kBitShiftClusId) - 1;
92 }
93 
95 TrkrDefs::getClusKeyLo(const TrkrDefs::TrkrId trkrId, const uint8_t lyr)
96 {
97  TrkrDefs::cluskey tmp = genHitSetKey(trkrId, lyr);
98  return (tmp << kBitShiftClusId);
99 }
100 
102 TrkrDefs::getClusKeyHi(const TrkrDefs::TrkrId trkrId, const uint8_t lyr)
103 {
104  TrkrDefs::cluskey tmp = genHitSetKey(trkrId, lyr + 1);
105  return (tmp << kBitShiftClusId) - 1;
106 }
107 
109 TrkrDefs::genHitSetKey(const TrkrDefs::TrkrId trkrId, const uint8_t lyr)
110 {
111  TrkrDefs::hitsetkey tmp = trkrId;
112  TrkrDefs::hitsetkey key = tmp << kBitShiftTrkrId; // detector id
113  tmp = lyr;
114  key |= (tmp << kBitShiftLayer); // layer
115  return key;
116 }
117 
118 
120 {
121  TrkrDefs::hitsetkey tmp = (key >> TrkrDefs::kBitShiftPhiElement);
122  return tmp;
123 }
124 
125 
126 
128 {
129  TrkrDefs::hitsetkey tmp = (key >> TrkrDefs::kBitShiftZElement);
130  return tmp;
131 }
132 
134 {
135  TrkrDefs::hitsetkey tmp = (key >> TrkrDefs::kBitShiftClusId);
136  return getPhiElement(tmp);
137 }
138 
140 {
141  TrkrDefs::hitsetkey tmp = (key >> TrkrDefs::kBitShiftClusId);
142  return getZElement(tmp);
143 }