test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1CaloEmCand.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
5 using std::ostream;
6 using std::endl;
7 using std::hex;
8 using std::dec;
9 
10 // default constructor
12  m_data(0),
13  m_rctCrate(0),
14  m_iso(false),
15  m_index(0),
16  m_bx(0)
17 {
18 
19 }
20 
21 // construct from raw data (for use in unpacking)
22 // last bool argument is a hack to distinguish this constructor from the next one!
23 L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso) :
24  m_data(data),
25  m_rctCrate(crate),
26  m_iso(iso),
27  m_index(0),
28  m_bx(0)
29  {
30  }
31 
32 // construct from raw data (for use in unpacking)
33 // last bool argument is a hack to distinguish this constructor from the next one!
34  L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy) :
35  m_data(data),
36  m_rctCrate(crate),
37  m_iso(iso),
38  m_index(index),
39  m_bx(bx)
40  {
41  }
42 
43 // construct from content (for use in emulator)
44 L1CaloEmCand::L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso) :
45  m_data(0), // over-ridden below
46  m_rctCrate(crate),
47  m_iso(iso),
48  m_index(0),
49  m_bx(0)
50 
51 {
52  m_data = (rank & 0x3f) + ((region & 0x1)<<6) + ((card & 0x7)<<7);
53 }
54 
55 // construct from content (for use in emulator)
56 L1CaloEmCand::L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx) :
57  m_data(0), // over-ridden below
58  m_rctCrate(crate),
59  m_iso(iso),
60  m_index(index),
61  m_bx(bx)
62 {
63  m_data = (rank & 0x3f) + ((region & 0x1)<<6) + ((card & 0x7)<<7);
64 }
65 
66 // destructor
68 
69 void L1CaloEmCand::setBx(int16_t bx) {
70  m_bx = bx;
71 }
72 
73 // pretty print
74 ostream& operator<<(ostream& s, const L1CaloEmCand& cand) {
75  s << "L1CaloEmCand : ";
76  s << "rank=" << cand.rank();
77  s << ", region=" << cand.rctRegion() << ", card=" << cand.rctCard() << ", crate=" << cand.rctCrate();
78  s << ", iso=" << cand.isolated();
79  s << ", index=" << cand.index() << ", BX=" << cand.bx();
80  return s;
81 }
void setBx(int16_t bx)
set BX
Definition: L1CaloEmCand.cc:69
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:18
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
L1CaloEmCand()
default constructor (for vector initialisation etc.)
Definition: L1CaloEmCand.cc:11
~L1CaloEmCand()
destructor
Definition: L1CaloEmCand.cc:67
unsigned rctCrate() const
get RCT crate
Definition: L1CaloEmCand.h:53
bool isolated() const
which stream did this come from
Definition: L1CaloEmCand.h:56
int16_t bx() const
get bunch-crossing index
Definition: L1CaloEmCand.h:62
int16_t m_bx
Definition: L1CaloEmCand.h:90
unsigned rank() const
get rank bits
Definition: L1CaloEmCand.h:44
unsigned rctCard() const
get RCT receiver card
Definition: L1CaloEmCand.h:47
uint16_t m_data
Definition: L1CaloEmCand.h:83
unsigned index() const
get index on cable
Definition: L1CaloEmCand.h:59
unsigned rctRegion() const
get RCT region ID
Definition: L1CaloEmCand.h:50
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
volatile std::atomic< bool > shutdown_flag false