CMS 3D CMS Logo

L1GctInternEtSum.cc
Go to the documentation of this file.
2 #include <cstdint>
3 
5 
7 L1GctInternEtSum::L1GctInternEtSum(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t et, uint8_t oflow)
8  : type_(null), capBlock_(capBlock), capIndex_(capIndex), bx_(bx), data_(0) {
9  this->setEt(et);
10  this->setOflow(oflow);
11 }
12 
15 
17  const uint16_t capIndex,
18  const int16_t bx,
19  const uint32_t data) {
21  s.setEt(data & kTotEtOrHtMaxValue);
22  s.setOflow((data >> kTotEtOrHtNBits) & 0x1);
23  s.setCapBlock(capBlock);
24  s.setCapIndex(capIndex);
25  s.setBx(bx);
26  s.setType(jet_tot_et);
27  return s;
28 }
29 
31  const uint16_t capIndex,
32  const int16_t bx,
33  const uint32_t data) {
35  uint32_t word = data >> 16;
36  s.setEt(word & kTotEtOrHtMaxValue);
37  s.setOflow((word >> kTotEtOrHtNBits) & 0x1);
38  s.setCapBlock(capBlock);
39  s.setCapIndex(capIndex);
40  s.setBx(bx);
41  s.setType(jet_tot_ht);
42  return s;
43 }
44 
46  const uint16_t capIndex,
47  const int16_t bx,
48  const uint32_t data) {
50  s.setEt(data & kJetMissEtMaxValue);
51  s.setOflow((data >> kJetMissEtNBits) & 0x1);
52  s.setCapBlock(capBlock);
53  s.setCapIndex(capIndex);
54  s.setBx(bx);
55  s.setType(jet_miss_et);
56  return s;
57 }
58 
60  const uint16_t capIndex,
61  const int16_t bx,
62  const uint32_t data) {
64  s.setEt(data & kTotEtOrHtMaxValue);
65  s.setOflow((data >> kTotEtOrHtNBits) & 0x1);
66  s.setCapBlock(capBlock);
67  s.setCapIndex(capIndex);
68  s.setBx(bx);
69  s.setType(total_et_or_ht);
70  return s;
71 }
72 
74  const uint16_t capIndex,
75  const int16_t bx,
76  const uint32_t data) {
78  s.setEt(data & kMissExOrEyNBits);
79  s.setOflow(0); // No over flow bit at the moment
80  s.setCapBlock(capBlock);
81  s.setCapIndex(capIndex);
82  s.setBx(bx);
83  s.setType(miss_etx_or_ety);
84  return s;
85 }
86 
88 
89 L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx) {
91  s.setEt(totEt & kTotEtOrHtMaxValue);
92  if (overFlow || (totEt > kTotEtOrHtMaxValue))
93  s.setOflow(0x1);
94  s.setBx(bx);
95  s.setType(jet_tot_et);
96  return s;
97 }
98 
99 L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx) {
101  s.setEt(totHt & kTotEtOrHtMaxValue);
102  if (overFlow || (totHt > kTotEtOrHtMaxValue))
103  s.setOflow(0x1);
104  s.setBx(bx);
105  s.setType(jet_tot_ht);
106  return s;
107 }
108 
109 L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx) {
111  s.setEt(missEtxOrEty & kJetMissEtMaxValue);
112  if (overFlow || (missEtxOrEty >= kJetMissEtOFlowBit / 2) || (missEtxOrEty < -kJetMissEtOFlowBit / 2))
113  s.setOflow(0x1);
114  s.setBx(bx);
115  s.setType(jet_miss_et);
116  return s;
117 }
118 
119 L1GctInternEtSum L1GctInternEtSum::fromEmulatorTotalEtOrHt(unsigned totEtOrHt, bool overFlow, int16_t bx) {
121  s.setEt(totEtOrHt & kTotEtOrHtMaxValue);
122  if (overFlow || (totEtOrHt > kTotEtOrHtMaxValue))
123  s.setOflow(0x1);
124  s.setBx(bx);
125  s.setType(total_et_or_ht);
126  return s;
127 }
128 
129 L1GctInternEtSum L1GctInternEtSum::fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx) {
131  s.setEt(missEtxOrEty & kMissExOrEyMaxValue);
132  if (overFlow || (missEtxOrEty >= kMissExOrEyOFlowBit / 2) || (missEtxOrEty < -kMissExOrEyOFlowBit / 2))
133  s.setOflow(0x1);
134  s.setBx(bx);
135  s.setType(miss_etx_or_ety);
136  return s;
137 }
138 
140 bool L1GctInternEtSum::operator==(const L1GctInternEtSum& c) const { return (data_ == c.raw() && bx_ == c.bx()); }
141 
144  data_ &= 0x80000000;
145  data_ |= val & 0x7ffffff;
146 }
147 
149 void L1GctInternEtSum::setEt(uint32_t et) { setValue(et); }
150 
153 
155 void L1GctInternEtSum::setOflow(uint8_t oflow) {
156  data_ &= 0x7ffffff;
157  data_ |= (oflow & 0x1) << 31;
158 }
159 
161 std::ostream& operator<<(std::ostream& s, const L1GctInternEtSum& c) {
162  s << "L1GctInternEtSum : ";
163 
164  if (c.type() == L1GctInternEtSum::jet_miss_et) {
165  s << " type=jet_miss_et";
166  } else if (c.type() == L1GctInternEtSum::jet_tot_et) {
167  s << " type=jet_tot_et";
168  } else if (c.type() == L1GctInternEtSum::jet_tot_ht) {
169  s << " type=jet_tot_ht";
170  } else if (c.type() == L1GctInternEtSum::total_et_or_ht) {
171  s << " type=total_et_or_ht";
172  } else if (c.type() == L1GctInternEtSum::miss_etx_or_ety) {
173  s << " type=miss_etx_or_ety";
174  }
175 
176  if (c.empty()) {
177  s << " empty!";
178  } else {
179  s << " mag=" << c.et();
180  if (c.oflow()) {
181  s << " overflow set";
182  }
183  }
184 
185  s << " cap block=" << std::hex << c.capBlock();
186  s << " index=" << std::dec << c.capIndex();
187  s << " BX=" << c.bx();
188 
189  return s;
190 }
static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
L1 GCT internal energy sum.
uint8_t oflow() const
get oflow
static L1GctInternEtSum fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx)
Emulator constructors.
void setOflow(uint8_t oflow)
set overflow bit
uint16_t capIndex() const
get index within capture block
uint32_t count() const
get count
static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
~L1GctInternEtSum()
destructor
static L1GctInternEtSum fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx)
uint64_t word
static L1GctInternEtSum fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx)
bool operator==(const L1GctInternEtSum &c) const
operators
static L1GctInternEtSum fromJetMissEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
static L1GctInternEtSum fromEmulatorTotalEtOrHt(unsigned totEtOrHt, bool overFlow, int16_t bx)
void setCount(uint32_t count)
set count
int16_t bx() const
get BX number
void setEt(uint32_t et)
set Et sum
uint32_t et() const
get et
void setValue(uint32_t val)
set value
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
std::ostream & operator<<(std::ostream &s, const L1GctInternEtSum &c)
Pretty-print operator for L1GctInternEtSum.
static L1GctInternEtSum fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx)
L1GctInternEtSum()
default constructor (for vector initialisation etc.)
uint16_t capBlock() const
get capture block
static L1GctInternEtSum fromJetTotEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
static L1GctInternEtSum fromJetTotHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)