CMS 3D CMS Logo

MicroGMTRankPtQualLUT.cc
Go to the documentation of this file.
2 
4  const unsigned ptFactor,
5  const unsigned qualFactor)
6  : MicroGMTLUT(),
7  m_ptMask(0),
8  m_qualMask(0),
9  m_ptInWidth(9),
10  m_qualInWidth(4),
11  m_ptFactor(ptFactor),
12  m_qualFactor(qualFactor) {
14  m_outWidth = 10;
15 
16  m_ptMask = (1 << m_ptInWidth) - 1;
17  m_qualMask = ((1 << m_qualInWidth) - 1) << m_ptInWidth;
18 
21 
22  if (fname != std::string("")) {
23  load(fname);
24  } else {
25  initialize();
26  }
27 }
28 
30  : MicroGMTLUT(lut), m_ptMask(0), m_qualMask(0), m_ptInWidth(9), m_qualInWidth(4), m_ptFactor(0), m_qualFactor(0) {
32  m_outWidth = 10;
33 
34  m_ptMask = (1 << m_ptInWidth) - 1;
35  m_qualMask = ((1 << m_qualInWidth) - 1) << m_ptInWidth;
36 
39 
40  m_initialized = true;
41 }
42 
43 int l1t::MicroGMTRankPtQualLUT::lookup(int pt, int qual) const {
44  // normalize these two to the same scale and then calculate?
45  if (m_initialized) {
46  return data((unsigned)hashInput(checkedInput(pt, m_ptInWidth), checkedInput(qual, m_qualInWidth)));
47  }
48 
49  int result = 0;
50  result = pt * m_ptFactor + qual * m_qualFactor;
51  // normalize to out width
52  return result;
53 }
54 
56  if (m_initialized) {
57  return data((unsigned)in);
58  }
59 
60  int pt = 0;
61  int qual = 0;
62  unHashInput(in, pt, qual);
63  return lookup(pt, qual);
64 }
65 
66 int l1t::MicroGMTRankPtQualLUT::hashInput(int pt, int qual) const {
67  int result = 0;
68  result += pt;
69  result += qual << m_ptInWidth;
70  return result;
71 }
72 
73 void l1t::MicroGMTRankPtQualLUT::unHashInput(int input, int& pt, int& qual) const {
74  pt = input & m_ptMask;
75  qual = (input & m_qualMask) >> m_ptInWidth;
76 }
input
static const std::string input
Definition: EdmProvDump.cc:48
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
l1t::MicroGMTRankPtQualLUT::m_ptInWidth
int m_ptInWidth
Definition: MicroGMTRankPtQualLUT.h:27
l1t::MicroGMTRankPtQualLUT::m_qualMask
int m_qualMask
Definition: MicroGMTRankPtQualLUT.h:26
l1t::MicroGMTLUT::initialize
void initialize()
Definition: MicroGMTLUT.cc:38
MicroGMTRankPtQualLUT.h
l1t::MicroGMTConfiguration::QUALITY
Definition: MicroGMTConfiguration.h:25
l1t::MicroGMTConfiguration::PT
Definition: MicroGMTConfiguration.h:20
l1t::MicroGMTRankPtQualLUT::lookup
int lookup(int pt, int qual) const
Definition: MicroGMTRankPtQualLUT.cc:43
l1t::MicroGMTRankPtQualLUT::lookupPacked
int lookupPacked(int in) const override
Definition: MicroGMTRankPtQualLUT.cc:55
l1t::MicroGMTRankPtQualLUT::m_qualInWidth
int m_qualInWidth
Definition: MicroGMTRankPtQualLUT.h:28
recoMuon::in
Definition: RecoMuonEnumerators.h:6
l1t::MicroGMTRankPtQualLUT::unHashInput
void unHashInput(int input, int &pt, int &qual) const
Definition: MicroGMTRankPtQualLUT.cc:73
l1t::MicroGMTLUT
Definition: MicroGMTLUT.h:14
l1t::MicroGMTLUT::m_initialized
bool m_initialized
Definition: MicroGMTLUT.h:37
l1t::MicroGMTLUT::m_totalInWidth
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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::MicroGMTRankPtQualLUT::m_ptMask
int m_ptMask
Definition: MicroGMTRankPtQualLUT.h:25
l1t::LUT
Definition: LUT.h:29
l1t::MicroGMTRankPtQualLUT::hashInput
int hashInput(int pt, int qual) const
Definition: MicroGMTRankPtQualLUT.cc:66
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
mps_fire.result
result
Definition: mps_fire.py:311
l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT
MicroGMTRankPtQualLUT()
Definition: MicroGMTRankPtQualLUT.h:13