CMS 3D CMS Logo

L1MuGMTMIAUEtaProLUT.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuGMTMIAUEtaProLUT
4 //
5 //
6 //
7 // Author :
8 // H. Sakulin HEPHY Vienna
9 //
10 // Migrated to CMSSW:
11 // I. Mikulec
12 //
13 //--------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 
24 //#include <iostream>
25 
26 //-------------------------------
27 // Collaborating Class Headers --
28 //-------------------------------
36 
38 
39 //-------------------
40 // InitParameters --
41 //-------------------
42 
44 
45 //--------------------------------------------------------------------------------
46 // Eta Projection LUT: Based on eta(6), pt(5) and charge(1), project in eta and directly
47 // =================== output the eta select-bits for the regions in eta.
48 //
49 // In the barrel there are 8 slect bits while in the forward chip there are 10.
50 //
51 // output: eta select bits
52 // eta= -3. 3.
53 // total: 14 rings in eta 0 1 2 3 4 5 6 7 8 9 10 11 12 13
54 //
55 // barrel:8 0 1 2 3 4 5 6 7
56 // fwd:10 0 1 2 3 4 5 6 7 8 9
57 //
58 // As for the phi projection, in case of MIP bits by defualt only one region is checked
59 // while for the ISO bit assignment multiple regions can be checked as given by
60 // IsolationCellSizeEta. Adjacent regions to be ckecked are determined in analogy to
61 // the phi projection.
62 //
63 //--------------------------------------------------------------------------------
64 
65 unsigned L1MuGMTMIAUEtaProLUT::TheLookupFunction(int idx, unsigned eta, unsigned pt, unsigned charge) const {
66  // idx is MIP_DT, MIP_BRPC, ISO_DT, ISO_BRPC, MIP_CSC, MIP_FRPC, ISO_CSC, ISO_FRPC
67  // INPUTS: eta(6) pt(5) charge(1)
68  // OUTPUTS: eta_sel(10)
69 
70  // const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
71  const L1MuTriggerScales* theTriggerScales = L1MuGMTConfig::getTriggerScales();
72  const L1MuTriggerPtScale* theTriggerPtScale = L1MuGMTConfig::getTriggerPtScale();
73  const L1CaloGeometry* theCaloGeom = L1MuGMTConfig::getCaloGeom();
74 
75  int isRPC = idx % 2;
76  int isFWD = idx / 4;
77 
78  int isISO = (idx / 2) % 2;
79 
80  int idx_drcr = isFWD * 2 + isRPC;
81 
82  if (pt == 0)
83  return 0; // empty candidate
84 
85  int ch_idx = (charge == 0) ? 1 : 0; // positive charge is 0 (but idx 1)
86 
87  float oldeta = theTriggerScales->getRegionalEtaScale(idx_drcr)->getCenter(eta);
88 
89  if (idx_drcr == 2)
90  oldeta = theTriggerScales->getRegionalEtaScale(idx_drcr)->getLowEdge(eta); //FIXME use center when changed in ORCA
91 
92  if ((isRPC && isFWD && fabs(oldeta) < 1.04) || (isRPC && !isFWD && fabs(oldeta) > 1.04)) {
93  if (!m_saveFlag)
94  edm::LogWarning("LUTRangeViolation") << "L1MuGMTMIAUEtaProLUT::TheLookupFunction: RPC " << (isFWD ? "fwd" : "brl")
95  << " eta value out of range: " << oldeta;
96  }
97 
98  // eta conversion depends only on isys by default
99  int isys = isFWD + 2 * isRPC; // DT, CSC, BRPC, FRPC
100  float neweta = L1MuGMTEtaLUT::eta(isys,
101  isISO,
102  ch_idx,
103  oldeta,
104  theTriggerPtScale->getPtScale()->getLowEdge(pt)); // use old LUT, here
105  // theTriggerScales->getPtScale()->getLowEdge(pt) ); // use old LUT, here
106 
107  // unsigned icenter = theGMTScales->getCaloEtaScale()->getPacked( neweta );
108  // globalEtaIndex is 0-21 for forward+central; need to shift to 0-13 for central only
109  unsigned icenter = theCaloGeom->globalEtaIndex(neweta) - theCaloGeom->numberGctForwardEtaBinsPerHalf();
110 
111  unsigned eta_select_word_14 = 1 << icenter; // for the whole detector
112 
113  // for ISOlation bit assignment, multiple regions can be selected according to the IsolationCellSize
114  if (isISO) {
115  int imin = icenter - (m_IsolationCellSizeEta - 1) / 2;
116  int imax = icenter + (m_IsolationCellSizeEta - 1) / 2;
117 
118  // for even number of isolation cells check the fine grain info
119  if (m_IsolationCellSizeEta % 2 == 0) {
120  // float bincenter = theGMTScales->getCaloEtaScale()->getCenter( icenter );
121  // globalEtaIndex is 0-21 for forward+central; need to shift to 0-13 for central only
122  float bincenter = theCaloGeom->globalEtaBinCenter(icenter + theCaloGeom->numberGctForwardEtaBinsPerHalf());
123  if (neweta > bincenter)
124  imax++;
125  else
126  imin--;
127  }
128  if (imin < 0)
129  imin = 0;
130  if (imax > 13)
131  imax = 13;
132 
133  for (int i = imin; i <= imax; i++)
134  eta_select_word_14 |= 1 << i;
135  }
136 
137  // generate select words for barrel (10 central bits)
138  // and for forward (5+5 fwd bits) case
139  unsigned eta_select_word;
140  if (isFWD) {
141  unsigned mask5 = (1 << 5) - 1;
142  eta_select_word = eta_select_word_14 & mask5;
143  eta_select_word |= (eta_select_word_14 & (mask5 << 9)) >> 4;
144  } else {
145  unsigned mask10 = (1 << 10) - 1;
146  eta_select_word = (eta_select_word_14 & (mask10 << 2)) >> 2;
147  }
148 
149  return eta_select_word;
150 }
double globalEtaBinCenter(unsigned int globalEtaIndex) const
static const L1CaloGeometry * getCaloGeom()
int m_IsolationCellSizeEta
Private data members (LUT parameters);.
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
const L1MuScale * getPtScale() const
get the Pt scale
const L1MuScale * getRegionalEtaScale(int isys) const
get the regioanl muon trigger eta scale, isys = 0(DT), 1(bRPC), 2(CSC), 3(fwdRPC) ...
static int getIsolationCellSizeEta()
unsigned int globalEtaIndex(const double &etaValue) const
static const L1MuTriggerPtScale * getTriggerPtScale()
bool isRPC(GeomDetEnumerators::SubDetector m)
unsigned int numberGctForwardEtaBinsPerHalf() const
static const L1MuTriggerScales * getTriggerScales()
void InitParameters()
Initialize scales, configuration parameters, alignment constants, ...
bool m_saveFlag
Definition: L1MuGMTLUT.h:221
static float eta(int isys, int isISO, int icharge, float eta, float pt)
look up delta-eta
unsigned TheLookupFunction(int idx, unsigned eta, unsigned pt, unsigned charge) const
The lookup function - here the functionality of the LUT is implemented.
Log< level::Warning, false > LogWarning