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

◆ MicroGMTLUT() [1/2]

l1t::MicroGMTLUT::MicroGMTLUT ( )
inline

Definition at line 16 of file MicroGMTLUT.h.

16 : m_totalInWidth(0), m_outWidth(0), m_initialized(false){};

◆ MicroGMTLUT() [2/2]

l1t::MicroGMTLUT::MicroGMTLUT ( l1t::LUT lut)

Definition at line 6 of file MicroGMTLUT.cc.

6  : m_totalInWidth(0), m_outWidth(0), m_initialized(true) {
7  std::stringstream ss;
8  lut->write(ss);
9  read(ss);
10 }

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

◆ ~MicroGMTLUT()

virtual l1t::MicroGMTLUT::~MicroGMTLUT ( )
inlinevirtual

Definition at line 18 of file MicroGMTLUT.h.

18 {};

Member Function Documentation

◆ checkedInput()

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 }

References recoMuon::in, and SiStripMonitorCluster_cfi::maxWidth.

◆ initialize()

void l1t::MicroGMTLUT::initialize ( void  )

Definition at line 38 of file MicroGMTLUT.cc.

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 }

References relativeConstraints::empty, recoMuon::in, MillePedeFileConverter_cfg::out, readEcalDQMStatus::read, and cms::cuda::stream.

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

◆ load()

int l1t::MicroGMTLUT::load ( const std::string &  inFileName)

Definition at line 15 of file MicroGMTLUT.cc.

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 }

References Exception, contentValuesFiles::fullPath, and readEcalDQMStatus::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().

◆ lookupPacked()

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.

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 }

References data, Exception, and input.

◆ save()

void l1t::MicroGMTLUT::save ( std::ofstream &  output)

Definition at line 13 of file MicroGMTLUT.cc.

13 { write(output); }

References convertSQLitetoXML_cfg::output, and writeEcalDQMStatus::write.

Referenced by L1TMicroGMTLUTDumper::dumpLut().

Member Data Documentation

◆ m_initialized

bool l1t::MicroGMTLUT::m_initialized
protected

◆ m_inputs

std::vector<MicroGMTConfiguration::input_t> l1t::MicroGMTLUT::m_inputs
protected

◆ m_outWidth

unsigned l1t::MicroGMTLUT::m_outWidth
protected

◆ m_totalInWidth

unsigned l1t::MicroGMTLUT::m_totalInWidth
protected
input
static const std::string input
Definition: EdmProvDump.cc:48
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
l1t::MicroGMTLUT::lookupPacked
virtual int lookupPacked(int input) const
Definition: MicroGMTLUT.cc:30
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::FileInPath
Definition: FileInPath.h:64
l1t::LUT::read
int read(std::istream &stream)
Definition: LUT.cc:11
l1t::LUT::empty
bool empty() const
Definition: LUT.h:58
recoMuon::in
Definition: RecoMuonEnumerators.h:6
l1t::MicroGMTLUT::m_initialized
bool m_initialized
Definition: MicroGMTLUT.h:37
l1t::LUT::data
int data(unsigned int address) const
Definition: LUT.h:46
l1t::MicroGMTLUT::m_totalInWidth
unsigned m_totalInWidth
Definition: MicroGMTLUT.h:34
l1t::MicroGMTLUT::m_outWidth
unsigned m_outWidth
Definition: MicroGMTLUT.h:35
Exception
Definition: hltDiff.cc:245
SiStripMonitorCluster_cfi.maxWidth
maxWidth
Definition: SiStripMonitorCluster_cfi.py:143
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
l1t::LUT::write
void write(std::ostream &stream) const
Definition: LUT.cc:65