234 double Pi = acos(-1.);
235 float etaR = 0, ptR_front = 0, ptR_rear = 0, dphi12R = 0, dphi23R = 0;
236 int charge12, charge23;
239 mode = address.track_mode;
241 int usedetaCUT =
true;
245 int EtaCutLevel_1 = 2;
248 for (
int i=0;
i<24;
i++)
251 if (EtaCutLevel_1 == 1)
253 else if (EtaCutLevel_1 == 2)
255 else if (EtaCutLevel_1 == 3)
257 else if (EtaCutLevel_1 == 4)
259 else if (EtaCutLevel_1 == 5)
261 else if (EtaCutLevel_1 == 6)
265 int EtaCutLevel_2 = 2;
268 for (
int i=0;
i<24;
i++)
271 if (EtaCutLevel_2 == 1)
273 else if (EtaCutLevel_2 == 2)
275 else if (EtaCutLevel_2 == 3)
277 else if (EtaCutLevel_2 == 4)
279 else if (EtaCutLevel_2 == 5)
281 else if (EtaCutLevel_2 == 6)
285 if (mode == 8 || mode == 10)
286 dEtaCut_2[
i] = scalef*dEtaCut_2[
i];
292 eta = address.track_eta;
294 fr = address.track_fr;
295 charge = address.delta_phi_sign;
297 unsigned front_pt, rear_pt;
298 front_pt = 0.; rear_pt = 0.;
299 unsigned front_quality, rear_quality;
303 front_quality = rear_quality = quality;
305 unsigned int remerged;
311 float bestLH_front = -999.0;
312 float bestLH_rear = -999.0;
340 remerged = (address.delta_phi_12 | (address.delta_phi_23 << 8 ) );
343 absPhi12 = ((1<<7)-1) & remerged;
344 absPhi23 = ((1<<5)-1) & (remerged >> 7);
350 if(charge) charge23 = 1;
355 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
358 bestLH_front = bestLH;
360 bestLH_rear = bestLH;
364 float dphi12Rmin = dphi12R - Pi*10/180/3;
365 float dphi12Rmax = dphi12R + Pi*10/180/3;
366 float dphi23Rmin = dphi23R;
367 float dphi23Rmax = dphi23R;
371 float bestLH_front_min = bestLH;
373 float bestLH_rear_min = bestLH;
375 float bestLH_front_max = bestLH;
377 float bestLH_rear_max = bestLH;
381 float best_pt_front = ptR_front;
382 float best_LH_front = bestLH_front;
383 if (bestLH_front_min > best_LH_front)
385 best_pt_front = ptR_front_min;
386 best_LH_front = bestLH_front_min;
388 if (bestLH_front_max > best_LH_front)
390 best_pt_front = ptR_front_max;
391 best_LH_front = bestLH_front_max;
393 ptR_front = best_pt_front;
395 float best_pt_rear = ptR_rear;
396 float best_LH_rear = bestLH_rear;
397 if (bestLH_rear_min > best_LH_rear)
399 best_pt_rear = ptR_rear_min;
400 best_LH_rear = bestLH_rear_min;
402 if (bestLH_rear_max > best_LH_rear)
404 best_pt_rear = ptR_rear_max;
405 best_LH_rear = bestLH_rear_max;
407 ptR_rear = best_pt_rear;
412 ptR_front =
std::max(ptR_front, ptR_front_min);
413 ptR_front =
std::max(ptR_front, ptR_front_max);
414 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
415 ptR_rear =
std::max(ptR_rear, ptR_rear_max);
424 remerged = (address.delta_phi_12 | (address.delta_phi_23 << 8 ) );
426 absPhi12 = ((1<<8)-1) & remerged;
428 dEta = ((1<<3)-1) & (remerged >> 8);
430 CLCT_pattern = 0x1 & (remerged >> 11);
433 if(iME11 == 1 && etaR > 1.6) etaR = 1.55;
434 if(iME11 == 0 && etaR < 1.6) etaR = 1.65;
437 absPhi12 = ((1<<8)-1) & address.delta_phi_12;
448 bestLH_front = bestLH;
450 bestLH_rear = bestLH;
453 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
455 float bestLH_front_min = bestLH;
457 float bestLH_rear_min = bestLH;
461 ptR_front = bestLH_front > bestLH_front_min ? ptR_front : ptR_front_min;
462 ptR_rear = bestLH_rear > bestLH_rear_min ? ptR_rear : ptR_rear_min;
467 ptR_front =
std::max(ptR_front, ptR_front_min);
468 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
472 if( (!CLCT_pattern) && (ptR_front > 5.)) ptR_front = 5.;
473 if( (!CLCT_pattern) && (ptR_rear > 5.)) ptR_rear = 5.;
477 if (mode == 6) index = 0;
478 if (mode == 7) index = 4;
479 if (mode == 13) index = 8;
483 if (fabs(etaR)>1.2 && fabs(etaR)<=1.5)
484 if (dEta>dEtaCut_1[index+0] )
486 if (ptR_front > 5) ptR_front = 5;
487 if (ptR_rear > 5) ptR_rear = 5;
489 if (fabs(etaR)>1.5 && fabs(etaR)<=1.65)
490 if (dEta>dEtaCut_1[index+1])
492 if (ptR_front > 5) ptR_front = 5;
493 if (ptR_rear > 5) ptR_rear = 5;
496 if (fabs(etaR)>1.65 && fabs(etaR)<=2.1)
497 if (dEta>dEtaCut_1[index+2] )
499 if (ptR_front > 5) ptR_front = 5;
500 if (ptR_rear > 5) ptR_rear = 5;
503 if (dEta>dEtaCut_1[index+3] )
505 if (ptR_front > 5) ptR_front = 5;
506 if (ptR_rear > 5) ptR_rear = 5;
518 remerged = (address.delta_phi_12 | (address.delta_phi_23 << 8 ) );
520 absPhi12 = ((1<<9)-1) & remerged;
522 dEta = ((1<<3)-1) & (remerged >> 9);
531 if (mode == 8) index = 12;
532 if (mode == 9) index = 16;
533 if (mode == 10) index = 20;
540 if (fabs(etaR)>1.2 && fabs(etaR)<=1.5)
541 if (dEta>dEtaCut_2[index+0] )
543 if (ptR_front > 5) ptR_front = 5;
544 if (ptR_rear > 5) ptR_rear = 5;
546 if (fabs(etaR)>1.5 && fabs(etaR)<=1.65)
547 if (dEta>dEtaCut_2[index+1])
549 if (ptR_front > 5) ptR_front = 5;
550 if (ptR_rear > 5) ptR_rear = 5;
553 if (fabs(etaR)>1.65 && fabs(etaR)<=2.1)
554 if (dEta>dEtaCut_2[index+2] )
556 if (ptR_front > 5) ptR_front = 5;
557 if (ptR_rear > 5) ptR_rear = 5;
560 if (dEta>dEtaCut_2[index+3] )
562 if (ptR_front > 5) ptR_front = 5;
563 if (ptR_rear > 5) ptR_rear = 5;
581 absPhi12 = address.delta_phi_12;
582 absPhi23 = address.delta_phi_23;
584 if(charge) charge23 = -1;
588 dphi23R = float(absPhi23);
589 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
593 if(fr == 1 && mode1 == 11) mode1 = 14;
630 absPhi12 = address.delta_phi_12;
631 absPhi23 = address.delta_phi_23;
633 if(charge) charge23 = 1;
638 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
645 float dphi12Rmin = dphi12R - Pi*10/180/3;
646 float dphi12Rmax = dphi12R + Pi*10/180/3;
647 float dphi23Rmin = dphi23R;
648 float dphi23Rmax = dphi23R;
656 ptR_front =
std::max(ptR_front, ptR_front_min);
657 ptR_front =
std::max(ptR_front, ptR_front_max);
658 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
659 ptR_rear =
std::max(ptR_rear, ptR_rear_max);
667 if(iME11 == 1 && etaR > 1.6) etaR = 1.55;
668 if(iME11 == 0 && etaR < 1.6) etaR = 1.65;
669 absPhi12 = address.delta_phi_12;
672 CLCT_pattern = int(address.delta_phi_23);
680 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
684 ptR_front =
std::max(ptR_front, ptR_front_min);
685 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
687 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_front > 5.)) ptR_front = 5.;
688 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_rear > 5.)) ptR_rear = 5.;
695 if(charge) absPhi12 = address.delta_phi();
698 int temp_phi = address.delta_phi();
699 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
719 absPhi12 = address.delta_phi_12;
720 absPhi23 = address.delta_phi_23;
722 if(charge) charge23 = -1;
726 dphi23R = float(absPhi23);
727 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
731 if(fr == 1 && mode1 == 11) mode1 = 14;
767 absPhi12 = address.delta_phi_12;
768 absPhi23 = address.delta_phi_23;
770 if(charge) charge23 = 1;
775 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
780 if(
pt_method == 22 && mode != 5 && etaR > 2.1)
782 float dphi12Rmin = dphi12R - Pi*10/180/3;
783 float dphi12Rmax = dphi12R + Pi*10/180/3;
784 float dphi23Rmin = dphi23R;
785 float dphi23Rmax = dphi23R;
793 ptR_front =
std::max(ptR_front, ptR_front_min);
794 ptR_front =
std::max(ptR_front, ptR_front_max);
795 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
796 ptR_rear =
std::max(ptR_rear, ptR_rear_max);
804 absPhi12 = address.delta_phi_12;
807 CLCT_pattern = int(address.delta_phi_23);
816 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
820 ptR_front =
std::max(ptR_front, ptR_front_min);
821 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
823 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_front > 5.)) ptR_front = 5.;
824 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_rear > 5.)) ptR_rear = 5.;
830 if(charge) absPhi12 = address.delta_phi();
833 int temp_phi = address.delta_phi();
834 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
853 absPhi12 = address.delta_phi_12;
854 absPhi23 = address.delta_phi_23;
856 if(charge) charge23 = -1;
860 dphi23R = float(absPhi23);
861 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
865 if(fr == 1 && mode1 == 11) mode1 = 14;
901 absPhi12 = address.delta_phi_12;
902 absPhi23 = address.delta_phi_23;
904 if(charge) charge23 = 1;
909 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
914 if(
pt_method == 12 && mode != 5 && etaR > 2.1)
916 float dphi12Rmin = dphi12R - Pi*10/180/3;
917 float dphi12Rmax = dphi12R + Pi*10/180/3;
918 float dphi23Rmin = dphi23R;
919 float dphi23Rmax = dphi23R;
920 if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
921 if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
927 ptR_front =
std::max(ptR_front, ptR_front_min);
928 ptR_front =
std::max(ptR_front, ptR_front_max);
929 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
930 ptR_rear =
std::max(ptR_rear, ptR_rear_max);
941 if(charge) absPhi12 = address.delta_phi();
944 int temp_phi = address.delta_phi();
945 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
953 if((
pt_method == 12) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)
955 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
959 ptR_front =
std::max(ptR_front, ptR_front_min);
960 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
969 if(charge) absPhi12 = address.delta_phi();
972 int temp_phi = address.delta_phi();
973 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
981 absPhi12 = address.delta_phi_12;
982 absPhi23 = address.delta_phi_23;
984 if(charge) charge23 = 1;
989 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
993 if(
pt_method == 12 && mode != 5 && etaR > 2.1)
995 float dphi12Rmin = dphi12R - Pi*10/180/3;
996 float dphi12Rmax = dphi12R + Pi*10/180/3;
997 float dphi23Rmin = dphi23R;
998 float dphi23Rmax = dphi23R;
999 if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
1000 if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
1004 ptR_front =
std::max(ptR_front, ptR_front_min);
1005 ptR_front =
std::max(ptR_front, ptR_front_max);
1032 && (mode == 2 || mode == 3 || mode == 4) && (eta<3)) mode = 6;
1034 && (eta<3)) mode = 8;
1044 absPhi12 = address.delta_phi_12;
1045 absPhi23 = address.delta_phi_23;
1047 if(charge) charge23 = 1;
1056 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
1061 if(
pt_method == 5 && mode != 5 && etaR > 2.1)
1063 float dphi12Rmin = dphi12R - Pi*10/180/3;
1064 float dphi12Rmax = dphi12R + Pi*10/180/3;
1065 float dphi23Rmin = dphi23R;
1066 float dphi23Rmax = dphi23R;
1067 if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
1068 if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
1074 ptR_front =
std::max(ptR_front, ptR_front_min);
1075 ptR_front =
std::max(ptR_front, ptR_front_max);
1076 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
1077 ptR_rear =
std::max(ptR_rear, ptR_rear_max);
1084 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
1094 ptR_front =
ptMethods.
Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1);
1095 ptR_rear =
ptMethods.
Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0);
1109 ptR_front =
ptMethods.
Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1);
1110 ptR_rear =
ptMethods.
Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0);
1127 if(charge) absPhi12 = address.delta_phi();
1130 int temp_phi = address.delta_phi();
1131 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
1134 if(absPhi12 < (1<<9))
1167 if((
pt_method == 5) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)
1169 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
1173 ptR_front =
std::max(ptR_front, ptR_front_min);
1174 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
1183 if(charge) absPhi12 = address.delta_phi();
1186 int temp_phi = address.delta_phi();
1187 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
1189 if(absPhi12 < (1<<9))
1207 if(fabs(dphi12R)<0.01 && (ptR_rear < 10 || ptR_front < 10))
1208 std::cout <<
"dphi12R = " << dphi12R <<
" ptR_rear = " << ptR_rear
1209 <<
" ptR_front = " << ptR_front <<
" etaR = " << etaR <<
" mode = " << mode << std::endl;
1215 if(charge) absPhi12 = address.delta_phi();
1218 int temp_phi = address.delta_phi();
1219 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
1221 if(absPhi12 < (1<<9))
1241 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
1245 ptR_front =
std::max(ptR_front, ptR_front_min);
1246 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
1279 if ((front_pt==0 || front_pt==1) && (eta<3) && quality==1 &&
pt_method != 2) front_pt = 31;
1280 if ((rear_pt==0 || rear_pt==1) && (eta<3) && quality==1 &&
pt_method != 2) rear_pt = 31;
1284 if (front_pt < 5) front_pt = 5;
1285 if (rear_pt < 5) rear_pt = 5;
1290 if(quality == 3 && mode == 5) {
1292 if (front_pt < 5) front_pt = 5;
1293 if (rear_pt < 5) rear_pt = 5;
1296 if(quality == 2 && mode > 7 && mode < 11) {
1298 if (front_pt < 5) front_pt = 5;
1299 if (rear_pt < 5) rear_pt = 5;
1307 result.front_rank = front_pt | front_quality << 5;
1308 result.rear_rank = rear_pt | rear_quality << 5;
1310 result.charge_valid_front = 1;
1311 result.charge_valid_rear = 1;
float Pt3Stn2012_DT(int type, float eta, float dphi1, float dphi2, int PtbyMLH, float &theLH, int fr=-1, int method=11) const
const L1MuTriggerScales * trigger_scale
float Pt3StnHybrid(int type, float eta, int dphi1, int dphi2, int fr) const
const L1MuScale * getPtScale() const
get the Pt scale
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
float Pt2Stn2010(int type, float eta, float dphi, int fr=-1, int method=11) const
static const int getPtbyMLH
float Pt2StnChiSq(int type, float eta, int dphi, int fr) const
float Pt2Stn2011(int type, float eta, float dphi, int fr=-1, int method=11, int phiSign=2) const
float Pt3Stn2011(int type, float eta, float dphi1, float dphi2, int fr=-1, int method=11) const
float Pt3StnChiSq(int type, float eta, int dphi1, int dphi2, int fr) const
static const int dEtaCut_High_C[24]
float Pt3Stn(int type, float eta, float dphi1, float dphi2, int fr=-1) const
static const int dPhiNLBMap_8bit[256]
static const int dEtaCut_Mid[24]
static const int dEtaCut_Low[24]
float Pt2StnHybrid(int type, float eta, int dphi, int fr) const
float Pt3Stn2010(int type, float eta, float dphi1, float dphi2, int fr=-1, int method=11) const
float Pt3Stn2012(int type, float eta, float dphi1, float dphi2, int PtbyMLH, float &theLH, int fr=-1, int method=11) const
static const int dEtaCut_High_A[24]
unsigned trackQuality(const unsigned &eta, const unsigned &mode, const unsigned &fr) const
const L1MuScale * getRegionalEtaScale(int isys) const
get the regioanl muon trigger eta scale, isys = 0(DT), 1(bRPC), 2(CSC), 3(fwdRPC) ...
static const int dEtaCut_Open[24]
float Pt2Stn2012(int type, float eta, float dphi, int PtbyMLH, float &theLH, int fr=-1, int method=11) const
virtual unsigned getPacked(float value) const =0
pack a value
static const int dPhiNLBMap_7bit[128]
static const double SECTOR_RAD
float Pt2Stn(int type, float eta, float dphi, int fr=-1) const
const L1MuTriggerPtScale * trigger_ptscale
static const int dEtaCut_High_B[24]
static const int dPhiNLBMap_5bit[32]
KK.