CMS 3D CMS Logo

CSCComparatorCodeLUT.h
Go to the documentation of this file.
1 #ifndef L1Trigger_CSCTriggerPrimitives_CSCComparatorCodeLUT
2 #define L1Trigger_CSCTriggerPrimitives_CSCComparatorCodeLUT
3 
4 #include <fstream>
5 #include <sstream>
6 #include <bitset>
7 #include <iostream>
8 #include <vector>
9 #include <limits>
10 
13 
15 public:
16  enum ReadCodes {
17  SUCCESS = 0,
23  };
24 
25  /* CSCComparatorCodeLUT(); */
26  explicit CSCComparatorCodeLUT(const std::string&);
27  /* explicit CSCComparatorCodeLUT(l1t::LUT*); */
29 
30  float lookup(int code) const;
31  float lookupPacked(const int input) const;
32 
33  // populates the map.
34  void initialize();
35 
36  unsigned checkedInput(unsigned in, unsigned maxWidth) const;
37 
38  // I/O functions
39  void save(std::ofstream& output);
40  int load(const std::string& inFileName);
41 
42  float data(unsigned int address) const;
43  int read(std::istream& stream);
44  void write(std::ostream& stream) const;
45 
46  unsigned int nrBitsAddress() const { return nrBitsAddress_; }
47  unsigned int nrBitsData() const { return nrBitsData_; }
48  //following the convention of vector::size()
49  unsigned int maxSize() const;
50  bool empty() const { return data_.empty(); }
51 
52 private:
53  int readHeader(std::istream&);
54 
55  unsigned int nrBitsAddress_; //technically redundant with addressMask
56  unsigned int nrBitsData_; //technically redundant with dataMask
57  unsigned int addressMask_;
58  unsigned int dataMask_;
59 
60  std::vector<float> data_;
61 
63  unsigned m_outWidth;
65 };
66 
67 #endif
input
static const std::string input
Definition: EdmProvDump.cc:48
CSCComparatorCodeLUT::read
int read(std::istream &stream)
Definition: CSCComparatorCodeLUT.cc:69
CSCComparatorCodeLUT::write
void write(std::ostream &stream) const
Definition: CSCComparatorCodeLUT.cc:123
CSCComparatorCodeLUT::m_codeInWidth
int m_codeInWidth
Definition: CSCComparatorCodeLUT.h:62
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
CSCComparatorCodeLUT::~CSCComparatorCodeLUT
~CSCComparatorCodeLUT()
Definition: CSCComparatorCodeLUT.h:28
CSCComparatorCodeLUT::data
float data(unsigned int address) const
Definition: CSCComparatorCodeLUT.cc:17
CSCComparatorCodeLUT::DUP_ENTRIES
Definition: CSCComparatorCodeLUT.h:19
CSCComparatorCodeLUT::nrBitsData
unsigned int nrBitsData() const
Definition: CSCComparatorCodeLUT.h:47
CSCComparatorCodeLUT::dataMask_
unsigned int dataMask_
Definition: CSCComparatorCodeLUT.h:58
CSCComparatorCodeLUT::m_initialized
bool m_initialized
Definition: CSCComparatorCodeLUT.h:64
CSCComparatorCodeLUT::readHeader
int readHeader(std::istream &)
Definition: CSCComparatorCodeLUT.cc:134
CSCComparatorCodeLUT::SUCCESS
Definition: CSCComparatorCodeLUT.h:17
CSCComparatorCodeLUT::data_
std::vector< float > data_
Definition: CSCComparatorCodeLUT.h:60
CSCComparatorCodeLUT::nrBitsData_
unsigned int nrBitsData_
Definition: CSCComparatorCodeLUT.h:56
CSCComparatorCodeLUT::maxSize
unsigned int maxSize() const
Definition: CSCComparatorCodeLUT.cc:130
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CSCComparatorCodeLUT::save
void save(std::ofstream &output)
Definition: CSCComparatorCodeLUT.cc:15
CSCComparatorCodeLUT::lookupPacked
float lookupPacked(const int input) const
Definition: CSCComparatorCodeLUT.cc:43
CSCComparatorCodeLUT::NO_ENTRIES
Definition: CSCComparatorCodeLUT.h:18
CSCComparatorCodeLUT::m_outWidth
unsigned m_outWidth
Definition: CSCComparatorCodeLUT.h:63
CSCComparatorCodeLUT::addressMask_
unsigned int addressMask_
Definition: CSCComparatorCodeLUT.h:57
CSCComparatorCodeLUT::empty
bool empty() const
Definition: CSCComparatorCodeLUT.h:50
recoMuon::in
Definition: RecoMuonEnumerators.h:6
CSCComparatorCodeLUT::lookup
float lookup(int code) const
Definition: CSCComparatorCodeLUT.cc:36
CSCComparatorCodeLUT::MAX_ADDRESS_OUTOFRANGE
Definition: CSCComparatorCodeLUT.h:21
CSCComparatorCodeLUT::MISS_ENTRIES
Definition: CSCComparatorCodeLUT.h:20
CSCComparatorCodeLUT::initialize
void initialize()
Definition: CSCComparatorCodeLUT.cc:51
CSCComparatorCodeLUT::nrBitsAddress_
unsigned int nrBitsAddress_
Definition: CSCComparatorCodeLUT.h:55
CSCComparatorCodeLUT::load
int load(const std::string &inFileName)
Definition: CSCComparatorCodeLUT.cc:21
Frameworkfwd.h
CSCComparatorCodeLUT
Definition: CSCComparatorCodeLUT.h:14
CSCComparatorCodeLUT::nrBitsAddress
unsigned int nrBitsAddress() const
Definition: CSCComparatorCodeLUT.h:46
SiStripMonitorCluster_cfi.maxWidth
maxWidth
Definition: SiStripMonitorCluster_cfi.py:143
CSCComparatorCodeLUT::ReadCodes
ReadCodes
Definition: CSCComparatorCodeLUT.h:16
CSCComparatorCodeLUT::NO_HEADER
Definition: CSCComparatorCodeLUT.h:22
ParameterSet.h
CSCComparatorCodeLUT::CSCComparatorCodeLUT
CSCComparatorCodeLUT(const std::string &)
Definition: CSCComparatorCodeLUT.cc:5
CSCComparatorCodeLUT::checkedInput
unsigned checkedInput(unsigned in, unsigned maxWidth) const
Definition: CSCComparatorCodeLUT.cc:64