CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
CSCTFPtLUT Class Reference

KK. More...

#include <CSCTFPtLUT.h>

Public Member Functions

 CSCTFPtLUT (const edm::EventSetup &c)
 KK. More...
 
 CSCTFPtLUT (const edm::ParameterSet &, const L1MuTriggerScales *scales, const L1MuTriggerPtScale *ptScale)
 
 CSCTFPtLUT (const CSCTFPtLUT &)
 
CSCTFPtLUToperator= (const CSCTFPtLUT &)
 
ptdat Pt (const ptadd &) const
 
ptdat Pt (const unsigned &) const
 
ptdat Pt (const unsigned &delta_phi_12, const unsigned &delta_phi23, const unsigned &track_eta, const unsigned &track_mode, const unsigned &track_fr, const unsigned &delta_phi_sign) const
 
ptdat Pt (const unsigned &delta_phi_12, const unsigned &track_eta, const unsigned &track_mode, const unsigned &track_fr, const unsigned &delta_phi_sign) const
 
 ~CSCTFPtLUT ()
 

Static Public Attributes

static const int dEtaCut_High_A [24] = {3,3,4,7,3,2,4,7,5,5,5,7,2,2,2,2,3,3,3,3,2,2,2,2}
 
static const int dEtaCut_High_B [24] = {3,3,4,7,3,3,5,7,6,6,6,7,2,2,3,3,3,3,3,3,3,3,3,2}
 
static const int dEtaCut_High_C [24] = {4,4,5,7,4,3,6,7,7,7,7,7,3,3,3,3,4,4,4,4,3,3,3,3}
 
static const int dEtaCut_Low [24] = {2,2,2,7,2,1,2,7,3,3,3,7,1,1,1,1,2,2,2,2,1,1,1,1}
 
static const int dEtaCut_Mid [24] = {2,2,3,7,2,2,3,7,4,4,4,7,2,2,2,2,2,2,2,2,2,2,2,2}
 
static const int dEtaCut_Open [24] = {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}
 
static const int dPhiNLBMap_5bit [32]
 
static const int dPhiNLBMap_7bit [128]
 
static const int dPhiNLBMap_8bit [256]
 
static const int getPtbyMLH = 0xFFFF
 

Private Member Functions

ptdat calcPt (const ptadd &) const
 
void readLUT ()
 
unsigned trackQuality (const unsigned &eta, const unsigned &mode, const unsigned &fr) const
 

Private Attributes

bool isBeamStartConf
 
bool isBinary
 
unsigned lowQualityFlag
 
ptdatpt_lut
 
edm::FileInPath pt_lut_file
 
unsigned pt_method
 
CSCTFPtMethods ptMethods
 
bool read_pt_lut_es
 
bool read_pt_lut_file
 
const L1MuCSCPtLuttheL1MuCSCPtLut_
 
const L1MuTriggerPtScaletrigger_ptscale
 
const L1MuTriggerScalestrigger_scale
 

Detailed Description

KK.

Definition at line 16 of file CSCTFPtLUT.h.

Constructor & Destructor Documentation

CSCTFPtLUT::CSCTFPtLUT ( const edm::EventSetup c)

KK.

Definition at line 72 of file CSCTFPtLUT.cc.

References edm::EventSetup::get(), isBeamStartConf, lowQualityFlag, edm::ESHandle< class >::product(), pt_method, ptMethods, theL1MuCSCPtLut_, trigger_ptscale, and trigger_scale.

73  : read_pt_lut_es(true),
74  read_pt_lut_file(false),
75  isBinary(false)
76 {
77  pt_method = 32;
78 
79  lowQualityFlag = 4;
80  isBeamStartConf = true;
81 
83  es.get<L1MuCSCPtLutRcd>().get(ptLUT);
84  theL1MuCSCPtLut_ = ptLUT.product();
85 
86  //std::cout << "theL1MuCSCPtLut_ pointer is "
87  // << theL1MuCSCPtLut_
88  // << std::endl;
89 
91  es.get< L1MuTriggerScalesRcd >().get( scales ) ;
92  trigger_scale = scales.product() ;
93 
95  es.get< L1MuTriggerPtScaleRcd >().get( ptScale ) ;
96  trigger_ptscale = ptScale.product() ;
97 
98  ptMethods = CSCTFPtMethods( ptScale.product() ) ;
99 
100 }
CSCTFPtMethods ptMethods
Definition: CSCTFPtLUT.h:66
const L1MuTriggerScales * trigger_scale
Definition: CSCTFPtLUT.h:62
unsigned lowQualityFlag
Definition: CSCTFPtLUT.h:75
bool isBeamStartConf
Definition: CSCTFPtLUT.h:73
const L1MuCSCPtLut * theL1MuCSCPtLut_
Definition: CSCTFPtLUT.h:61
bool read_pt_lut_es
Definition: CSCTFPtLUT.h:73
unsigned pt_method
Definition: CSCTFPtLUT.h:75
bool read_pt_lut_file
Definition: CSCTFPtLUT.h:73
T const * product() const
Definition: ESHandle.h:62
bool isBinary
Definition: CSCTFPtLUT.h:73
const L1MuTriggerPtScale * trigger_ptscale
Definition: CSCTFPtLUT.h:63
CSCTFPtLUT::CSCTFPtLUT ( const edm::ParameterSet pset,
const L1MuTriggerScales scales,
const L1MuTriggerPtScale ptScale 
)

Definition at line 103 of file CSCTFPtLUT.cc.

References edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isBeamStartConf, isBinary, lowQualityFlag, pt_lut, pt_lut_file, pt_method, read_pt_lut_file, and readLUT().

106  : trigger_scale( scales ),
107  trigger_ptscale( ptScale ),
108  ptMethods( ptScale ),
109  read_pt_lut_es(false),
110  read_pt_lut_file(false),
111  isBinary(false)
112 {
113 
114  read_pt_lut_file = pset.getParameter<bool>("ReadPtLUT");
115  if(read_pt_lut_file)
116  {
117  // if read from file, then need to set extra variables
118  pt_lut_file = pset.getParameter<edm::FileInPath>("PtLUTFile");
119  isBinary = pset.getParameter<bool>("isBinary");
120 
121  edm::LogInfo("CSCTFPtLUT::CSCTFPtLUT") << "Reading file: "
122  << pt_lut_file.fullPath().c_str()
123  << " isBinary?(1/0): "
124  << isBinary;
125  }
126 
127  // Determine the pt assignment method to use
128  // 1 - Darin's parameterization method
129  // 2 - Cathy Yeh's chi-square minimization method
130  // 3 - Hybrid
131  // 4 - Anna's parameterization method
132  // 5 - Anna's parameterization method
133  //with improvments at ME1/1a: find max pt for 3 links hypothesis
134  // 11 - Anna's: for fw 20101011 <- 2011 data taking <- not valide any more
135  // 12 - Anna's: for fw 20101011 <- 2011 data taking <- not valide any more
136  //with improvments at ME1/1a: find max pt for 3 links hypothesis
137  // 21 - Anna's: for fw 20110118 and up, curves with data 2010 <- 2011 data taking
138  // 22 - Anna's: for fw 20110118 and up, curves with data 2010 <- 2011 data taking
139  //with improvments at ME1/1a: find max pt for 3 links hypothesis
140  // 23 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
141  // 24 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
142  //with improvments at ME1/1a: find max pt for 3 links hypothesis
143  //25 and 26 like 23 and 24 correspondenly but fix high pt assignment in DT-CSC region
144  // 25 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
145  // 26 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
146  //with improvments at ME1/1a: find max pt for 3 links hypothesis
147  // change Quality: Q = 3 for mode 5, Quility = 2 for mode = 8, 9, 10 at eta = 1.6-1.8
148  // 27 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
149  // 28 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
150  //with improvments at ME1/1a: find max pt for 3 links hypothesis
151  // 29 - Bobby's medium Quality: using fw 2012_01_31. Switch to Global Log(L). Non-Linear dphi binning.
152  // 33 - Bobby's medium Quality: using fw 2012_01_31. Switch to Global Log(L). Non-Linear dphi binning. No max pt at eta > 2.1
153  // 30 - Bobby's loose Quality: using fw 2012_01_31. Switch to Global Log(L). Non-Linear dphi binning.
154  // 31 - Bobby's tight Quality: using fw 2012_01_31. Switch to Global Log(L). Non-Linear dphi binning.
155  // 32 - Bobby's medium Quality+ {tight only mode5 at eta > 2.1}: using fw 2012_01_31. Switch to Global Log(L). Non-Linear dphi binning.
156  pt_method = pset.getUntrackedParameter<unsigned>("PtMethod",32);
157  //std::cout << "pt_method from pset " << std::endl;
158  // what does this mean???
159  lowQualityFlag = pset.getUntrackedParameter<unsigned>("LowQualityFlag",4);
160 
161  if(read_pt_lut_file)
162  {
163  pt_lut = new ptdat[1<<21];
164  readLUT();
165  }
166 
167  isBeamStartConf = pset.getUntrackedParameter<bool>("isBeamStartConf", true);
168 
169 }
CSCTFPtMethods ptMethods
Definition: CSCTFPtLUT.h:66
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const L1MuTriggerScales * trigger_scale
Definition: CSCTFPtLUT.h:62
unsigned lowQualityFlag
Definition: CSCTFPtLUT.h:75
bool isBeamStartConf
Definition: CSCTFPtLUT.h:73
bool read_pt_lut_es
Definition: CSCTFPtLUT.h:73
ptdat * pt_lut
Definition: CSCTFPtLUT.h:71
unsigned pt_method
Definition: CSCTFPtLUT.h:75
bool read_pt_lut_file
Definition: CSCTFPtLUT.h:73
void readLUT()
Definition: CSCTFPtLUT.cc:1431
edm::FileInPath pt_lut_file
Definition: CSCTFPtLUT.h:74
class pt_data ptdat
bool isBinary
Definition: CSCTFPtLUT.h:73
std::string fullPath() const
Definition: FileInPath.cc:171
const L1MuTriggerPtScale * trigger_ptscale
Definition: CSCTFPtLUT.h:63
CSCTFPtLUT::CSCTFPtLUT ( const CSCTFPtLUT )
CSCTFPtLUT::~CSCTFPtLUT ( )
inline

Definition at line 28 of file CSCTFPtLUT.h.

28 {}

Member Function Documentation

ptdat CSCTFPtLUT::calcPt ( const ptadd address) const
private

Definition at line 231 of file CSCTFPtLUT.cc.

References DeDxDiscriminatorTools::charge(), gather_cfg::cout, dEtaCut_High_A, dEtaCut_High_B, dEtaCut_High_C, dEtaCut_Low, dEtaCut_Mid, dEtaCut_Open, dPhiNLBMap_5bit, dPhiNLBMap_7bit, dPhiNLBMap_8bit, eta(), L1MuScale::getLowEdge(), L1MuScale::getPacked(), getPtbyMLH, L1MuTriggerPtScale::getPtScale(), L1MuTriggerScales::getRegionalEtaScale(), i, getHLTprescales::index, isBeamStartConf, max(), alignBH_cfg::mode, Pi, CSCTFPtMethods::Pt2Stn(), CSCTFPtMethods::Pt2Stn2010(), CSCTFPtMethods::Pt2Stn2011(), CSCTFPtMethods::Pt2Stn2012(), CSCTFPtMethods::Pt2StnChiSq(), CSCTFPtMethods::Pt2StnHybrid(), CSCTFPtMethods::Pt3Stn(), CSCTFPtMethods::Pt3Stn2010(), CSCTFPtMethods::Pt3Stn2011(), CSCTFPtMethods::Pt3Stn2012(), CSCTFPtMethods::Pt3Stn2012_DT(), CSCTFPtMethods::Pt3StnChiSq(), CSCTFPtMethods::Pt3StnHybrid(), pt_method, ptMethods, query::result, CSCTFConstants::SECTOR_RAD, trackQuality(), trigger_ptscale, and trigger_scale.

Referenced by Pt().

232 {
233  ptdat result;
234 
235  double Pi = acos(-1.);
236  float etaR = 0, ptR_front = 0, ptR_rear = 0, dphi12R = 0, dphi23R = 0;
237  int charge12, charge23;
238  unsigned type, mode, eta, fr, quality, charge, absPhi12, absPhi23;
239 
240  mode = address.track_mode;
241 
242  int usedetaCUT = true;
243  // Chose Eta cut tightness. 1=tightest, 2=moderate, 3=loose, 4=very loose, 5=extremely loose, 6=open
244 
245  // modes 6, 7, 13
246  int EtaCutLevel_1 = 2;
247  int dEtaCut_1[24];
248 
249  for (int i=0;i<24;i++)
250  {
251  dEtaCut_1[i] = 10;
252  if (EtaCutLevel_1 == 1)
253  dEtaCut_1[i] = dEtaCut_Low[i];
254  else if (EtaCutLevel_1 == 2)
255  dEtaCut_1[i] = dEtaCut_Mid[i];
256  else if (EtaCutLevel_1 == 3)
257  dEtaCut_1[i] = dEtaCut_High_A[i];
258  else if (EtaCutLevel_1 == 4)
259  dEtaCut_1[i] = dEtaCut_High_B[i];
260  else if (EtaCutLevel_1 == 5)
261  dEtaCut_1[i] = dEtaCut_High_C[i];
262  else if (EtaCutLevel_1 == 6)
263  dEtaCut_1[i] = dEtaCut_Open[i];
264  }
265  // modes 8, 9, 10
266  int EtaCutLevel_2 = 2;
267  int dEtaCut_2[24];
268 
269  for (int i=0;i<24;i++)
270  {
271  dEtaCut_2[i] = 10;
272  if (EtaCutLevel_2 == 1)
273  dEtaCut_2[i] = dEtaCut_Low[i];
274  else if (EtaCutLevel_2 == 2)
275  dEtaCut_2[i] = dEtaCut_Mid[i];
276  else if (EtaCutLevel_2 == 3)
277  dEtaCut_2[i] = dEtaCut_High_A[i];
278  else if (EtaCutLevel_2 == 4)
279  dEtaCut_2[i] = dEtaCut_High_B[i];
280  else if (EtaCutLevel_2 == 5)
281  dEtaCut_2[i] = dEtaCut_High_C[i];
282  else if (EtaCutLevel_2 == 6)
283  dEtaCut_2[i] = dEtaCut_Open[i];
284 
285  float scalef = 1.0;
286  if (mode == 8 || mode == 10)
287  dEtaCut_2[i] = scalef*dEtaCut_2[i];
288 
289  }
290 
291 
292 
293  eta = address.track_eta;
294 
295  fr = address.track_fr;
296  charge = address.delta_phi_sign;
297  quality = trackQuality(eta, mode, fr);
298  unsigned front_pt, rear_pt;
299  front_pt = 0.; rear_pt = 0.;
300  unsigned front_quality, rear_quality;
301 
302  etaR = trigger_scale->getRegionalEtaScale(2)->getLowEdge(2*eta+1);
303 
304  front_quality = rear_quality = quality;
305 
306  unsigned int remerged;
307  int iME11;
308  int CLCT_pattern;
309  int dEta;
310  int index = 0;
311  float bestLH = -999;
312  float bestLH_front = -999.0;
313  float bestLH_rear = -999.0;
314 
315  int PtbyMLH = false;
316 
317  //***************************************************//
318  if(pt_method >= 29 && pt_method <= 33)
319  {
320  // using fw 2012_01_31. Switch to Global Log(L). Non-Linear dphi binning.
321  PtbyMLH = 0x1 & (getPtbyMLH >> (int)mode);
323  // switch off any improvment for eta > 2.1
324  if(etaR > 2.1){
325  usedetaCUT = false;
326  PtbyMLH = 0x0;
327  }
329 
330  switch(mode)
331  {
332  case 2:
333  case 3:
334  case 4:
335  case 5:
336 
337 
338  charge12 = 1;
339 
340  // First remake the 12-bit dPhi word from the core
341  remerged = (address.delta_phi_12 | (address.delta_phi_23 << 8 ) );
342 
343  // Now separate it into 7-bit dPhi12 and 5-bit dPhi23 parts
344  absPhi12 = ((1<<7)-1) & remerged;
345  absPhi23 = ((1<<5)-1) & (remerged >> 7);
346 
347  // Now get the corresponding dPhi value in our phi-units using the inverse dPhi LUTs
348  absPhi12 = dPhiNLBMap_7bit[absPhi12];
349  absPhi23 = dPhiNLBMap_5bit[absPhi23];
350 
351  if(charge) charge23 = 1;
352  else charge23 = -1;
353 
354  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
355  dphi23R = (static_cast<float>(absPhi23)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
356  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
357 
358  ptR_front = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12R, dphi23R, PtbyMLH, bestLH, 1, int(pt_method));
359  bestLH_front = bestLH;
360  ptR_rear = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12R, dphi23R, PtbyMLH, bestLH, 0, int(pt_method));
361  bestLH_rear = bestLH;
362 
363  if((pt_method == 29 || pt_method == 32 || pt_method == 30 || pt_method == 31) && mode != 5 && etaR > 2.1)//exclude mode without ME11a
364  {
365  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
366  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
367  float dphi23Rmin = dphi23R;
368  float dphi23Rmax = dphi23R;
369  //if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
370  //if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
371  float ptR_front_min = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12Rmin, dphi23Rmin, PtbyMLH, bestLH, 1, int(pt_method));
372  float bestLH_front_min = bestLH;
373  float ptR_rear_min = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12Rmin, dphi23Rmin, PtbyMLH, bestLH, 0, int(pt_method));
374  float bestLH_rear_min = bestLH;
375  float ptR_front_max = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12Rmax, dphi23Rmax, PtbyMLH, bestLH, 1, int(pt_method));
376  float bestLH_front_max = bestLH;
377  float ptR_rear_max = ptMethods.Pt3Stn2012(int(mode), etaR, dphi12Rmax, dphi23Rmax, PtbyMLH, bestLH, 0, int(pt_method));
378  float bestLH_rear_max = bestLH;
379 
380  if (PtbyMLH)
381  {
382  float best_pt_front = ptR_front;
383  float best_LH_front = bestLH_front;
384  if (bestLH_front_min > best_LH_front)
385  {
386  best_pt_front = ptR_front_min;
387  best_LH_front = bestLH_front_min;
388  }
389  if (bestLH_front_max > best_LH_front)
390  {
391  best_pt_front = ptR_front_max;
392  best_LH_front = bestLH_front_max;
393  }
394  ptR_front = best_pt_front;
395 
396  float best_pt_rear = ptR_rear;
397  float best_LH_rear = bestLH_rear;
398  if (bestLH_rear_min > best_LH_rear)
399  {
400  best_pt_rear = ptR_rear_min;
401  best_LH_rear = bestLH_rear_min;
402  }
403  if (bestLH_rear_max > best_LH_rear)
404  {
405  best_pt_rear = ptR_rear_max;
406  best_LH_rear = bestLH_rear_max;
407  }
408  ptR_rear = best_pt_rear;
409  }
410  else
411  {
412  // select max pt solution for 3 links:
413  ptR_front = std::max(ptR_front, ptR_front_min);
414  ptR_front = std::max(ptR_front, ptR_front_max);
415  ptR_rear = std::max(ptR_rear, ptR_rear_min);
416  ptR_rear = std::max(ptR_rear, ptR_rear_max);
417  }
418  }
419  break;
420  case 6: // for mode 6, 7 and 13 add CLCT information in dph23 bit and iME11 in charge bit
421  case 7:
422  case 13: // ME1-ME4
423 
424  // First remake the 12-bit dPhi word from the core
425  remerged = (address.delta_phi_12 | (address.delta_phi_23 << 8 ) );
426  // Now get 8-bit dPhi12
427  absPhi12 = ((1<<8)-1) & remerged;
428  // Now get 3-bit dEta
429  dEta = ((1<<3)-1) & (remerged >> 8);
430  // New get CLCT bit. CLCT = true if CLCTPattern = 8, 9, or 10, else 0.
431  CLCT_pattern = 0x1 & (remerged >> 11);
432 
433  iME11 = int(charge); // = 0 if ME1/1, = 1 if ME1/2 or ME1/3 station
434  if(iME11 == 1 && etaR > 1.6) etaR = 1.55; // shift for ME1/2 station
435  if(iME11 == 0 && etaR < 1.6) etaR = 1.65; // shift for ME1/1 station
436 
437  // Get the 8-bit dPhi bin number
438  absPhi12 = ((1<<8)-1) & address.delta_phi_12;
439 
440  // Now get the corresponding dPhi value in our phi-units using the inverse dPhi LUTs
441  absPhi12 = dPhiNLBMap_8bit[absPhi12];
442 
443  //int CLCT_pattern = static_cast<int>(address.delta_phi_23);
444 
445  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
446 
447  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
448  ptR_front = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12R, PtbyMLH, bestLH, 1, int(pt_method));
449  bestLH_front = bestLH;
450  ptR_rear = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12R, PtbyMLH, bestLH, 0, int(pt_method));
451  bestLH_rear = bestLH;
452  if((pt_method == 29 || pt_method == 32 || pt_method == 30 || pt_method == 31) && etaR > 2.1)//exclude tracks without ME11a
453  {
454  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
455  float ptR_front_min = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12Rmin, PtbyMLH, bestLH, 1, int(pt_method));
456  float bestLH_front_min = bestLH;
457  float ptR_rear_min = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12Rmin, PtbyMLH, bestLH, 0, int(pt_method));
458  float bestLH_rear_min = bestLH;
459 
460  if (PtbyMLH)
461  {
462  ptR_front = bestLH_front > bestLH_front_min ? ptR_front : ptR_front_min;
463  ptR_rear = bestLH_rear > bestLH_rear_min ? ptR_rear : ptR_rear_min;
464  }
465  else
466  {
467  // select max pt solution for 3 links:
468  ptR_front = std::max(ptR_front, ptR_front_min);
469  ptR_rear = std::max(ptR_rear, ptR_rear_min);
470  }
471  }
472 
473  if( (!CLCT_pattern) && (ptR_front > 5.)) ptR_front = 5.;
474  if( (!CLCT_pattern) && (ptR_rear > 5.)) ptR_rear = 5.;
475 
476  // Check dEta against reasonable values for high-pt muons
477  index = 0;
478  if (mode == 6) index = 0;
479  if (mode == 7) index = 4;
480  if (mode == 13) index = 8;
481 
482  if (usedetaCUT)
483  {
484  if (fabs(etaR)>1.2 && fabs(etaR)<=1.5)
485  if (dEta>dEtaCut_1[index+0] )
486  {
487  if (ptR_front > 5) ptR_front = 5;
488  if (ptR_rear > 5) ptR_rear = 5;
489  }
490  if (fabs(etaR)>1.5 && fabs(etaR)<=1.65)
491  if (dEta>dEtaCut_1[index+1])
492  {
493  if (ptR_front > 5) ptR_front = 5;
494  if (ptR_rear > 5) ptR_rear = 5;
495  }
496 
497  if (fabs(etaR)>1.65 && fabs(etaR)<=2.1)
498  if (dEta>dEtaCut_1[index+2] )
499  {
500  if (ptR_front > 5) ptR_front = 5;
501  if (ptR_rear > 5) ptR_rear = 5;
502  }
503  if (fabs(etaR)>2.1)
504  if (dEta>dEtaCut_1[index+3] )
505  {
506  if (ptR_front > 5) ptR_front = 5;
507  if (ptR_rear > 5) ptR_rear = 5;
508  }
509  }
510 
511  break;
512 
513  case 8:
514  case 9:
515  case 10:
516 
517 
518  // First remake the 12-bit dPhi word from the core
519  remerged = (address.delta_phi_12 | (address.delta_phi_23 << 8 ) );
520  // Now get 9-bit dPhi12
521  absPhi12 = ((1<<9)-1) & remerged;
522  // Now get 3-bit dEta
523  dEta = ((1<<3)-1) & (remerged >> 9);
524 
525  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
526 
527  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
528  ptR_front = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12R, PtbyMLH, bestLH, 1, int(pt_method));
529  ptR_rear = ptMethods.Pt2Stn2012(int(mode), etaR, dphi12R, PtbyMLH, bestLH, 0, int(pt_method));
530 
531  index = 0;
532  if (mode == 8) index = 12;
533  if (mode == 9) index = 16;
534  if (mode == 10) index = 20;
535 
536 
537 
538 
539  if (usedetaCUT)
540  {
541  if (fabs(etaR)>1.2 && fabs(etaR)<=1.5)
542  if (dEta>dEtaCut_2[index+0] )
543  {
544  if (ptR_front > 5) ptR_front = 5;
545  if (ptR_rear > 5) ptR_rear = 5;
546  }
547  if (fabs(etaR)>1.5 && fabs(etaR)<=1.65)
548  if (dEta>dEtaCut_2[index+1])
549  {
550  if (ptR_front > 5) ptR_front = 5;
551  if (ptR_rear > 5) ptR_rear = 5;
552  }
553 
554  if (fabs(etaR)>1.65 && fabs(etaR)<=2.1)
555  if (dEta>dEtaCut_2[index+2] )
556  {
557  if (ptR_front > 5) ptR_front = 5;
558  if (ptR_rear > 5) ptR_rear = 5;
559  }
560  if (fabs(etaR)>2.1)
561  if (dEta>dEtaCut_2[index+3] )
562  {
563  if (ptR_front > 5) ptR_front = 5;
564  if (ptR_rear > 5) ptR_rear = 5;
565  }
566  }
567 
568  break;
569  // for overlap DT-CSC region using curves from data 2010
570  case 11: // FR = 1 -> b1-1-3, FR = 0 -> b1-3
571  case 12: // FR = 1 -> b1-2-3, FR = 0 -> b1-2
572  case 14: // FR = 1 -> b1-1-2-(3), FR = 0 -> b1-1
573 
574 
575  //sign definition: sign dphi12 = Phi_DT - Phi_CSC
576  // sing dphi23 = 5th sign. bit of phiBend
577  // -> charge = 1 -> dphi12 = +, phiBend = -
578  // -> charge = 0 -> dphi12 = +, phiBend = +
579  charge12 = 1;
580 
581  // DT tracks are still using linear dPhi binning
582  absPhi12 = address.delta_phi_12;
583  absPhi23 = address.delta_phi_23;
584 
585  if(charge) charge23 = -1;
586  else charge23 = 1;
587 
588  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
589  dphi23R = float(absPhi23);
590  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
591 
592  int mode1;
593  mode1 = int(mode);
594  if(fr == 1 && mode1 == 11) mode1 = 14; // 3 station track we use dphi12 and phiBend for 2 and 3 station track
595 
596  ptR_front = ptMethods.Pt3Stn2012_DT(mode1, etaR, dphi12R, dphi23R, PtbyMLH, bestLH, int(0), int(pt_method));
597  ptR_rear = ptMethods.Pt3Stn2012_DT(mode1, etaR, dphi12R, dphi23R, PtbyMLH, bestLH, int(0), int(pt_method));
598 
599  break;
600  case 15: // halo trigger
601  case 1: // tracks that fail delta phi cuts
602  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3); // 2 GeV
603  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
604  break;
605  default: // Tracks in this category are not considered muons.
606  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0); // 0 GeV
607  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
608  };// end switch
609 
610  front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
611  rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
612 
613  } //end pt_methods 29
614 
615 
616 //***************************************************//
617  if(pt_method >= 23 && pt_method <= 28){ //here we have only pt_methods greater then
618  //for fw 20110118 <- 2011 data taking, curves from MC like method 4
619  // mode definition you could find at page 6 & 7:
620  // http://www.phys.ufl.edu/~madorsky/sp/2011-11-18/sp_core_interface.pdf
621  // it is valid starting the beggining of 2011
622  //std::cout << " pt_method = " << pt_method << std::endl;//test
623  switch(mode)
624  {
625  case 2:
626  case 3:
627  case 4:
628  case 5:
629 
630  charge12 = 1;
631  absPhi12 = address.delta_phi_12;
632  absPhi23 = address.delta_phi_23;
633 
634  if(charge) charge23 = 1;
635  else charge23 = -1;
636 
637  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
638  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
639  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
640 
641  ptR_front = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12R, dphi23R, 1, int(pt_method));
642  ptR_rear = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12R, dphi23R, 0, int(pt_method));
643 
644  if((pt_method == 24 || pt_method == 26 || pt_method == 28) && mode != 5 && etaR > 2.1)//exclude mode without ME11a
645  {
646  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
647  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
648  float dphi23Rmin = dphi23R;
649  float dphi23Rmax = dphi23R;
650  //if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
651  //if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
652  float ptR_front_min = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
653  float ptR_rear_min = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
654  float ptR_front_max = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
655  float ptR_rear_max = ptMethods.Pt3Stn2010(int(mode), etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
656  // select max pt solution for 3 links:
657  ptR_front = std::max(ptR_front, ptR_front_min);
658  ptR_front = std::max(ptR_front, ptR_front_max);
659  ptR_rear = std::max(ptR_rear, ptR_rear_min);
660  ptR_rear = std::max(ptR_rear, ptR_rear_max);
661  }
662  break;
663  case 6: // for mode 6, 7 and 13 add CLCT information in dph23 bit and iME11 in charge bit
664  case 7:
665  case 13: // ME1-ME4
666  int iME11;
667  iME11 = int(charge); // = 0 if ME1/1, = 1 if ME1/2 or ME1/3 station
668  if(iME11 == 1 && etaR > 1.6) etaR = 1.55; // shift for ME1/2 station
669  if(iME11 == 0 && etaR < 1.6) etaR = 1.65; // shift for ME1/1 station
670  absPhi12 = address.delta_phi_12;
671  //int CLCT_pattern = static_cast<int>(address.delta_phi_23);
672  int CLCT_pattern;
673  CLCT_pattern = int(address.delta_phi_23);
674  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
675 
676  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
677  ptR_front = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 1, int(pt_method));
678  ptR_rear = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 0, int(pt_method));
679  if((pt_method == 24 || pt_method == 26 || pt_method == 28) && etaR > 2.1)//exclude tracks without ME11a
680  {
681  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
682  float ptR_front_min = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12Rmin, 1, int(pt_method));
683  float ptR_rear_min = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12Rmin, 0, int(pt_method));
684  // select max pt solution for 3 links:
685  ptR_front = std::max(ptR_front, ptR_front_min);
686  ptR_rear = std::max(ptR_rear, ptR_rear_min);
687  }
688  if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_front > 5.)) ptR_front = 5.;
689  if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_rear > 5.)) ptR_rear = 5.;
690  //std::cout << "mode = "<< mode << " CLCT_pattern = " << CLCT_pattern << " ptR_rear = " << ptR_rear << std::endl;
691 
692  break;
693  case 8:
694  case 9:
695  case 10:
696  if(charge) absPhi12 = address.delta_phi();
697  else
698  {
699  int temp_phi = address.delta_phi();
700  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
701  }
702 
703  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
704 
705  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
706  ptR_front = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 1, int(pt_method));
707  ptR_rear = ptMethods.Pt2Stn2010(int(mode), etaR, dphi12R, 0, int(pt_method));
708 
709  break;
710  // for overlap DT-CSC region using curves from data 2010
711  case 11: // FR = 1 -> b1-1-3, FR = 0 -> b1-3
712  case 12: // FR = 1 -> b1-2-3, FR = 0 -> b1-2
713  case 14: // FR = 1 -> b1-1-2-(3), FR = 0 -> b1-1
714 
715  //sign definition: sign dphi12 = Phi_DT - Phi_CSC
716  // sing dphi23 = 5th sign. bit of phiBend
717  // -> charge = 1 -> dphi12 = +, phiBend = -
718  // -> charge = 0 -> dphi12 = +, phiBend = +
719  charge12 = 1;
720  absPhi12 = address.delta_phi_12;
721  absPhi23 = address.delta_phi_23;
722 
723  if(charge) charge23 = -1;
724  else charge23 = 1;
725 
726  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
727  dphi23R = float(absPhi23);
728  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
729 
730  int mode1;
731  mode1 = int(mode);
732  if(fr == 1 && mode1 == 11) mode1 = 14; // 3 station track we use dphi12 and phiBend for 2 and 3 station track
733 
734  ptR_front = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
735  ptR_rear = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
736 
737  break;
738  case 15: // halo trigger
739  case 1: // tracks that fail delta phi cuts
740  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3); // 2 GeV
741  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
742  break;
743  default: // Tracks in this category are not considered muons.
744  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0); // 0 GeV
745  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
746  };// end switch
747 
748  front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
749  rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
750 
751  } //end pt_methods 23 - 28
752 
753 //***************************************************//
754 //***************************************************//
755  if(pt_method == 21 || pt_method == 22){ //here we have only pt_methods greater then
756  //for fw 20110118 <- 2011 data taking
757  // mode definition you could find at page 6 & 7:
758  // http://www.phys.ufl.edu/~madorsky/sp/2011-11-18/sp_core_interface.pdf
759  // it is valid starting the beggining of 2011
760  switch(mode)
761  {
762  case 2:
763  case 3:
764  case 4:
765  case 5:
766 
767  charge12 = 1;
768  absPhi12 = address.delta_phi_12;
769  absPhi23 = address.delta_phi_23;
770 
771  if(charge) charge23 = 1;
772  else charge23 = -1;
773 
774  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
775  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
776  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
777 
778  ptR_front = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12R, dphi23R, 1, int(pt_method));
779  ptR_rear = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12R, dphi23R, 0, int(pt_method));
780 
781  if(pt_method == 22 && mode != 5 && etaR > 2.1)//exclude mode without ME11a
782  {
783  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
784  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
785  float dphi23Rmin = dphi23R;
786  float dphi23Rmax = dphi23R;
787  //if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
788  //if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
789  float ptR_front_min = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
790  float ptR_rear_min = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
791  float ptR_front_max = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
792  float ptR_rear_max = ptMethods.Pt3Stn2011(int(mode), etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
793  // select max pt solution for 3 links:
794  ptR_front = std::max(ptR_front, ptR_front_min);
795  ptR_front = std::max(ptR_front, ptR_front_max);
796  ptR_rear = std::max(ptR_rear, ptR_rear_min);
797  ptR_rear = std::max(ptR_rear, ptR_rear_max);
798  }
799  break;
800  case 6: // for mode 6, 7 and 13 add CLCT information in dph23 bit and iME11 in charge bit
801  case 7:
802  case 13: // ME1-ME4
803  int iME11;
804  iME11 = int(charge);
805  absPhi12 = address.delta_phi_12;
806  //int CLCT_pattern = static_cast<int>(address.delta_phi_23);
807  int CLCT_pattern;
808  CLCT_pattern = int(address.delta_phi_23);
809 
810  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
811 
812  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
813  ptR_front = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 1, int(pt_method), iME11);
814  ptR_rear = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 0, int(pt_method), iME11);
815  if((pt_method == 22) && etaR > 2.1)//exclude tracks without ME11a
816  {
817  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
818  float ptR_front_min = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12Rmin, 1, int(pt_method), iME11);
819  float ptR_rear_min = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12Rmin, 0, int(pt_method), iME11);
820  // select max pt solution for 3 links:
821  ptR_front = std::max(ptR_front, ptR_front_min);
822  ptR_rear = std::max(ptR_rear, ptR_rear_min);
823  }
824  if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_front > 5.)) ptR_front = 5.;
825  if( ((CLCT_pattern < 8) || (CLCT_pattern > 10)) && (ptR_rear > 5.)) ptR_rear = 5.;
826 
827  break;
828  case 8:
829  case 9:
830  case 10:
831  if(charge) absPhi12 = address.delta_phi();
832  else
833  {
834  int temp_phi = address.delta_phi();
835  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
836  }
837 
838  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
839 
840  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
841  ptR_front = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 1, int(pt_method), int(2));
842  ptR_rear = ptMethods.Pt2Stn2011(int(mode), etaR, dphi12R, 0, int(pt_method), int(2));
843 
844  break;
845  case 11: // FR = 1 -> b1-1-3, FR = 0 -> b1-3
846  case 12: // FR = 1 -> b1-2-3, FR = 0 -> b1-2
847  case 14: // FR = 1 -> b1-1-2-(3), FR = 0 -> b1-1
848 
849  //sign definition: sign dphi12 = Phi_DT - Phi_CSC
850  // sing dphi23 = 5th sign. bit of phiBend
851  // -> charge = 1 -> dphi12 = +, phiBend = -
852  // -> charge = 0 -> dphi12 = +, phiBend = +
853  charge12 = 1;
854  absPhi12 = address.delta_phi_12;
855  absPhi23 = address.delta_phi_23;
856 
857  if(charge) charge23 = -1;
858  else charge23 = 1;
859 
860  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
861  dphi23R = float(absPhi23);
862  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
863 
864  int mode1;
865  mode1 = int(mode);
866  if(fr == 1 && mode1 == 11) mode1 = 14; // 3 station track we use dphi12 and phiBend for 2 and 3 station track
867 
868  ptR_front = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
869  ptR_rear = ptMethods.Pt3Stn2011(mode1, etaR, dphi12R, dphi23R, int(0), int(pt_method));
870 
871  break;
872  case 15: // halo trigger
873  case 1: // tracks that fail delta phi cuts
874  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3); // 2 GeV
875  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
876  break;
877  default: // Tracks in this category are not considered muons.
878  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0); // 0 GeV
879  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
880  };// end switch
881 
882  front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
883  rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
884 
885  } //end pt_methods greater or equal to 21
886 
887 //***************************************************//
888 //***************************************************//
889  if(pt_method >= 11 && pt_method < 20){ //here we have only pt_methods greater or equal to 11
890  //for fw 20101011 <- 2011 data taking
891  // mode definition you could find at page 6 & 7:
892  // http://www.phys.ufl.edu/~madorsky/sp/2010-10-11/sp_core_interface.pdf
893  // it is valid starting the beggining of 2011
894  switch(mode)
895  {
896  case 2:
897  case 3:
898  case 4:
899  case 5:
900 
901  charge12 = 1;
902  absPhi12 = address.delta_phi_12;
903  absPhi23 = address.delta_phi_23;
904 
905  if(charge) charge23 = 1;
906  else charge23 = -1;
907 
908  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
909  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
910  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
911 
912  ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1, int(pt_method));
913  ptR_rear = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 0, int(pt_method));
914 
915  if(pt_method == 12 && mode != 5 && etaR > 2.1)//exclude mode without ME11a
916  {
917  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
918  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
919  float dphi23Rmin = dphi23R;
920  float dphi23Rmax = dphi23R;
921  if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
922  if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
923  float ptR_front_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
924  float ptR_rear_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
925  float ptR_front_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
926  float ptR_rear_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
927  // select max pt solution for 3 links:
928  ptR_front = std::max(ptR_front, ptR_front_min);
929  ptR_front = std::max(ptR_front, ptR_front_max);
930  ptR_rear = std::max(ptR_rear, ptR_rear_min);
931  ptR_rear = std::max(ptR_rear, ptR_rear_max);
932  }
933  break;
934  case 6:
935  case 7:
936  case 8:
937  case 9:
938  case 10:
939  case 13: // ME1-ME4
940  type = mode - 5;
941 
942  if(charge) absPhi12 = address.delta_phi();
943  else
944  {
945  int temp_phi = address.delta_phi();
946  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
947  }
948 
949  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
950 
951  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
952  ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
953  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
954  if((pt_method == 12) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)//exclude tracks without ME11a
955  {
956  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
957  float ptR_front_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 1, int(pt_method));
958  float ptR_rear_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 0, int(pt_method));
959  // select max pt solution for 3 links:
960  ptR_front = std::max(ptR_front, ptR_front_min);
961  ptR_rear = std::max(ptR_rear, ptR_rear_min);
962  }
963 
964  break;
965  case 11: // FR = 1 -> b1-1-3, FR = 0 -> b1-3
966  case 12: // FR = 1 -> b1-2-3, FR = 0 -> b1-2
967  case 14: // FR = 1 -> b1-1-2-(3), FR = 0 -> b1-1
968 
969  if(fr == 0){ // 2 station track
970  if(charge) absPhi12 = address.delta_phi();
971  else
972  {
973  int temp_phi = address.delta_phi();
974  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
975  }
976  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
977  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
978 
979  }// end fr == 0
980  if(fr == 1){ // 3 station track
981  charge12 = 1;
982  absPhi12 = address.delta_phi_12;
983  absPhi23 = address.delta_phi_23;
984 
985  if(charge) charge23 = 1;
986  else charge23 = -1;
987 
988  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
989  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
990  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
991 
992  ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1, int(pt_method));
993 
994  if(pt_method == 12 && mode != 5 && etaR > 2.1)//exclude mode without ME11a
995  {
996  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
997  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
998  float dphi23Rmin = dphi23R;
999  float dphi23Rmax = dphi23R;
1000  if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
1001  if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
1002  float ptR_front_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
1003  float ptR_front_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
1004  // select max pt solution for 3 links:
1005  ptR_front = std::max(ptR_front, ptR_front_min);
1006  ptR_front = std::max(ptR_front, ptR_front_max);
1007  }
1008  } // end fr == 1
1009 
1010  break;
1011  case 15: // halo trigger
1012  case 1: // tracks that fail delta phi cuts
1013  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(3); // 2 GeV
1014  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(3);
1015  break;
1016  default: // Tracks in this category are not considered muons.
1017  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0); // 0 GeV
1018  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
1019  };// end switch
1020 
1021  front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
1022  rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
1023 
1024  } //end pt_methods greater or equal to 11
1025 //***************************************************//
1026  if(pt_method <= 5){ //here we have only pt_methods less or equal to 5
1027  // mode definition you could find at https://twiki.cern.ch/twiki/pub/Main/PtLUTs/mode_codes.xls
1028  // it is valid till the end 2010
1029 
1030  // kluge to use 2-stn track in overlap region
1031  // see also where this routine is called, and encode LUTaddress, and assignPT
1032  if (pt_method != 4 && pt_method !=5
1033  && (mode == 2 || mode == 3 || mode == 4) && (eta<3)) mode = 6;
1034  if (pt_method != 4 && pt_method !=5 && (mode == 5)
1035  && (eta<3)) mode = 8;
1036 
1037  switch(mode)
1038  {
1039  case 2:
1040  case 3:
1041  case 4:
1042  case 5:
1043  type = mode - 1;
1044  charge12 = 1;
1045  absPhi12 = address.delta_phi_12;
1046  absPhi23 = address.delta_phi_23;
1047 
1048  if(charge) charge23 = 1;
1049  else charge23 = -1;
1050 
1051  // now convert to real numbers for input into PT assignment algos.
1052 
1053  if(pt_method == 4 || pt_method == 5) // param method 2010
1054  {
1055  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1056  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1057  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
1058 
1059  ptR_front = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 1, int(pt_method));
1060  ptR_rear = ptMethods.Pt3Stn2010(mode, etaR, dphi12R, dphi23R, 0, int(pt_method));
1061 
1062  if(pt_method == 5 && mode != 5 && etaR > 2.1)//exclude mode without ME11a
1063  {
1064  float dphi12Rmin = dphi12R - Pi*10/180/3; // 10/3 degrees
1065  float dphi12Rmax = dphi12R + Pi*10/180/3; // 10/3 degrees
1066  float dphi23Rmin = dphi23R;
1067  float dphi23Rmax = dphi23R;
1068  if(dphi12Rmin*dphi12R < 0) dphi23Rmin = -dphi23R;
1069  if(dphi12Rmax*dphi12R < 0) dphi23Rmax = -dphi23R;
1070  float ptR_front_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 1, int(pt_method));
1071  float ptR_rear_min = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmin, dphi23Rmin, 0, int(pt_method));
1072  float ptR_front_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 1, int(pt_method));
1073  float ptR_rear_max = ptMethods.Pt3Stn2010(mode, etaR, dphi12Rmax, dphi23Rmax, 0, int(pt_method));
1074  // select max pt solution for 3 links:
1075  ptR_front = std::max(ptR_front, ptR_front_min);
1076  ptR_front = std::max(ptR_front, ptR_front_max);
1077  ptR_rear = std::max(ptR_rear, ptR_rear_min);
1078  ptR_rear = std::max(ptR_rear, ptR_rear_max);
1079  }
1080  }
1081  else if(pt_method == 1) // param method
1082  {
1083  dphi12R = (static_cast<float>(absPhi12<<1)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1084  dphi23R = (static_cast<float>(absPhi23<<4)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1085  if(charge12 * charge23 < 0) dphi23R = -dphi23R;
1086 
1087  ptR_front = ptMethods.Pt3Stn(type, etaR, dphi12R, dphi23R, 1);
1088  ptR_rear = ptMethods.Pt3Stn(type, etaR, dphi12R, dphi23R, 0);
1089 
1090  }
1091  else if(pt_method == 2) // cathy's method
1092  {
1093  if(type <= 2)
1094  {
1095  ptR_front = ptMethods.Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1);
1096  ptR_rear = ptMethods.Pt3StnChiSq(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0);
1097  }
1098  else
1099  {
1100  ptR_front = ptMethods.Pt2StnChiSq(type-2, etaR, absPhi12<<1, 1);
1101  ptR_rear = ptMethods.Pt2StnChiSq(type-2, etaR, absPhi12<<1, 0);
1102  }
1103 
1104  }
1105  else // hybrid
1106  {
1107 
1108  if(type <= 2)
1109  {
1110  ptR_front = ptMethods.Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 1);
1111  ptR_rear = ptMethods.Pt3StnHybrid(type+3, etaR, absPhi12<<1, ((charge == 0) ? -(absPhi23<<4) : (absPhi23<<4)), 0);
1112  }
1113  else
1114  {
1115  ptR_front = ptMethods.Pt2StnHybrid(type-2, etaR, absPhi12<<1, 1);
1116  ptR_rear = ptMethods.Pt2StnHybrid(type-2, etaR, absPhi12<<1, 0);
1117  }
1118 
1119  }
1120  break;
1121  case 6:
1122  case 7:
1123  case 8:
1124  case 9:
1125  case 10:
1126  type = mode - 5;
1127 
1128  if(charge) absPhi12 = address.delta_phi();
1129  else
1130  {
1131  int temp_phi = address.delta_phi();
1132  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
1133  }
1134 
1135  if(absPhi12 < (1<<9))
1136  {
1137  if(pt_method == 1 || type == 5)
1138  {
1139  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1140 
1141  ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1);
1142  ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0);
1143 
1144  }
1145  else if(pt_method == 2)
1146  {
1147  ptR_front = ptMethods.Pt2StnChiSq(type-1, etaR, absPhi12, 1);
1148  ptR_rear = ptMethods.Pt2StnChiSq(type-1, etaR, absPhi12, 0);
1149  }
1150  else
1151  {
1152  ptR_front = ptMethods.Pt2StnHybrid(type-1, etaR, absPhi12, 1);
1153  ptR_rear = ptMethods.Pt2StnHybrid(type-1, etaR, absPhi12, 0);
1154  }
1155  }
1156  else
1157  {
1158  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1);
1159  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1);
1160  }
1161  if(pt_method == 4 || pt_method == 5) // param method 2010
1162  {
1163  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1164 
1165  //std::cout<< " Sector_rad = " << (CSCTFConstants::SECTOR_RAD) << std::endl;
1166  ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
1167  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
1168  if((pt_method == 5) && etaR > 2.1 && mode != 8 && mode !=9 && mode !=10)//exclude tracks without ME11a
1169  {
1170  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
1171  float ptR_front_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 1, int(pt_method));
1172  float ptR_rear_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 0, int(pt_method));
1173  // select max pt solution for 3 links:
1174  ptR_front = std::max(ptR_front, ptR_front_min);
1175  ptR_rear = std::max(ptR_rear, ptR_rear_min);
1176  }
1177  }
1178 
1179  break;
1180  case 12: // 1-2-b1 calculated only delta_phi12 = 2-b1
1181  case 14:
1182  type = 2;
1183 
1184  if(charge) absPhi12 = address.delta_phi();
1185  else
1186  {
1187  int temp_phi = address.delta_phi();
1188  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
1189  }
1190  if(absPhi12 < (1<<9))
1191  {
1192  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1193  ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1);
1194  ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0);
1195  }
1196  else
1197  {
1198  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1);
1199  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1);
1200  }
1201  if(pt_method == 4 || pt_method == 5) // param method 2010
1202  {
1203  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1204 
1205  ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
1206  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
1207 
1208  if(fabs(dphi12R)<0.01 && (ptR_rear < 10 || ptR_front < 10))
1209  std::cout << "dphi12R = " << dphi12R << " ptR_rear = " << ptR_rear
1210  << " ptR_front = " << ptR_front << " etaR = " << etaR << " mode = " << mode << std::endl;
1211  }
1212  break;
1213  case 13:
1214  type = 4;
1215 
1216  if(charge) absPhi12 = address.delta_phi();
1217  else
1218  {
1219  int temp_phi = address.delta_phi();
1220  absPhi12 = static_cast<unsigned>(-temp_phi) & 0xfff;
1221  }
1222  if(absPhi12 < (1<<9))
1223  {
1224  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1225  ptR_front = ptMethods.Pt2Stn(type, etaR, dphi12R, 1);
1226  ptR_rear = ptMethods.Pt2Stn(type, etaR, dphi12R, 0);
1227  }
1228  else
1229  {
1230  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(1);
1231  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(1);
1232  }
1233 
1234  if(pt_method == 4 || pt_method == 5) // param method 2010
1235  {
1236  dphi12R = (static_cast<float>(absPhi12)) / (static_cast<float>(1<<12)) * CSCTFConstants::SECTOR_RAD;
1237 
1238  ptR_front = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 1, int(pt_method));
1239  ptR_rear = ptMethods.Pt2Stn2010(mode, etaR, dphi12R, 0, int(pt_method));
1240  if((pt_method == 5) && etaR > 2.1)//mode = 13: ME1-ME4 exclude tracks without ME11a
1241  {
1242  float dphi12Rmin = fabs(fabs(dphi12R) - Pi*10/180/3); // 10/3 degrees
1243  float ptR_front_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 1, int(pt_method));
1244  float ptR_rear_min = ptMethods.Pt2Stn2010(mode, etaR, dphi12Rmin, 0, int(pt_method));
1245  // select max pt solution for 3 links:
1246  ptR_front = std::max(ptR_front, ptR_front_min);
1247  ptR_rear = std::max(ptR_rear, ptR_rear_min);
1248  }
1249  }
1250 
1251  break;
1252  case 11:
1253  // singles trigger
1254  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5);
1255  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5);
1256  //ptR_front = trigger_ptscale->getPtScale()->getLowEdge(31);
1257  //ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(31);
1258  break;
1259  case 15:
1260  // halo trigger
1261  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5);
1262  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5);
1263  break;
1264  case 1:
1265  // tracks that fail delta phi cuts
1266  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(5);
1267  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(5);
1268  break;
1269  default: // Tracks in this category are not considered muons.
1270  ptR_front = trigger_ptscale->getPtScale()->getLowEdge(0);
1271  ptR_rear = trigger_ptscale->getPtScale()->getLowEdge(0);
1272  };
1273 
1274  front_pt = trigger_ptscale->getPtScale()->getPacked(ptR_front);
1275  rear_pt = trigger_ptscale->getPtScale()->getPacked(ptR_rear);
1276 
1277  // kluge to set arbitrary Pt for some tracks with lousy resolution (and no param)
1278  if(pt_method != 4 && pt_method != 5)
1279  {
1280  if ((front_pt==0 || front_pt==1) && (eta<3) && quality==1 && pt_method != 2) front_pt = 31;
1281  if ((rear_pt==0 || rear_pt==1) && (eta<3) && quality==1 && pt_method != 2) rear_pt = 31;
1282  }
1283  if(pt_method != 2 && pt_method != 4 && quality == 1)
1284  {
1285  if (front_pt < 5) front_pt = 5;
1286  if (rear_pt < 5) rear_pt = 5;
1287  }
1288 
1289  // in order to match the pt assignement of the previous routine
1290  if(isBeamStartConf && pt_method != 2 && pt_method != 4 && pt_method !=5) {
1291  if(quality == 3 && mode == 5) {
1292 
1293  if (front_pt < 5) front_pt = 5;
1294  if (rear_pt < 5) rear_pt = 5;
1295  }
1296 
1297  if(quality == 2 && mode > 7 && mode < 11) {
1298 
1299  if (front_pt < 5) front_pt = 5;
1300  if (rear_pt < 5) rear_pt = 5;
1301  }
1302  }
1303 
1304  } // end if for pt_method less or equal to 5
1305 //***************************************************//
1306 
1307 
1308  result.front_rank = front_pt | front_quality << 5;
1309  result.rear_rank = rear_pt | rear_quality << 5;
1310 
1311  result.charge_valid_front = 1; //ptMethods.chargeValid(front_pt, quality, eta, pt_method);
1312  result.charge_valid_rear = 1; //ptMethods.chargeValid(rear_pt, quality, eta, pt_method);
1313 
1314 
1315  /* if (mode == 1) {
1316  std::cout << "F_pt: " << front_pt << std::endl;
1317  std::cout << "R_pt: " << rear_pt << std::endl;
1318  std::cout << "F_quality: " << front_quality << std::endl;
1319  std::cout << "R_quality: " << rear_quality << std::endl;
1320  std::cout << "F_rank: " << std::hex << result.front_rank << std::endl;
1321  std::cout << "R_rank: " << std::hex << result.rear_rank << std::endl;
1322  }
1323  */
1324  return result;
1325 }
float Pt3Stn2012_DT(int type, float eta, float dphi1, float dphi2, int PtbyMLH, float &theLH, int fr=-1, int method=11) const
CSCTFPtMethods ptMethods
Definition: CSCTFPtLUT.h:66
const double Pi
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
const L1MuTriggerScales * trigger_scale
Definition: CSCTFPtLUT.h:62
char * address
Definition: mlp_lapack.h:14
float Pt3StnHybrid(int type, float eta, int dphi1, int dphi2, int fr) const
const L1MuScale * getPtScale() const
get the Pt scale
bool isBeamStartConf
Definition: CSCTFPtLUT.h:73
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
Definition: CSCTFPtLUT.h:56
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:75
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 const int dEtaCut_High_C[24]
Definition: CSCTFPtLUT.h:53
float Pt3Stn(int type, float eta, float dphi1, float dphi2, int fr=-1) const
static const int dPhiNLBMap_8bit[256]
Definition: CSCTFPtLUT.h:46
static const int dEtaCut_Mid[24]
Definition: CSCTFPtLUT.h:50
static const int dEtaCut_Low[24]
Definition: CSCTFPtLUT.h:49
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
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]
Definition: CSCTFPtLUT.h:51
unsigned trackQuality(const unsigned &eta, const unsigned &mode, const unsigned &fr) const
Definition: CSCTFPtLUT.cc:1328
class pt_data ptdat
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]
Definition: CSCTFPtLUT.h:54
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]
Definition: CSCTFPtLUT.h:45
static const double SECTOR_RAD
tuple cout
Definition: gather_cfg.py:121
float Pt2Stn(int type, float eta, float dphi, int fr=-1) const
const L1MuTriggerPtScale * trigger_ptscale
Definition: CSCTFPtLUT.h:63
static const int dEtaCut_High_B[24]
Definition: CSCTFPtLUT.h:52
static const int dPhiNLBMap_5bit[32]
Definition: CSCTFPtLUT.h:44
CSCTFPtLUT& CSCTFPtLUT::operator= ( const CSCTFPtLUT )
ptdat CSCTFPtLUT::Pt ( const ptadd address) const

Definition at line 171 of file CSCTFPtLUT.cc.

References calcPt(), L1MuCSCPtLut::pt(), pt_lut, read_pt_lut_es, read_pt_lut_file, query::result, theL1MuCSCPtLut_, and tmp.

Referenced by MuonCandProducerMon::produce(), Pt(), and CSCTFSectorProcessor::run().

172 {
173  ptdat result;
174 
175  if(read_pt_lut_es)
176  {
177  unsigned int shortAdd = (address.toint()& 0x1fffff);
178  ptdat tmp( theL1MuCSCPtLut_->pt(shortAdd) );
179 
180  result = tmp;
181  }
182 
183  else if (read_pt_lut_file)
184  {
185  int shortAdd = (address.toint()& 0x1fffff);
186  result = pt_lut[shortAdd];
187  }
188 
189  else
190  result = calcPt(address);
191 
192  return result;
193 }
char * address
Definition: mlp_lapack.h:14
const L1MuCSCPtLut * theL1MuCSCPtLut_
Definition: CSCTFPtLUT.h:61
bool read_pt_lut_es
Definition: CSCTFPtLUT.h:73
ptdat * pt_lut
Definition: CSCTFPtLUT.h:71
tuple result
Definition: query.py:137
bool read_pt_lut_file
Definition: CSCTFPtLUT.h:73
unsigned short pt(unsigned long addr) const
Definition: L1MuCSCPtLut.h:18
class pt_data ptdat
ptdat calcPt(const ptadd &) const
Definition: CSCTFPtLUT.cc:231
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
ptdat CSCTFPtLUT::Pt ( const unsigned &  address) const

Definition at line 195 of file CSCTFPtLUT.cc.

References Pt().

196 {
197  return Pt(ptadd(address));
198 }
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:171
char * address
Definition: mlp_lapack.h:14
class pt_address ptadd
ptdat CSCTFPtLUT::Pt ( const unsigned &  delta_phi_12,
const unsigned &  delta_phi23,
const unsigned &  track_eta,
const unsigned &  track_mode,
const unsigned &  track_fr,
const unsigned &  delta_phi_sign 
) const

Definition at line 200 of file CSCTFPtLUT.cc.

References Pt().

203 {
204  ptadd address;
205  address.delta_phi_12 = delta_phi_12;
206  address.delta_phi_23 = delta_phi_23;
207  address.track_eta = track_eta;
208  address.track_mode = track_mode;
209  address.track_fr = track_fr;
210  address.delta_phi_sign = delta_phi_sign;
211 
212  return Pt(address);
213 }
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:171
char * address
Definition: mlp_lapack.h:14
class pt_address ptadd
ptdat CSCTFPtLUT::Pt ( const unsigned &  delta_phi_12,
const unsigned &  track_eta,
const unsigned &  track_mode,
const unsigned &  track_fr,
const unsigned &  delta_phi_sign 
) const

Definition at line 215 of file CSCTFPtLUT.cc.

References Pt().

218 {
219  ptadd address;
220  address.delta_phi_12 = ((1<<8)-1)&delta_phi_12;
221  address.delta_phi_23 = ((1<<4)-1)&(delta_phi_12>>8);
222  address.track_eta = track_eta;
223  address.track_mode = track_mode;
224  address.track_fr = track_fr;
225  address.delta_phi_sign = delta_phi_sign;
226 
227  return Pt(address);
228 }
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:171
char * address
Definition: mlp_lapack.h:14
class pt_address ptadd
void CSCTFPtLUT::readLUT ( )
private

Definition at line 1431 of file CSCTFPtLUT.cc.

References end, edm::FileInPath::fullPath(), i, isBinary, CSCBitWidths::kPtAddressWidth, pt_lut, pt_lut_file, and groupFilesInBlocks::temp.

Referenced by CSCTFPtLUT().

1432 {
1433  std::ifstream PtLUT;
1434 
1435  if(isBinary)
1436  {
1437  PtLUT.open(pt_lut_file.fullPath().c_str(), std::ios::binary);
1438  PtLUT.seekg(0, std::ios::end);
1439  int length = PtLUT.tellg();;
1440  if( length == (1<<CSCBitWidths::kPtAddressWidth)*sizeof(short) )
1441  {
1442  PtLUT.seekg(0, std::ios::beg);
1443  PtLUT.read(reinterpret_cast<char*>(pt_lut),length);
1444  }
1445  else
1446  {
1447  edm::LogError("CSCPtLUT") << "File " << pt_lut_file.fullPath() << " is incorrect size!\n";
1448  }
1449  PtLUT.close();
1450  }
1451  else
1452  {
1453  PtLUT.open(pt_lut_file.fullPath().c_str());
1454  unsigned i = 0;
1455  unsigned short temp = 0;
1456  while(!PtLUT.eof() && i < 1 << CSCBitWidths::kPtAddressWidth)
1457  {
1458  PtLUT >> temp;
1459  pt_lut[i++] = (*reinterpret_cast<ptdat*>(&temp));
1460  }
1461  PtLUT.close();
1462  }
1463 }
int i
Definition: DBlmapReader.cc:9
ptdat * pt_lut
Definition: CSCTFPtLUT.h:71
#define end
Definition: vmac.h:38
edm::FileInPath pt_lut_file
Definition: CSCTFPtLUT.h:74
class pt_data ptdat
bool isBinary
Definition: CSCTFPtLUT.h:73
std::string fullPath() const
Definition: FileInPath.cc:171
unsigned CSCTFPtLUT::trackQuality ( const unsigned &  eta,
const unsigned &  mode,
const unsigned &  fr 
) const
private

DEA try increasing quality

Definition at line 1328 of file CSCTFPtLUT.cc.

References isBeamStartConf, lowQualityFlag, and pt_method.

Referenced by calcPt().

1329 {
1330  // eta and mode should be only 4-bits, since that is the input to the large LUT
1331  if (eta>15 || mode>15)
1332  {
1333  //std::cout << "Error: Eta or Mode out of range in AU quality assignment" << std::endl;
1334  edm::LogError("CSCTFPtLUT::trackQuality()")<<"Eta or Mode out of range in AU quality assignment";
1335  return 0;
1336  }
1337  unsigned int quality;
1338  switch (mode) {
1339  case 2:
1340  quality = 3;
1341  if(pt_method > 10 && eta < 3) quality = 1; //eta < 1.2
1342  if(pt_method == 32 && eta >= 12) quality = 2; // eta > 2.1
1343  break;
1344  case 3:
1345  case 4:
1347  // quality = 2;
1348  quality = 3;
1349  if(pt_method == 32 && eta >= 12) quality = 2; // eta > 2.1
1350  break;
1351  case 5:
1352  quality = 1;
1353  if (isBeamStartConf && eta >= 12 && pt_method < 20) // eta > 2.1
1354  quality = 3;
1355  if(pt_method == 27 || pt_method == 28 || pt_method == 29 || pt_method == 32 || pt_method == 30 || pt_method == 33) quality = 3;// all mode = 5 set to quality 3 due to a lot dead ME1/1a stations
1356  break;
1357  case 6:
1358  if (eta>=3) // eta > 1.2
1359  quality = 2;
1360  else
1361  quality = 1;
1362  if(pt_method == 32 && eta >= 12) quality = 1; // eta > 2.1
1363  break;
1364  case 7:
1365  quality = 2;
1366  if(pt_method > 10 && eta < 3) quality = 1; //eta < 1.2
1367  if(pt_method == 32 && eta >= 12) quality = 1; // eta > 2.1
1368  break;
1369  case 8:
1370  case 9:
1371  case 10:
1372  quality = 1;
1373  if (isBeamStartConf && eta >= 12 && pt_method < 20) // eta > 2.1
1374  quality = 2;
1375  if((pt_method == 27 || pt_method == 28 || pt_method == 30) && (eta >= 7 && eta < 9)) quality = 2; //set to quality 2 for eta = 1.6-1.8 due to a lot dead ME1/1a stations
1376  break;
1377  case 11:
1378  // single LCTs
1379  quality = 1;
1380  // overlap region
1381  if(pt_method > 10 && fr == 0) quality = 2;
1382  if(pt_method > 10 && fr == 1) quality = 3;
1383  if(pt_method > 20 && fr == 0) quality = 3;
1384  break;
1385  case 12:
1386  quality = 3;
1387  // overlap region
1388  if(pt_method > 10 && fr == 0) quality = 2;
1389  if(pt_method > 10 && fr == 1) quality = 3;
1390  if(pt_method > 20 && fr == 0) quality = 3;
1391  break;
1392  case 13:
1393  quality = 2;
1394  if(pt_method == 32 && eta >= 12) quality = 1; // eta > 2.1
1395  break;
1396  case 14:
1397  quality = 2;
1398  // overlap region
1399  if(pt_method > 10 && fr == 0) quality = 2;
1400  if(pt_method > 10 && fr == 1) quality = 3;
1401  if(pt_method > 20 && fr == 0) quality = 3;
1402  break;
1403  case 15:
1404  // halo triggers
1405  quality = 1;
1406  break;
1407  //DEA: keep muons that fail delta phi cut
1408  case 1:
1409  quality = 1;
1410  break;
1411  default:
1412  quality = 0;
1413  break;
1414  }
1415 
1416  // allow quality = 1 only in overlap region or eta = 1.6 region
1417  // if ((quality == 1) && (eta >= 4) && (eta != 6) && (eta != 7)) quality = 0;
1418  // if ( (quality == 1) && (eta >= 4) ) quality = 0;
1419 
1420  if ( (quality == 1) && (eta >= 4) && (eta < 11)
1421  && ((lowQualityFlag&4)==0) ) quality = 0;
1422  if ( (quality == 1) && (eta < 4) && ((lowQualityFlag&1)==0)
1423  && ((lowQualityFlag&4)==0) ) quality = 0;
1424  if ( (quality == 1) && (eta >=11) && ((lowQualityFlag&2)==0)
1425  && ((lowQualityFlag&4)==0) ) quality = 0;
1426 
1427  return quality;
1428 
1429 }
unsigned lowQualityFlag
Definition: CSCTFPtLUT.h:75
bool isBeamStartConf
Definition: CSCTFPtLUT.h:73
unsigned pt_method
Definition: CSCTFPtLUT.h:75
T eta() const

Member Data Documentation

const int CSCTFPtLUT::dEtaCut_High_A = {3,3,4,7,3,2,4,7,5,5,5,7,2,2,2,2,3,3,3,3,2,2,2,2}
static

Definition at line 51 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::dEtaCut_High_B = {3,3,4,7,3,3,5,7,6,6,6,7,2,2,3,3,3,3,3,3,3,3,3,2}
static

Definition at line 52 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::dEtaCut_High_C = {4,4,5,7,4,3,6,7,7,7,7,7,3,3,3,3,4,4,4,4,3,3,3,3}
static

Definition at line 53 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::dEtaCut_Low = {2,2,2,7,2,1,2,7,3,3,3,7,1,1,1,1,2,2,2,2,1,1,1,1}
static

Definition at line 49 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::dEtaCut_Mid = {2,2,3,7,2,2,3,7,4,4,4,7,2,2,2,2,2,2,2,2,2,2,2,2}
static

Definition at line 50 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::dEtaCut_Open = {7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}
static

Definition at line 54 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::dPhiNLBMap_5bit
static
Initial value:
=
{ 0 , 1 , 2 , 4 , 5 , 7 , 9 , 11 , 13 , 15 , 18 , 21 , 24 , 28 , 32 , 37 , 41 , 47 , 53 , 60 , 67 , 75 , 84 , 94 , 105 , 117 , 131 , 145 , 162 , 180 , 200 , 222}

Definition at line 44 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::dPhiNLBMap_7bit
static
Initial value:
=
{ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 8 , 9 , 10 , 11 , 12 , 14 , 15 , 16 , 17 , 19 , 20 , 21 , 23 , 24 , 26 , 27 , 29 , 30 , 32 , 33 , 35 , 37 , 38 , 40 , 42 , 44 , 45 , 47 , 49 , 51 , 53 , 55 , 57 , 59 , 61 , 63 , 65 , 67 , 70 , 72 , 74 , 77 , 79 , 81 , 84 , 86 , 89 , 92 , 94 , 97 , 100 , 103 , 105 , 108 , 111 , 114 , 117 , 121 , 124 , 127 , 130 , 134 , 137 , 141 , 144 , 148 , 151 , 155 , 159 , 163 , 167 , 171 , 175 , 179 , 183 , 188 , 192 , 197 , 201 , 206 , 210 , 215 , 220 , 225 , 230 , 235 , 241 , 246 , 251 , 257 , 263 , 268 , 274 , 280 , 286 , 292 , 299 , 305 , 312 , 318 , 325 , 332 , 339 , 346 , 353 , 361 , 368 , 376 , 383 , 391 , 399 , 408 , 416 , 425 , 433 , 442 , 451 , 460 , 469 , 479 , 489 }

Definition at line 45 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::dPhiNLBMap_8bit
static
Initial value:
=
{ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 35 , 36 , 37 , 38 , 39 , 40 , 42 , 43 , 44 , 45 , 46 , 48 , 49 , 50 , 51 , 53 , 54 , 55 , 56 , 58 , 59 , 60 , 61 , 63 , 64 , 65 , 67 , 68 , 69 , 70 , 72 , 73 , 74 , 76 , 77 , 79 , 80 , 81 , 83 , 84 , 85 , 87 , 88 , 90 , 91 , 92 , 94 , 95 , 97 , 98 , 100 , 101 , 103 , 104 , 105 , 107 , 108 , 110 , 111 , 113 , 115 , 116 , 118 , 119 , 121 , 122 , 124 , 125 , 127 , 129 , 130 , 132 , 133 , 135 , 137 , 138 , 140 , 141 , 143 , 145 , 146 , 148 , 150 , 151 , 153 , 155 , 157 , 158 , 160 , 162 , 163 , 165 , 167 , 169 , 171 , 172 , 174 , 176 , 178 , 180 , 181 , 183 , 185 , 187 , 189 , 191 , 192 , 194 , 196 , 198 , 200 , 202 , 204 , 206 , 208 , 210 , 212 , 214 , 216 , 218 , 220 , 222 , 224 , 226 , 228 , 230 , 232 , 234 , 236 , 238 , 240 , 242 , 244 , 246 , 249 , 251 , 253 , 255 , 257 , 259 , 261 , 264 , 266 , 268 , 270 , 273 , 275 , 277 , 279 , 282 , 284 , 286 , 289 , 291 , 293 , 296 , 298 , 300 , 303 , 305 , 307 , 310 , 312 , 315 , 317 , 320 , 322 , 324 , 327 , 329 , 332 , 334 , 337 , 340 , 342 , 345 , 347 , 350 , 352 , 355 , 358 , 360 , 363 , 366 , 368 , 371 , 374 , 376 , 379 , 382 , 385 , 387 , 390 , 393 , 396 , 398 , 401 , 404 , 407 , 410 , 413 , 416 , 419 , 421 , 424 , 427 , 430 , 433 , 436 , 439 , 442 , 445 , 448 , 451 , 454 , 457 , 461 , 464 , 467 , 470 , 473 , 476 , 479 , 483 }

Definition at line 46 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::getPtbyMLH = 0xFFFF
static

Definition at line 56 of file CSCTFPtLUT.h.

Referenced by calcPt().

bool CSCTFPtLUT::isBeamStartConf
private

Definition at line 73 of file CSCTFPtLUT.h.

Referenced by calcPt(), CSCTFPtLUT(), and trackQuality().

bool CSCTFPtLUT::isBinary
private

Definition at line 73 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and readLUT().

unsigned CSCTFPtLUT::lowQualityFlag
private

Definition at line 75 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and trackQuality().

ptdat* CSCTFPtLUT::pt_lut
private

Definition at line 71 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), Pt(), and readLUT().

edm::FileInPath CSCTFPtLUT::pt_lut_file
private

Definition at line 74 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and readLUT().

unsigned CSCTFPtLUT::pt_method
private

Definition at line 75 of file CSCTFPtLUT.h.

Referenced by calcPt(), CSCTFPtLUT(), and trackQuality().

CSCTFPtMethods CSCTFPtLUT::ptMethods
private

Definition at line 66 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().

bool CSCTFPtLUT::read_pt_lut_es
private

Definition at line 73 of file CSCTFPtLUT.h.

Referenced by Pt().

bool CSCTFPtLUT::read_pt_lut_file
private

Definition at line 73 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and Pt().

const L1MuCSCPtLut* CSCTFPtLUT::theL1MuCSCPtLut_
private

Definition at line 61 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and Pt().

const L1MuTriggerPtScale* CSCTFPtLUT::trigger_ptscale
private

Definition at line 63 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().

const L1MuTriggerScales* CSCTFPtLUT::trigger_scale
private

Definition at line 62 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().