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 | Static 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]
 KK. More...
 
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
 
edm::FileInPath pt_lut_file
 
unsigned pt_method
 
CSCTFPtMethods ptMethods
 
bool read_pt_lut
 
const L1MuTriggerPtScaletrigger_ptscale
 
const L1MuTriggerScalestrigger_scale
 

Static Private Attributes

static bool lut_read_in = false
 
static ptdatpt_lut = NULL
 

Detailed Description

KK.

Definition at line 14 of file CSCTFPtLUT.h.

Constructor & Destructor Documentation

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

KK.

Definition at line 81 of file CSCTFPtLUT.cc.

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

82  : read_pt_lut(true),
83  isBinary(false)
84 {
85  pt_method = 34;
86  //std::cout << "pt_method from 4 " << std::endl;
87  lowQualityFlag = 4;
88  isBeamStartConf = true;
89  pt_lut = new ptdat[1<<21];
90 
92  es.get<L1MuCSCPtLutRcd>().get(ptLUT);
93  const L1MuCSCPtLut *myConfigPt_ = ptLUT.product();
94 
95  memcpy((void*)pt_lut,(void*)myConfigPt_->lut(),(1<<21)*sizeof(ptdat));
96 
97  lut_read_in = true;
98 
100  es.get< L1MuTriggerScalesRcd >().get( scales ) ;
101  trigger_scale = scales.product() ;
102 
104  es.get< L1MuTriggerPtScaleRcd >().get( ptScale ) ;
105  trigger_ptscale = ptScale.product() ;
106 
107  ptMethods = CSCTFPtMethods( ptScale.product() ) ;
108 
109 }
CSCTFPtMethods ptMethods
Definition: CSCTFPtLUT.h:61
const L1MuTriggerScales * trigger_scale
Definition: CSCTFPtLUT.h:59
unsigned lowQualityFlag
Definition: CSCTFPtLUT.h:65
bool isBeamStartConf
Definition: CSCTFPtLUT.h:63
static bool lut_read_in
Definition: CSCTFPtLUT.h:58
unsigned pt_method
Definition: CSCTFPtLUT.h:65
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:57
const unsigned short * lut(void) const
Definition: L1MuCSCPtLut.h:25
class pt_data ptdat
T const * product() const
Definition: ESHandle.h:86
bool read_pt_lut
Definition: CSCTFPtLUT.h:63
bool isBinary
Definition: CSCTFPtLUT.h:63
const L1MuTriggerPtScale * trigger_ptscale
Definition: CSCTFPtLUT.h:60
CSCTFPtLUT::CSCTFPtLUT ( const edm::ParameterSet pset,
const L1MuTriggerScales scales,
const L1MuTriggerPtScale ptScale 
)

Definition at line 112 of file CSCTFPtLUT.cc.

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

115  : trigger_scale( scales ),
116  trigger_ptscale( ptScale ),
117  ptMethods( ptScale ),
118  read_pt_lut(false),
119  isBinary(false)
120 {
121  //read_pt_lut = pset.getUntrackedParameter<bool>("ReadPtLUT",false);
122  read_pt_lut = pset.getParameter<bool>("ReadPtLUT");
123  if(read_pt_lut)
124  {
125  pt_lut_file = pset.getParameter<edm::FileInPath>("PtLUTFile");
126  //isBinary = pset.getUntrackedParameter<bool>("isBinary", false);
127  isBinary = pset.getParameter<bool>("isBinary");
128 
129  edm::LogInfo("CSCTFPtLUT::CSCTFPtLUT") << "Reading file: "
130  << pt_lut_file.fullPath().c_str()
131  << " isBinary?(1/0): "
132  << isBinary;
133  }
134 
135  // Determine the pt assignment method to use
136  // 1 - Darin's parameterization method
137  // 2 - Cathy Yeh's chi-square minimization method
138  // 3 - Hybrid
139  // 4 - Anna's parameterization method
140  // 5 - Anna's parameterization method
141  //with improvments at ME1/1a: find max pt for 3 links hypothesis
142  // 11 - Anna's: for fw 20101011 <- 2011 data taking <- not valide any more
143  // 12 - Anna's: for fw 20101011 <- 2011 data taking <- not valide any more
144  //with improvments at ME1/1a: find max pt for 3 links hypothesis
145  // 21 - Anna's: for fw 20110118 and up, curves with data 2010 <- 2011 data taking
146  // 22 - Anna's: for fw 20110118 and up, curves with data 2010 <- 2011 data taking
147  //with improvments at ME1/1a: find max pt for 3 links hypothesis
148  // 23 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
149  // 24 - 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  //25 and 26 like 23 and 24 correspondenly but fix high pt assignment in DT-CSC region
152  // 25 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
153  // 26 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
154  //with improvments at ME1/1a: find max pt for 3 links hypothesis
155  // change Quality: Q = 3 for mode 5, Quility = 2 for mode = 8, 9, 10 at eta = 1.6-1.8
156  // 27 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
157  // 28 - Anna's: for fw 20110118 and up, curves with MC like method 4 <- 2011 data taking
158  //with improvments at ME1/1a: find max pt for 3 links hypothesis
159  // 29 - Bobby's medium Quality: using fw 2012_01_31. Switch to Global Log(L). Non-Linear dphi binning.
160  // 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
161  // 30 - Bobby's loose Quality: using fw 2012_01_31. Switch to Global Log(L). Non-Linear dphi binning.
162  // 31 - Bobby's tight Quality: using fw 2012_01_31. Switch to Global Log(L). Non-Linear dphi binning.
163  // 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.
164  // 34 - Michele. As 33 plus Non-Linear dphi binning also for eta > 2.1
165 
166  pt_method = pset.getUntrackedParameter<unsigned>("PtMethod",32);
167  //std::cout << "pt_method from pset " << std::endl;
168  // what does this mean???
169  lowQualityFlag = pset.getUntrackedParameter<unsigned>("LowQualityFlag",4);
170 
171  if(read_pt_lut && !lut_read_in)
172  {
173  pt_lut = new ptdat[1<<21];
174  readLUT();
175  lut_read_in = true;
176  }
177 
178  isBeamStartConf = pset.getUntrackedParameter<bool>("isBeamStartConf", true);
179 
180 }
CSCTFPtMethods ptMethods
Definition: CSCTFPtLUT.h:61
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const L1MuTriggerScales * trigger_scale
Definition: CSCTFPtLUT.h:59
unsigned lowQualityFlag
Definition: CSCTFPtLUT.h:65
bool isBeamStartConf
Definition: CSCTFPtLUT.h:63
static bool lut_read_in
Definition: CSCTFPtLUT.h:58
unsigned pt_method
Definition: CSCTFPtLUT.h:65
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:57
void readLUT()
Definition: CSCTFPtLUT.cc:1433
edm::FileInPath pt_lut_file
Definition: CSCTFPtLUT.h:64
class pt_data ptdat
bool read_pt_lut
Definition: CSCTFPtLUT.h:63
bool isBinary
Definition: CSCTFPtLUT.h:63
std::string fullPath() const
Definition: FileInPath.cc:165
const L1MuTriggerPtScale * trigger_ptscale
Definition: CSCTFPtLUT.h:60
CSCTFPtLUT::CSCTFPtLUT ( const CSCTFPtLUT )
CSCTFPtLUT::~CSCTFPtLUT ( )
inline

Definition at line 26 of file CSCTFPtLUT.h.

References NULL, and pt_lut.

26 { if(pt_lut) delete [] pt_lut; pt_lut = NULL; }
#define NULL
Definition: scimark2.h:8
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:57

Member Function Documentation

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

Definition at line 232 of file CSCTFPtLUT.cc.

References 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, cmsHarvester::index, isBeamStartConf, bookConverter::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, HLT_25ns14e33_v1_cff::quality, query::result, CSCTFConstants::SECTOR_RAD, trackQuality(), trigger_ptscale, and trigger_scale.

Referenced by Pt().

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

Definition at line 182 of file CSCTFPtLUT.cc.

References calcPt(), and query::result.

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

183 {
184  ptdat result;
185  /*
186  if(read_pt_lut)
187  {
188  int shortAdd = (address.toint()& 0x1fffff);
189  result = pt_lut[shortAdd];
190  } else
191  */
192  result = calcPt(address);
193  return result;
194 }
tuple result
Definition: query.py:137
class pt_data ptdat
ptdat calcPt(const ptadd &) const
Definition: CSCTFPtLUT.cc:232
ptdat CSCTFPtLUT::Pt ( const unsigned &  address) const

Definition at line 196 of file CSCTFPtLUT.cc.

References Pt().

197 {
198  return Pt(ptadd(address));
199 }
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:182
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 201 of file CSCTFPtLUT.cc.

References Pt().

204 {
205  ptadd address;
206  address.delta_phi_12 = delta_phi_12;
207  address.delta_phi_23 = delta_phi_23;
208  address.track_eta = track_eta;
209  address.track_mode = track_mode;
210  address.track_fr = track_fr;
211  address.delta_phi_sign = delta_phi_sign;
212 
213  return Pt(address);
214 }
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:182
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 216 of file CSCTFPtLUT.cc.

References Pt().

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

Definition at line 1433 of file CSCTFPtLUT.cc.

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

Referenced by CSCTFPtLUT().

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

DEA try increasing quality

Definition at line 1330 of file CSCTFPtLUT.cc.

References isBeamStartConf, lowQualityFlag, pt_method, and HLT_25ns14e33_v1_cff::quality.

Referenced by calcPt().

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

KK.

Definition at line 42 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 43 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 44 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::getPtbyMLH = 0xFFFF
static

Definition at line 54 of file CSCTFPtLUT.h.

Referenced by calcPt().

bool CSCTFPtLUT::isBeamStartConf
private

Definition at line 63 of file CSCTFPtLUT.h.

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

bool CSCTFPtLUT::isBinary
private

Definition at line 63 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and readLUT().

unsigned CSCTFPtLUT::lowQualityFlag
private

Definition at line 65 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and trackQuality().

bool CSCTFPtLUT::lut_read_in = false
staticprivate

Definition at line 58 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT().

ptdat * CSCTFPtLUT::pt_lut = NULL
staticprivate

Definition at line 57 of file CSCTFPtLUT.h.

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

edm::FileInPath CSCTFPtLUT::pt_lut_file
private

Definition at line 64 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and readLUT().

unsigned CSCTFPtLUT::pt_method
private

Definition at line 65 of file CSCTFPtLUT.h.

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

CSCTFPtMethods CSCTFPtLUT::ptMethods
private

Definition at line 61 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().

bool CSCTFPtLUT::read_pt_lut
private

Definition at line 63 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT().

const L1MuTriggerPtScale* CSCTFPtLUT::trigger_ptscale
private

Definition at line 60 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().

const L1MuTriggerScales* CSCTFPtLUT::trigger_scale
private

Definition at line 59 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().