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 }
L1GctInternEtSum::fromJetTotHt
static L1GctInternEtSum fromJetTotHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
Definition: L1GctInternEtSum.cc:30
L1GctInternEtSum::setValue
void setValue(uint32_t val)
set value
Definition: L1GctInternEtSum.cc:143
L1GctInternEtSum::fromEmulatorMissEtxOrEty
static L1GctInternEtSum fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx)
Definition: L1GctInternEtSum.cc:129
operator<<
std::ostream & operator<<(std::ostream &s, const L1GctInternEtSum &c)
Pretty-print operator for L1GctInternEtSum.
Definition: L1GctInternEtSum.cc:161
L1GctInternEtSum::kMissExOrEyNBits
Definition: L1GctInternEtSum.h:29
L1GctInternEtSum::capBlock
uint16_t capBlock() const
get capture block
Definition: L1GctInternEtSum.h:77
L1GctInternEtSum::et
uint32_t et() const
get et
Definition: L1GctInternEtSum.h:97
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
L1GctInternEtSum::miss_etx_or_ety
Definition: L1GctInternEtSum.h:23
L1GctInternEtSum::setEt
void setEt(uint32_t et)
set Et sum
Definition: L1GctInternEtSum.cc:149
L1GctInternEtSum::kTotEtOrHtMaxValue
Definition: L1GctInternEtSum.h:33
L1GctInternEtSum::capIndex
uint16_t capIndex() const
get index within capture block
Definition: L1GctInternEtSum.h:80
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
L1GctInternEtSum::jet_tot_et
Definition: L1GctInternEtSum.h:19
L1GctInternEtSum::~L1GctInternEtSum
~L1GctInternEtSum()
destructor
Definition: L1GctInternEtSum.cc:14
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1GctInternEtSum::count
uint32_t count() const
get count
Definition: L1GctInternEtSum.h:100
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
L1GctInternEtSum::fromEmulatorTotalEtOrHt
static L1GctInternEtSum fromEmulatorTotalEtOrHt(unsigned totEtOrHt, bool overFlow, int16_t bx)
Definition: L1GctInternEtSum.cc:119
L1GctInternEtSum::kMissExOrEyMaxValue
Definition: L1GctInternEtSum.h:35
L1GctInternEtSum.h
L1GctInternEtSum::jet_tot_ht
Definition: L1GctInternEtSum.h:20
L1GctInternEtSum::operator==
bool operator==(const L1GctInternEtSum &c) const
operators
Definition: L1GctInternEtSum.cc:140
L1GctInternEtSum::jet_miss_et
Definition: L1GctInternEtSum.h:21
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
L1GctInternEtSum::kJetMissEtMaxValue
Definition: L1GctInternEtSum.h:34
L1GctInternEtSum::fromTotalEtOrHt
static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
Definition: L1GctInternEtSum.cc:59
L1GctInternEtSum::fromEmulatorJetMissEt
static L1GctInternEtSum fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx)
Definition: L1GctInternEtSum.cc:109
L1GctInternEtSum::setCount
void setCount(uint32_t count)
set count
Definition: L1GctInternEtSum.cc:152
heppy_batch.val
val
Definition: heppy_batch.py:351
L1GctInternEtSum::kMissExOrEyOFlowBit
Definition: L1GctInternEtSum.h:32
L1GctInternEtSum
L1 GCT internal energy sum.
Definition: L1GctInternEtSum.h:14
L1GctInternEtSum::fromMissEtxOrEty
static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
Definition: L1GctInternEtSum.cc:73
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
L1GctInternEtSum::bx_
int16_t bx_
Definition: L1GctInternEtSum.h:146
L1GctInternEtSum::kJetMissEtOFlowBit
Definition: L1GctInternEtSum.h:31
L1GctInternEtSum::kJetMissEtNBits
Definition: L1GctInternEtSum.h:28
L1GctInternEtSum::total_et_or_ht
Definition: L1GctInternEtSum.h:22
L1GctInternEtSum::data_
uint32_t data_
Definition: L1GctInternEtSum.h:149
L1GctInternEtSum::fromEmulatorJetTotHt
static L1GctInternEtSum fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx)
Definition: L1GctInternEtSum.cc:99
L1GctInternEtSum::oflow
uint8_t oflow() const
get oflow
Definition: L1GctInternEtSum.h:103
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
L1GctInternEtSum::kTotEtOrHtNBits
Definition: L1GctInternEtSum.h:27
L1GctInternEtSum::fromJetMissEt
static L1GctInternEtSum fromJetMissEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
Definition: L1GctInternEtSum.cc:45
L1GctInternEtSum::L1GctInternEtSum
L1GctInternEtSum()
default constructor (for vector initialisation etc.)
Definition: L1GctInternEtSum.cc:4
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
L1GctInternEtSum::bx
int16_t bx() const
get BX number
Definition: L1GctInternEtSum.h:83
L1GctInternEtSum::fromEmulatorJetTotEt
static L1GctInternEtSum fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx)
Emulator constructors.
Definition: L1GctInternEtSum.cc:89
L1GctInternEtSum::fromJetTotEt
static L1GctInternEtSum fromJetTotEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
Definition: L1GctInternEtSum.cc:16
L1GctInternEtSum::setOflow
void setOflow(uint8_t oflow)
set overflow bit
Definition: L1GctInternEtSum.cc:155