CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
l1t::MicroGMTRankPtQualLUT Class Reference

#include <MicroGMTRankPtQualLUT.h>

Inheritance diagram for l1t::MicroGMTRankPtQualLUT:
l1t::MicroGMTLUT l1t::LUT

Public Member Functions

int hashInput (int pt, int qual) const
 
int lookup (int pt, int qual) const
 
int lookupPacked (int in) const override
 
 MicroGMTRankPtQualLUT ()
 
 MicroGMTRankPtQualLUT (const std::string &, const unsigned, const unsigned)
 
 MicroGMTRankPtQualLUT (l1t::LUT *)
 
void unHashInput (int input, int &pt, int &qual) const
 
 ~MicroGMTRankPtQualLUT () override
 
- Public Member Functions inherited from l1t::MicroGMTLUT
int checkedInput (unsigned in, unsigned maxWidth) const
 
void initialize ()
 
int load (const std::string &inFileName)
 
 MicroGMTLUT ()
 
 MicroGMTLUT (l1t::LUT *lut)
 
void save (std::ofstream &output)
 
virtual ~MicroGMTLUT ()
 
- Public Member Functions inherited from l1t::LUT
int data (unsigned int address) const
 
bool empty () const
 
 LUT ()
 
 LUT (std::istream &stream)
 
unsigned int maxSize () const
 
unsigned int nrBitsAddress () const
 
unsigned int nrBitsData () const
 
int read (std::istream &stream)
 
void write (std::ostream &stream) const
 
 ~LUT ()
 

Private Attributes

unsigned m_ptFactor
 
int m_ptInWidth
 
int m_ptMask
 
unsigned m_qualFactor
 
int m_qualInWidth
 
int m_qualMask
 

Additional Inherited Members

- Public Types inherited from l1t::LUT
enum  ReadCodes {
  SUCCESS = 0, NO_ENTRIES = 1, DUP_ENTRIES = 2, MISS_ENTRIES = 3,
  MAX_ADDRESS_OUTOFRANGE = 4, NO_HEADER = 5
}
 
- Protected Attributes inherited from l1t::MicroGMTLUT
bool m_initialized
 
std::vector< MicroGMTConfiguration::input_tm_inputs
 
unsigned m_outWidth
 
unsigned m_totalInWidth
 

Detailed Description

Definition at line 11 of file MicroGMTRankPtQualLUT.h.

Constructor & Destructor Documentation

◆ MicroGMTRankPtQualLUT() [1/3]

l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT ( )
inline

Definition at line 13 of file MicroGMTRankPtQualLUT.h.

13 {}

◆ MicroGMTRankPtQualLUT() [2/3]

l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT ( const std::string &  fname,
const unsigned  ptFactor,
const unsigned  qualFactor 
)
explicit

Definition at line 3 of file MicroGMTRankPtQualLUT.cc.

References alignmentValidation::fname, l1t::MicroGMTLUT::initialize(), l1t::MicroGMTLUT::load(), l1t::MicroGMTLUT::m_inputs, l1t::MicroGMTLUT::m_outWidth, m_ptInWidth, m_ptMask, m_qualInWidth, m_qualMask, l1t::MicroGMTLUT::m_totalInWidth, l1t::MicroGMTConfiguration::PT, l1t::MicroGMTConfiguration::QUALITY, and AlCaHLTBitMon_QueryRunRegistry::string.

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 }
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
int load(const std::string &inFileName)
Definition: MicroGMTLUT.cc:15
std::vector< MicroGMTConfiguration::input_t > m_inputs
Definition: MicroGMTLUT.h:36
string fname
main script
unsigned m_outWidth
Definition: MicroGMTLUT.h:35

◆ MicroGMTRankPtQualLUT() [3/3]

l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT ( l1t::LUT lut)
explicit

Definition at line 29 of file MicroGMTRankPtQualLUT.cc.

References l1t::MicroGMTLUT::m_initialized, l1t::MicroGMTLUT::m_inputs, l1t::MicroGMTLUT::m_outWidth, m_ptInWidth, m_ptMask, m_qualInWidth, m_qualMask, l1t::MicroGMTLUT::m_totalInWidth, l1t::MicroGMTConfiguration::PT, and l1t::MicroGMTConfiguration::QUALITY.

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 }
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
std::vector< MicroGMTConfiguration::input_t > m_inputs
Definition: MicroGMTLUT.h:36
unsigned m_outWidth
Definition: MicroGMTLUT.h:35

◆ ~MicroGMTRankPtQualLUT()

l1t::MicroGMTRankPtQualLUT::~MicroGMTRankPtQualLUT ( )
inlineoverride

Definition at line 16 of file MicroGMTRankPtQualLUT.h.

16 {}

Member Function Documentation

◆ hashInput()

int l1t::MicroGMTRankPtQualLUT::hashInput ( int  pt,
int  qual 
) const

Definition at line 66 of file MicroGMTRankPtQualLUT.cc.

References DiDispStaMuonMonitor_cfi::pt, and mps_fire::result.

66  {
67  int result = 0;
68  result += pt;
69  result += qual << m_ptInWidth;
70  return result;
71 }

◆ lookup()

int l1t::MicroGMTRankPtQualLUT::lookup ( int  pt,
int  qual 
) const

Definition at line 43 of file MicroGMTRankPtQualLUT.cc.

References data, DiDispStaMuonMonitor_cfi::pt, and mps_fire::result.

43  {
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 }
int checkedInput(unsigned in, unsigned maxWidth) const
Definition: MicroGMTLUT.cc:51
int data(unsigned int address) const
Definition: LUT.h:46
int hashInput(int pt, int qual) const

◆ lookupPacked()

int l1t::MicroGMTRankPtQualLUT::lookupPacked ( int  in) const
overridevirtual

Reimplemented from l1t::MicroGMTLUT.

Definition at line 55 of file MicroGMTRankPtQualLUT.cc.

References data, recoMuon::in, and DiDispStaMuonMonitor_cfi::pt.

55  {
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 }
int lookup(int pt, int qual) const
int data(unsigned int address) const
Definition: LUT.h:46
void unHashInput(int input, int &pt, int &qual) const

◆ unHashInput()

void l1t::MicroGMTRankPtQualLUT::unHashInput ( int  input,
int &  pt,
int &  qual 
) const

Member Data Documentation

◆ m_ptFactor

unsigned l1t::MicroGMTRankPtQualLUT::m_ptFactor
private

Definition at line 31 of file MicroGMTRankPtQualLUT.h.

◆ m_ptInWidth

int l1t::MicroGMTRankPtQualLUT::m_ptInWidth
private

Definition at line 27 of file MicroGMTRankPtQualLUT.h.

Referenced by MicroGMTRankPtQualLUT().

◆ m_ptMask

int l1t::MicroGMTRankPtQualLUT::m_ptMask
private

Definition at line 25 of file MicroGMTRankPtQualLUT.h.

Referenced by MicroGMTRankPtQualLUT().

◆ m_qualFactor

unsigned l1t::MicroGMTRankPtQualLUT::m_qualFactor
private

Definition at line 32 of file MicroGMTRankPtQualLUT.h.

◆ m_qualInWidth

int l1t::MicroGMTRankPtQualLUT::m_qualInWidth
private

Definition at line 28 of file MicroGMTRankPtQualLUT.h.

Referenced by MicroGMTRankPtQualLUT().

◆ m_qualMask

int l1t::MicroGMTRankPtQualLUT::m_qualMask
private

Definition at line 26 of file MicroGMTRankPtQualLUT.h.

Referenced by MicroGMTRankPtQualLUT().