56 memcpy((
void*)
pt_lut,(
void*)myConfigPt_->
lut(),(1<<21)*
sizeof(
ptdat));
75 : trigger_scale( scales ),
76 trigger_ptscale( ptScale ),
89 edm::LogInfo(
"CSCTFPtLUT::CSCTFPtLUT") <<
"Reading file: "
91 <<
" isBinary?(1/0): "
135 int shortAdd = (address.toint()& 0x1fffff);
136 result =
pt_lut[shortAdd];
148 const unsigned& track_eta,
const unsigned& track_mode,
149 const unsigned& track_fr,
const unsigned& delta_phi_sign)
const
152 address.delta_phi_12 = delta_phi_12;
153 address.delta_phi_23 = delta_phi_23;
154 address.track_eta = track_eta;
155 address.track_mode = track_mode;
156 address.track_fr = track_fr;
157 address.delta_phi_sign = delta_phi_sign;
163 const unsigned& track_mode,
const unsigned& track_fr,
164 const unsigned& delta_phi_sign)
const
167 address.delta_phi_12 = ((1<<8)-1)&delta_phi_12;
168 address.delta_phi_23 = ((1<<4)-1)&(delta_phi_12>>8);
169 address.track_eta = track_eta;
170 address.track_mode = track_mode;
171 address.track_fr = track_fr;
172 address.delta_phi_sign = delta_phi_sign;
182 double Pi = acos(-1.);
183 float etaR = 0, ptR_front = 0, ptR_rear = 0, dphi12R = 0, dphi23R = 0;
184 int charge12, charge23;
187 eta = address.track_eta;
188 mode = address.track_mode;
189 fr = address.track_fr;
190 charge = address.delta_phi_sign;
192 unsigned front_pt, rear_pt;
193 front_pt = 0.; rear_pt = 0.;
194 unsigned front_quality, rear_quality;
198 front_quality = rear_quality = quality;
216 absPhi12 = address.delta_phi_12;
217 absPhi23 = address.delta_phi_23;
219 if(charge) charge23 = 1;
224 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
231 float dphi12Rmin = dphi12R - Pi*10/180/3;
232 float dphi12Rmax = dphi12R + Pi*10/180/3;
233 float dphi23Rmin = dphi23R;
234 float dphi23Rmax = dphi23R;
242 ptR_front =
std::max(ptR_front, ptR_front_min);
243 ptR_front =
std::max(ptR_front, ptR_front_max);
244 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
245 ptR_rear =
std::max(ptR_rear, ptR_rear_max);
253 if(iME11 == 1 && etaR > 1.6) etaR = 1.55;
254 if(iME11 == 0 && etaR < 1.6) etaR = 1.65;
255 absPhi12 = address.delta_phi_12;
258 CLCT_pattern = int(address.delta_phi_23);
266 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
270 ptR_front =
std::max(ptR_front, ptR_front_min);
271 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
273 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_front > 5.)) ptR_front = 5.;
274 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_rear > 5.)) ptR_rear = 5.;
281 if(charge) absPhi12 = address.delta_phi();
284 int temp_phi = address.delta_phi();
285 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
305 absPhi12 = address.delta_phi_12;
306 absPhi23 = address.delta_phi_23;
308 if(charge) charge23 = -1;
312 dphi23R = float(absPhi23);
313 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
317 if(fr == 1 && mode1 == 11) mode1 = 14;
353 absPhi12 = address.delta_phi_12;
354 absPhi23 = address.delta_phi_23;
356 if(charge) charge23 = 1;
361 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
366 if(
pt_method == 22 && mode != 5 && etaR > 2.1)
368 float dphi12Rmin = dphi12R - Pi*10/180/3;
369 float dphi12Rmax = dphi12R + Pi*10/180/3;
370 float dphi23Rmin = dphi23R;
371 float dphi23Rmax = dphi23R;
379 ptR_front =
std::max(ptR_front, ptR_front_min);
380 ptR_front =
std::max(ptR_front, ptR_front_max);
381 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
382 ptR_rear =
std::max(ptR_rear, ptR_rear_max);
390 absPhi12 = address.delta_phi_12;
393 CLCT_pattern = int(address.delta_phi_23);
402 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
406 ptR_front =
std::max(ptR_front, ptR_front_min);
407 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
409 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_front > 5.)) ptR_front = 5.;
410 if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_rear > 5.)) ptR_rear = 5.;
416 if(charge) absPhi12 = address.delta_phi();
419 int temp_phi = address.delta_phi();
420 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
439 absPhi12 = address.delta_phi_12;
440 absPhi23 = address.delta_phi_23;
442 if(charge) charge23 = -1;
446 dphi23R = float(absPhi23);
447 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
451 if(fr == 1 && mode1 == 11) mode1 = 14;
487 absPhi12 = address.delta_phi_12;
488 absPhi23 = address.delta_phi_23;
490 if(charge) charge23 = 1;
495 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
500 if(
pt_method == 12 && mode != 5 && etaR > 2.1)
502 float dphi12Rmin = dphi12R - Pi*10/180/3;
503 float dphi12Rmax = dphi12R + Pi*10/180/3;
504 float dphi23Rmin = dphi23R;
505 float dphi23Rmax = dphi23R;
506 if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
507 if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
513 ptR_front =
std::max(ptR_front, ptR_front_min);
514 ptR_front =
std::max(ptR_front, ptR_front_max);
515 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
516 ptR_rear =
std::max(ptR_rear, ptR_rear_max);
527 if(charge) absPhi12 = address.delta_phi();
530 int temp_phi = address.delta_phi();
531 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
539 if((
pt_method == 12) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)
541 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
545 ptR_front =
std::max(ptR_front, ptR_front_min);
546 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
555 if(charge) absPhi12 = address.delta_phi();
558 int temp_phi = address.delta_phi();
559 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
567 absPhi12 = address.delta_phi_12;
568 absPhi23 = address.delta_phi_23;
570 if(charge) charge23 = 1;
575 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
579 if(
pt_method == 12 && mode != 5 && etaR > 2.1)
581 float dphi12Rmin = dphi12R - Pi*10/180/3;
582 float dphi12Rmax = dphi12R + Pi*10/180/3;
583 float dphi23Rmin = dphi23R;
584 float dphi23Rmax = dphi23R;
585 if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
586 if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
590 ptR_front =
std::max(ptR_front, ptR_front_min);
591 ptR_front =
std::max(ptR_front, ptR_front_max);
618 && (mode == 2 || mode == 3 || mode == 4) && (eta<3)) mode = 6;
620 && (eta<3)) mode = 8;
630 absPhi12 = address.delta_phi_12;
631 absPhi23 = address.delta_phi_23;
633 if(charge) charge23 = 1;
642 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
647 if(
pt_method == 5 && mode != 5 && etaR > 2.1)
649 float dphi12Rmin = dphi12R - Pi*10/180/3;
650 float dphi12Rmax = dphi12R + Pi*10/180/3;
651 float dphi23Rmin = dphi23R;
652 float dphi23Rmax = dphi23R;
653 if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
654 if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
660 ptR_front =
std::max(ptR_front, ptR_front_min);
661 ptR_front =
std::max(ptR_front, ptR_front_max);
662 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
663 ptR_rear =
std::max(ptR_rear, ptR_rear_max);
670 if(charge12 * charge23 < 0) dphi23R = -dphi23R;
680 ptR_front =
ptMethods.
Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1);
681 ptR_rear =
ptMethods.
Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0);
695 ptR_front =
ptMethods.
Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1);
696 ptR_rear =
ptMethods.
Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0);
713 if(charge) absPhi12 = address.delta_phi();
716 int temp_phi = address.delta_phi();
717 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
720 if(absPhi12 < (1<<9))
753 if((
pt_method == 5) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)
755 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
759 ptR_front =
std::max(ptR_front, ptR_front_min);
760 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
769 if(charge) absPhi12 = address.delta_phi();
772 int temp_phi = address.delta_phi();
773 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
775 if(absPhi12 < (1<<9))
793 if(fabs(dphi12R)<0.01 && (ptR_rear < 10 || ptR_front < 10))
794 std::cout <<
"dphi12R = " << dphi12R <<
" ptR_rear = " << ptR_rear
795 <<
" ptR_front = " << ptR_front <<
" etaR = " << etaR <<
" mode = " << mode << std::endl;
801 if(charge) absPhi12 = address.delta_phi();
804 int temp_phi = address.delta_phi();
805 absPhi12 =
static_cast<unsigned>(-temp_phi) & 0xfff;
807 if(absPhi12 < (1<<9))
827 float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3);
831 ptR_front =
std::max(ptR_front, ptR_front_min);
832 ptR_rear =
std::max(ptR_rear, ptR_rear_min);
865 if ((front_pt==0 || front_pt==1) && (eta<3) && quality==1 &&
pt_method != 2) front_pt = 31;
866 if ((rear_pt==0 || rear_pt==1) && (eta<3) && quality==1 &&
pt_method != 2) rear_pt = 31;
870 if (front_pt < 5) front_pt = 5;
871 if (rear_pt < 5) rear_pt = 5;
876 if(quality == 3 && mode == 5) {
878 if (front_pt < 5) front_pt = 5;
879 if (rear_pt < 5) rear_pt = 5;
882 if(quality == 2 && mode > 7 && mode < 11) {
884 if (front_pt < 5) front_pt = 5;
885 if (rear_pt < 5) rear_pt = 5;
893 result.front_rank = front_pt | front_quality << 5;
894 result.rear_rank = rear_pt | rear_quality << 5;
896 result.charge_valid_front = 1;
897 result.charge_valid_rear = 1;
916 if (eta>15 || mode>15)
919 edm::LogError(
"CSCTFPtLUT::trackQuality()")<<
"Eta or Mode out of range in AU quality assignment";
922 unsigned int quality;
926 if(
pt_method > 10 && eta < 3) quality = 1;
947 if(
pt_method > 10 && eta < 3) quality = 1;
968 if(
pt_method > 10 && fr == 0) quality = 2;
969 if(
pt_method > 10 && fr == 1) quality = 3;
970 if(
pt_method > 20 && fr == 0) quality = 3;
975 if(
pt_method > 10 && fr == 0) quality = 2;
976 if(
pt_method > 10 && fr == 1) quality = 3;
977 if(
pt_method > 20 && fr == 0) quality = 3;
985 if(
pt_method > 10 && fr == 0) quality = 2;
986 if(
pt_method > 10 && fr == 1) quality = 3;
987 if(
pt_method > 20 && fr == 0) quality = 3;
1006 if ( (quality == 1) && (eta >= 4) && (eta < 11)
1019 std::ifstream PtLUT;
1025 int length = PtLUT.tellg();;
1028 PtLUT.seekg(0, std::ios::beg);
1029 PtLUT.read(reinterpret_cast<char*>(
pt_lut),length);
1041 unsigned short temp = 0;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const L1MuTriggerScales * trigger_scale
ptdat Pt(const ptadd &) const
float Pt3StnHybrid(int type, float eta, int dphi1, int dphi2, int fr) const
const L1MuScale * getPtScale() const
get the Pt scale
CSCTFPtLUT(const edm::EventSetup &c)
KK.
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
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
float Pt3Stn(int type, float eta, float dphi1, float dphi2, int fr=-1) const
const unsigned short * lut(void) const
const T & max(const T &a, const T &b)
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
edm::FileInPath pt_lut_file
unsigned trackQuality(const unsigned &eta, const unsigned &mode, const unsigned &fr) const
T const * product() const
ptdat calcPt(const ptadd &) const
const L1MuScale * getRegionalEtaScale(int isys) const
get the regioanl muon trigger eta scale, isys = 0(DT), 1(bRPC), 2(CSC), 3(fwdRPC) ...
virtual unsigned getPacked(float value) const =0
pack a value
static const double SECTOR_RAD
std::string fullPath() const
float Pt2Stn(int type, float eta, float dphi, int fr=-1) const
const L1MuTriggerPtScale * trigger_ptscale