test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 //---------------------------------------------------------------------------
41 // Cancel-Out-Unit Delta-Eta LUT
42 // =============================
43 //
44 // Calculate delta-eta between two eta values coded in a special 4-bit scale
45 // used in the overlap region
46 //
47 // This scale is used to save I/O pins and in order to be able to do the delta-eta
48 // calculateion in a distributed RAM LUT
49 //
50 //---------------------------------------------------------------------------
51 
52 unsigned L1MuGMTLFCOUDeltaEtaLUT::TheLookupFunction (int idx, unsigned eta1, unsigned eta2) const {
53  // idx is DTCSC, CSCDT, bRPCCSC, fRPCDT
54  // INPUTS: eta1(4) eta2(4)
55  // OUTPUTS: delta_eta(4)
56 
57  const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
58 
59  // check out of range in inputs
61  unsigned delta_eta_OOR = pack.packedFromIdx (-8);
62 
63  if (eta1==7 || eta2 ==7) return delta_eta_OOR;
64 
65  int type1=0, type2=0;
66  switch (idx) {
67  case 0: type1 = 0; type2 = 2; break; // DT, CSC
68  case 1: type1 = 2; type2 = 0; break; // CSC, DT
69  case 2: type1 = 1; type2 = 2; break; // bRPC, CSC
70  case 3: type1 = 3; type2 = 0; break; // fRPC, DT
71  }
72 
73  float etaValue1 = theGMTScales->getOvlEtaScale(type1)->getCenter(eta1);
74  float etaValue2 = theGMTScales->getOvlEtaScale(type2)->getCenter(eta2);
75 
76  float delta_eta = etaValue1 - etaValue2;
77 
78  unsigned delta_eta_4bit = 0;
79 
80  // check out of range
81  if (delta_eta < theGMTScales->getDeltaEtaScale(idx+2)->getScaleMin() ||
82  delta_eta > theGMTScales->getDeltaEtaScale(idx+2)->getScaleMax()) {
83  delta_eta_4bit = delta_eta_OOR;
84  }
85  else {
86  delta_eta_4bit = theGMTScales->getDeltaEtaScale(idx+2)->getPacked( delta_eta );
87  }
88 
89  return delta_eta_4bit;
90 }
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
virtual float getScaleMax() const =0
get the upper edge of the last bin
double delta_eta(double eta1, double eta2)
Definition: AnglesUtil.h:98
virtual unsigned packedFromIdx(int idx) const
get the packed notation of a value, check range
Definition: L1MuPacking.h:102
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()
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
unsigned TheLookupFunction(int idx, unsigned eta1, unsigned eta2) const
The lookup function - here the functionality of the LUT is implemented.
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)