CMS 3D CMS Logo

LUT.h
Go to the documentation of this file.
1 
16 //
17 
18 #ifndef CondFormats_L1TObjects_LUT_h
19 #define CondFormats_L1TObjects_LUT_h
20 
21 #include <iostream>
22 #include <vector>
23 #include <limits>
24 
26 
27 namespace l1t {
28 
29  class LUT {
30  public:
31  enum ReadCodes {
32  SUCCESS = 0,
38  };
39 
41 
42  explicit LUT(std::istream& stream) : data_() { read(stream); }
43 
44  ~LUT() {}
45 
46  int data(unsigned int address) const {
47  return (address & addressMask_) < data_.size() ? dataMask_ & data_[addressMask_ & address] : 0;
48  }
49  int read(std::istream& stream);
50  void write(std::ostream& stream) const;
51 
52  unsigned int nrBitsAddress() const { return nrBitsAddress_; }
53  unsigned int nrBitsData() const { return nrBitsData_; }
54  //following the convention of vector::size()
55  unsigned int maxSize() const {
57  }
58  bool empty() const { return data_.empty(); }
59 
60  private:
61  int readHeader_(std::istream&);
62 
63  unsigned int nrBitsAddress_; //technically redundant with addressMask
64  unsigned int nrBitsData_; //technically redundant with dataMask
65  unsigned int addressMask_;
66  unsigned int dataMask_;
67 
68  std::vector<int> data_;
70  };
71 
72 } // namespace l1t
73 
74 #endif
l1t::LUT::data_
std::vector< int > data_
Definition: LUT.h:68
l1t::LUT::maxSize
unsigned int maxSize() const
Definition: LUT.h:55
l1t::LUT::nrBitsData_
unsigned int nrBitsData_
Definition: LUT.h:64
l1t::LUT::nrBitsAddress
unsigned int nrBitsAddress() const
Definition: LUT.h:52
l1t::LUT::NO_HEADER
Definition: LUT.h:37
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
cms::cuda::stream
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition: HistoContainer.h:51
l1t::LUT::LUT
LUT(std::istream &stream)
Definition: LUT.h:42
l1t::LUT::addressMask_
unsigned int addressMask_
Definition: LUT.h:65
l1t::LUT::read
int read(std::istream &stream)
Definition: LUT.cc:11
l1t::LUT::ReadCodes
ReadCodes
Definition: LUT.h:31
l1t::LUT::DUP_ENTRIES
Definition: LUT.h:34
l1t::LUT::empty
bool empty() const
Definition: LUT.h:58
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
l1t
delete x;
Definition: CaloConfig.h:22
l1t::LUT::LUT
LUT()
Definition: LUT.h:40
l1t::LUT::nrBitsAddress_
unsigned int nrBitsAddress_
Definition: LUT.h:63
l1t::LUT::data
int data(unsigned int address) const
Definition: LUT.h:46
Serializable.h
l1t::LUT::dataMask_
unsigned int dataMask_
Definition: LUT.h:66
l1t::LUT::MAX_ADDRESS_OUTOFRANGE
Definition: LUT.h:36
l1t::LUT
Definition: LUT.h:29
l1t::LUT::~LUT
~LUT()
Definition: LUT.h:44
l1t::LUT::readHeader_
int readHeader_(std::istream &)
Definition: LUT.cc:72
l1t::LUT::SUCCESS
Definition: LUT.h:32
l1t::LUT::NO_ENTRIES
Definition: LUT.h:33
l1t::LUT::MISS_ENTRIES
Definition: LUT.h:35
l1t::LUT::write
void write(std::ostream &stream) const
Definition: LUT.cc:65
l1t::LUT::nrBitsData
unsigned int nrBitsData() const
Definition: LUT.h:53