1 #ifndef SiStripHitEfficiencyHelpers_H 2 #define SiStripHitEfficiencyHelpers_H 9 #include <fmt/printf.h> 19 k_LayersAtTOBEnd = 10,
20 k_LayersAtTIDEnd = 13,
21 k_LayersAtTECEnd = 22,
23 k_END_OF_LAYS_AND_RINGS = 35
30 while ((start_pos =
str.find(from, start_pos)) != std::string::npos) {
31 str.replace(start_pos, from.length(),
to);
32 start_pos +=
to.length();
36 inline unsigned int checkLayer(
unsigned int iidd,
const TrackerTopology* tTopo) {
37 switch (
DetId(iidd).subdetId()) {
41 return tTopo->
tobLayer(iidd) + bounds::k_LayersAtTIBEnd;
43 return tTopo->
tidWheel(iidd) + bounds::k_LayersAtTOBEnd;
45 return tTopo->
tecWheel(iidd) + bounds::k_LayersAtTIDEnd;
47 return bounds::k_LayersStart;
53 if (
k > bounds::k_LayersStart &&
k <= bounds::k_LayersAtTIBEnd) {
55 }
else if (
k > bounds::k_LayersAtTIBEnd &&
k <= bounds::k_LayersAtTOBEnd) {
56 return fmt::format(
"TOB L{:d}",
k - bounds::k_LayersAtTIBEnd);
57 }
else if (
k > bounds::k_LayersAtTOBEnd &&
k <= bounds::k_LayersAtTIDEnd) {
58 return fmt::format(
"TID {0}{1:d}", ringlabel,
k - bounds::k_LayersAtTOBEnd);
59 }
else if (
k > bounds::k_LayersAtTIDEnd &&
k <= bounds::k_LayersAtTIDEnd + nTEClayers) {
60 return fmt::format(
"TEC {0}{1:d}", ringlabel,
k - bounds::k_LayersAtTIDEnd);
62 return "should never be here!";
66 inline std::string layerSideName(Long_t
k,
const bool showRings,
const unsigned int nTEClayers) {
68 if (
k > bounds::k_LayersStart &&
k <= bounds::k_LayersAtTIBEnd) {
70 }
else if (
k > bounds::k_LayersAtTIBEnd &&
k <= bounds::k_LayersAtTOBEnd) {
71 return fmt::format(
"TOB L{:d}",
k - bounds::k_LayersAtTIBEnd);
72 }
else if (
k > bounds::k_LayersAtTOBEnd &&
k < 14) {
73 return fmt::format(
"TID- {0}{1:d}", ringlabel,
k - bounds::k_LayersAtTOBEnd);
74 }
else if (
k > 13 &&
k < 17) {
76 }
else if (
k > 16 &&
k < 17 + nTEClayers) {
78 }
else if (
k > 16 + nTEClayers) {
79 return fmt::format(
"TEC+ {0}{1:d}", ringlabel,
k - 16 - nTEClayers);
81 return "shoud never be here!";
90 double consistency = separation /
error;
94 inline bool isDoubleSided(
unsigned int iidd,
const TrackerTopology* tTopo) {
96 switch (
DetId(iidd).subdetId()) {
114 inline bool check2DPartner(
unsigned int iidd,
const std::vector<TrajectoryMeasurement>& traj) {
115 unsigned int partner_iidd = 0;
116 bool found2DPartner =
false;
118 if ((iidd & 0x3) == 1)
119 partner_iidd = iidd + 1;
120 if ((iidd & 0x3) == 2)
121 partner_iidd = iidd - 1;
124 for (
const auto& tm : traj) {
125 if (tm.recHit()->geographicalId().rawId() == partner_iidd) {
126 found2DPartner =
true;
129 return found2DPartner;
132 inline bool isInBondingExclusionZone(
133 unsigned int iidd,
unsigned int TKlayers,
double yloc,
double yErr,
const TrackerTopology* tTopo) {
134 constexpr
float exclusionWidth = 0.4;
135 constexpr
float TOBexclusion = 0.0;
136 constexpr
float TECexRing5 = -0.89;
137 constexpr
float TECexRing6 = -0.56;
138 constexpr
float TECexRing7 = 0.60;
142 const int ringnumber = ((iidd >> 5) & 0x7);
146 if ((TKlayers >= 5 && TKlayers < 11) || ((
subdetector == 6) && ((ringnumber >= 5) && (ringnumber <= 7)))) {
148 float highzone = 0.0;
150 float higherr = yloc + 5.0 * yErr;
151 float lowerr = yloc - 5.0 * yErr;
152 if (TKlayers >= 5 && TKlayers < 11) {
154 highzone = TOBexclusion + exclusionWidth;
155 lowzone = TOBexclusion - exclusionWidth;
156 }
else if (ringnumber == 5) {
158 highzone = TECexRing5 + exclusionWidth;
159 lowzone = TECexRing5 - exclusionWidth;
160 }
else if (ringnumber == 6) {
162 highzone = TECexRing6 + exclusionWidth;
163 lowzone = TECexRing6 - exclusionWidth;
164 }
else if (ringnumber == 7) {
166 highzone = TECexRing7 + exclusionWidth;
167 lowzone = TECexRing7 - exclusionWidth;
170 if ((highzone <= higherr) && (highzone >= lowerr))
172 if ((lowzone >= lowerr) && (lowzone <= higherr))
174 if ((higherr <= highzone) && (higherr >= lowzone))
176 if ((lowerr >= lowzone) && (lowerr <= highzone))
186 ClusterInfo(
float xRes,
float xResPull,
float xLoc) : xResidual(xRes), xResidualPull(xResPull), xLocal(xLoc) {}
189 inline float calcPhi(
float x,
float y) {
191 if ((
x >= 0) && (
y >= 0))
192 phi = std::atan(
y /
x);
193 else if ((
x >= 0) && (
y <= 0))
195 else if ((
x <= 0) && (
y >= 0))
std::pair< LocalPoint, LocalError > LocalValues
unsigned int tobLayer(const DetId &id) const
constexpr char const * layerName[numberOfLayers]
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
constexpr std::array< uint8_t, layerIndexSize > layer
Abs< T >::type abs(const T &t)
unsigned int tidRing(const DetId &id) const
unsigned int tibLayer(const DetId &id) const