CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCTFPtLUT.cc
Go to the documentation of this file.
1 /*****************************************************
2  * 28/01/2010
3  * GP: added new switch to use the beam start Pt LUTs
4  * if (eta > 2.1) 2 stations tracks have quality 2
5  * 3 stations tracks have quality 3
6  * NB: no matter if the have ME1
7  *
8  * --> by default is set to true
9  *****************************************************/
10 
14 #include <fstream>
15 
17 bool CSCTFPtLUT::lut_read_in = false;
18 // L1MuTriggerScales CSCTFPtLUT::trigger_scale;
19 // L1MuTriggerPtScale CSCTFPtLUT::trigger_ptscale;
20 // CSCTFPtMethods CSCTFPtLUT::ptMethods;
21 
27 
32 
33 // info for getPtScale() pt scale in GeV
34 // low edges of pt bins
35 /* const float ptscale[33] = { */
36 /* -1., 0.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, */
37 /* 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 12.0, 14.0, */
38 /* 16.0, 18.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, */
39 /* 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 120.0, 140.0, 1.E6 }; */
40 
41 
43  : read_pt_lut(false),
45 {
46  pt_method = 26;
47  //std::cout << "pt_method from 4 " << std::endl;
48  lowQualityFlag = 4;
49  isBeamStartConf = true;
50  pt_lut = new ptdat[1<<21];
51 
53  es.get<L1MuCSCPtLutRcd>().get(ptLUT);
54  const L1MuCSCPtLut *myConfigPt_ = ptLUT.product();
55 
56  memcpy((void*)pt_lut,(void*)myConfigPt_->lut(),(1<<21)*sizeof(ptdat));
57 
58  lut_read_in = true;
59 
61  es.get< L1MuTriggerScalesRcd >().get( scales ) ;
62  trigger_scale = scales.product() ;
63 
65  es.get< L1MuTriggerPtScaleRcd >().get( ptScale ) ;
66  trigger_ptscale = ptScale.product() ;
67 
68  ptMethods = CSCTFPtMethods( ptScale.product() ) ;
69 }
71 
73  const L1MuTriggerScales* scales,
74  const L1MuTriggerPtScale* ptScale)
75  : trigger_scale( scales ),
76  trigger_ptscale( ptScale ),
77  ptMethods( ptScale ),
78  read_pt_lut(false),
80 {
81  //read_pt_lut = pset.getUntrackedParameter<bool>("ReadPtLUT",false);
82  read_pt_lut = pset.getParameter<bool>("ReadPtLUT");
83  if(read_pt_lut)
84  {
85  pt_lut_file = pset.getParameter<edm::FileInPath>("PtLUTFile");
86  //isBinary = pset.getUntrackedParameter<bool>("isBinary", false);
87  isBinary = pset.getParameter<bool>("isBinary");
88 
89  edm::LogInfo("CSCTFPtLUT::CSCTFPtLUT") << "Reading file: "
90  << pt_lut_file.fullPath().c_str()
91  << " isBinary?(1/0): "
92  << isBinary;
93  }
94 
95  // Determine the pt assignment method to use
96  // 1 - Darin's parameterization method
97  // 2 - Cathy Yeh's chi-square minimization method
98  // 3 - Hybrid
99  // 4 - Anna's parameterization method
100  // 5 - Anna's parameterization method
101  //with improvments at ME1/1a: find max pt for 3 links hypothesis
102  // 11 - Anna's: for fw 20101011 <- 2011 data taking <- not valide any more
103  // 12 - Anna's: for fw 20101011 <- 2011 data taking <- not valide any more
104  //with improvments at ME1/1a: find max pt for 3 links hypothesis
105  // 21 - Anna's: for fw 20110118 and up, curves with data 2010 <- 2011 data taking
106  // 22 - Anna's: for fw 20110118 and up, curves with data 2010 <- 2011 data taking
107  //with improvments at ME1/1a: find max pt for 3 links hypothesis
108  // 23 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
109  // 24 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
110  //with improvments at ME1/1a: find max pt for 3 links hypothesis
111  //25 and 26 like 23 and 24 correspondenly but fix high pt assignment in DT-CSC region
112  // 25 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
113  // 26 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
114  //with improvments at ME1/1a: find max pt for 3 links hypothesis
115  pt_method = pset.getUntrackedParameter<unsigned>("PtMethod",26);
116  //std::cout << "pt_method from pset " << std::endl;
117  // what does this mean???
118  lowQualityFlag = pset.getUntrackedParameter<unsigned>("LowQualityFlag",4);
119 
120  if(read_pt_lut && !lut_read_in)
121  {
122  pt_lut = new ptdat[1<<21];
123  readLUT();
124  lut_read_in = true;
125  }
126 
127  isBeamStartConf = pset.getUntrackedParameter<bool>("isBeamStartConf", true);
128 }
129 
131 {
132  ptdat result;
133  if(read_pt_lut)
134  {
135  int shortAdd = (address.toint()& 0x1fffff);
136  result = pt_lut[shortAdd];
137  } else
138  result = calcPt(address);
139  return result;
140 }
141 
142 ptdat CSCTFPtLUT::Pt(const unsigned& address) const
143 {
144  return Pt(ptadd(address));
145 }
146 
147 ptdat CSCTFPtLUT::Pt(const unsigned& delta_phi_12, const unsigned& delta_phi_23,
148  const unsigned& track_eta, const unsigned& track_mode,
149  const unsigned& track_fr, const unsigned& delta_phi_sign) const
150 {
151  ptadd address;
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;
158 
159  return Pt(address);
160 }
161 
162 ptdat CSCTFPtLUT::Pt(const unsigned& delta_phi_12, const unsigned& track_eta,
163  const unsigned& track_mode, const unsigned& track_fr,
164  const unsigned& delta_phi_sign) const
165 {
166  ptadd address;
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;
173 
174  return Pt(address);
175 }
176 
177 
179 {
180  ptdat result;
181 
182  double Pi = acos(-1.);
183  float etaR = 0, ptR_front = 0, ptR_rear = 0, dphi12R = 0, dphi23R = 0;
184  int charge12, charge23;
185  unsigned type, mode, eta, fr, quality, charge, absPhi12, absPhi23;
186 
187  eta = address.track_eta;
188  mode = address.track_mode;
189  fr = address.track_fr;
190  charge = address.delta_phi_sign;
191  quality = trackQuality(eta, mode, fr);
192  unsigned front_pt, rear_pt;
193  front_pt = 0.; rear_pt = 0.;
194  unsigned front_quality, rear_quality;
195 
196  etaR = trigger_scale->getRegionalEtaScale(2)->getLowEdge(2*eta+1);
197 
198  front_quality = rear_quality = quality;
199 
200 
201 //***************************************************//
202  if(pt_method >= 23 && pt_method <= 26){ //here we have only pt_methods greater then
203  //for fw 20110118 <- 2011 data taking, curves from MC like method 4
204  // mode definition you could find at page 6 & 7:
205  // http://www.phys.ufl.edu/~madorsky/sp/2011-11-18/sp_core_interface.pdf
206  // it is valid starting the beggining of 2011
207  //std::cout << " pt_method = " << pt_method << std::endl;//test
208  switch(mode)
209  {
210  case 2:
211  case 3:
212  case 4:
213  case 5:
214 
215  charge12 = 1;
216  absPhi12 = address.delta_phi_12;
217  absPhi23 = address.delta_phi_23;
218 
219  if(charge) charge23 = 1;
220  else charge23 = -1;
221 
222  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
223  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
224  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
225 
226  ptR_front = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12R, dphi23R, 1, int(pt_method));
227  ptR_rear = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12R, dphi23R, 0, int(pt_method));
228 
229  if((pt_method == 24 || pt_method == 26) && mode != 5 && etaR > 2.1)//exclude mode without ME11a
230  {
231  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
232  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
233  float dphi23Rmin = dphi23R;
234  float dphi23Rmax = dphi23R;
235  //if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
236  //if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
237  float ptR_front_min = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
238  float ptR_rear_min = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
239  float ptR_front_max = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
240  float ptR_rear_max = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
241  // select max pt solution for 3 links:
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);
246  }
247  break;
248  case 6: // for mode 6, 7 and 13 add CLCT information in dph23 bit and iME11 in charge bit
249  case 7:
250  case 13: // ME1-ME4
251  int iME11;
252  iME11 = int(charge); // = 0 if ME1/1, = 1 if ME1/2 or ME1/3 station
253  if(iME11 == 1 && etaR > 1.6) etaR = 1.55; // shift for ME1/2 station
254  if(iME11 == 0 && etaR < 1.6) etaR = 1.65; // shift for ME1/1 station
255  absPhi12 = address.delta_phi_12;
256  //int CLCT_pattern = static_cast<int>(address.delta_phi_23);
257  int CLCT_pattern;
258  CLCT_pattern = int(address.delta_phi_23);
259  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
260 
261  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
262  ptR_front = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 1, int(pt_method));
263  ptR_rear = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 0, int(pt_method));
264  if((pt_method == 24 || pt_method ==26) && etaR > 2.1)//exclude tracks without ME11a
265  {
266  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
267  float ptR_front_min = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12Rmin, 1, int(pt_method));
268  float ptR_rear_min = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12Rmin, 0, int(pt_method));
269  // select max pt solution for 3 links:
270  ptR_front = std::max(ptR_front, ptR_front_min);
271  ptR_rear = std::max(ptR_rear, ptR_rear_min);
272  }
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.;
275  //std::cout << "mode = "<< mode << " CLCT_pattern = " << CLCT_pattern << " ptR_rear = " << ptR_rear << std::endl;
276 
277  break;
278  case 8:
279  case 9:
280  case 10:
281  if(charge) absPhi12 = address.delta_phi();
282  else
283  {
284  int temp_phi = address.delta_phi();
285  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
286  }
287 
288  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
289 
290  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
291  ptR_front = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 1, int(pt_method));
292  ptR_rear = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 0, int(pt_method));
293 
294  break;
295  // for overlap DT-CSC region using curves from data 2010
296  case 11: // FR = 1 -> b1-1-3, FR = 0 -> b1-3
297  case 12: // FR = 1 -> b1-2-3, FR = 0 -> b1-2
298  case 14: // FR = 1 -> b1-1-2-(3), FR = 0 -> b1-1
299 
300  //sign definition: sign dphi12 = Phi_DT - Phi_CSC
301  // sing dphi23 = 5th sign. bit of phiBend
302  // -> charge = 1 -> dphi12 = +, phiBend = -
303  // -> charge = 0 -> dphi12 = +, phiBend = +
304  charge12 = 1;
305  absPhi12 = address.delta_phi_12;
306  absPhi23 = address.delta_phi_23;
307 
308  if(charge) charge23 = -1;
309  else charge23 = 1;
310 
311  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
312  dphi23R = float(absPhi23);
313  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
314 
315  int mode1;
316  mode1 = int(mode);
317  if(fr == 1 && mode1 == 11) mode1 = 14; // 3 station track we use dphi12 and phiBend for 2 and 3 station track
318 
319  ptR_front = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
320  ptR_rear = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
321 
322  break;
323  case 15: // halo trigger
324  case 1: // tracks that fail delta phi cuts
325  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3); // 2 GeV
326  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
327  break;
328  default: // Tracks in this category are not considered muons.
329  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0); // 0 GeV
330  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
331  };// end switch
332 
333  front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
334  rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
335 
336  } //end pt_methods 23 & 24
337 
338 //***************************************************//
339 //***************************************************//
340  if(pt_method == 21 || pt_method == 22){ //here we have only pt_methods greater then
341  //for fw 20110118 <- 2011 data taking
342  // mode definition you could find at page 6 & 7:
343  // http://www.phys.ufl.edu/~madorsky/sp/2011-11-18/sp_core_interface.pdf
344  // it is valid starting the beggining of 2011
345  switch(mode)
346  {
347  case 2:
348  case 3:
349  case 4:
350  case 5:
351 
352  charge12 = 1;
353  absPhi12 = address.delta_phi_12;
354  absPhi23 = address.delta_phi_23;
355 
356  if(charge) charge23 = 1;
357  else charge23 = -1;
358 
359  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
360  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
361  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
362 
363  ptR_front = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12R, dphi23R, 1, int(pt_method));
364  ptR_rear = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12R, dphi23R, 0, int(pt_method));
365 
366  if(pt_method == 22 && mode != 5 && etaR > 2.1)//exclude mode without ME11a
367  {
368  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
369  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
370  float dphi23Rmin = dphi23R;
371  float dphi23Rmax = dphi23R;
372  //if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
373  //if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
374  float ptR_front_min = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
375  float ptR_rear_min = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
376  float ptR_front_max = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
377  float ptR_rear_max = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
378  // select max pt solution for 3 links:
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);
383  }
384  break;
385  case 6: // for mode 6, 7 and 13 add CLCT information in dph23 bit and iME11 in charge bit
386  case 7:
387  case 13: // ME1-ME4
388  int iME11;
389  iME11 = int(charge);
390  absPhi12 = address.delta_phi_12;
391  //int CLCT_pattern = static_cast<int>(address.delta_phi_23);
392  int CLCT_pattern;
393  CLCT_pattern = int(address.delta_phi_23);
394 
395  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
396 
397  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
398  ptR_front = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 1, int(pt_method), iME11);
399  ptR_rear = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 0, int(pt_method), iME11);
400  if((pt_method == 22) && etaR > 2.1)//exclude tracks without ME11a
401  {
402  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
403  float ptR_front_min = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12Rmin, 1, int(pt_method), iME11);
404  float ptR_rear_min = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12Rmin, 0, int(pt_method), iME11);
405  // select max pt solution for 3 links:
406  ptR_front = std::max(ptR_front, ptR_front_min);
407  ptR_rear = std::max(ptR_rear, ptR_rear_min);
408  }
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.;
411 
412  break;
413  case 8:
414  case 9:
415  case 10:
416  if(charge) absPhi12 = address.delta_phi();
417  else
418  {
419  int temp_phi = address.delta_phi();
420  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
421  }
422 
423  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
424 
425  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
426  ptR_front = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 1, int(pt_method), int(2));
427  ptR_rear = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 0, int(pt_method), int(2));
428 
429  break;
430  case 11: // FR = 1 -> b1-1-3, FR = 0 -> b1-3
431  case 12: // FR = 1 -> b1-2-3, FR = 0 -> b1-2
432  case 14: // FR = 1 -> b1-1-2-(3), FR = 0 -> b1-1
433 
434  //sign definition: sign dphi12 = Phi_DT - Phi_CSC
435  // sing dphi23 = 5th sign. bit of phiBend
436  // -> charge = 1 -> dphi12 = +, phiBend = -
437  // -> charge = 0 -> dphi12 = +, phiBend = +
438  charge12 = 1;
439  absPhi12 = address.delta_phi_12;
440  absPhi23 = address.delta_phi_23;
441 
442  if(charge) charge23 = -1;
443  else charge23 = 1;
444 
445  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
446  dphi23R = float(absPhi23);
447  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
448 
449  int mode1;
450  mode1 = int(mode);
451  if(fr == 1 && mode1 == 11) mode1 = 14; // 3 station track we use dphi12 and phiBend for 2 and 3 station track
452 
453  ptR_front = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
454  ptR_rear = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
455 
456  break;
457  case 15: // halo trigger
458  case 1: // tracks that fail delta phi cuts
459  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3); // 2 GeV
460  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
461  break;
462  default: // Tracks in this category are not considered muons.
463  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0); // 0 GeV
464  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
465  };// end switch
466 
467  front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
468  rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
469 
470  } //end pt_methods greater or equal to 21
471 
472 //***************************************************//
473 //***************************************************//
474  if(pt_method >= 11 && pt_method < 20){ //here we have only pt_methods greater or equal to 11
475  //for fw 20101011 <- 2011 data taking
476  // mode definition you could find at page 6 & 7:
477  // http://www.phys.ufl.edu/~madorsky/sp/2010-10-11/sp_core_interface.pdf
478  // it is valid starting the beggining of 2011
479  switch(mode)
480  {
481  case 2:
482  case 3:
483  case 4:
484  case 5:
485 
486  charge12 = 1;
487  absPhi12 = address.delta_phi_12;
488  absPhi23 = address.delta_phi_23;
489 
490  if(charge) charge23 = 1;
491  else charge23 = -1;
492 
493  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
494  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
495  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
496 
497  ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1, int(pt_method));
498  ptR_rear = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 0, int(pt_method));
499 
500  if(pt_method == 12 && mode != 5 && etaR > 2.1)//exclude mode without ME11a
501  {
502  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
503  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
504  float dphi23Rmin = dphi23R;
505  float dphi23Rmax = dphi23R;
506  if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
507  if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
508  float ptR_front_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
509  float ptR_rear_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
510  float ptR_front_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
511  float ptR_rear_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
512  // select max pt solution for 3 links:
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);
517  }
518  break;
519  case 6:
520  case 7:
521  case 8:
522  case 9:
523  case 10:
524  case 13: // ME1-ME4
525  type = mode - 5;
526 
527  if(charge) absPhi12 = address.delta_phi();
528  else
529  {
530  int temp_phi = address.delta_phi();
531  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
532  }
533 
534  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
535 
536  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
537  ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
538  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
539  if((pt_method == 12) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)//exclude tracks without ME11a
540  {
541  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
542  float ptR_front_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 1, int(pt_method));
543  float ptR_rear_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 0, int(pt_method));
544  // select max pt solution for 3 links:
545  ptR_front = std::max(ptR_front, ptR_front_min);
546  ptR_rear = std::max(ptR_rear, ptR_rear_min);
547  }
548 
549  break;
550  case 11: // FR = 1 -> b1-1-3, FR = 0 -> b1-3
551  case 12: // FR = 1 -> b1-2-3, FR = 0 -> b1-2
552  case 14: // FR = 1 -> b1-1-2-(3), FR = 0 -> b1-1
553 
554  if(fr == 0){ // 2 station track
555  if(charge) absPhi12 = address.delta_phi();
556  else
557  {
558  int temp_phi = address.delta_phi();
559  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
560  }
561  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
562  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
563 
564  }// end fr == 0
565  if(fr == 1){ // 3 station track
566  charge12 = 1;
567  absPhi12 = address.delta_phi_12;
568  absPhi23 = address.delta_phi_23;
569 
570  if(charge) charge23 = 1;
571  else charge23 = -1;
572 
573  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
574  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
575  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
576 
577  ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1, int(pt_method));
578 
579  if(pt_method == 12 && mode != 5 && etaR > 2.1)//exclude mode without ME11a
580  {
581  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
582  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
583  float dphi23Rmin = dphi23R;
584  float dphi23Rmax = dphi23R;
585  if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
586  if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
587  float ptR_front_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
588  float ptR_front_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
589  // select max pt solution for 3 links:
590  ptR_front = std::max(ptR_front, ptR_front_min);
591  ptR_front = std::max(ptR_front, ptR_front_max);
592  }
593  } // end fr == 1
594 
595  break;
596  case 15: // halo trigger
597  case 1: // tracks that fail delta phi cuts
598  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3); // 2 GeV
599  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
600  break;
601  default: // Tracks in this category are not considered muons.
602  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0); // 0 GeV
603  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
604  };// end switch
605 
606  front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
607  rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
608 
609  } //end pt_methods greater or equal to 11
610 //***************************************************//
611  if(pt_method <= 5){ //here we have only pt_methods less or equal to 5
612  // mode definition you could find at https://twiki.cern.ch/twiki/pub/Main/PtLUTs/mode_codes.xls
613  // it is valid till the end 2010
614 
615  // kluge to use 2-stn track in overlap region
616  // see also where this routine is called, and encode LUTaddress, and assignPT
617  if (pt_method != 4 && pt_method !=5
618  && (mode == 2 || mode == 3 || mode == 4) && (eta<3)) mode = 6;
619  if (pt_method != 4 && pt_method !=5 && (mode == 5)
620  && (eta<3)) mode = 8;
621 
622  switch(mode)
623  {
624  case 2:
625  case 3:
626  case 4:
627  case 5:
628  type = mode - 1;
629  charge12 = 1;
630  absPhi12 = address.delta_phi_12;
631  absPhi23 = address.delta_phi_23;
632 
633  if(charge) charge23 = 1;
634  else charge23 = -1;
635 
636  // now convert to real numbers for input into PT assignment algos.
637 
638  if(pt_method == 4 || pt_method == 5) // param method 2010
639  {
640  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
641  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
642  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
643 
644  ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1, int(pt_method));
645  ptR_rear = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 0, int(pt_method));
646 
647  if(pt_method == 5 && mode != 5 && etaR > 2.1)//exclude mode without ME11a
648  {
649  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
650  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
651  float dphi23Rmin = dphi23R;
652  float dphi23Rmax = dphi23R;
653  if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
654  if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
655  float ptR_front_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
656  float ptR_rear_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
657  float ptR_front_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
658  float ptR_rear_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
659  // select max pt solution for 3 links:
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);
664  }
665  }
666  else if(pt_method == 1) // param method
667  {
668  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
669  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
670  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
671 
672  ptR_front = ptMethods.Pt3Stn(type, etaR, dphi12R, dphi23R, 1);
673  ptR_rear = ptMethods.Pt3Stn(type, etaR, dphi12R, dphi23R, 0);
674 
675  }
676  else if(pt_method == 2) // cathy's method
677  {
678  if(type <= 2)
679  {
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);
682  }
683  else
684  {
685  ptR_front = ptMethods.Pt2StnChiSq(type-2, etaR, absPhi12<<1, 1);
686  ptR_rear = ptMethods.Pt2StnChiSq(type-2, etaR, absPhi12<<1, 0);
687  }
688 
689  }
690  else // hybrid
691  {
692 
693  if(type <= 2)
694  {
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);
697  }
698  else
699  {
700  ptR_front = ptMethods.Pt2StnHybrid(type-2, etaR, absPhi12<<1, 1);
701  ptR_rear = ptMethods.Pt2StnHybrid(type-2, etaR, absPhi12<<1, 0);
702  }
703 
704  }
705  break;
706  case 6:
707  case 7:
708  case 8:
709  case 9:
710  case 10:
711  type = mode - 5;
712 
713  if(charge) absPhi12 = address.delta_phi();
714  else
715  {
716  int temp_phi = address.delta_phi();
717  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
718  }
719 
720  if(absPhi12 < (1<<9))
721  {
722  if(pt_method == 1 || type == 5)
723  {
724  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
725 
726  ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1);
727  ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0);
728 
729  }
730  else if(pt_method == 2)
731  {
732  ptR_front = ptMethods.Pt2StnChiSq(type-1, etaR, absPhi12, 1);
733  ptR_rear = ptMethods.Pt2StnChiSq(type-1, etaR, absPhi12, 0);
734  }
735  else
736  {
737  ptR_front = ptMethods.Pt2StnHybrid(type-1, etaR, absPhi12, 1);
738  ptR_rear = ptMethods.Pt2StnHybrid(type-1, etaR, absPhi12, 0);
739  }
740  }
741  else
742  {
743  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1);
744  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1);
745  }
746  if(pt_method == 4 || pt_method == 5) // param method 2010
747  {
748  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
749 
750  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
751  ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
752  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
753  if((pt_method == 5) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)//exclude tracks without ME11a
754  {
755  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
756  float ptR_front_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 1, int(pt_method));
757  float ptR_rear_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 0, int(pt_method));
758  // select max pt solution for 3 links:
759  ptR_front = std::max(ptR_front, ptR_front_min);
760  ptR_rear = std::max(ptR_rear, ptR_rear_min);
761  }
762  }
763 
764  break;
765  case 12: // 1-2-b1 calculated only delta_phi12 = 2-b1
766  case 14:
767  type = 2;
768 
769  if(charge) absPhi12 = address.delta_phi();
770  else
771  {
772  int temp_phi = address.delta_phi();
773  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
774  }
775  if(absPhi12 < (1<<9))
776  {
777  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
778  ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1);
779  ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0);
780  }
781  else
782  {
783  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1);
784  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1);
785  }
786  if(pt_method == 4 || pt_method == 5) // param method 2010
787  {
788  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
789 
790  ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
791  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
792 
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;
796  }
797  break;
798  case 13:
799  type = 4;
800 
801  if(charge) absPhi12 = address.delta_phi();
802  else
803  {
804  int temp_phi = address.delta_phi();
805  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
806  }
807  if(absPhi12 < (1<<9))
808  {
809  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
810  ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1);
811  ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0);
812  }
813  else
814  {
815  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1);
816  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1);
817  }
818 
819  if(pt_method == 4 || pt_method == 5) // param method 2010
820  {
821  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
822 
823  ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
824  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
825  if((pt_method == 5) && etaR > 2.1)//mode = 13: ME1-ME4 exclude tracks without ME11a
826  {
827  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
828  float ptR_front_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 1, int(pt_method));
829  float ptR_rear_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 0, int(pt_method));
830  // select max pt solution for 3 links:
831  ptR_front = std::max(ptR_front, ptR_front_min);
832  ptR_rear = std::max(ptR_rear, ptR_rear_min);
833  }
834  }
835 
836  break;
837  case 11:
838  // singles trigger
839  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5);
840  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5);
841  //ptR_front = trigger_ptscale->getPtScale()->getLowEdge(31);
842  //ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(31);
843  break;
844  case 15:
845  // halo trigger
846  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5);
847  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5);
848  break;
849  case 1:
850  // tracks that fail delta phi cuts
851  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5);
852  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5);
853  break;
854  default: // Tracks in this category are not considered muons.
855  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0);
856  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
857  };
858 
859  front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
860  rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
861 
862  // kluge to set arbitrary Pt for some tracks with lousy resolution (and no param)
863  if(pt_method != 4 && pt_method != 5)
864  {
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;
867  }
868  if(pt_method != 2 && pt_method != 4 && quality == 1)
869  {
870  if (front_pt < 5) front_pt = 5;
871  if (rear_pt < 5) rear_pt = 5;
872  }
873 
874  // in order to match the pt assignement of the previous routine
875  if(isBeamStartConf && pt_method != 2 && pt_method != 4 && pt_method !=5) {
876  if(quality == 3 && mode == 5) {
877 
878  if (front_pt < 5) front_pt = 5;
879  if (rear_pt < 5) rear_pt = 5;
880  }
881 
882  if(quality == 2 && mode > 7 && mode < 11) {
883 
884  if (front_pt < 5) front_pt = 5;
885  if (rear_pt < 5) rear_pt = 5;
886  }
887  }
888 
889  } // end if for pt_method less or equal to 5
890 //***************************************************//
891 
892 
893  result.front_rank = front_pt | front_quality << 5;
894  result.rear_rank = rear_pt | rear_quality << 5;
895 
896  result.charge_valid_front = 1; //ptMethods.chargeValid(front_pt, quality, eta, pt_method);
897  result.charge_valid_rear = 1; //ptMethods.chargeValid(rear_pt, quality, eta, pt_method);
898 
899 
900  /* if (mode == 1) {
901  std::cout << "F_pt: " << front_pt << std::endl;
902  std::cout << "R_pt: " << rear_pt << std::endl;
903  std::cout << "F_quality: " << front_quality << std::endl;
904  std::cout << "R_quality: " << rear_quality << std::endl;
905  std::cout << "F_rank: " << std::hex << result.front_rank << std::endl;
906  std::cout << "R_rank: " << std::hex << result.rear_rank << std::endl;
907  }
908  */
909  return result;
910 }
911 
912 
913 unsigned CSCTFPtLUT::trackQuality(const unsigned& eta, const unsigned& mode, const unsigned& fr) const
914 {
915  // eta and mode should be only 4-bits, since that is the input to the large LUT
916  if (eta>15 || mode>15)
917  {
918  //std::cout << "Error: Eta or Mode out of range in AU quality assignment" << std::endl;
919  edm::LogError("CSCTFPtLUT::trackQuality()")<<"Eta or Mode out of range in AU quality assignment";
920  return 0;
921  }
922  unsigned int quality;
923  switch (mode) {
924  case 2:
925  quality = 3;
926  if(pt_method > 10 && eta < 3) quality = 1; //eta < 1.2
927  break;
928  case 3:
929  case 4:
931  // quality = 2;
932  quality = 3;
933  break;
934  case 5:
935  quality = 1;
936  if (isBeamStartConf && eta >= 12 && pt_method < 20) // eta > 2.1
937  quality = 3;
938  break;
939  case 6:
940  if (eta>=3) // eta > 1.2
941  quality = 2;
942  else
943  quality = 1;
944  break;
945  case 7:
946  quality = 2;
947  if(pt_method > 10 && eta < 3) quality = 1; //eta < 1.2
948  break;
949  case 8:
950  quality = 1;
951  if (isBeamStartConf && eta >= 12 && pt_method < 20) // eta > 2.1
952  quality = 2;
953  break;
954  case 9:
955  quality = 1;
956  if (isBeamStartConf && eta >= 12 && pt_method < 20) // eta > 2.1
957  quality = 2;
958  break;
959  case 10:
960  quality = 1;
961  if (isBeamStartConf && eta >= 12 && pt_method < 20) // eta > 2.1
962  quality = 2;
963  break;
964  case 11:
965  // single LCTs
966  quality = 1;
967  // overlap region
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;
971  break;
972  case 12:
973  quality = 3;
974  // overlap region
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;
978  break;
979  case 13:
980  quality = 2;
981  break;
982  case 14:
983  quality = 2;
984  // overlap region
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;
988  break;
989  case 15:
990  // halo triggers
991  quality = 1;
992  break;
993  //DEA: keep muons that fail delta phi cut
994  case 1:
995  quality = 1;
996  break;
997  default:
998  quality = 0;
999  break;
1000  }
1001 
1002  // allow quality = 1 only in overlap region or eta = 1.6 region
1003  // if ((quality == 1) && (eta >= 4) && (eta != 6) && (eta != 7)) quality = 0;
1004  // if ( (quality == 1) && (eta >= 4) ) quality = 0;
1005 
1006  if ( (quality == 1) && (eta >= 4) && (eta < 11)
1007  && ((lowQualityFlag&4)==0) ) quality = 0;
1008  if ( (quality == 1) && (eta < 4) && ((lowQualityFlag&1)==0)
1009  && ((lowQualityFlag&4)==0) ) quality = 0;
1010  if ( (quality == 1) && (eta >=11) && ((lowQualityFlag&2)==0)
1011  && ((lowQualityFlag&4)==0) ) quality = 0;
1012 
1013  return quality;
1014 
1015 }
1016 
1018 {
1019  std::ifstream PtLUT;
1020 
1021  if(isBinary)
1022  {
1023  PtLUT.open(pt_lut_file.fullPath().c_str(), std::ios::binary);
1024  PtLUT.seekg(0, std::ios::end);
1025  int length = PtLUT.tellg();;
1026  if( length == (1<<CSCBitWidths::kPtAddressWidth)*sizeof(short) )
1027  {
1028  PtLUT.seekg(0, std::ios::beg);
1029  PtLUT.read(reinterpret_cast<char*>(pt_lut),length);
1030  }
1031  else
1032  {
1033  edm::LogError("CSCPtLUT") << "File " << pt_lut_file.fullPath() << " is incorrect size!\n";
1034  }
1035  PtLUT.close();
1036  }
1037  else
1038  {
1039  PtLUT.open(pt_lut_file.fullPath().c_str());
1040  unsigned i = 0;
1041  unsigned short temp = 0;
1042  while(!PtLUT.eof() && i < 1 << CSCBitWidths::kPtAddressWidth)
1043  {
1044  PtLUT >> temp;
1045  pt_lut[i++] = (*reinterpret_cast<ptdat*>(&temp));
1046  }
1047  PtLUT.close();
1048  }
1049 }
1050 
1051 
CSCTFPtMethods ptMethods
Definition: CSCTFPtLUT.h:47
const double Pi
type
Definition: HCALResponse.h:22
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
const L1MuTriggerScales * trigger_scale
Definition: CSCTFPtLUT.h:45
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:130
char * address
Definition: mlp_lapack.h:14
float Pt3StnHybrid(int type, float eta, int dphi1, int dphi2, int fr) const
unsigned lowQualityFlag
Definition: CSCTFPtLUT.h:51
const L1MuScale * getPtScale() const
get the Pt scale
CSCTFPtLUT(const edm::EventSetup &c)
KK.
Definition: CSCTFPtLUT.cc:42
bool isBeamStartConf
Definition: CSCTFPtLUT.h:49
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
#define NULL
Definition: scimark2.h:8
static bool lut_read_in
Definition: CSCTFPtLUT.h:44
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
unsigned pt_method
Definition: CSCTFPtLUT.h:51
T eta() const
float Pt3StnChiSq(int type, float eta, int dphi1, int dphi2, int fr) const
double charge(const std::vector< uint8_t > &Ampls)
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:43
float Pt3Stn(int type, float eta, float dphi1, float dphi2, int fr=-1) const
const unsigned short * lut(void) const
Definition: L1MuCSCPtLut.h:23
const T & max(const T &a, const T &b)
float Pt2StnHybrid(int type, float eta, int dphi, int fr) const
tuple result
Definition: query.py:137
#define end
Definition: vmac.h:38
void readLUT()
Definition: CSCTFPtLUT.cc:1017
float Pt3Stn2010(int type, float eta, float dphi1, float dphi2, int fr=-1, int method=11) const
edm::FileInPath pt_lut_file
Definition: CSCTFPtLUT.h:50
unsigned trackQuality(const unsigned &eta, const unsigned &mode, const unsigned &fr) const
Definition: CSCTFPtLUT.cc:913
class pt_address ptadd
class pt_data ptdat
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
int mode
Definition: AMPTWrapper.h:139
ptdat calcPt(const ptadd &) const
Definition: CSCTFPtLUT.cc:178
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
bool read_pt_lut
Definition: CSCTFPtLUT.h:49
tuple cout
Definition: gather_cfg.py:41
bool isBinary
Definition: CSCTFPtLUT.h:49
std::string fullPath() const
Definition: FileInPath.cc:170
float Pt2Stn(int type, float eta, float dphi, int fr=-1) const
const L1MuTriggerPtScale * trigger_ptscale
Definition: CSCTFPtLUT.h:46