test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctInternEtSum.cc
Go to the documentation of this file.
2 #include <stdint.h>
3 
4 
6 
7 }
8 
9 
12  uint16_t capIndex,
13  int16_t bx,
14  uint32_t et,
15  uint8_t oflow) :
16  type_(null),
17  capBlock_(capBlock),
18  capIndex_(capIndex),
19  bx_(bx),
20  data_(0)
21 {
22  this->setEt(et);
23  this->setOflow(oflow);
24 }
25 
26 
29 
30 }
31 
33  const uint16_t capIndex,
34  const int16_t bx,
35  const uint32_t data) {
37  s.setEt(data & kTotEtOrHtMaxValue);
38  s.setOflow((data>>kTotEtOrHtNBits)&0x1);
39  s.setCapBlock(capBlock);
40  s.setCapIndex(capIndex);
41  s.setBx(bx);
43  return s;
44 }
45 
47  const uint16_t capIndex,
48  const int16_t bx,
49  const uint32_t data) {
51  uint32_t word=data>>16;
52  s.setEt(word & kTotEtOrHtMaxValue);
53  s.setOflow((word>>kTotEtOrHtNBits)&0x1);
54  s.setCapBlock(capBlock);
55  s.setCapIndex(capIndex);
56  s.setBx(bx);
58  return s;
59 }
60 
62  const uint16_t capIndex,
63  const int16_t bx,
64  const uint32_t data) {
66  s.setEt(data & kJetMissEtMaxValue);
67  s.setOflow((data>>kJetMissEtNBits) & 0x1);
68  s.setCapBlock(capBlock);
69  s.setCapIndex(capIndex);
70  s.setBx(bx);
72  return s;
73 }
74 
75 
77  const uint16_t capIndex,
78  const int16_t bx,
79  const uint32_t data) {
81  s.setEt(data & kTotEtOrHtMaxValue);
82  s.setOflow((data>>kTotEtOrHtNBits) & 0x1);
83  s.setCapBlock(capBlock);
84  s.setCapIndex(capIndex);
85  s.setBx(bx);
87  return s;
88 }
89 
91  const uint16_t capIndex,
92  const int16_t bx,
93  const uint32_t data) {
95  s.setEt(data & kMissExOrEyNBits);
96  s.setOflow(0); // No over flow bit at the moment
97  s.setCapBlock(capBlock);
98  s.setCapIndex(capIndex);
99  s.setBx(bx);
101  return s;
102 }
103 
104 
106 
107 L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx) {
109  s.setEt(totEt & kTotEtOrHtMaxValue);
110  if (overFlow || (totEt > kTotEtOrHtMaxValue)) s.setOflow(0x1);
111  s.setBx(bx);
112  s.setType(jet_tot_et);
113  return s;
114 }
115 
116 L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx) {
118  s.setEt(totHt & kTotEtOrHtMaxValue);
119  if (overFlow || (totHt > kTotEtOrHtMaxValue)) s.setOflow(0x1);
120  s.setBx(bx);
121  s.setType(jet_tot_ht);
122  return s;
123 }
124 
125 L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx) {
127  s.setEt(missEtxOrEty & kJetMissEtMaxValue);
128  if (overFlow || (missEtxOrEty >= kJetMissEtOFlowBit/2) || (missEtxOrEty < -kJetMissEtOFlowBit/2)) s.setOflow(0x1);
129  s.setBx(bx);
130  s.setType(jet_miss_et);
131  return s;
132 }
133 
134 L1GctInternEtSum L1GctInternEtSum::fromEmulatorTotalEtOrHt(unsigned totEtOrHt, bool overFlow, int16_t bx) {
136  s.setEt(totEtOrHt & kTotEtOrHtMaxValue);
137  if (overFlow || (totEtOrHt > kTotEtOrHtMaxValue)) s.setOflow(0x1);
138  s.setBx(bx);
140  return s;
141 }
142 
143 L1GctInternEtSum L1GctInternEtSum::fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx) {
145  s.setEt(missEtxOrEty & kMissExOrEyMaxValue);
146  if (overFlow || (missEtxOrEty >= kMissExOrEyOFlowBit/2) || (missEtxOrEty < -kMissExOrEyOFlowBit/2)) s.setOflow(0x1);
147  s.setBx(bx);
149  return s;
150 }
151 
154  return ( data_ == c.raw() && bx_ == c.bx() );
155 }
156 
157 
159 void L1GctInternEtSum::setValue(uint32_t val) {
160  data_ &= 0x80000000;
161  data_ |= val & 0x7ffffff;
162 }
163 
165 void L1GctInternEtSum::setEt(uint32_t et) {
166  setValue(et);
167 }
168 
171  setValue(count);
172 }
173 
175 void L1GctInternEtSum::setOflow(uint8_t oflow) {
176  data_ &= 0x7ffffff;
177  data_ |= (oflow & 0x1)<<31;
178 }
179 
181 std::ostream& operator<<(std::ostream& s, const L1GctInternEtSum& c)
182 {
183  s << "L1GctInternEtSum : ";
184 
186  s << " type=jet_miss_et";
187  } else if (c.type()==L1GctInternEtSum::jet_tot_et){
188  s << " type=jet_tot_et";
189  } else if (c.type()==L1GctInternEtSum::jet_tot_ht){
190  s << " type=jet_tot_ht";
191  } else if (c.type()==L1GctInternEtSum::total_et_or_ht){
192  s << " type=total_et_or_ht";
193  } else if (c.type()==L1GctInternEtSum::miss_etx_or_ety){
194  s << " type=miss_etx_or_ety";
195  }
196 
197  if (c.empty()) {
198  s << " empty!";
199  } else {
200  s << " mag=" << c.et();
201  if (c.oflow()) { s << " overflow set"; }
202  }
203 
204  s << " cap block=" << std::hex << c.capBlock();
205  s << " index=" << std::dec << c.capIndex();
206  s << " BX=" << c.bx();
207 
208  return s;
209 }
static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
L1 GCT internal energy sum.
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:188
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)
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:82
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)