CMS 3D CMS Logo

L1GctHFRingEtSums.cc
Go to the documentation of this file.
1 
3 
5 //static const unsigned L1GctHFRingEtSums::N_SUMS = 4;
6 
8 L1GctHFRingEtSums::L1GctHFRingEtSums() : capBlock_(0), capIndex_(0), bx_(0), data_(0) {}
9 
12 
13 // named ctor for unpacker
15  const uint16_t capIndex,
16  const int16_t bx,
17  const uint32_t data) {
19  s.setCapBlock(capBlock);
20  s.setCapIndex(capIndex);
21  s.setBx(bx);
22  s.setEtSum(0, (data >> 12) & 0x7);
23  s.setEtSum(1, (data >> 16) & 0x7);
24  s.setEtSum(2, (data >> 19) & 0x7);
25  s.setEtSum(3, (data >> 22) & 0x7);
26  return s;
27 }
28 
29 // named ctor for GCT emulator
31  const uint16_t etSumPosEtaRing1,
32  const uint16_t etSumNegEtaRing1,
33  const uint16_t etSumPosEtaRing2,
34  const uint16_t etSumNegEtaRing2) {
36  s.setBx(bx);
37  s.setEtSum(0, etSumPosEtaRing1);
38  s.setEtSum(1, etSumNegEtaRing1);
39  s.setEtSum(2, etSumPosEtaRing2);
40  s.setEtSum(3, etSumNegEtaRing2);
41  return s;
42 }
43 
50 uint16_t L1GctHFRingEtSums::etSum(unsigned const i) const { return (data_ >> (i * 3)) & 0x7; }
51 
53 bool L1GctHFRingEtSums::operator==(const L1GctHFRingEtSums& c) const { return (this->raw() == c.raw()); }
54 
56 void L1GctHFRingEtSums::setEtSum(unsigned i, uint16_t et) {
57  data_ &= ~(0x7 << (i * 3));
58  data_ |= (et & 0x7) << (i * 3);
59 }
60 
61 std::ostream& operator<<(std::ostream& s, const L1GctHFRingEtSums& cand) {
62  s << "L1GctHFRingEtSums :";
63 
64  if (cand.empty()) {
65  s << " empty";
66  } else {
67  s << " ring1 eta+=" << cand.etSum(0);
68  s << " ring1 eta-=" << cand.etSum(1);
69  s << " ring2 eta+=" << cand.etSum(2);
70  s << " ring2 eta-=" << cand.etSum(3);
71  s << std::endl;
72  }
73 
74  s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx();
75 
76  return s;
77 }
static L1GctHFRingEtSums fromGctEmulator(const int16_t bx, const uint16_t etSumPosEtaRing1, const uint16_t etSumNegEtaRing1, const uint16_t etSumPosEtaRing2, const uint16_t etSumNegEtaRing2)
named ctor for GCT emulator
~L1GctHFRingEtSums()
destructor
bool operator==(const L1GctHFRingEtSums &c) const
operators
uint16_t etSum(unsigned const i) const
std::ostream & operator<<(std::ostream &s, const L1GctHFRingEtSums &cand)
int16_t bx() const
get BX number
void setEtSum(unsigned i, uint16_t et)
set a sum
uint16_t capIndex() const
get index within GCT unpacker capture block
static L1GctHFRingEtSums fromConcRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
L1 GCT HF ring Et sums.
uint16_t capBlock() const
get GCT unpacker capture block
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
uint16_t raw() const
get the raw data
L1GctHFRingEtSums()
default constructor (for vector initialisation etc.)