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 // $Date: 2007/04/02 15:45:38 $
7 // $Revision: 1.3 $
8 //
9 // Author :
10 // H. Sakulin HEPHY Vienna
11 //
12 // Migrated to CMSSW:
13 // I. Mikulec
14 //
15 //--------------------------------------------------
16 
17 //-----------------------
18 // This Class's Header --
19 //-----------------------
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 
26 //#include <iostream>
27 
28 //-------------------------------
29 // Collaborating Class Headers --
30 //-------------------------------
34 
35 //-------------------
36 // InitParameters --
37 //-------------------
38 
40 }
41 
42 //---------------------------------------------------------------------------
43 // Cancel-Out-Unit Delta-Eta LUT
44 // =============================
45 //
46 // Calculate delta-eta between two eta values coded in a special 4-bit scale
47 // used in the overlap region
48 //
49 // This scale is used to save I/O pins and in order to be able to do the delta-eta
50 // calculateion in a distributed RAM LUT
51 //
52 //---------------------------------------------------------------------------
53 
54 unsigned L1MuGMTLFCOUDeltaEtaLUT::TheLookupFunction (int idx, unsigned eta1, unsigned eta2) const {
55  // idx is DTCSC, CSCDT, bRPCCSC, fRPCDT
56  // INPUTS: eta1(4) eta2(4)
57  // OUTPUTS: delta_eta(4)
58 
59  const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
60 
61  // check out of range in inputs
63  unsigned delta_eta_OOR = pack.packedFromIdx (-8);
64 
65  if (eta1==7 || eta2 ==7) return delta_eta_OOR;
66 
67  int type1=0, type2=0;
68  switch (idx) {
69  case 0: type1 = 0; type2 = 2; break; // DT, CSC
70  case 1: type1 = 2; type2 = 0; break; // CSC, DT
71  case 2: type1 = 1; type2 = 2; break; // bRPC, CSC
72  case 3: type1 = 3; type2 = 0; break; // fRPC, DT
73  }
74 
75  float etaValue1 = theGMTScales->getOvlEtaScale(type1)->getCenter(eta1);
76  float etaValue2 = theGMTScales->getOvlEtaScale(type2)->getCenter(eta2);
77 
78  float delta_eta = etaValue1 - etaValue2;
79 
80  unsigned delta_eta_4bit = 0;
81 
82  // check out of range
83  if (delta_eta < theGMTScales->getDeltaEtaScale(idx+2)->getScaleMin() ||
84  delta_eta > theGMTScales->getDeltaEtaScale(idx+2)->getScaleMax()) {
85  delta_eta_4bit = delta_eta_OOR;
86  }
87  else {
88  delta_eta_4bit = theGMTScales->getDeltaEtaScale(idx+2)->getPacked( delta_eta );
89  }
90 
91  return delta_eta_4bit;
92 }
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
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:94
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.
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)