CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctHFRingEtSums.cc
Go to the documentation of this file.
1 
3 
5 //static const unsigned L1GctHFRingEtSums::N_SUMS = 4;
6 
7 
10  capBlock_(0),
11  capIndex_(0),
12  bx_(0),
13  data_(0)
14 { }
15 
16 
19 { }
20 
21 
22 // named ctor for unpacker
24  const uint16_t capIndex,
25  const int16_t bx,
26  const uint32_t data)
27 {
29  s.setCapBlock(capBlock);
30  s.setCapIndex(capIndex);
31  s.setBx(bx);
32  s.setEtSum(0, (data>>12)&0x7 );
33  s.setEtSum(1, (data>>16)&0x7 );
34  s.setEtSum(2, (data>>19)&0x7 );
35  s.setEtSum(3, (data>>22)&0x7 );
36  return s;
37 }
38 
39 // named ctor for GCT emulator
41  const uint16_t etSumPosEtaRing1,
42  const uint16_t etSumNegEtaRing1,
43  const uint16_t etSumPosEtaRing2,
44  const uint16_t etSumNegEtaRing2)
45 {
47  s.setBx(bx);
48  s.setEtSum(0, etSumPosEtaRing1);
49  s.setEtSum(1, etSumNegEtaRing1);
50  s.setEtSum(2, etSumPosEtaRing2);
51  s.setEtSum(3, etSumNegEtaRing2);
52  return s;
53 }
54 
61 uint16_t L1GctHFRingEtSums::etSum(unsigned const i) const {
62  return (data_>>(i*3)) & 0x7;
63 }
64 
65 
68  return (this->raw() == c.raw());
69 }
70 
72 void L1GctHFRingEtSums::setEtSum(unsigned i, uint16_t et) {
73  data_ &= ~(0x7<<(i*3));
74  data_ |= (et&0x7)<<(i*3);
75 }
76 
77 std::ostream& operator<<(std::ostream& s, const L1GctHFRingEtSums& cand)
78 {
79  s << "L1GctHFRingEtSums :";
80 
81  if (cand.empty()) {
82  s << " empty";
83  } else {
84  s << " ring1 eta+=" << cand.etSum(0);
85  s << " ring1 eta-=" << cand.etSum(1);
86  s << " ring2 eta+=" << cand.etSum(2);
87  s << " ring2 eta-=" << cand.etSum(3);
88  s << std::endl;
89  }
90 
91  s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx();
92 
93  return s;
94 }
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
uint16_t capBlock() const
get GCT unpacker capture block
int i
Definition: DBlmapReader.cc:9
bool operator==(const L1GctHFRingEtSums &c) const
operators
uint16_t capIndex() const
get index within GCT unpacker capture block
void setCapIndex(uint16_t capIndex)
set cap index
~L1GctHFRingEtSums()
destructor
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
bool empty() const
is the sum non-zero
void setEtSum(unsigned i, uint16_t et)
set a sum
void setCapBlock(uint16_t capBlock)
set cap block
int16_t bx() const
get BX number
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 raw() const
get the raw data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
L1GctHFRingEtSums()
default constructor (for vector initialisation etc.)
void setBx(uint16_t bx)
set bx
uint16_t etSum(unsigned const i) const