CMS 3D CMS Logo

MicroGMTMatchQualFineLUT.cc
Go to the documentation of this file.
2 #include "TMath.h"
3 
5  const double maxDR,
6  const double fEta,
7  const double fEtaCoarse,
8  const double fPhi,
9  cancel_t cancelType)
10  : MicroGMTMatchQualLUT(), m_fEtaCoarse(fEtaCoarse) {
11  m_dEtaRedInWidth = 5;
12  m_dPhiRedInWidth = 3;
13  m_maxDR = maxDR;
14  m_fEta = fEta;
15  m_fPhi = fPhi;
16  m_cancelType = cancelType;
17 
19  m_outWidth = 1;
20 
21  m_dPhiRedMask = (1 << m_dPhiRedInWidth) - 1;
24 
28 
29  m_phiScale = 2 * TMath::Pi() / 576.0;
30  m_etaScale = 0.010875;
31 
32  if (fname != std::string("")) {
33  load(fname);
34  } else {
35  initialize();
36  }
37 }
38 
40  : MicroGMTMatchQualLUT(lut) {
41  m_dEtaRedInWidth = 5;
42  m_dPhiRedInWidth = 3;
43  m_cancelType = cancelType;
44 
46  m_outWidth = 1;
47 
48  m_dPhiRedMask = (1 << m_dPhiRedInWidth) - 1;
51 
55 
56  m_phiScale = 2 * TMath::Pi() / 576.0;
57  m_etaScale = 0.010875;
58 
59  m_initialized = true;
60 }
61 
62 int l1t::MicroGMTMatchQualFineLUT::lookup(int etaFine, int dEtaRed, int dPhiRed) const {
63  // normalize these two to the same scale and then calculate?
64  if (m_initialized) {
65  return data((unsigned)hashInput(
66  checkedInput(etaFine, 1), checkedInput(dEtaRed, m_dEtaRedInWidth), checkedInput(dPhiRed, m_dPhiRedInWidth)));
67  }
68  double dEta = m_fEtaCoarse * dEtaRed * m_etaScale;
69  if (etaFine > 0) {
70  dEta = m_fEta * dEtaRed * m_etaScale;
71  }
72  double dPhi = m_fPhi * dPhiRed * m_phiScale;
73  double dR = std::sqrt(dEta * dEta + dPhi * dPhi);
74 
75  int retVal = dR <= m_maxDR ? 1 : 0;
76 
77  return retVal;
78 }
79 
81  if (m_initialized) {
82  return data((unsigned)in);
83  }
84 
85  int etaFine = 0;
86  int dEtaRed = 0;
87  int dPhiRed = 0;
88  unHashInput(in, etaFine, dEtaRed, dPhiRed);
89  return lookup(etaFine, dEtaRed, dPhiRed);
90 }
91 
92 int l1t::MicroGMTMatchQualFineLUT::hashInput(int etaFine, int dEtaRed, int dPhiRed) const {
93  int result = 0;
94  result += dPhiRed;
95  result += dEtaRed << m_dPhiRedInWidth;
96  result += etaFine << (m_dEtaRedInWidth + m_dPhiRedInWidth);
97  return result;
98 }
99 
100 void l1t::MicroGMTMatchQualFineLUT::unHashInput(int input, int& etaFine, int& dEtaRed, int& dPhiRed) const {
101  dPhiRed = input & m_dPhiRedMask;
102  dEtaRed = (input & m_dEtaRedMask) >> m_dPhiRedInWidth;
103  etaFine = (input & m_etaFineMask) >> (m_dEtaRedInWidth + m_dPhiRedInWidth);
104 }
l1t::MicroGMTMatchQualLUT::m_phiScale
double m_phiScale
Definition: MicroGMTMatchQualLUT.h:41
l1t::MicroGMTMatchQualFineLUT::MicroGMTMatchQualFineLUT
MicroGMTMatchQualFineLUT()
Definition: MicroGMTMatchQualLUT.h:68
l1t::MicroGMTMatchQualFineLUT::lookupPacked
int lookupPacked(int in) const override
Definition: MicroGMTMatchQualFineLUT.cc:80
input
static const std::string input
Definition: EdmProvDump.cc:48
l1t::MicroGMTMatchQualLUT::m_cancelType
cancel_t m_cancelType
Definition: MicroGMTMatchQualLUT.h:47
l1t::cancel_t
cancel_t
Definition: MicroGMTMatchQualLUT.h:11
l1t::MicroGMTMatchQualLUT::m_dPhiRedInWidth
int m_dPhiRedInWidth
Definition: MicroGMTMatchQualLUT.h:38
l1t::MicroGMTMatchQualLUT::m_dEtaRedInWidth
int m_dEtaRedInWidth
Definition: MicroGMTMatchQualLUT.h:37
HLT_FULL_cff.dPhi
dPhi
Definition: HLT_FULL_cff.py:13702
l1t::MicroGMTMatchQualLUT::m_fEta
double m_fEta
Definition: MicroGMTMatchQualLUT.h:44
l1t::MicroGMTMatchQualFineLUT::unHashInput
void unHashInput(int input, int &etaFine, int &dEta, int &dPhi) const
Definition: MicroGMTMatchQualFineLUT.cc:100
l1t::MicroGMTMatchQualLUT::m_fPhi
double m_fPhi
Definition: MicroGMTMatchQualLUT.h:45
l1t::MicroGMTLUT::initialize
void initialize()
Definition: MicroGMTLUT.cc:38
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1t::MicroGMTConfiguration::DELTA_PHI_RED
Definition: MicroGMTConfiguration.h:27
l1t::MicroGMTConfiguration::ETA_FINE_BIT
Definition: MicroGMTConfiguration.h:29
recoMuon::in
Definition: RecoMuonEnumerators.h:6
l1t::MicroGMTMatchQualLUT::m_etaScale
double m_etaScale
Definition: MicroGMTMatchQualLUT.h:40
l1t::MicroGMTLUT::m_initialized
bool m_initialized
Definition: MicroGMTLUT.h:37
l1t::MicroGMTLUT::m_totalInWidth
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
MicroGMTMatchQualLUT.h
l1t::MicroGMTMatchQualFineLUT::lookup
int lookup(int etaFine, int dEta, int dPhi) const override
Definition: MicroGMTMatchQualFineLUT.cc:62
HLTMuonOfflineAnalyzer_cfi.etaFine
etaFine
Definition: HLTMuonOfflineAnalyzer_cfi.py:113
l1t::MicroGMTLUT::load
int load(const std::string &inFileName)
Definition: MicroGMTLUT.cc:15
l1t::MicroGMTLUT::m_outWidth
unsigned m_outWidth
Definition: MicroGMTLUT.h:35
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
l1t::MicroGMTConfiguration::DELTA_ETA_RED
Definition: MicroGMTConfiguration.h:26
l1t::LUT
Definition: LUT.h:29
HLT_FULL_cff.dEta
dEta
Definition: HLT_FULL_cff.py:13701
l1t::MicroGMTMatchQualLUT
Definition: MicroGMTMatchQualLUT.h:23
l1t::MicroGMTMatchQualLUT::m_dPhiRedMask
int m_dPhiRedMask
Definition: MicroGMTMatchQualLUT.h:36
l1t::MicroGMTMatchQualLUT::m_dEtaRedMask
int m_dEtaRedMask
Definition: MicroGMTMatchQualLUT.h:35
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
l1t::MicroGMTLUT::m_inputs
std::vector< MicroGMTConfiguration::input_t > m_inputs
Definition: MicroGMTLUT.h:36
l1t::MicroGMTMatchQualFineLUT::hashInput
int hashInput(int etaFine, int dEta, int dPhi) const
Definition: MicroGMTMatchQualFineLUT.cc:92
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
l1t::MicroGMTMatchQualLUT::m_maxDR
double m_maxDR
Definition: MicroGMTMatchQualLUT.h:43
mps_fire.result
result
Definition: mps_fire.py:311
jets_cff.maxDR
maxDR
Definition: jets_cff.py:126
l1t::MicroGMTMatchQualFineLUT::m_etaFineMask
int m_etaFineMask
Definition: MicroGMTMatchQualLUT.h:84
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7