CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
CSCTFPtLUT Class Reference

KK. More...

#include <CSCTFPtLUT.h>

Classes

struct  Tokens
 

Public Member Functions

 CSCTFPtLUT (const edm::EventSetup &c, const Tokens &tokens)
 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 Member Functions

static Tokens consumes (edm::ConsumesCollector iC)
 

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

Detailed Description

KK.

Definition at line 19 of file CSCTFPtLUT.h.

Constructor & Destructor Documentation

◆ CSCTFPtLUT() [1/3]

CSCTFPtLUT::CSCTFPtLUT ( const edm::EventSetup c,
const Tokens tokens 
)

KK.

Definition at line 97 of file CSCTFPtLUT.cc.

References edm::EventSetup::getData(), isBeamStartConf, lowQualityFlag, L1MuCSCPtLut::lut(), lut_read_in, pt_lut, pt_method, CSCTFPtLUT::Tokens::ptLUT, ptMethods, CSCTFPtLUT::Tokens::ptScale, CSCTFPtLUT::Tokens::scales, trigger_ptscale, and trigger_scale.

97  : read_pt_lut(true), isBinary(false) {
98  pt_method = 34;
99  //std::cout << "pt_method from 4 " << std::endl;
100  lowQualityFlag = 4;
101  isBeamStartConf = true;
102  if (!lut_read_in) {
103  pt_lut = new ptdat[1 << 21];
104 
105  const L1MuCSCPtLut& myConfigPt_ = es.getData(tokens.ptLUT);
106 
107  memcpy((void*)pt_lut, (void*)myConfigPt_.lut(), (1 << 21) * sizeof(ptdat));
108 
109  lut_read_in = true;
110  }
111  trigger_scale = &es.getData(tokens.scales);
112  trigger_ptscale = &es.getData(tokens.ptScale);
113 
115 }
CSCTFPtMethods ptMethods
Definition: CSCTFPtLUT.h:79
const L1MuTriggerScales * trigger_scale
Definition: CSCTFPtLUT.h:77
unsigned lowQualityFlag
Definition: CSCTFPtLUT.h:83
bool isBeamStartConf
Definition: CSCTFPtLUT.h:81
static bool lut_read_in
Definition: CSCTFPtLUT.h:76
unsigned pt_method
Definition: CSCTFPtLUT.h:83
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:75
class pt_data ptdat
bool read_pt_lut
Definition: CSCTFPtLUT.h:81
bool isBinary
Definition: CSCTFPtLUT.h:81
const unsigned short * lut(void) const
Definition: L1MuCSCPtLut.h:26
const L1MuTriggerPtScale * trigger_ptscale
Definition: CSCTFPtLUT.h:78

◆ CSCTFPtLUT() [2/3]

CSCTFPtLUT::CSCTFPtLUT ( const edm::ParameterSet pset,
const L1MuTriggerScales scales,
const L1MuTriggerPtScale ptScale 
)

Definition at line 118 of file CSCTFPtLUT.cc.

References edm::FileInPath::fullPath(), isBeamStartConf, isBinary, lowQualityFlag, lut_read_in, muonDTDigis_cfi::pset, pt_lut, pt_lut_file, pt_method, read_pt_lut, and readLUT().

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

◆ CSCTFPtLUT() [3/3]

CSCTFPtLUT::CSCTFPtLUT ( const CSCTFPtLUT )

◆ ~CSCTFPtLUT()

CSCTFPtLUT::~CSCTFPtLUT ( )
inline

Definition at line 36 of file CSCTFPtLUT.h.

References pt_lut.

36  {
37  if (pt_lut)
38  delete[] pt_lut;
39  pt_lut = nullptr;
40  }
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:75

Member Function Documentation

◆ calcPt()

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

Definition at line 226 of file CSCTFPtLUT.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, gather_cfg::cout, HLT_2024v10_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, nano_mu_digi_cff::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, quality, mps_fire::result, CSCTFConstants::SECTOR_RAD, trackQuality(), trigger_ptscale, and trigger_scale.

Referenced by Pt().

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

◆ consumes()

CSCTFPtLUT::Tokens CSCTFPtLUT::consumes ( edm::ConsumesCollector  iC)
static

Definition at line 87 of file CSCTFPtLUT.cc.

References edm::ConsumesCollector::esConsumes(), lut_read_in, CSCTFPtLUT::Tokens::ptLUT, CSCTFPtLUT::Tokens::ptScale, and CSCTFPtLUT::Tokens::scales.

Referenced by CSCTFSectorProcessor::consumes().

87  {
88  Tokens tok;
89  if (not lut_read_in) {
90  tok.ptLUT = iC.esConsumes();
91  }
92  tok.scales = iC.esConsumes();
93  tok.ptScale = iC.esConsumes();
94  return tok;
95 }
static bool lut_read_in
Definition: CSCTFPtLUT.h:76

◆ operator=()

CSCTFPtLUT& CSCTFPtLUT::operator= ( const CSCTFPtLUT )

◆ Pt() [1/4]

ptdat CSCTFPtLUT::Pt ( const ptadd address) const

Definition at line 178 of file CSCTFPtLUT.cc.

References calcPt(), and mps_fire::result.

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

178  {
179  ptdat result;
180  /*
181  if(read_pt_lut)
182  {
183  int shortAdd = (address.toint()& 0x1fffff);
184  result = pt_lut[shortAdd];
185  } else
186  */
187  result = calcPt(address);
188  return result;
189 }
class pt_data ptdat
ptdat calcPt(const ptadd &) const
Definition: CSCTFPtLUT.cc:226

◆ Pt() [2/4]

ptdat CSCTFPtLUT::Pt ( const unsigned &  address) const

Definition at line 191 of file CSCTFPtLUT.cc.

References Pt().

191 { return Pt(ptadd(address)); }
class pt_address ptadd
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:178

◆ Pt() [3/4]

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 193 of file CSCTFPtLUT.cc.

References Pt().

198  {
199  ptadd address;
200  address.delta_phi_12 = delta_phi_12;
201  address.delta_phi_23 = delta_phi_23;
202  address.track_eta = track_eta;
203  address.track_mode = track_mode;
204  address.track_fr = track_fr;
205  address.delta_phi_sign = delta_phi_sign;
206 
207  return Pt(address);
208 }
class pt_address ptadd
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:178

◆ Pt() [4/4]

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 210 of file CSCTFPtLUT.cc.

References Pt().

214  {
215  ptadd address;
216  address.delta_phi_12 = ((1 << 8) - 1) & delta_phi_12;
217  address.delta_phi_23 = ((1 << 4) - 1) & (delta_phi_12 >> 8);
218  address.track_eta = track_eta;
219  address.track_mode = track_mode;
220  address.track_fr = track_fr;
221  address.delta_phi_sign = delta_phi_sign;
222 
223  return Pt(address);
224 }
class pt_address ptadd
ptdat Pt(const ptadd &) const
Definition: CSCTFPtLUT.cc:178

◆ readLUT()

void CSCTFPtLUT::readLUT ( )
private

Definition at line 1458 of file CSCTFPtLUT.cc.

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

Referenced by CSCTFPtLUT().

1458  {
1459  std::ifstream PtLUT;
1460 
1461  if (isBinary) {
1462  PtLUT.open(pt_lut_file.fullPath().c_str(), std::ios::binary);
1463  PtLUT.seekg(0, std::ios::end);
1464  int length = PtLUT.tellg();
1465  ;
1466  if (length == (1 << CSCBitWidths::kPtAddressWidth) * sizeof(short)) {
1467  PtLUT.seekg(0, std::ios::beg);
1468  PtLUT.read(reinterpret_cast<char*>(pt_lut), length);
1469  } else {
1470  edm::LogError("CSCPtLUT") << "File " << pt_lut_file.fullPath() << " is incorrect size!\n";
1471  }
1472  PtLUT.close();
1473  } else {
1474  PtLUT.open(pt_lut_file.fullPath().c_str());
1475  unsigned i = 0;
1476  unsigned short temp = 0;
1477  while (!PtLUT.eof() && i < 1 << CSCBitWidths::kPtAddressWidth) {
1478  PtLUT >> temp;
1479  pt_lut[i++] = temp;
1480  }
1481  PtLUT.close();
1482  }
1483 }
std::string fullPath() const
Definition: FileInPath.cc:161
Log< level::Error, false > LogError
static ptdat * pt_lut
Definition: CSCTFPtLUT.h:75
edm::FileInPath pt_lut_file
Definition: CSCTFPtLUT.h:82
bool isBinary
Definition: CSCTFPtLUT.h:81

◆ trackQuality()

unsigned CSCTFPtLUT::trackQuality ( const unsigned &  eta,
const unsigned &  mode,
const unsigned &  fr 
) const
private

DEA try increasing quality

Definition at line 1339 of file CSCTFPtLUT.cc.

References PVValHelper::eta, isBeamStartConf, lowQualityFlag, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, pt_method, and quality.

Referenced by calcPt().

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

Member Data Documentation

◆ dEtaCut_High_A

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 67 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ dEtaCut_High_B

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 68 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ dEtaCut_High_C

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 69 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ dEtaCut_Low

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 65 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ dEtaCut_Mid

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 66 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ dEtaCut_Open

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 70 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ dPhiNLBMap_5bit

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 61 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ dPhiNLBMap_7bit

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 62 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ dPhiNLBMap_8bit

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 63 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ getPtbyMLH

const int CSCTFPtLUT::getPtbyMLH = 0xFFFF
static

Definition at line 72 of file CSCTFPtLUT.h.

Referenced by calcPt().

◆ isBeamStartConf

bool CSCTFPtLUT::isBeamStartConf
private

Definition at line 81 of file CSCTFPtLUT.h.

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

◆ isBinary

bool CSCTFPtLUT::isBinary
private

Definition at line 81 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and readLUT().

◆ lowQualityFlag

unsigned CSCTFPtLUT::lowQualityFlag
private

Definition at line 83 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and trackQuality().

◆ lut_read_in

bool CSCTFPtLUT::lut_read_in = false
staticprivate

Definition at line 76 of file CSCTFPtLUT.h.

Referenced by consumes(), and CSCTFPtLUT().

◆ pt_lut

ptdat * CSCTFPtLUT::pt_lut = nullptr
staticprivate

Definition at line 75 of file CSCTFPtLUT.h.

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

◆ pt_lut_file

edm::FileInPath CSCTFPtLUT::pt_lut_file
private

Definition at line 82 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT(), and readLUT().

◆ pt_method

unsigned CSCTFPtLUT::pt_method
private

Definition at line 83 of file CSCTFPtLUT.h.

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

◆ ptMethods

CSCTFPtMethods CSCTFPtLUT::ptMethods
private

Definition at line 79 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().

◆ read_pt_lut

bool CSCTFPtLUT::read_pt_lut
private

Definition at line 81 of file CSCTFPtLUT.h.

Referenced by CSCTFPtLUT().

◆ trigger_ptscale

const L1MuTriggerPtScale* CSCTFPtLUT::trigger_ptscale
private

Definition at line 78 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().

◆ trigger_scale

const L1MuTriggerScales* CSCTFPtLUT::trigger_scale
private

Definition at line 77 of file CSCTFPtLUT.h.

Referenced by calcPt(), and CSCTFPtLUT().