CMS 3D CMS Logo

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

6  : m_totalInWidth(0), m_outWidth(0), m_initialized(true) {
7  std::stringstream ss;
8  lut->write(ss);
9  read(ss);
10 }
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
void write(std::ostream &stream) const
Definition: LUT.cc:65
int read(std::istream &stream)
Definition: LUT.cc:11
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 51 of file MicroGMTLUT.cc.

51  {
52  unsigned maxIn = (1 << maxWidth) - 1;
53  return (in < maxIn ? in : maxIn);
54 }
void l1t::MicroGMTLUT::initialize ( void  )

Definition at line 38 of file MicroGMTLUT.cc.

References relativeConstraints::empty, recoMuon::in, submitPVResolutionJobs::out, SiPixelLorentzAngle_cfi::read, and cms::cuda::stream.

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

38  {
39  if (empty()) {
40  std::stringstream stream;
41  stream << "#<header> V1 " << m_totalInWidth << " " << m_outWidth << " </header> " << std::endl;
42  for (int in = 0; in < (1 << m_totalInWidth); ++in) {
43  int out = lookupPacked(in);
44  stream << in << " " << out << std::endl;
45  }
46  read(stream);
47  }
48  m_initialized = true;
49 }
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
bool empty() const
Definition: LUT.h:58
virtual int lookupPacked(int input) const
Definition: MicroGMTLUT.cc:30
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
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 15 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().

15  {
16  std::ifstream fstream;
17  fstream.open(edm::FileInPath(inFileName.c_str()).fullPath());
18  if (!fstream.good()) {
19  fstream.close();
20  throw cms::Exception("FileOpenError") << "Failed to open LUT file: " << inFileName;
21  }
22  int readCode = read(fstream);
23 
24  m_initialized = true;
25  fstream.close();
26 
27  return readCode;
28 }
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 30 of file MicroGMTLUT.cc.

References data, and Exception.

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

Definition at line 13 of file MicroGMTLUT.cc.

References TablePrint::write.

Referenced by L1TMicroGMTLUTDumper::dumpLut().

13 { write(output); }
void write(std::ostream &stream) const
Definition: LUT.cc:65

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