CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1MuGMTLFCOUDeltaEtaLUT.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuGMTLFCOUDeltaEtaLUT
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 //-------------------------------
32 
33 //-------------------
34 // InitParameters --
35 //-------------------
36 
38 
39 //---------------------------------------------------------------------------
40 // Cancel-Out-Unit Delta-Eta LUT
41 // =============================
42 //
43 // Calculate delta-eta between two eta values coded in a special 4-bit scale
44 // used in the overlap region
45 //
46 // This scale is used to save I/O pins and in order to be able to do the delta-eta
47 // calculateion in a distributed RAM LUT
48 //
49 //---------------------------------------------------------------------------
50 
51 unsigned L1MuGMTLFCOUDeltaEtaLUT::TheLookupFunction(int idx, unsigned eta1, unsigned eta2) const {
52  // idx is DTCSC, CSCDT, bRPCCSC, fRPCDT
53  // INPUTS: eta1(4) eta2(4)
54  // OUTPUTS: delta_eta(4)
55 
56  const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
57 
58  // check out of range in inputs
60  unsigned delta_eta_OOR = pack.packedFromIdx(-8);
61 
62  if (eta1 == 7 || eta2 == 7)
63  return delta_eta_OOR;
64 
65  int type1 = 0, type2 = 0;
66  switch (idx) {
67  case 0:
68  type1 = 0;
69  type2 = 2;
70  break; // DT, CSC
71  case 1:
72  type1 = 2;
73  type2 = 0;
74  break; // CSC, DT
75  case 2:
76  type1 = 1;
77  type2 = 2;
78  break; // bRPC, CSC
79  case 3:
80  type1 = 3;
81  type2 = 0;
82  break; // fRPC, DT
83  }
84 
85  float etaValue1 = theGMTScales->getOvlEtaScale(type1)->getCenter(eta1);
86  float etaValue2 = theGMTScales->getOvlEtaScale(type2)->getCenter(eta2);
87 
88  float delta_eta = etaValue1 - etaValue2;
89 
90  unsigned delta_eta_4bit = 0;
91 
92  // check out of range
93  if (delta_eta < theGMTScales->getDeltaEtaScale(idx + 2)->getScaleMin() ||
94  delta_eta > theGMTScales->getDeltaEtaScale(idx + 2)->getScaleMax()) {
95  delta_eta_4bit = delta_eta_OOR;
96  } else {
97  delta_eta_4bit = theGMTScales->getDeltaEtaScale(idx + 2)->getPacked(delta_eta);
98  }
99 
100  return delta_eta_4bit;
101 }
virtual float getScaleMax() const =0
get the upper edge of the last bin
double delta_eta(double eta1, double eta2)
Definition: AnglesUtil.h:89
void InitParameters()
Initialize scales, configuration parameters, alignment constants, ...
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
static const L1MuGMTScales * getGMTScales()
unsigned TheLookupFunction(int idx, unsigned eta1, unsigned eta2) const
The lookup function - here the functionality of the LUT is implemented.
unsigned packedFromIdx(int idx) const override
get the packed notation of a value, check range
Definition: L1MuPacking.h:104
virtual unsigned getPacked(float value) const =0
pack a value
const L1MuScale * getDeltaEtaScale(int idx) const
get the delta eta scale; idx = 0(DT=RPC), 1(CSC-RPC), 2(DT-CSC), 3(CSC-DT), 4(bRPC-CSC), 5(fRPC-DT)
const L1MuScale * getOvlEtaScale(int isys) const
get the overlap eta scale (4 bits); isys = 0(DT), 1(bRPC), 2(CSC), 3(fwdRPC)