CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
l1t::MicroGMTLUT Class Reference

#include <MicroGMTLUT.h>

Inheritance diagram for l1t::MicroGMTLUT:
l1t::LUT l1t::MicroGMTAbsoluteIsolationCheckLUT l1t::MicroGMTCaloIndexSelectionLUT l1t::MicroGMTExtrapolationLUT l1t::MicroGMTMatchQualLUT l1t::MicroGMTRankPtQualLUT l1t::MicroGMTRelativeIsolationCheckLUT l1t::MicroGMTMatchQualFineLUT l1t::MicroGMTMatchQualSimpleLUT

Public Member Functions

int checkedInput (unsigned in, unsigned maxWidth) const
 
void initialize ()
 
int load (const std::string &inFileName)
 
virtual int lookupPacked (int input) const
 
 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 ()
 

Protected Attributes

bool m_initialized
 
std::vector< MicroGMTConfiguration::input_tm_inputs
 
unsigned m_outWidth
 
unsigned m_totalInWidth
 

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
}
 

Detailed Description

Definition at line 14 of file MicroGMTLUT.h.

Constructor & Destructor Documentation

l1t::MicroGMTLUT::MicroGMTLUT ( )
inline

Definition at line 16 of file MicroGMTLUT.h.

References lumiPlot::lut.

16 : m_totalInWidth(0), m_outWidth(0), m_initialized(false) {};
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
unsigned m_outWidth
Definition: MicroGMTLUT.h:35
l1t::MicroGMTLUT::MicroGMTLUT ( l1t::LUT lut)

Definition at line 6 of file MicroGMTLUT.cc.

References l1t::LUT::read(), and l1t::LUT::write().

7 {
8  std::stringstream ss;
9  lut->write(ss);
10  read(ss);
11 }
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
void write(std::ostream &stream) const
Definition: LUT.cc:67
int read(std::istream &stream)
Definition: LUT.cc:11
unsigned m_outWidth
Definition: MicroGMTLUT.h:35
virtual l1t::MicroGMTLUT::~MicroGMTLUT ( )
inlinevirtual

Member Function Documentation

int l1t::MicroGMTLUT::checkedInput ( unsigned  in,
unsigned  maxWidth 
) const
void l1t::MicroGMTLUT::initialize ( void  )

Definition at line 47 of file MicroGMTLUT.cc.

References l1t::LUT::empty(), recoMuon::in, lookupPacked(), m_initialized, m_outWidth, m_totalInWidth, MillePedeFileConverter_cfg::out, and l1t::LUT::read().

Referenced by l1t::MicroGMTMatchQualFineLUT::MicroGMTMatchQualFineLUT(), l1t::MicroGMTMatchQualSimpleLUT::MicroGMTMatchQualSimpleLUT(), l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT(), and ~MicroGMTLUT().

48 {
49  if (empty()) {
50  std::stringstream stream;
51  stream <<"#<header> V1 "<<m_totalInWidth<<" "<<m_outWidth<<" </header> "<<std::endl;
52  for (int in = 0; in < (1 << m_totalInWidth); ++in) {
53  int out = lookupPacked(in);
54  stream << in << " " << out << std::endl;
55  }
56  read(stream);
57  }
58  m_initialized = true;
59 }
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
bool empty() const
Definition: LUT.h:54
virtual int lookupPacked(int input) const
Definition: MicroGMTLUT.cc:37
int read(std::istream &stream)
Definition: LUT.cc:11
unsigned m_outWidth
Definition: MicroGMTLUT.h:35
int l1t::MicroGMTLUT::load ( const std::string &  inFileName)

Definition at line 21 of file MicroGMTLUT.cc.

References Exception, m_initialized, and l1t::LUT::read().

Referenced by l1t::MicroGMTAbsoluteIsolationCheckLUT::MicroGMTAbsoluteIsolationCheckLUT(), l1t::MicroGMTCaloIndexSelectionLUT::MicroGMTCaloIndexSelectionLUT(), l1t::MicroGMTExtrapolationLUT::MicroGMTExtrapolationLUT(), l1t::MicroGMTMatchQualFineLUT::MicroGMTMatchQualFineLUT(), l1t::MicroGMTMatchQualSimpleLUT::MicroGMTMatchQualSimpleLUT(), l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT(), l1t::MicroGMTRelativeIsolationCheckLUT::MicroGMTRelativeIsolationCheckLUT(), and ~MicroGMTLUT().

21  {
22  std::ifstream fstream;
23  fstream.open(edm::FileInPath(inFileName.c_str()).fullPath());
24  if (!fstream.good()) {
25  fstream.close();
26  throw cms::Exception("FileOpenError") << "Failed to open LUT file: " << inFileName;
27  }
28  int readCode = read(fstream);
29 
30  m_initialized = true;
31  fstream.close();
32 
33  return readCode;
34 }
int read(std::istream &stream)
Definition: LUT.cc:11
int l1t::MicroGMTLUT::lookupPacked ( int  input) const
virtual

Reimplemented in l1t::MicroGMTMatchQualFineLUT, l1t::MicroGMTMatchQualSimpleLUT, and l1t::MicroGMTRankPtQualLUT.

Definition at line 37 of file MicroGMTLUT.cc.

References l1t::LUT::data(), Exception, and m_initialized.

Referenced by initialize(), l1t::MicroGMTRelativeIsolationCheckLUT::lookup(), l1t::MicroGMTCaloIndexSelectionLUT::lookup(), l1t::MicroGMTAbsoluteIsolationCheckLUT::lookup(), l1t::MicroGMTExtrapolationLUT::lookup(), ~MicroGMTLUT(), l1t::MicroGMTMatchQualFineLUT::~MicroGMTMatchQualFineLUT(), and l1t::MicroGMTMatchQualSimpleLUT::~MicroGMTMatchQualSimpleLUT().

38 {
39  if (m_initialized) {
40  return data((unsigned int) input);
41  }
42  throw cms::Exception("Uninitialized") << "If you're not loading a LUT from file you need to implement lookupPacked.";
43  return 0;
44 }
static std::string const input
Definition: EdmProvDump.cc:48
int data(unsigned int address) const
Definition: LUT.h:46
void l1t::MicroGMTLUT::save ( std::ofstream &  output)

Definition at line 15 of file MicroGMTLUT.cc.

References l1t::LUT::write().

Referenced by L1TMicroGMTLUTDumper::dumpLut(), and ~MicroGMTLUT().

16 {
17  write(output);
18 }
void write(std::ostream &stream) const
Definition: LUT.cc:67

Member Data Documentation

bool l1t::MicroGMTLUT::m_initialized
protected
std::vector<MicroGMTConfiguration::input_t> l1t::MicroGMTLUT::m_inputs
protected
unsigned l1t::MicroGMTLUT::m_outWidth
protected
unsigned l1t::MicroGMTLUT::m_totalInWidth
protected