CMS 3D CMS Logo

L1CaloEmCand.h
Go to the documentation of this file.
1 #ifndef L1CALOEMCAND_H
2 #define L1CALOEMCAND_H
3 
4 #include <ostream>
5 
7 
17 class L1CaloEmCand {
18 public:
20  L1CaloEmCand();
21 
23  L1CaloEmCand(uint16_t data, unsigned crate, bool iso);
24 
27  L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy);
28 
30  L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso);
31 
33  L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx);
34 
36  ~L1CaloEmCand();
37 
39  uint16_t raw() const { return m_data; }
40 
42  unsigned rank() const { return m_data & 0x3f; }
43 
45  unsigned rctCard() const { return (m_data >> 7) & 0x7; }
46 
48  unsigned rctRegion() const { return (m_data >> 6) & 0x1; }
49 
51  unsigned rctCrate() const { return m_rctCrate; }
52 
54  bool isolated() const { return m_iso; }
55 
57  unsigned index() const { return m_index; }
58 
60  int16_t bx() const { return m_bx; }
61 
64 
66  void setBx(int16_t bx);
67 
69  int operator==(const L1CaloEmCand& c) const {
70  return ((m_data == c.raw() && m_iso == c.isolated() && m_rctCrate == c.rctCrate() &&
71  this->regionId() == c.regionId()) ||
72  (this->empty() && c.empty()));
73  }
74 
76  int operator!=(const L1CaloEmCand& c) const { return !(*this == c); }
77 
79  bool empty() const { return (rank() == 0); }
80 
81 private:
82  // rank, card and region ID are contained in the data on the cable
83  uint16_t m_data;
84 
85  // members to store geographical information (crate/cable)
86  // these should probably be packed into a single uint16_t (or m_data) ???
87  uint16_t m_rctCrate;
88  bool m_iso;
89  uint16_t m_index;
90  int16_t m_bx;
91 };
92 
93 std::ostream& operator<<(std::ostream& s, const L1CaloEmCand& cand);
94 
95 #endif
int16_t bx() const
get bunch-crossing index
Definition: L1CaloEmCand.h:60
void setBx(int16_t bx)
set BX
Definition: L1CaloEmCand.cc:49
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:17
bool isolated() const
which stream did this come from
Definition: L1CaloEmCand.h:54
int operator!=(const L1CaloEmCand &c) const
inequality operator
Definition: L1CaloEmCand.h:76
L1CaloEmCand()
default constructor (for vector initialisation etc.)
Definition: L1CaloEmCand.cc:11
L1CaloRegionDetId regionId() const
get DetID object
Definition: L1CaloEmCand.h:63
unsigned rctRegion() const
get RCT region ID
Definition: L1CaloEmCand.h:48
~L1CaloEmCand()
destructor
Definition: L1CaloEmCand.cc:47
uint16_t m_index
Definition: L1CaloEmCand.h:89
unsigned rctCrate() const
get RCT crate
Definition: L1CaloEmCand.h:51
int operator==(const L1CaloEmCand &c) const
equality operator, including rank, isolation, position
Definition: L1CaloEmCand.h:69
int16_t m_bx
Definition: L1CaloEmCand.h:90
uint16_t m_rctCrate
Definition: L1CaloEmCand.h:87
std::ostream & operator<<(std::ostream &s, const L1CaloEmCand &cand)
uint16_t m_data
Definition: L1CaloEmCand.h:83
unsigned rank() const
get rank bits
Definition: L1CaloEmCand.h:42
unsigned index() const
get index on cable
Definition: L1CaloEmCand.h:57
unsigned rctCard() const
get RCT receiver card
Definition: L1CaloEmCand.h:45
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
uint16_t raw() const
get the raw data
Definition: L1CaloEmCand.h:39
bool empty() const
is there any information in the candidate
Definition: L1CaloEmCand.h:79