test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctHFBitCounts.cc
Go to the documentation of this file.
1 
3 
5 //static const unsigned L1GctHFBitCounts::N_COUNTS = 4;
6 
9  capBlock_(0),
10  capIndex_(0),
11  bx_(0),
12  data_(0)
13 { }
14 
15 
18 { }
19 
20 // named ctor for unpacker
22  const uint16_t capIndex,
23  const int16_t bx,
24  const uint32_t data)
25 {
27  c.setCapBlock(capBlock);
28  c.setCapIndex(capIndex);
29  c.setBx(bx);
30  c.setData(data&0xfff);
31  return c;
32 }
33 
34 
35 // named ctor for GCT emulator
37  const uint16_t bitCountPosEtaRing1,
38  const uint16_t bitCountNegEtaRing1,
39  const uint16_t bitCountPosEtaRing2,
40  const uint16_t bitCountNegEtaRing2)
41 {
43  c.setBx(bx);
44  c.setBitCount(0, bitCountPosEtaRing1);
45  c.setBitCount(1, bitCountNegEtaRing1);
46  c.setBitCount(2, bitCountPosEtaRing2);
47  c.setBitCount(3, bitCountNegEtaRing2);
48  return c;
49 }
50 
51 
58 uint16_t L1GctHFBitCounts::bitCount(unsigned const i) const {
59  return (data_>>(i*3)) & 0x7;
60 }
61 
62 
65  return (this->raw() == c.raw());
66 }
67 
68 
70 void L1GctHFBitCounts::setBitCount(unsigned i, uint16_t c) {
71  data_ &= ~(0x7<<(i*3));
72  data_ |= (c&0x7)<<(i*3);
73 }
74 
75 
76 std::ostream& operator<<(std::ostream& s, const L1GctHFBitCounts& cand)
77 {
78  s << "L1GctHFBitCounts :";
79 
80  if (cand.empty()) {
81  s << " empty";
82  } else {
83  s << " ring1 eta+=" << cand.bitCount(0);
84  s << " ring1 eta-=" << cand.bitCount(1);
85  s << " ring2 eta+=" << cand.bitCount(2);
86  s << " ring2 eta-=" << cand.bitCount(3);
87  s << std::endl;
88  }
89 
90  s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx();
91 
92  return s;
93 }
int i
Definition: DBlmapReader.cc:9
void setData(uint32_t data)
set the raw data
void setBx(int16_t bx)
set bx
bool empty() const
is the sum non-zero
void setBitCount(unsigned i, uint16_t c)
set a sum
int16_t bx() const
get BX number
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
uint16_t bitCount(unsigned const i) const
~L1GctHFBitCounts()
destructor
uint16_t capBlock() const
get GCT unpacker capture block
L1 GCT HF ring Et sums.
void setCapBlock(uint16_t capBlock)
set cap block
void setCapIndex(uint16_t capIndex)
set cap index
L1GctHFBitCounts()
default constructor (for vector initialisation etc.)
bool operator==(const L1GctHFBitCounts &c) const
operators
static L1GctHFBitCounts fromConcHFBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
uint16_t capIndex() const
get index within GCT unpacker capture block
uint16_t raw() const
the raw data
static L1GctHFBitCounts fromGctEmulator(const int16_t bx, const uint16_t bitCountPosEtaRing1, const uint16_t bitCountNegEtaRing1, const uint16_t bitCountPosEtaRing2, const uint16_t bitCountNegEtaRing2)
named ctor for GCT emulator