28 pt_xml = fmin(20.,
pt);
29 pt_scale = 1.13 / (1 - 0.015 * pt_xml);
31 pt_xml = fmin(20.,
pt);
32 pt_scale = 1.2 / (1 - 0.015 * pt_xml);
41 float pt_unscale = -99;
44 pt_unscale = 1 / (1.13 + 0.015 *
pt);
45 pt_unscale = fmax(pt_unscale, (1 - 0.015 * 20) / 1.13);
47 pt_unscale = 1 / (1.2 + 0.015 *
pt);
48 pt_unscale = fmax(pt_unscale, (1 - 0.015 * 20) / 1.2);
67 int iA = -1, iB = -1, iC = -1, iD = -1;
68 int iAB, iAC, iAD, iBC, iCD;
135 iAB = (iA >= 0 && iB >= 0) ? iA + iB - (iA == 0) : -1;
136 iAC = (iA >= 0 && iC >= 0) ? iA + iC - (iA == 0) : -1;
137 iAD = (iA >= 0 && iD >= 0) ? 2 : -1;
138 iBC = (iB >= 0 && iC >= 0) ? iB + iC : -1;
139 iCD = (iC >= 0 && iD >= 0) ? 5 : -1;
142 int st1_ring2 =
data.st1_ring2;
144 int dPhiAB =
data.delta_ph[iAB];
145 int dPhiBC =
data.delta_ph[iBC];
146 int dPhiCD =
data.delta_ph[iCD];
147 int sPhiAB =
data.sign_ph[iAB];
148 int sPhiBC = (
data.sign_ph[iBC] == sPhiAB);
149 int sPhiCD = (
data.sign_ph[iCD] == sPhiAB);
150 int dTheta =
data.delta_th[iAD] * (
data.sign_th[iAD] ? 1 : -1);
151 int frA =
data.fr[iA];
152 int clctA =
data.cpattern[iA];
153 int clctB =
data.cpattern[iB];
154 int clctC =
data.cpattern[iC];
155 int clctD =
data.cpattern[iD];
166 address |= (dPhiAB & ((1 << 7) - 1)) << (0);
167 address |= (dPhiBC & ((1 << 5) - 1)) << (0 + 7);
168 address |= (dPhiCD & ((1 << 4) - 1)) << (0 + 7 + 5);
169 address |= (sPhiBC & ((1 << 1) - 1)) << (0 + 7 + 5 + 4);
170 address |= (sPhiCD & ((1 << 1) - 1)) << (0 + 7 + 5 + 4 + 1);
171 address |= (dTheta & ((1 << 2) - 1)) << (0 + 7 + 5 + 4 + 1 + 1);
172 address |= (frA & ((1 << 1) - 1)) << (0 + 7 + 5 + 4 + 1 + 1 + 2);
173 address |= (mode15_8b & ((1 << 8) - 1)) << (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1);
174 address |= (mode_ID & ((1 << 1) - 1)) << (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1 + 8);
176 }
else if (
nHits == 3) {
177 int dPhiAB =
data.delta_ph[iAB];
178 int dPhiBC =
data.delta_ph[iBC];
179 int sPhiAB =
data.sign_ph[iAB];
180 int sPhiBC = (
data.sign_ph[iBC] == sPhiAB);
181 int dTheta =
data.delta_th[iAC] * (
data.sign_th[iAC] ? 1 : -1);
182 int frA =
data.fr[iA];
183 int frB =
data.fr[iB];
184 int clctA =
data.cpattern[iA];
185 int clctB =
data.cpattern[iB];
186 int clctC =
data.cpattern[iC];
198 address |= (dPhiAB & ((1 << 7) - 1)) << (0);
199 address |= (dPhiBC & ((1 << 5) - 1)) << (0 + 7);
200 address |= (sPhiBC & ((1 << 1) - 1)) << (0 + 7 + 5);
201 address |= (dTheta & ((1 << 3) - 1)) << (0 + 7 + 5 + 1);
202 address |= (frA & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 3);
205 address |= (frB & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 3 + 1);
208 address |= (clctA & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit);
209 address |= (rpc_2b & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit + 2);
210 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2);
212 address |= (mode_ID & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2 + 5);
215 address |= (mode_ID & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2 + 5);
219 }
else if (
nHits == 2) {
220 int dPhiAB =
data.delta_ph[iAB];
221 int sPhiAB =
data.sign_ph[iAB];
222 int dTheta =
data.delta_th[iAB] * (
data.sign_th[iAB] ? 1 : -1);
223 int frA =
data.fr[iA];
224 int frB =
data.fr[iB];
225 int clctA =
data.cpattern[iA];
226 int clctB =
data.cpattern[iB];
236 address |= (dPhiAB & ((1 << 7) - 1)) << (0);
237 address |= (dTheta & ((1 << 3) - 1)) << (0 + 7);
238 address |= (frA & ((1 << 1) - 1)) << (0 + 7 + 3);
239 address |= (frB & ((1 << 1) - 1)) << (0 + 7 + 3 + 1);
240 address |= (clctA & ((1 << 3) - 1)) << (0 + 7 + 3 + 1 + 1);
241 address |= (clctB & ((1 << 3) - 1)) << (0 + 7 + 3 + 1 + 1 + 3);
242 address |= (
theta & ((1 << 5) - 1)) << (0 + 7 + 3 + 1 + 1 + 3 + 3);
243 address |= (mode_ID & ((1 << 3) - 1)) << (0 + 7 + 3 + 1 + 1 + 3 + 3 + 5);
262 if (address >=
pow(2, 29)) {
265 }
else if (address >=
pow(2, 27)) {
267 }
else if (address >=
pow(2, 26)) {
270 }
else if (address >=
pow(2, 24)) {
276 int mode_ID,
theta, dTheta;
277 int dPhiAB, dPhiBC = -1, dPhiCD = -1;
278 int sPhiAB, sPhiBC = -1, sPhiCD = -1;
280 int clctA, clctB = -1;
281 int rpcA, rpcB, rpcC, rpcD;
289 dPhiAB = (address >> (0) & ((1 << 7) - 1));
290 dPhiBC = (address >> (0 + 7) & ((1 << 5) - 1));
291 dPhiCD = (address >> (0 + 7 + 5) & ((1 << 4) - 1));
292 sPhiBC = (address >> (0 + 7 + 5 + 4) & ((1 << 1) - 1));
293 sPhiCD = (address >> (0 + 7 + 5 + 4 + 1) & ((1 << 1) - 1));
294 dTheta = (address >> (0 + 7 + 5 + 4 + 1 + 1) & ((1 << 2) - 1));
295 frA = (address >> (0 + 7 + 5 + 4 + 1 + 1 + 2) & ((1 << 1) - 1));
296 mode15_8b = (address >> (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1) & ((1 << 8) - 1));
297 mode_ID = (address >> (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1 + 8) & ((1 << 1) - 1));
299 }
else if (
nHits == 3) {
300 dPhiAB = (address >> (0) & ((1 << 7) - 1));
301 dPhiBC = (address >> (0 + 7) & ((1 << 5) - 1));
302 sPhiBC = (address >> (0 + 7 + 5) & ((1 << 1) - 1));
303 dTheta = (address >> (0 + 7 + 5 + 1) & ((1 << 3) - 1));
304 frA = (address >> (0 + 7 + 5 + 1 + 3) & ((1 << 1) - 1));
307 frB = (address >> (0 + 7 + 5 + 1 + 3 + 1) & ((1 << 1) - 1));
310 clctA = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit) & ((1 << 2) - 1));
311 rpc_2b = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit + 2) & ((1 << 2) - 1));
312 theta = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2) & ((1 << 5) - 1));
314 mode_ID = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2 + 5) & ((1 << 2) - 1));
317 mode_ID = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2 + 5) & ((1 << 1) - 1));
320 }
else if (
nHits == 2) {
321 dPhiAB = (address >> (0) & ((1 << 7) - 1));
322 dTheta = (address >> (0 + 7) & ((1 << 3) - 1));
323 frA = (address >> (0 + 7 + 3) & ((1 << 1) - 1));
324 frB = (address >> (0 + 7 + 3 + 1) & ((1 << 1) - 1));
325 clctA = (address >> (0 + 7 + 3 + 1 + 1) & ((1 << 3) - 1));
326 clctB = (address >> (0 + 7 + 3 + 1 + 1 + 3) & ((1 << 3) - 1));
327 theta = (address >> (0 + 7 + 3 + 1 + 1 + 3 + 3) & ((1 << 5) - 1));
328 mode_ID = (address >> (0 + 7 + 3 + 1 + 1 + 3 + 3 + 5) & ((1 << 3) - 1));
347 }
else if (
nHits == 2) {
385 }
else if (
nHits == 3) {
398 }
else if (
nHits == 2) {
415 std::vector<int> predictors;
418 int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi;
423 theta, St1_ring2, dPhiAB, dPhiBC, dPhiCD, dPhiAB + dPhiBC, dPhiAB + dPhiBC + dPhiCD, dPhiBC + dPhiCD, frA, clctA};
432 dPhiAB + dPhiBC + dPhiCD,
437 int tmp[10] = {dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTheta, rpcA, rpcB, rpcC, rpcD};
438 predictors.insert(predictors.end(),
tmp,
tmp + 10);
439 }
else if (
nHits == 3) {
441 predictors = {
theta, St1_ring2, dPhiAB, dPhiBC, dPhiAB + dPhiBC, frA, frB, clctA, dTheta, rpcA, rpcB, rpcC};
443 predictors = {
theta, St1_ring2, dPhiAB, dPhiAB + dPhiBC, dPhiBC, frA, frB, clctA, dTheta, rpcA, rpcB, rpcC};
445 predictors = {
theta, St1_ring2, dPhiBC, dPhiAB, dPhiAB + dPhiBC, frA, frB, clctA, dTheta, rpcA, rpcB, rpcC};
447 predictors = {
theta, dPhiAB, dPhiBC, dPhiAB + dPhiBC, frA, clctA, dTheta, rpcA, rpcB, rpcC};
449 predictors = {
theta, St1_ring2, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0)};
451 predictors = {
theta, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0)};
457 std::vector<double> tree_data(predictors.cbegin(), predictors.cend());
459 auto tree_event = std::make_unique<emtf::Event>();
460 tree_event->predictedValue = 0;
461 tree_event->data = tree_data;
469 float log2_pt = tree_event->predictedValue;
470 pt_xml =
pow(2, fmax(0.0, log2_pt));
472 float inv_pt = tree_event->predictedValue;
473 pt_xml = 1.0 / fmax(0.001, inv_pt);
486 auto contain = [](
const std::vector<int>& vec,
int elem) {
487 return (
std::find(vec.begin(), vec.end(), elem) != vec.end());
498 int st1 = (
mode >= 8);
499 int st2 = ((
mode % 8) >= 4);
500 int st3 = ((
mode % 4) >= 2);
501 int st4 = ((
mode % 2) == 1);
504 int dPhi_12, dPhi_13, dPhi_14, dPhi_23, dPhi_24, dPhi_34, dPhiSign;
505 int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi;
506 int dTh_12, dTh_13, dTh_14, dTh_23, dTh_24, dTh_34;
507 int FR_1, FR_2, FR_3, FR_4;
508 int bend_1, bend_2, bend_3, bend_4;
509 int RPC_1, RPC_2, RPC_3, RPC_4;
510 int St1_ring2 =
data.st1_ring2;
512 int ph1 = -99, ph2 = -99, ph3 = -99, ph4 = -99;
513 int th1 = -99, th2 = -99, th3 = -99, th4 = -99;
514 int pat1 = -99, pat2 = -99, pat3 = -99, pat4 = -99;
521 ph1 = ph2 -
data.delta_ph[0] * (
data.sign_ph[0] ? 1 : -1);
523 th1 = th2 -
data.delta_th[0] * (
data.sign_th[0] ? 1 : -1);
525 ph3 = ph2 +
data.delta_ph[3] * (
data.sign_ph[3] ? 1 : -1);
528 ph4 = ph3 +
data.delta_ph[5] * (
data.sign_ph[5] ? 1 : -1);
530 ph4 = ph2 +
data.delta_ph[4] * (
data.sign_ph[4] ? 1 : -1);
535 th3 = th1 +
data.delta_th[1] * (
data.sign_th[1] ? 1 : -1);
537 th3 = th2 +
data.delta_th[3] * (
data.sign_th[3] ? 1 : -1);
539 th4 = th1 +
data.delta_th[2] * (
data.sign_th[2] ? 1 : -1);
541 th4 = th2 +
data.delta_th[4] * (
data.sign_th[4] ? 1 : -1);
546 ph1 = ph3 -
data.delta_ph[1] * (
data.sign_ph[1] ? 1 : -1);
548 th1 = th3 -
data.delta_th[1] * (
data.sign_th[1] ? 1 : -1);
550 ph4 = ph3 +
data.delta_ph[5] * (
data.sign_ph[5] ? 1 : -1);
552 th4 = th1 +
data.delta_th[2] * (
data.sign_th[2] ? 1 : -1);
554 th4 = th3 +
data.delta_th[5] * (
data.sign_th[5] ? 1 : -1);
559 ph1 = ph4 -
data.delta_ph[2] * (
data.sign_ph[2] ? 1 : -1);
561 th1 = th4 -
data.delta_th[2] * (
data.sign_th[2] ? 1 : -1);
565 pat1 =
data.cpattern[0];
567 pat2 =
data.cpattern[1];
569 pat3 =
data.cpattern[2];
571 pat4 =
data.cpattern[3];
596 aux().
calcDeltaThetas(dTh_12, dTh_13, dTh_14, dTh_23, dTh_24, dTh_34, th1, th2, th3, th4,
mode,
true);
598 FR_1 = (st1 ?
data.fr[0] : -99);
599 FR_2 = (st2 ?
data.fr[1] : -99);
600 FR_3 = (st3 ?
data.fr[2] : -99);
601 FR_4 = (st4 ?
data.fr[3] : -99);
603 aux().
calcBends(bend_1, bend_2, bend_3, bend_4, pat1, pat2, pat3, pat4, dPhiSign,
endcap,
mode,
true);
605 RPC_1 = (st1 ? (pat1 == 0) : -99);
606 RPC_2 = (st2 ? (pat2 == 0) : -99);
607 RPC_3 = (st3 ? (pat3 == 0) : -99);
608 RPC_4 = (st4 ? (pat4 == 0) : -99);
616 std::vector<int> predictors;
619 predictors = {
theta, St1_ring2, dPhi_12, dPhi_23, dPhi_34, dPhi_13, dPhi_14, dPhi_24, FR_1, bend_1,
620 dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTh_14, RPC_1, RPC_2, RPC_3, RPC_4};
623 predictors = {
theta, St1_ring2, dPhi_12, dPhi_23, dPhi_13, FR_1, FR_2, bend_1, dTh_13, RPC_1, RPC_2, RPC_3};
626 predictors = {
theta, St1_ring2, dPhi_12, dPhi_14, dPhi_24, FR_1, FR_2, bend_1, dTh_14, RPC_1, RPC_2, RPC_4};
629 predictors = {
theta, St1_ring2, dPhi_34, dPhi_13, dPhi_14, FR_1, FR_3, bend_1, dTh_14, RPC_1, RPC_3, RPC_4};
632 predictors = {
theta, dPhi_23, dPhi_34, dPhi_24, FR_2, bend_2, dTh_24, RPC_2, RPC_3, RPC_4};
635 predictors = {
theta, St1_ring2, dPhi_12, FR_1, FR_2, bend_1, bend_2, dTh_12, RPC_1, RPC_2};
638 predictors = {
theta, St1_ring2, dPhi_13, FR_1, FR_3, bend_1, bend_3, dTh_13, RPC_1, RPC_3};
641 predictors = {
theta, St1_ring2, dPhi_14, FR_1, FR_4, bend_1, bend_4, dTh_14, RPC_1, RPC_4};
644 predictors = {
theta, dPhi_23, FR_2, FR_3, bend_2, bend_3, dTh_23, RPC_2, RPC_3};
647 predictors = {
theta, dPhi_24, FR_2, FR_4, bend_2, bend_4, dTh_24, RPC_2, RPC_4};
650 predictors = {
theta, dPhi_34, FR_3, FR_4, bend_3, bend_4, dTh_34, RPC_3, RPC_4};
654 std::vector<double> tree_data(predictors.cbegin(), predictors.cend());
656 auto tree_event = std::make_unique<emtf::Event>();
657 tree_event->predictedValue = 0;
658 tree_event->data = tree_data;
666 float log2_pt = tree_event->predictedValue;
667 pt_xml =
pow(2, fmax(0.0, log2_pt));
669 float inv_pt = tree_event->predictedValue;
670 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
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
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_
Geom::Theta< T > theta() const
int getTheta(int theta, int ring2, int bits=5) const
int getdTheta(int dTheta, int bits=3) const
Power< A, B >::type pow(const A &a, const B &b)
address_t calculate_address(const EMTFTrack &track) const override