CMS 3D CMS Logo

L1MuGMTLFMatchQualLUT.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuGMTLFMatchQualLUT
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 
42 
46 
47  for (int i=2; i<6; i++) {
51  }
52 }
53 
54 //------------------------
55 // The Lookup Function --
56 //------------------------
57 
58 unsigned L1MuGMTLFMatchQualLUT::TheLookupFunction (int idx, unsigned delta_eta, unsigned delta_phi) const {
59  // idx is DTRPC, CSCRPC, DTCSC, CSCDT, CSCbRPC, DTfRPC
60  // INPUTS: delta_eta(4) delta_phi(3)
61  // OUTPUTS: mq(6)
62 
63  const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
64 
65  float deta = theGMTScales->getDeltaEtaScale(idx)->getCenter( delta_eta );
66  float dphi = theGMTScales->getDeltaPhiScale()->getCenter( delta_phi );
67 
68  // check out-of range code
69  L1MuSignedPacking<4> EtaPacking;
70  int delta_eta_signed = EtaPacking.idxFromPacked(delta_eta);
71  L1MuSignedPacking<3> PhiPacking;
72  int delta_phi_signed = PhiPacking.idxFromPacked(delta_phi);
73 
74  bool dphi_outofrange = (delta_phi_signed == -4);
75 
76  // limit delta-phi even further **FIXME: make this configurable
77  if (delta_phi_signed >=3 || delta_phi_signed <=-3)
78  dphi_outofrange = true;
79 
80  // check out-of range code
81  bool deta_outofrange = (delta_eta_signed == -8);
82 
83  // limit delta-eta even further **FIXME: make this configurable
84  if (delta_eta_signed >=7 || delta_eta_signed <=-7)
85  deta_outofrange = true;
86 
87  double delta_etaphi = sqrt(m_EtaWeights[idx]*deta*deta + m_PhiWeights[idx]*dphi*dphi);
88 
89 // cout << "MQ LUT : delta_phi = " << dphi
90 // << ", delta_eta = " << deta
91 // << ", delta_etaphi = " << delta_etaphi
92 // << endl;
93 
94 
95  int matchqual = 0;
96  if ( dphi_outofrange || deta_outofrange ||
97  delta_etaphi > m_EtaPhiThresholds[idx] ) {
98  matchqual = 0;
99  }
100  else {
101  double mq = 64. * (m_EtaPhiThresholds[idx] - delta_etaphi) / m_EtaPhiThresholds[idx];
102  matchqual = static_cast<int>(mq);
103  }
104 
105  if (matchqual > 63) matchqual = 63;
106  return matchqual;
107 }
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
static float getPhiWeightEndcap()
static float getEtaWeightEndcap()
float m_EtaWeights[6]
Private data members (LUT parameters);.
const L1MuScale * getDeltaPhiScale() const
get the delta phi scale ( 3 bits)
int idxFromPacked(unsigned packed) const override
get the value from the packed notation (+/-)
Definition: L1MuPacking.h:101
void InitParameters()
Initialize scales, configuration parameters, alignment constants, ...
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
static float getEtaPhiThresholdEndcap()
T sqrt(T t)
Definition: SSEVec.h:18
static float getEtaWeightCOU()
static float getEtaPhiThresholdCOU()
static float getPhiWeightCOU()
static const L1MuGMTScales * getGMTScales()
static float getEtaWeightBarrel()
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)
unsigned TheLookupFunction(int idx, unsigned delta_eta, unsigned delta_phi) const
The lookup function - here the functionality of the LUT is implemented.
static float getEtaPhiThresholdBarrel()
static float getPhiWeightBarrel()