test
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 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_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: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(), contentValuesCheck::ss, 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:86
int read(std::istream &stream)
Definition: LUT.cc:35
unsigned m_outWidth
Definition: MicroGMTLUT.h:35
virtual l1t::MicroGMTLUT::~MicroGMTLUT ( )
inlinevirtual

Definition at line 18 of file MicroGMTLUT.h.

18 {};

Member Function Documentation

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

Definition at line 62 of file MicroGMTLUT.cc.

References SiStripMonitorClusterAlca_cfi::maxWidth.

63 {
64  unsigned maxIn = (1 << maxWidth) - 1;
65  return (in < maxIn ? in : maxIn);
66 }
void l1t::MicroGMTLUT::initialize ( void  )

Definition at line 47 of file MicroGMTLUT.cc.

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

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

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:35
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, contentValuesFiles::fullPath, and SiPixelLorentzAngle_cfi::read.

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

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:35
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 data, and Exception.

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:44
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 TablePrint::write.

Referenced by L1TMicroGMTLUTDumper::dumpLut().

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

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