27 pt_xml = fmin(20.,
pt);
28 pt_scale = 1.07 / (1 - 0.015 * pt_xml);
30 pt_xml = fmin(20.,
pt);
31 pt_scale = 1.13 / (1 - 0.015 * pt_xml);
33 pt_xml = fmin(20.,
pt);
34 pt_scale = 1.2 / (1 - 0.015 * pt_xml);
43 float pt_unscale = -99;
46 pt_unscale = 1 / (1.07 + 0.015 *
pt);
47 pt_unscale = fmax(pt_unscale, (1 - 0.015 * 20) / 1.07);
49 pt_unscale = 1 / (1.13 + 0.015 *
pt);
50 pt_unscale = fmax(pt_unscale, (1 - 0.015 * 20) / 1.13);
52 pt_unscale = 1 / (1.2 + 0.015 *
pt);
53 pt_unscale = fmax(pt_unscale, (1 - 0.015 * 20) / 1.2);
72 int iA = -1, iB = -1, iC = -1, iD = -1;
73 int iAB, iAC, iAD, iBC, iCD;
140 iAB = (iA >= 0 && iB >= 0) ? iA + iB - (iA == 0) : -1;
141 iAC = (iA >= 0 && iC >= 0) ? iA + iC - (iA == 0) : -1;
142 iAD = (iA >= 0 && iD >= 0) ? 2 : -1;
143 iBC = (iB >= 0 && iC >= 0) ? iB + iC : -1;
144 iCD = (iC >= 0 && iD >= 0) ? 5 : -1;
147 int st1_ring2 =
data.st1_ring2;
149 int dPhiAB =
data.delta_ph[iAB];
150 int dPhiBC =
data.delta_ph[iBC];
151 int dPhiCD =
data.delta_ph[iCD];
152 int sPhiAB =
data.sign_ph[iAB];
153 int sPhiBC = (
data.sign_ph[iBC] == sPhiAB);
154 int sPhiCD = (
data.sign_ph[iCD] == sPhiAB);
155 int dTheta =
data.delta_th[iAD] * (
data.sign_th[iAD] ? 1 : -1);
156 int frA =
data.fr[iA];
157 int clctA =
data.cpattern[iA];
158 int clctB =
data.cpattern[iB];
159 int clctC =
data.cpattern[iC];
160 int clctD =
data.cpattern[iD];
171 address |= (dPhiAB & ((1 << 7) - 1)) << (0);
172 address |= (dPhiBC & ((1 << 5) - 1)) << (0 + 7);
173 address |= (dPhiCD & ((1 << 4) - 1)) << (0 + 7 + 5);
174 address |= (sPhiBC & ((1 << 1) - 1)) << (0 + 7 + 5 + 4);
175 address |= (sPhiCD & ((1 << 1) - 1)) << (0 + 7 + 5 + 4 + 1);
176 address |= (dTheta & ((1 << 2) - 1)) << (0 + 7 + 5 + 4 + 1 + 1);
177 address |= (frA & ((1 << 1) - 1)) << (0 + 7 + 5 + 4 + 1 + 1 + 2);
178 address |= (mode15_8b & ((1 << 8) - 1)) << (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1);
179 address |= (mode_ID & ((1 << 1) - 1)) << (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1 + 8);
181 }
else if (
nHits == 3) {
182 int dPhiAB =
data.delta_ph[iAB];
183 int dPhiBC =
data.delta_ph[iBC];
184 int sPhiAB =
data.sign_ph[iAB];
185 int sPhiBC = (
data.sign_ph[iBC] == sPhiAB);
186 int dTheta =
data.delta_th[iAC] * (
data.sign_th[iAC] ? 1 : -1);
187 int frA =
data.fr[iA];
188 int frB =
data.fr[iB];
189 int clctA =
data.cpattern[iA];
190 int clctB =
data.cpattern[iB];
191 int clctC =
data.cpattern[iC];
203 address |= (dPhiAB & ((1 << 7) - 1)) << (0);
204 address |= (dPhiBC & ((1 << 5) - 1)) << (0 + 7);
205 address |= (sPhiBC & ((1 << 1) - 1)) << (0 + 7 + 5);
206 address |= (dTheta & ((1 << 3) - 1)) << (0 + 7 + 5 + 1);
207 address |= (frA & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 3);
210 address |= (frB & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 3 + 1);
213 address |= (clctA & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 +
bit);
214 address |= (rpc_2b & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 +
bit + 2);
215 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 +
bit + 2 + 2);
217 address |= (mode_ID & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 +
bit + 2 + 2 + 5);
220 address |= (mode_ID & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 +
bit + 2 + 2 + 5);
224 }
else if (
nHits == 2) {
225 int dPhiAB =
data.delta_ph[iAB];
226 int sPhiAB =
data.sign_ph[iAB];
227 int dTheta =
data.delta_th[iAB] * (
data.sign_th[iAB] ? 1 : -1);
228 int frA =
data.fr[iA];
229 int frB =
data.fr[iB];
230 int clctA =
data.cpattern[iA];
231 int clctB =
data.cpattern[iB];
241 address |= (dPhiAB & ((1 << 7) - 1)) << (0);
242 address |= (dTheta & ((1 << 3) - 1)) << (0 + 7);
243 address |= (frA & ((1 << 1) - 1)) << (0 + 7 + 3);
244 address |= (frB & ((1 << 1) - 1)) << (0 + 7 + 3 + 1);
245 address |= (clctA & ((1 << 3) - 1)) << (0 + 7 + 3 + 1 + 1);
246 address |= (clctB & ((1 << 3) - 1)) << (0 + 7 + 3 + 1 + 1 + 3);
247 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 3 + 1 + 1 + 3 + 3);
248 address |= (mode_ID & ((1 << 3) - 1)) << (0 + 7 + 3 + 1 + 1 + 3 + 3 + 5);
267 if (address >=
pow(2, 29)) {
270 }
else if (address >=
pow(2, 27)) {
272 }
else if (address >=
pow(2, 26)) {
275 }
else if (address >=
pow(2, 24)) {
281 int mode_ID,
theta, dTheta;
282 int dPhiAB, dPhiBC = -1, dPhiCD = -1;
283 int sPhiAB, sPhiBC = -1, sPhiCD = -1;
285 int clctA, clctB = -1;
286 int rpcA, rpcB, rpcC, rpcD;
294 dPhiAB = (address >> (0) & ((1 << 7) - 1));
295 dPhiBC = (address >> (0 + 7) & ((1 << 5) - 1));
296 dPhiCD = (address >> (0 + 7 + 5) & ((1 << 4) - 1));
297 sPhiBC = (address >> (0 + 7 + 5 + 4) & ((1 << 1) - 1));
298 sPhiCD = (address >> (0 + 7 + 5 + 4 + 1) & ((1 << 1) - 1));
299 dTheta = (address >> (0 + 7 + 5 + 4 + 1 + 1) & ((1 << 2) - 1));
300 frA = (address >> (0 + 7 + 5 + 4 + 1 + 1 + 2) & ((1 << 1) - 1));
301 mode15_8b = (address >> (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1) & ((1 << 8) - 1));
302 mode_ID = (address >> (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1 + 8) & ((1 << 1) - 1));
304 }
else if (
nHits == 3) {
305 dPhiAB = (address >> (0) & ((1 << 7) - 1));
306 dPhiBC = (address >> (0 + 7) & ((1 << 5) - 1));
307 sPhiBC = (address >> (0 + 7 + 5) & ((1 << 1) - 1));
308 dTheta = (address >> (0 + 7 + 5 + 1) & ((1 << 3) - 1));
309 frA = (address >> (0 + 7 + 5 + 1 + 3) & ((1 << 1) - 1));
312 frB = (address >> (0 + 7 + 5 + 1 + 3 + 1) & ((1 << 1) - 1));
315 clctA = (address >> (0 + 7 + 5 + 1 + 3 + 1 +
bit) & ((1 << 2) - 1));
316 rpc_2b = (address >> (0 + 7 + 5 + 1 + 3 + 1 +
bit + 2) & ((1 << 2) - 1));
317 theta = (address >> (0 + 7 + 5 + 1 + 3 + 1 +
bit + 2 + 2) & ((1 << 5) - 1));
319 mode_ID = (address >> (0 + 7 + 5 + 1 + 3 + 1 +
bit + 2 + 2 + 5) & ((1 << 2) - 1));
322 mode_ID = (address >> (0 + 7 + 5 + 1 + 3 + 1 +
bit + 2 + 2 + 5) & ((1 << 1) - 1));
325 }
else if (
nHits == 2) {
326 dPhiAB = (address >> (0) & ((1 << 7) - 1));
327 dTheta = (address >> (0 + 7) & ((1 << 3) - 1));
328 frA = (address >> (0 + 7 + 3) & ((1 << 1) - 1));
329 frB = (address >> (0 + 7 + 3 + 1) & ((1 << 1) - 1));
330 clctA = (address >> (0 + 7 + 3 + 1 + 1) & ((1 << 3) - 1));
331 clctB = (address >> (0 + 7 + 3 + 1 + 1 + 3) & ((1 << 3) - 1));
332 theta = (address >> (0 + 7 + 3 + 1 + 1 + 3 + 3) & ((1 << 5) - 1));
333 mode_ID = (address >> (0 + 7 + 3 + 1 + 1 + 3 + 3 + 5) & ((1 << 3) - 1));
352 }
else if (
nHits == 2) {
390 }
else if (
nHits == 3) {
403 }
else if (
nHits == 2) {
420 std::vector<int> predictors;
423 int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi;
428 theta, St1_ring2, dPhiAB, dPhiBC, dPhiCD, dPhiAB + dPhiBC, dPhiAB + dPhiBC + dPhiCD, dPhiBC + dPhiCD, frA, clctA};
437 dPhiAB + dPhiBC + dPhiCD,
442 int tmp[10] = {dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTheta, rpcA, rpcB, rpcC, rpcD};
443 predictors.insert(predictors.end(),
tmp,
tmp + 10);
444 }
else if (
nHits == 3) {
446 predictors = {
theta, St1_ring2, dPhiAB, dPhiBC, dPhiAB + dPhiBC, frA, frB, clctA, dTheta, rpcA, rpcB, rpcC};
448 predictors = {
theta, St1_ring2, dPhiAB, dPhiAB + dPhiBC, dPhiBC, frA, frB, clctA, dTheta, rpcA, rpcB, rpcC};
450 predictors = {
theta, St1_ring2, dPhiBC, dPhiAB, dPhiAB + dPhiBC, frA, frB, clctA, dTheta, rpcA, rpcB, rpcC};
452 predictors = {
theta, dPhiAB, dPhiBC, dPhiAB + dPhiBC, frA, clctA, dTheta, rpcA, rpcB, rpcC};
454 predictors = {
theta, St1_ring2, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0)};
456 predictors = {
theta, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0)};
462 std::vector<double> tree_data(predictors.cbegin(), predictors.cend());
464 auto tree_event = std::make_unique<emtf::Event>();
465 tree_event->predictedValue = 0;
466 tree_event->data = tree_data;
474 float log2_pt = tree_event->predictedValue;
475 pt_xml =
pow(2, fmax(0.0, log2_pt));
477 float inv_pt = tree_event->predictedValue;
478 pt_xml = 1.0 / fmax(0.001, inv_pt);
491 auto contain = [](
const std::vector<int>& vec,
int elem) {
492 return (
std::find(vec.begin(), vec.end(), elem) != vec.end());
503 int st1 = (
mode >= 8);
504 int st2 = ((
mode % 8) >= 4);
505 int st3 = ((
mode % 4) >= 2);
506 int st4 = ((
mode % 2) == 1);
509 int dPhi_12, dPhi_13, dPhi_14, dPhi_23, dPhi_24, dPhi_34, dPhiSign;
510 int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi;
511 int dTh_12, dTh_13, dTh_14, dTh_23, dTh_24, dTh_34;
512 int FR_1, FR_2, FR_3, FR_4;
513 int bend_1, bend_2, bend_3, bend_4;
514 int RPC_1, RPC_2, RPC_3, RPC_4;
515 int St1_ring2 =
data.st1_ring2;
517 int ph1 = -99, ph2 = -99, ph3 = -99, ph4 = -99;
518 int th1 = -99, th2 = -99, th3 = -99, th4 = -99;
519 int pat1 = -99, pat2 = -99, pat3 = -99, pat4 = -99;
526 ph1 = ph2 -
data.delta_ph[0] * (
data.sign_ph[0] ? 1 : -1);
528 th1 = th2 -
data.delta_th[0] * (
data.sign_th[0] ? 1 : -1);
530 ph3 = ph2 +
data.delta_ph[3] * (
data.sign_ph[3] ? 1 : -1);
533 ph4 = ph3 +
data.delta_ph[5] * (
data.sign_ph[5] ? 1 : -1);
535 ph4 = ph2 +
data.delta_ph[4] * (
data.sign_ph[4] ? 1 : -1);
540 th3 = th1 +
data.delta_th[1] * (
data.sign_th[1] ? 1 : -1);
542 th3 = th2 +
data.delta_th[3] * (
data.sign_th[3] ? 1 : -1);
544 th4 = th1 +
data.delta_th[2] * (
data.sign_th[2] ? 1 : -1);
546 th4 = th2 +
data.delta_th[4] * (
data.sign_th[4] ? 1 : -1);
551 ph1 = ph3 -
data.delta_ph[1] * (
data.sign_ph[1] ? 1 : -1);
553 th1 = th3 -
data.delta_th[1] * (
data.sign_th[1] ? 1 : -1);
555 ph4 = ph3 +
data.delta_ph[5] * (
data.sign_ph[5] ? 1 : -1);
557 th4 = th1 +
data.delta_th[2] * (
data.sign_th[2] ? 1 : -1);
559 th4 = th3 +
data.delta_th[5] * (
data.sign_th[5] ? 1 : -1);
564 ph1 = ph4 -
data.delta_ph[2] * (
data.sign_ph[2] ? 1 : -1);
566 th1 = th4 -
data.delta_th[2] * (
data.sign_th[2] ? 1 : -1);
570 pat1 =
data.cpattern[0];
572 pat2 =
data.cpattern[1];
574 pat3 =
data.cpattern[2];
576 pat4 =
data.cpattern[3];
601 aux().
calcDeltaThetas(dTh_12, dTh_13, dTh_14, dTh_23, dTh_24, dTh_34, th1, th2, th3, th4,
mode,
true);
603 FR_1 = (st1 ?
data.fr[0] : -99);
604 FR_2 = (st2 ?
data.fr[1] : -99);
605 FR_3 = (st3 ?
data.fr[2] : -99);
606 FR_4 = (st4 ?
data.fr[3] : -99);
608 aux().
calcBends(bend_1, bend_2, bend_3, bend_4, pat1, pat2, pat3, pat4, dPhiSign,
endcap,
mode,
true);
610 RPC_1 = (st1 ? (pat1 == 0) : -99);
611 RPC_2 = (st2 ? (pat2 == 0) : -99);
612 RPC_3 = (st3 ? (pat3 == 0) : -99);
613 RPC_4 = (st4 ? (pat4 == 0) : -99);
621 std::vector<int> predictors;
624 predictors = {
theta, St1_ring2, dPhi_12, dPhi_23, dPhi_34, dPhi_13, dPhi_14, dPhi_24, FR_1, bend_1,
625 dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTh_14, RPC_1, RPC_2, RPC_3, RPC_4};
628 predictors = {
theta, St1_ring2, dPhi_12, dPhi_23, dPhi_13, FR_1, FR_2, bend_1, dTh_13, RPC_1, RPC_2, RPC_3};
631 predictors = {
theta, St1_ring2, dPhi_12, dPhi_14, dPhi_24, FR_1, FR_2, bend_1, dTh_14, RPC_1, RPC_2, RPC_4};
634 predictors = {
theta, St1_ring2, dPhi_34, dPhi_13, dPhi_14, FR_1, FR_3, bend_1, dTh_14, RPC_1, RPC_3, RPC_4};
637 predictors = {
theta, dPhi_23, dPhi_34, dPhi_24, FR_2, bend_2, dTh_24, RPC_2, RPC_3, RPC_4};
640 predictors = {
theta, St1_ring2, dPhi_12, FR_1, FR_2, bend_1, bend_2, dTh_12, RPC_1, RPC_2};
643 predictors = {
theta, St1_ring2, dPhi_13, FR_1, FR_3, bend_1, bend_3, dTh_13, RPC_1, RPC_3};
646 predictors = {
theta, St1_ring2, dPhi_14, FR_1, FR_4, bend_1, bend_4, dTh_14, RPC_1, RPC_4};
649 predictors = {
theta, dPhi_23, FR_2, FR_3, bend_2, bend_3, dTh_23, RPC_2, RPC_3};
652 predictors = {
theta, dPhi_24, FR_2, FR_4, bend_2, bend_4, dTh_24, RPC_2, RPC_4};
655 predictors = {
theta, dPhi_34, FR_3, FR_4, bend_3, bend_4, dTh_34, RPC_3, RPC_4};
659 std::vector<double> tree_data(predictors.cbegin(), predictors.cend());
661 auto tree_event = std::make_unique<emtf::Event>();
662 tree_event->predictedValue = 0;
663 tree_event->data = tree_data;
671 float log2_pt = tree_event->predictedValue;
672 pt_xml =
pow(2, fmax(0.0, log2_pt));
674 float inv_pt = tree_event->predictedValue;
675 pt_xml = 1.0 / fmax(0.001, inv_pt);
void predictEvent(Event *e, unsigned int trees)
void calcDeltaThetas(int &dTh12, int &dTh13, int &dTh14, int &dTh23, int &dTh24, int &dTh34, const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP=false) const
void calcBends(int &bend1, int &bend2, int &bend3, int &bend4, const int pat1, const int pat2, const int pat3, const int pat4, const int dPhSign, const int endcap, const int mode, const bool BIT_COMP=false) const
int unpackSt1Ring2(int theta, int bits) const
static PFTauRenderPlugin instance
int getdPhiFromBin(int dPhiBin, int bits=7, int max=512) const
void unpack8bMode15(int mode15_8b, int &theta, int &st1_ring2, int endcap, int sPhiAB, int &clctA, int &rpcA, int &rpcB, int &rpcC, int &rpcD) const
int calcTrackTheta(const int th1, const int th2, const int th3, const int th4, const int ring1, const int mode, const bool BIT_COMP=false) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void calcRPCs(int &RPC1, int &RPC2, int &RPC3, int &RPC4, const int mode, const int st1_ring2, const int theta, const bool BIT_COMP=false) const
float scale_pt(const float pt, const int mode=15) const override
int getCLCT(int clct, int endcap, int dPhiSign, int bits=3) const
void calcDeltaPhiSums(int &dPhSum4, int &dPhSum4A, int &dPhSum3, int &dPhSum3A, int &outStPh, const int dPh12, const int dPh13, const int dPh14, const int dPh23, const int dPh24, const int dPh34) const
float unscale_pt(const float pt, const int mode=15) const override
std::array< emtf::Forest, 16 > forests_
const PtAssignmentEngineAux2017 & aux() const
int get8bMode15(int theta, int st1_ring2, int endcap, int sPhiAB, int clctA, int clctB, int clctC, int clctD) const
float calculate_pt_xml(const address_t &address) const override
void calcDeltaPhis(int &dPh12, int &dPh13, int &dPh14, int &dPh23, int &dPh24, int &dPh34, int &dPhSign, int &dPhSum4, int &dPhSum4A, int &dPhSum3, int &dPhSum3A, int &outStPh, const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP=false) const
char data[epos_bytes_allocation]
int getNLBdPhiBin(int dPhi, int bits=7, int max=512) const
void unpack2bRPC(int rpc_2b, int &rpcA, int &rpcB, int &rpcC) const
int get2bRPC(int clctA, int clctB, int clctC) const
std::vector< int > allowedModes_
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
Geom::Theta< T > theta() const
int getTheta(int theta, int ring2, int bits=5) const
int getdTheta(int dTheta, int bits=3) const
address_t calculate_address(const EMTFTrack &track) const override