CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1GctInternHFData.cc
Go to the documentation of this file.
1 
3 
4 L1GctInternHFData::L1GctInternHFData() : type_(null), capBlock_(0), capIndex_(0), bx_(0), data_(0) {}
5 
8 
10  const uint16_t capIndex,
11  const int16_t bx,
12  const uint32_t data) {
15  d.setCapIndex(capIndex);
16  d.setCapBlock(capBlock);
17  d.setBx(bx);
18  d.setData(data);
19  return d;
20 }
21 
23  const uint16_t capIndex,
24  const int16_t bx,
25  const uint32_t data) {
28  d.setCapIndex(capIndex);
29  d.setCapBlock(capBlock);
30  d.setBx(bx);
31  for (unsigned i = 0; i < 4; ++i) {
32  d.setCount(i, (data >> (6 * i)) & 0x3f);
33  }
34  return d;
35 }
36 
38  const uint16_t capIndex,
39  const int16_t bx,
40  const uint32_t data) {
43  d.setCapIndex(capIndex);
44  d.setCapBlock(capBlock);
45  d.setBx(bx);
46  d.setData(data & 0xff);
47  return d;
48 }
49 
51  const uint16_t capIndex,
52  const int16_t bx,
53  const uint32_t data) {
56  d.setCapIndex(capIndex);
57  d.setCapBlock(capBlock);
58  d.setBx(bx);
59  d.setCount(0, data & 0x3f);
60  return d;
61 }
62 
63 // get value
64 uint16_t L1GctInternHFData::value(unsigned i) const { return (data_ >> (i * 8)) & 0xff; }
65 
67 uint16_t L1GctInternHFData::et(unsigned i) const { return value(i); }
68 
70 uint16_t L1GctInternHFData::count(unsigned i) const { return value(i); }
71 
73 bool L1GctInternHFData::operator==(const L1GctInternHFData& c) const { return (this->raw() == c.raw()); }
74 
75 // set value
76 void L1GctInternHFData::setValue(unsigned i, uint16_t val) {
77  data_ &= ~(0xff << (i * 8));
78  data_ |= (val & 0xff) << (i * 8);
79 }
80 
82 void L1GctInternHFData::setEt(unsigned i, uint16_t et) { setValue(i, et); }
83 
85 void L1GctInternHFData::setCount(unsigned i, uint16_t count) { setValue(i, count); }
86 
87 std::ostream& operator<<(std::ostream& s, const L1GctInternHFData& cand) {
88  s << "L1GctInternHFData :";
89 
90  if (cand.empty()) {
91  s << " empty";
92  } else {
94  s << " type=conc_hf_ring_et_sums";
95  s << " ring1 eta+=" << cand.et(0);
96  s << " ring1 eta-=" << cand.et(1);
97  s << " ring2 eta+=" << cand.et(2);
98  s << " ring2 eta-=" << cand.et(3);
99  } else if (cand.type() == L1GctInternHFData::conc_hf_bit_counts) {
100  s << " type=conc_hf_bit_counts";
101  s << " ring1 eta+=" << cand.count(0);
102  s << " ring1 eta-=" << cand.count(1);
103  s << " ring2 eta+=" << cand.count(2);
104  s << " ring2 eta-=" << cand.count(3);
105  } else if (cand.type() == L1GctInternHFData::wheel_hf_ring_et_sums) {
106  s << " type=conc_hf_ring_et_sums";
107  s << " Et sum=" << cand.et(0);
108  } else if (cand.type() == L1GctInternHFData::wheel_hf_bit_counts) {
109  s << " type=wheel_hf_bit_counts";
110  s << " Bit count=" << cand.et(0);
111  }
112  }
113  s << std::endl;
114 
115  s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx();
116 
117  return s;
118 }
const edm::EventSetup & c
void setCapBlock(uint16_t const capBlock)
set cap block
L1GctInternHFData()
default constructor (for vector initialisation etc.)
L1GctInternHFData::L1GctInternHFDataType type() const
metadata
void setValue(unsigned const i, uint16_t const val)
set value
uint16_t capIndex() const
get index within capture block
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
void setCount(unsigned const i, uint16_t const count)
set the count
static L1GctInternHFData fromConcBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
tuple d
Definition: ztail.py:151
static L1GctInternHFData fromConcRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
uint16_t count(unsigned i) const
get the counts
uint16_t capBlock() const
get capture block
uint16_t et(unsigned i) const
get the et sums
int16_t bx() const
get BX number
static L1GctInternHFData fromWheelRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
void setType(L1GctInternHFDataType type)
set type
uint16_t value(unsigned i) const
get value
void setEt(unsigned const i, uint16_t const et)
set the sum
void setBx(int16_t const bx)
set bx
bool empty() const
is the sum non-zero
~L1GctInternHFData()
destructor
void setData(uint32_t const data)
bool operator==(const L1GctInternHFData &c) const
operators
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
static L1GctInternHFData fromWheelBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
uint32_t raw() const
get the raw data
L1 GCT internal ring sums and/or bit counts.
void setCapIndex(uint16_t const capIndex)
set cap index