CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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);
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);
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);
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);
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);
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);
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);
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);
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 
152 void L1GctInternEtSum::setCount(uint32_t count) { setValue(count); }
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.
const edm::EventSetup & c
static L1GctInternEtSum fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx)
Emulator constructors.
uint16_t capIndex() const
get index within capture block
uint16_t capBlock() const
get capture block
void setOflow(uint8_t oflow)
set overflow bit
void setCapBlock(uint16_t capBlock)
set cap block
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
bool empty() const
is the sum non-zero
void setBx(uint16_t bx)
set bx
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
uint8_t oflow() const
get oflow
void setType(L1GctInternEtSumType type)
set type
static L1GctInternEtSum fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx)
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)
L1GctInternEtSum::L1GctInternEtSumType type() const
metadata
uint32_t et() const
get et
void setCount(uint32_t count)
set count
void setEt(uint32_t et)
set Et sum
uint32_t raw() const
get the actual bits
void setValue(uint32_t val)
set value
bool operator==(const L1GctInternEtSum &c) const
operators
int16_t bx() const
get BX number
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
static L1GctInternEtSum fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx)
L1GctInternEtSum()
default constructor (for vector initialisation etc.)
void setCapIndex(uint16_t capIndex)
set cap index
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)