CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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 ()
 
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_t
m_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.

16 : m_totalInWidth(0), m_outWidth(0), m_initialized(false) {};
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:33
unsigned m_outWidth
Definition: MicroGMTLUT.h:34
virtual l1t::MicroGMTLUT::~MicroGMTLUT ( )
inlinevirtual

Definition at line 17 of file MicroGMTLUT.h.

17 {};

Member Function Documentation

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

Definition at line 55 of file MicroGMTLUT.cc.

References SiStripMonitorClusterAlca_cfi::maxWidth.

56 {
57  unsigned maxIn = (1 << maxWidth) - 1;
58  return (in < maxIn ? in : maxIn);
59 }
void l1t::MicroGMTLUT::initialize ( void  )

Definition at line 40 of file MicroGMTLUT.cc.

References relativeConstraints::empty, recoMuon::in, GenerateHcalLaserBadRunList::out, and SiPixelLorentzAngle_cfi::read.

Referenced by l1t::MicroGMTMatchQualLUT::MicroGMTMatchQualLUT(), and l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT().

41 {
42  if (empty()) {
43  std::stringstream stream;
44  stream <<"#<header> V1 "<<m_totalInWidth<<" "<<m_outWidth<<" </header> "<<std::endl;
45  for (int in = 0; in < (1 << m_totalInWidth); ++in) {
46  int out = lookupPacked(in);
47  stream << in << " " << out << std::endl;
48  }
49  read(stream);
50  }
51  m_initialized = true;
52 }
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:33
bool empty() const
Definition: LUT.h:54
virtual int lookupPacked(int input) const
Definition: MicroGMTLUT.cc:30
int read(std::istream &stream)
Definition: LUT.cc:35
unsigned m_outWidth
Definition: MicroGMTLUT.h:34
int l1t::MicroGMTLUT::load ( const std::string &  inFileName)

Definition at line 14 of file MicroGMTLUT.cc.

References Exception, contentValuesFiles::fullPath, and SiPixelLorentzAngle_cfi::read.

Referenced by l1t::MicroGMTAbsoluteIsolationCheckLUT::MicroGMTAbsoluteIsolationCheckLUT(), l1t::MicroGMTCaloIndexSelectionLUT::MicroGMTCaloIndexSelectionLUT(), l1t::MicroGMTExtrapolationLUT::MicroGMTExtrapolationLUT(), l1t::MicroGMTMatchQualLUT::MicroGMTMatchQualLUT(), l1t::MicroGMTRankPtQualLUT::MicroGMTRankPtQualLUT(), and l1t::MicroGMTRelativeIsolationCheckLUT::MicroGMTRelativeIsolationCheckLUT().

14  {
15  std::ifstream fstream;
16  fstream.open(edm::FileInPath(inFileName.c_str()).fullPath());
17  if (!fstream.good()) {
18  fstream.close();
19  throw cms::Exception("FileOpenError") << "Failed to open LUT file: " << inFileName;
20  }
21  int readCode = read(fstream);
22 
23  m_initialized = true;
24  fstream.close();
25 
26  return readCode;
27 }
int read(std::istream &stream)
Definition: LUT.cc:35
int l1t::MicroGMTLUT::lookupPacked ( int  input) const
virtual

Reimplemented in l1t::MicroGMTMatchQualLUT, and l1t::MicroGMTRankPtQualLUT.

Definition at line 30 of file MicroGMTLUT.cc.

References data, and Exception.

31 {
32  if (m_initialized) {
33  return data((unsigned int) input);
34  }
35  throw cms::Exception("Uninitialized") << "If you're not loading a LUT from file you need to implement lookupPacked.";
36  return 0;
37 }
static std::string const input
Definition: EdmProvDump.cc:44
int data(unsigned int address) const
Definition: LUT.h:46
void l1t::MicroGMTLUT::save ( std::ofstream &  output)

Definition at line 8 of file MicroGMTLUT.cc.

References l1t::LUT::write().

Referenced by L1TMicroGMTLUTDumper::dumpLut().

9 {
10  write(output);
11 }
void write(std::ostream &stream) const
Definition: LUT.cc:86

Member Data Documentation

bool l1t::MicroGMTLUT::m_initialized
protected

Definition at line 36 of file MicroGMTLUT.h.

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