CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
virtual int lookupPacked (int in) const
 
 MicroGMTRankPtQualLUT ()
 
 MicroGMTRankPtQualLUT (const std::string &, const unsigned, const unsigned)
 
 MicroGMTRankPtQualLUT (l1t::LUT *)
 
void unHashInput (int input, int &pt, int &qual) const
 
virtual ~MicroGMTRankPtQualLUT ()
 
- 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_t
m_inputs
 
unsigned m_outWidth
 
unsigned m_totalInWidth
 

Detailed Description

Definition at line 12 of file MicroGMTRankPtQualLUT.h.

Constructor & Destructor Documentation

l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT ( )
inline

Definition at line 14 of file MicroGMTRankPtQualLUT.h.

14 {};
l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT ( const std::string &  fname,
const unsigned  ptFactor,
const unsigned  qualFactor 
)
explicit

Definition at line 3 of file MicroGMTRankPtQualLUT.cc.

References 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.

3  : MicroGMTLUT(), m_ptMask(0), m_qualMask(0), m_ptInWidth(9), m_qualInWidth(4), m_ptFactor(ptFactor), m_qualFactor(qualFactor)
4 {
6  m_outWidth = 10;
7 
8  m_ptMask = (1 << m_ptInWidth) - 1;
9  m_qualMask = ((1 << m_qualInWidth) - 1) << m_ptInWidth;
10 
13 
14  if (fname != std::string("")) {
15  load(fname);
16  } else {
17  initialize();
18  }
19 }
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
int load(const std::string &inFileName)
Definition: MicroGMTLUT.cc:21
std::vector< MicroGMTConfiguration::input_t > m_inputs
Definition: MicroGMTLUT.h:36
string fname
main script
unsigned m_outWidth
Definition: MicroGMTLUT.h:35
l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT ( l1t::LUT lut)
explicit

Definition at line 21 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.

22 {
24  m_outWidth = 10;
25 
26  m_ptMask = (1 << m_ptInWidth) - 1;
27  m_qualMask = ((1 << m_qualInWidth) - 1) << m_ptInWidth;
28 
31 
32  m_initialized = true;
33 }
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
virtual l1t::MicroGMTRankPtQualLUT::~MicroGMTRankPtQualLUT ( )
inlinevirtual

Definition at line 17 of file MicroGMTRankPtQualLUT.h.

17 {};

Member Function Documentation

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

Definition at line 63 of file MicroGMTRankPtQualLUT.cc.

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

64 {
65 
66  int result = 0;
67  result += pt;
68  result += qual << m_ptInWidth;
69  return result;
70 }
tuple result
Definition: mps_fire.py:83
int l1t::MicroGMTRankPtQualLUT::lookup ( int  pt,
int  qual 
) const

Definition at line 36 of file MicroGMTRankPtQualLUT.cc.

References AlCaHLTBitMon_QueryRunRegistry::data, and mps_fire::result.

37 {
38  // normalize these two to the same scale and then calculate?
39  if (m_initialized) {
40  return data((unsigned)hashInput(checkedInput(pt, m_ptInWidth), checkedInput(qual, m_qualInWidth)));
41  }
42 
43  int result = 0;
44  result = pt * m_ptFactor + qual * m_qualFactor;
45  // normalize to out width
46  return result;
47 }
int checkedInput(unsigned in, unsigned maxWidth) const
Definition: MicroGMTLUT.cc:62
tuple result
Definition: mps_fire.py:83
int hashInput(int pt, int qual) const
int data(unsigned int address) const
Definition: LUT.h:46
int l1t::MicroGMTRankPtQualLUT::lookupPacked ( int  in) const
virtual

Reimplemented from l1t::MicroGMTLUT.

Definition at line 50 of file MicroGMTRankPtQualLUT.cc.

References AlCaHLTBitMon_QueryRunRegistry::data, and EnergyCorrector::pt.

51 {
52  if (m_initialized) {
53  return data((unsigned)in);
54  }
55 
56  int pt = 0;
57  int qual = 0;
58  unHashInput(in, pt, qual);
59  return lookup(pt, qual);
60 }
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
void l1t::MicroGMTRankPtQualLUT::unHashInput ( int  input,
int &  pt,
int &  qual 
) const

Definition at line 73 of file MicroGMTRankPtQualLUT.cc.

Member Data Documentation

unsigned l1t::MicroGMTRankPtQualLUT::m_ptFactor
private

Definition at line 31 of file MicroGMTRankPtQualLUT.h.

int l1t::MicroGMTRankPtQualLUT::m_ptInWidth
private

Definition at line 27 of file MicroGMTRankPtQualLUT.h.

Referenced by MicroGMTRankPtQualLUT().

int l1t::MicroGMTRankPtQualLUT::m_ptMask
private

Definition at line 25 of file MicroGMTRankPtQualLUT.h.

Referenced by MicroGMTRankPtQualLUT().

unsigned l1t::MicroGMTRankPtQualLUT::m_qualFactor
private

Definition at line 32 of file MicroGMTRankPtQualLUT.h.

int l1t::MicroGMTRankPtQualLUT::m_qualInWidth
private

Definition at line 28 of file MicroGMTRankPtQualLUT.h.

Referenced by MicroGMTRankPtQualLUT().

int l1t::MicroGMTRankPtQualLUT::m_qualMask
private

Definition at line 26 of file MicroGMTRankPtQualLUT.h.

Referenced by MicroGMTRankPtQualLUT().