CMS 3D CMS Logo

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 = 0
 

Detailed Description

KK.

Definition at line 14 of file CSCTFPtLUT.h.

Constructor & Destructor Documentation

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

KK.

Definition at line 95 of file CSCTFPtLUT.cc.

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

95  : read_pt_lut(true), isBinary(false) {
96  pt_method = 34;
97  //std::cout << "pt_method from 4 " << std::endl;
98  lowQualityFlag = 4;
99  isBeamStartConf = true;
100  if (!lut_read_in) {
101  pt_lut = new ptdat[1 << 21];
102 
104  es.get<L1MuCSCPtLutRcd>().get(ptLUT);
105  const L1MuCSCPtLut* myConfigPt_ = ptLUT.product();
106 
107  memcpy((void*)pt_lut, (void*)myConfigPt_->lut(), (1 << 21) * sizeof(ptdat));
108 
109  lut_read_in = true;
110  }
112  es.get<L1MuTriggerScalesRcd>().get(scales);
113  trigger_scale = scales.product();
114 
116  es.get<L1MuTriggerPtScaleRcd>().get(ptScale);
117  trigger_ptscale = ptScale.product();
118 
119  ptMethods = CSCTFPtMethods(ptScale.product());
120 }
CSCTFPtMethods ptMethods
Definition: CSCTFPtLUT.h:66
const L1MuTriggerScales * trigger_scale
Definition: CSCTFPtLUT.h:64
unsigned lowQualityFlag
Definition: CSCTFPtLUT.h:70
bool isBeamStartConf
Definition: CSCTFPtLUT.h:68
static bool lut_read_in
Definition: CSCTFPtLUT.h:63
unsigned pt_method
Definition: CSCTFPtLUT.h:70
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:62
const unsigned short * lut(void) const
Definition: L1MuCSCPtLut.h:26
class pt_data ptdat
const std::vector< double > ptScale
Definition: Utilities.cc:33
bool read_pt_lut
Definition: CSCTFPtLUT.h:68
bool isBinary
Definition: CSCTFPtLUT.h:68
T const * product() const
Definition: ESHandle.h:86
const L1MuTriggerPtScale * trigger_ptscale
Definition: CSCTFPtLUT.h:65
CSCTFPtLUT::CSCTFPtLUT ( const edm::ParameterSet pset,
const L1MuTriggerScales scales,
const L1MuTriggerPtScale ptScale 
)

Definition at line 123 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().

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

Definition at line 23 of file CSCTFPtLUT.h.

References operator=(), Pt(), and pt_lut.

23  {
24  if (pt_lut)
25  delete[] pt_lut;
26  pt_lut = nullptr;
27  }
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:62

Member Function Documentation

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

Definition at line 231 of file CSCTFPtLUT.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, gather_cfg::cout, HLT_2018_cff::dEta, dEtaCut_High_A, dEtaCut_High_B, dEtaCut_High_C, dEtaCut_Low, dEtaCut_Mid, dEtaCut_Open, dPhiNLBMap_5bit, dPhiNLBMap_7bit, dPhiNLBMap_8bit, PVValHelper::eta, dqmMemoryStats::float, L1MuScale::getLowEdge(), L1MuScale::getPacked(), getPtbyMLH, L1MuTriggerPtScale::getPtScale(), L1MuTriggerScales::getRegionalEtaScale(), mps_fire::i, createfilelist::int, isBeamStartConf, SiStripPI::max, ALCARECOPromptCalibProdSiPixelAli0T_cff::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, qcdUeDQM_cfi::quality, mps_fire::result, CSCTFConstants::SECTOR_RAD, trackQuality(), trigger_ptscale, and trigger_scale.

Referenced by Pt().

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

Referenced by ~CSCTFPtLUT().

ptdat CSCTFPtLUT::Pt ( const ptadd address) const

Definition at line 183 of file CSCTFPtLUT.cc.

References calcPt(), and mps_fire::result.

Referenced by Pt(), CSCTFSectorProcessor::run(), L1Analysis::L1AnalysisCSCTF::SetTracks(), and ~CSCTFPtLUT().

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 }
class pt_data ptdat
ptdat calcPt(const ptadd &) const
Definition: CSCTFPtLUT.cc:231
ptdat CSCTFPtLUT::Pt ( const unsigned &  address) const

Definition at line 196 of file CSCTFPtLUT.cc.

References Pt().

196 { return Pt(ptadd(address)); }
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:183
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 198 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:183
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().

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:183
class pt_address ptadd
void CSCTFPtLUT::readLUT ( )
private

Definition at line 1465 of file CSCTFPtLUT.cc.

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

Referenced by CSCTFPtLUT().

1465  {
1466  std::ifstream PtLUT;
1467 
1468  if (isBinary) {
1469  PtLUT.open(pt_lut_file.fullPath().c_str(), std::ios::binary);
1470  PtLUT.seekg(0, std::ios::end);
1471  int length = PtLUT.tellg();
1472  ;
1473  if (length == (1 << CSCBitWidths::kPtAddressWidth) * sizeof(short)) {
1474  PtLUT.seekg(0, std::ios::beg);
1475  PtLUT.read(reinterpret_cast<char*>(pt_lut), length);
1476  } else {
1477  edm::LogError("CSCPtLUT") << "File " << pt_lut_file.fullPath() << " is incorrect size!\n";
1478  }
1479  PtLUT.close();
1480  } else {
1481  PtLUT.open(pt_lut_file.fullPath().c_str());
1482  unsigned i = 0;
1483  unsigned short temp = 0;
1484  while (!PtLUT.eof() && i < 1 << CSCBitWidths::kPtAddressWidth) {
1485  PtLUT >> temp;
1486  pt_lut[i++] = (*reinterpret_cast<ptdat*>(&temp));
1487  }
1488  PtLUT.close();
1489  }
1490 }
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:62
#define end
Definition: vmac.h:39
edm::FileInPath pt_lut_file
Definition: CSCTFPtLUT.h:69
class pt_data ptdat
std::string fullPath() const
Definition: FileInPath.cc:163
bool isBinary
Definition: CSCTFPtLUT.h:68
unsigned CSCTFPtLUT::trackQuality ( const unsigned &  eta,
const unsigned &  mode,
const unsigned &  fr 
) const
private

DEA try increasing quality

Definition at line 1346 of file CSCTFPtLUT.cc.

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

Referenced by calcPt().

1346  {
1347  // eta and mode should be only 4-bits, since that is the input to the large LUT
1348  if (eta > 15 || mode > 15) {
1349  //std::cout << "Error: Eta or Mode out of range in AU quality assignment" << std::endl;
1350  edm::LogError("CSCTFPtLUT::trackQuality()") << "Eta or Mode out of range in AU quality assignment";
1351  return 0;
1352  }
1353  unsigned int quality;
1354  switch (mode) {
1355  case 2:
1356  quality = 3;
1357  if (pt_method > 10 && eta < 3)
1358  quality = 1; //eta < 1.2
1359  if (pt_method == 32 && eta >= 12)
1360  quality = 2; // eta > 2.1
1361  break;
1362  case 3:
1363  case 4:
1365  // quality = 2;
1366  quality = 3;
1367  if (pt_method == 32 && eta >= 12)
1368  quality = 2; // eta > 2.1
1369  break;
1370  case 5:
1371  quality = 1;
1372  if (isBeamStartConf && eta >= 12 && pt_method < 20) // eta > 2.1
1373  quality = 3;
1374  if (pt_method == 27 || pt_method == 28 || pt_method == 29 || pt_method == 32 || pt_method == 30 ||
1375  pt_method == 33 || pt_method == 34)
1376  quality = 3; // all mode = 5 set to quality 3 due to a lot dead ME1/1a stations
1377  break;
1378  case 6:
1379  if (eta >= 3) // eta > 1.2
1380  quality = 2;
1381  else
1382  quality = 1;
1383  if (pt_method == 32 && eta >= 12)
1384  quality = 1; // eta > 2.1
1385  break;
1386  case 7:
1387  quality = 2;
1388  if (pt_method > 10 && eta < 3)
1389  quality = 1; //eta < 1.2
1390  if (pt_method == 32 && eta >= 12)
1391  quality = 1; // eta > 2.1
1392  break;
1393  case 8:
1394  case 9:
1395  case 10:
1396  quality = 1;
1397  if (isBeamStartConf && eta >= 12 && pt_method < 20) // eta > 2.1
1398  quality = 2;
1399  if ((pt_method == 27 || pt_method == 28 || pt_method == 30) && (eta >= 7 && eta < 9))
1400  quality = 2; //set to quality 2 for eta = 1.6-1.8 due to a lot dead ME1/1a stations
1401  break;
1402  case 11:
1403  // single LCTs
1404  quality = 1;
1405  // overlap region
1406  if (pt_method > 10 && fr == 0)
1407  quality = 2;
1408  if (pt_method > 10 && fr == 1)
1409  quality = 3;
1410  if (pt_method > 20 && fr == 0)
1411  quality = 3;
1412  break;
1413  case 12:
1414  quality = 3;
1415  // overlap region
1416  if (pt_method > 10 && fr == 0)
1417  quality = 2;
1418  if (pt_method > 10 && fr == 1)
1419  quality = 3;
1420  if (pt_method > 20 && fr == 0)
1421  quality = 3;
1422  break;
1423  case 13:
1424  quality = 2;
1425  if (pt_method == 32 && eta >= 12)
1426  quality = 1; // eta > 2.1
1427  break;
1428  case 14:
1429  quality = 2;
1430  // overlap region
1431  if (pt_method > 10 && fr == 0)
1432  quality = 2;
1433  if (pt_method > 10 && fr == 1)
1434  quality = 3;
1435  if (pt_method > 20 && fr == 0)
1436  quality = 3;
1437  break;
1438  case 15:
1439  // halo triggers
1440  quality = 1;
1441  break;
1442  //DEA: keep muons that fail delta phi cut
1443  case 1:
1444  quality = 1;
1445  break;
1446  default:
1447  quality = 0;
1448  break;
1449  }
1450 
1451  // allow quality = 1 only in overlap region or eta = 1.6 region
1452  // if ((quality == 1) && (eta >= 4) && (eta != 6) && (eta != 7)) quality = 0;
1453  // if ( (quality == 1) && (eta >= 4) ) quality = 0;
1454 
1455  if ((quality == 1) && (eta >= 4) && (eta < 11) && ((lowQualityFlag & 4) == 0))
1456  quality = 0;
1457  if ((quality == 1) && (eta < 4) && ((lowQualityFlag & 1) == 0) && ((lowQualityFlag & 4) == 0))
1458  quality = 0;
1459  if ((quality == 1) && (eta >= 11) && ((lowQualityFlag & 2) == 0) && ((lowQualityFlag & 4) == 0))
1460  quality = 0;
1461 
1462  return quality;
1463 }
unsigned lowQualityFlag
Definition: CSCTFPtLUT.h:70
bool isBeamStartConf
Definition: CSCTFPtLUT.h:68
unsigned pt_method
Definition: CSCTFPtLUT.h:70

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 54 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 55 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 56 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 52 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 53 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 57 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 48 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 49 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 50 of file CSCTFPtLUT.h.

Referenced by calcPt().

const int CSCTFPtLUT::getPtbyMLH = 0xFFFF
static

Definition at line 59 of file CSCTFPtLUT.h.

Referenced by calcPt().

bool CSCTFPtLUT::isBeamStartConf
private

Definition at line 68 of file CSCTFPtLUT.h.

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

bool CSCTFPtLUT::isBinary
private

Definition at line 68 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and readLUT().

unsigned CSCTFPtLUT::lowQualityFlag
private

Definition at line 70 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and trackQuality().

bool CSCTFPtLUT::lut_read_in = false
staticprivate

Definition at line 63 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT().

ptdat * CSCTFPtLUT::pt_lut = 0
staticprivate

Definition at line 62 of file CSCTFPtLUT.h.

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

edm::FileInPath CSCTFPtLUT::pt_lut_file
private

Definition at line 69 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and readLUT().

unsigned CSCTFPtLUT::pt_method
private

Definition at line 70 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
private

Definition at line 68 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT().

const L1MuTriggerPtScale* CSCTFPtLUT::trigger_ptscale
private

Definition at line 65 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().

const L1MuTriggerScales* CSCTFPtLUT::trigger_scale
private

Definition at line 64 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().