29 pt_xml = fmin(20., pt);
30 pt_scale = 1.2 / (1 - 0.015 * pt_xml);
39 float pt_unscale = -99;
43 pt_unscale = 1 / (1.2 + 0.015 *
pt);
44 pt_unscale = fmax(pt_unscale, (1 - 0.015 * 20) / 1.2);
58 int nHits = (mode / 8) + ((mode % 8) / 4) + ((mode % 4) / 2) + ((mode % 2) / 1);
63 int iA = -1, iB = -1, iC = -1, iD = -1;
64 int iAB, iAC, iAD, iBC, iCD;
131 iAB = (iA >= 0 && iB >= 0) ? iA + iB - (iA == 0) : -1;
132 iAC = (iA >= 0 && iC >= 0) ? iA + iC - (iA == 0) : -1;
133 iAD = (iA >= 0 && iD >= 0) ? 2 : -1;
134 iBC = (iB >= 0 && iC >= 0) ? iB + iC : -1;
135 iCD = (iC >= 0 && iD >= 0) ? 5 : -1;
143 int sPhiAB = data.
sign_ph[iAB];
144 int sPhiBC = (data.
sign_ph[iBC] == sPhiAB);
145 int sPhiCD = (data.
sign_ph[iCD] == sPhiAB);
147 int frA = data.
fr[iA];
159 int mode15_8b =
aux().
get8bMode15(theta, st1_ring2, endcap, (sPhiAB == 1 ? 1 : -1), clctA, clctB, clctC, clctD);
162 address |= (dPhiAB & ((1 << 7) - 1)) << (0);
163 address |= (dPhiBC & ((1 << 5) - 1)) << (0 + 7);
164 address |= (dPhiCD & ((1 << 4) - 1)) << (0 + 7 + 5);
165 address |= (sPhiBC & ((1 << 1) - 1)) << (0 + 7 + 5 + 4);
166 address |= (sPhiCD & ((1 << 1) - 1)) << (0 + 7 + 5 + 4 + 1);
167 address |= (dTheta & ((1 << 2) - 1)) << (0 + 7 + 5 + 4 + 1 + 1);
168 address |= (frA & ((1 << 1) - 1)) << (0 + 7 + 5 + 4 + 1 + 1 + 2);
169 address |= (mode15_8b & ((1 << 8) - 1)) << (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1);
170 address |= (mode_ID & ((1 << 1) - 1)) << (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1 + 8);
172 }
else if (nHits == 3) {
175 int sPhiAB = data.
sign_ph[iAB];
176 int sPhiBC = (data.
sign_ph[iBC] == sPhiAB);
178 int frA = data.
fr[iA];
179 int frB = data.
fr[iB];
190 clctA =
aux().
getCLCT(clctA, endcap, (sPhiAB == 1 ? 1 : -1), 2);
194 address |= (dPhiAB & ((1 << 7) - 1)) << (0);
195 address |= (dPhiBC & ((1 << 5) - 1)) << (0 + 7);
196 address |= (sPhiBC & ((1 << 1) - 1)) << (0 + 7 + 5);
197 address |= (dTheta & ((1 << 3) - 1)) << (0 + 7 + 5 + 1);
198 address |= (frA & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 3);
201 address |= (frB & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 3 + 1);
204 address |= (clctA & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit);
205 address |= (rpc_2b & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit + 2);
206 address |= (theta & ((1 << 5) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2);
208 address |= (mode_ID & ((1 << 2) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2 + 5);
211 address |= (mode_ID & ((1 << 1) - 1)) << (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2 + 5);
215 }
else if (nHits == 2) {
217 int sPhiAB = data.
sign_ph[iAB];
219 int frA = data.
fr[iA];
220 int frB = data.
fr[iB];
227 clctA =
aux().
getCLCT(clctA, endcap, (sPhiAB == 1 ? 1 : -1), 3);
228 clctB =
aux().
getCLCT(clctB, endcap, (sPhiAB == 1 ? 1 : -1), 3);
232 address |= (dPhiAB & ((1 << 7) - 1)) << (0);
233 address |= (dTheta & ((1 << 3) - 1)) << (0 + 7);
234 address |= (frA & ((1 << 1) - 1)) << (0 + 7 + 3);
235 address |= (frB & ((1 << 1) - 1)) << (0 + 7 + 3 + 1);
236 address |= (clctA & ((1 << 3) - 1)) << (0 + 7 + 3 + 1 + 1);
237 address |= (clctB & ((1 << 3) - 1)) << (0 + 7 + 3 + 1 + 1 + 3);
238 address |= (theta & ((1 << 5) - 1)) << (0 + 7 + 3 + 1 + 1 + 3 + 3);
239 address |= (mode_ID & ((1 << 3) - 1)) << (0 + 7 + 3 + 1 + 1 + 3 + 3 + 5);
258 if (address >=
pow(2, 29)) {
261 }
else if (address >=
pow(2, 27)) {
263 }
else if (address >=
pow(2, 26)) {
266 }
else if (address >=
pow(2, 24)) {
272 int mode_ID,
theta, dTheta;
273 int dPhiAB, dPhiBC = -1, dPhiCD = -1;
274 int sPhiAB, sPhiBC = -1, sPhiCD = -1;
276 int clctA, clctB = -1;
277 int rpcA, rpcB, rpcC, rpcD;
285 dPhiAB = (address >> (0) & ((1 << 7) - 1));
286 dPhiBC = (address >> (0 + 7) & ((1 << 5) - 1));
287 dPhiCD = (address >> (0 + 7 + 5) & ((1 << 4) - 1));
288 sPhiBC = (address >> (0 + 7 + 5 + 4) & ((1 << 1) - 1));
289 sPhiCD = (address >> (0 + 7 + 5 + 4 + 1) & ((1 << 1) - 1));
290 dTheta = (address >> (0 + 7 + 5 + 4 + 1 + 1) & ((1 << 2) - 1));
291 frA = (address >> (0 + 7 + 5 + 4 + 1 + 1 + 2) & ((1 << 1) - 1));
292 mode15_8b = (address >> (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1) & ((1 << 8) - 1));
293 mode_ID = (address >> (0 + 7 + 5 + 4 + 1 + 1 + 2 + 1 + 8) & ((1 << 1) - 1));
295 }
else if (nHits == 3) {
296 dPhiAB = (address >> (0) & ((1 << 7) - 1));
297 dPhiBC = (address >> (0 + 7) & ((1 << 5) - 1));
298 sPhiBC = (address >> (0 + 7 + 5) & ((1 << 1) - 1));
299 dTheta = (address >> (0 + 7 + 5 + 1) & ((1 << 3) - 1));
300 frA = (address >> (0 + 7 + 5 + 1 + 3) & ((1 << 1) - 1));
303 frB = (address >> (0 + 7 + 5 + 1 + 3 + 1) & ((1 << 1) - 1));
306 clctA = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit) & ((1 << 2) - 1));
307 rpc_2b = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit + 2) & ((1 << 2) - 1));
308 theta = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2) & ((1 << 5) - 1));
310 mode_ID = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2 + 5) & ((1 << 2) - 1));
313 mode_ID = (address >> (0 + 7 + 5 + 1 + 3 + 1 + bit + 2 + 2 + 5) & ((1 << 1) - 1));
316 }
else if (nHits == 2) {
317 dPhiAB = (address >> (0) & ((1 << 7) - 1));
318 dTheta = (address >> (0 + 7) & ((1 << 3) - 1));
319 frA = (address >> (0 + 7 + 3) & ((1 << 1) - 1));
320 frB = (address >> (0 + 7 + 3 + 1) & ((1 << 1) - 1));
321 clctA = (address >> (0 + 7 + 3 + 1 + 1) & ((1 << 3) - 1));
322 clctB = (address >> (0 + 7 + 3 + 1 + 1 + 3) & ((1 << 3) - 1));
323 theta = (address >> (0 + 7 + 3 + 1 + 1 + 3 + 3) & ((1 << 5) - 1));
324 mode_ID = (address >> (0 + 7 + 3 + 1 + 1 + 3 + 3 + 5) & ((1 << 3) - 1));
329 if (nHits == 3 &&
mode != 7) {
343 }
else if (nHits == 2) {
377 aux().
unpack8bMode15(mode15_8b, theta, St1_ring2, endcap, (sPhiAB == 1 ? 1 : -1), clctA, rpcA, rpcB, rpcC, rpcD);
381 }
else if (nHits == 3) {
394 }
else if (nHits == 2) {
411 std::vector<int> predictors;
414 int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi;
419 theta, St1_ring2, dPhiAB, dPhiBC, dPhiCD, dPhiAB + dPhiBC, dPhiAB + dPhiBC + dPhiCD, dPhiBC + dPhiCD, frA, clctA};
428 dPhiAB + dPhiBC + dPhiCD,
433 int tmp[10] = {dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTheta, rpcA, rpcB, rpcC, rpcD};
434 predictors.insert(predictors.end(),
tmp, tmp + 10);
435 }
else if (nHits == 3) {
437 predictors = {
theta, St1_ring2, dPhiAB, dPhiBC, dPhiAB + dPhiBC, frA, frB, clctA, dTheta, rpcA, rpcB, rpcC};
439 predictors = {
theta, St1_ring2, dPhiAB, dPhiAB + dPhiBC, dPhiBC, frA, frB, clctA, dTheta, rpcA, rpcB, rpcC};
441 predictors = {
theta, St1_ring2, dPhiBC, dPhiAB, dPhiAB + dPhiBC, frA, frB, clctA, dTheta, rpcA, rpcB, rpcC};
443 predictors = {
theta, dPhiAB, dPhiBC, dPhiAB + dPhiBC, frA, clctA, dTheta, rpcA, rpcB, rpcC};
444 }
else if (nHits == 2 &&
mode >= 8) {
445 predictors = {
theta, St1_ring2, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0)};
446 }
else if (nHits == 2 &&
mode < 8) {
447 predictors = {
theta, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0)};
453 std::vector<double> tree_data(predictors.cbegin(), predictors.cend());
455 auto tree_event = std::make_unique<emtf::Event>();
456 tree_event->predictedValue = 0;
457 tree_event->data = tree_data;
467 float inv_pt = tree_event->predictedValue;
468 pt_xml = 1.0 / fmax(0.001, inv_pt);
480 auto contain = [](
const std::vector<int>& vec,
int elem) {
481 return (
std::find(vec.begin(), vec.end(), elem) != vec.end());
492 int st1 = (mode >= 8);
493 int st2 = ((mode % 8) >= 4);
494 int st3 = ((mode % 4) >= 2);
495 int st4 = ((mode % 2) == 1);
498 int dPhi_12, dPhi_13, dPhi_14, dPhi_23, dPhi_24, dPhi_34, dPhiSign;
499 int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi;
500 int dTh_12, dTh_13, dTh_14, dTh_23, dTh_24, dTh_34;
501 int FR_1, FR_2, FR_3, FR_4;
502 int bend_1, bend_2, bend_3, bend_4;
503 int RPC_1, RPC_2, RPC_3, RPC_4;
506 int ph1 = -99, ph2 = -99, ph3 = -99, ph4 = -99;
507 int th1 = -99, th2 = -99, th3 = -99, th4 = -99;
508 int pat1 = -99, pat2 = -99, pat3 = -99, pat4 = -99;
590 aux().
calcDeltaThetas(dTh_12, dTh_13, dTh_14, dTh_23, dTh_24, dTh_34, th1, th2, th3, th4, mode,
true);
592 FR_1 = (st1 ? data.
fr[0] : -99);
593 FR_2 = (st2 ? data.
fr[1] : -99);
594 FR_3 = (st3 ? data.
fr[2] : -99);
595 FR_4 = (st4 ? data.
fr[3] : -99);
597 aux().
calcBends(bend_1, bend_2, bend_3, bend_4, pat1, pat2, pat3, pat4, dPhiSign, endcap, mode,
true);
599 RPC_1 = (st1 ? (pat1 == 0) : -99);
600 RPC_2 = (st2 ? (pat2 == 0) : -99);
601 RPC_3 = (st3 ? (pat3 == 0) : -99);
602 RPC_4 = (st4 ? (pat4 == 0) : -99);
604 aux().
calcRPCs(RPC_1, RPC_2, RPC_3, RPC_4, mode, St1_ring2, theta,
true);
610 std::vector<int> predictors;
613 predictors = {
theta, St1_ring2, dPhi_12, dPhi_23, dPhi_34, dPhi_13, dPhi_14, dPhi_24, FR_1, bend_1,
614 dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTh_14, RPC_1, RPC_2, RPC_3, RPC_4};
617 predictors = {
theta, St1_ring2, dPhi_12, dPhi_23, dPhi_13, FR_1, FR_2, bend_1, dTh_13, RPC_1, RPC_2, RPC_3};
620 predictors = {
theta, St1_ring2, dPhi_12, dPhi_14, dPhi_24, FR_1, FR_2, bend_1, dTh_14, RPC_1, RPC_2, RPC_4};
623 predictors = {
theta, St1_ring2, dPhi_34, dPhi_13, dPhi_14, FR_1, FR_3, bend_1, dTh_14, RPC_1, RPC_3, RPC_4};
626 predictors = {
theta, dPhi_23, dPhi_34, dPhi_24, FR_2, bend_2, dTh_24, RPC_2, RPC_3, RPC_4};
629 predictors = {
theta, St1_ring2, dPhi_12, FR_1, FR_2, bend_1, bend_2, dTh_12, RPC_1, RPC_2};
632 predictors = {
theta, St1_ring2, dPhi_13, FR_1, FR_3, bend_1, bend_3, dTh_13, RPC_1, RPC_3};
635 predictors = {
theta, St1_ring2, dPhi_14, FR_1, FR_4, bend_1, bend_4, dTh_14, RPC_1, RPC_4};
638 predictors = {
theta, dPhi_23, FR_2, FR_3, bend_2, bend_3, dTh_23, RPC_2, RPC_3};
641 predictors = {
theta, dPhi_24, FR_2, FR_4, bend_2, bend_4, dTh_24, RPC_2, RPC_4};
644 predictors = {
theta, dPhi_34, FR_3, FR_4, bend_3, bend_4, dTh_34, RPC_3, RPC_4};
648 std::vector<double> tree_data(predictors.cbegin(), predictors.cend());
650 auto tree_event = std::make_unique<emtf::Event>();
651 tree_event->predictedValue = 0;
652 tree_event->data = tree_data;
662 float inv_pt = tree_event->predictedValue;
663 pt_xml = 1.0 / fmax(0.001, inv_pt);
int getTheta(int theta, int ring2, int bits=5) const
void predictEvent(Event *e, unsigned int trees)
static PFTauRenderPlugin instance
const PtAssignmentEngineAux2017 & aux() const
Geom::Theta< T > theta() 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
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
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
int get2bRPC(int clctA, int clctB, int clctC) const
float scale_pt(const float pt, const int mode=15) const override
void unpack2bRPC(int rpc_2b, int &rpcA, int &rpcB, int &rpcC) 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
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
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 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
int getCLCT(int clct, int endcap, int dPhiSign, int bits=3) const
float unscale_pt(const float pt, const int mode=15) const override
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
std::array< emtf::Forest, 16 > forests_
int getdPhiFromBin(int dPhiBin, int bits=7, int max=512) 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 getdTheta(int dTheta, int bits=3) const
float calculate_pt_xml(const address_t &address) const override
int get8bMode15(int theta, int st1_ring2, int endcap, int sPhiAB, int clctA, int clctB, int clctC, int clctD) const
char data[epos_bytes_allocation]
std::vector< int > allowedModes_
int unpackSt1Ring2(int theta, int bits) const
int getNLBdPhiBin(int dPhi, int bits=7, int max=512) const
Power< A, B >::type pow(const A &a, const B &b)
address_t calculate_address(const EMTFTrack &track) const override
static constexpr float b1