CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1GctHFBitCounts.cc
Go to the documentation of this file.
1 
3 
5 //static const unsigned L1GctHFBitCounts::N_COUNTS = 4;
6 
8 L1GctHFBitCounts::L1GctHFBitCounts() : 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  c.setCapBlock(capBlock);
20  c.setCapIndex(capIndex);
21  c.setBx(bx);
22  c.setData(data & 0xfff);
23  return c;
24 }
25 
26 // named ctor for GCT emulator
28  const uint16_t bitCountPosEtaRing1,
29  const uint16_t bitCountNegEtaRing1,
30  const uint16_t bitCountPosEtaRing2,
31  const uint16_t bitCountNegEtaRing2) {
33  c.setBx(bx);
34  c.setBitCount(0, bitCountPosEtaRing1);
35  c.setBitCount(1, bitCountNegEtaRing1);
36  c.setBitCount(2, bitCountPosEtaRing2);
37  c.setBitCount(3, bitCountNegEtaRing2);
38  return c;
39 }
40 
47 uint16_t L1GctHFBitCounts::bitCount(unsigned const i) const { return (data_ >> (i * 3)) & 0x7; }
48 
50 bool L1GctHFBitCounts::operator==(const L1GctHFBitCounts& c) const { return (this->raw() == c.raw()); }
51 
53 void L1GctHFBitCounts::setBitCount(unsigned i, uint16_t c) {
54  data_ &= ~(0x7 << (i * 3));
55  data_ |= (c & 0x7) << (i * 3);
56 }
57 
58 std::ostream& operator<<(std::ostream& s, const L1GctHFBitCounts& cand) {
59  s << "L1GctHFBitCounts :";
60 
61  if (cand.empty()) {
62  s << " empty";
63  } else {
64  s << " ring1 eta+=" << cand.bitCount(0);
65  s << " ring1 eta-=" << cand.bitCount(1);
66  s << " ring2 eta+=" << cand.bitCount(2);
67  s << " ring2 eta-=" << cand.bitCount(3);
68  s << std::endl;
69  }
70 
71  s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx();
72 
73  return s;
74 }
void setData(uint32_t data)
set the raw data
const edm::EventSetup & c
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:167
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
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
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