CMS 3D CMS Logo

L1CaloRegion.h
Go to the documentation of this file.
1 #ifndef L1CALOREGION_H
2 #define L1CALOREGION_H
3 
4 #include <ostream>
5 
7 
21 class L1CaloRegion {
22 public:
24  L1CaloRegion();
25 
28  unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn);
29 
31  L1CaloRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn);
32 
34  L1CaloRegion(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi);
35 
37  L1CaloRegion(uint16_t data, unsigned ieta, unsigned iphi, int16_t bx);
38 
40  ~L1CaloRegion();
41 
42  // named ctors
43 
45  static L1CaloRegion makeHBHERegion(const unsigned et,
46  const bool overFlow,
47  const bool tauVeto,
48  const bool mip,
49  const bool quiet,
50  const unsigned crate,
51  const unsigned card,
52  const unsigned rgn);
53 
55  static L1CaloRegion makeHFRegion(const unsigned et, const bool fineGrain, const unsigned crate, const unsigned rgn);
56 
58  static L1CaloRegion makeRegionFromGctIndices(const unsigned et,
59  const bool overFlow,
60  const bool fineGrain,
61  const bool mip,
62  const bool quiet,
63  const unsigned ieta,
64  const unsigned iphi);
66  static L1CaloRegion makeRegionFromUnpacker(const uint16_t data,
67  const unsigned ieta,
68  const unsigned iphi,
69  const uint16_t block,
70  const uint16_t index,
71  const int16_t bx);
72 
74  static L1CaloRegion makeGctJetRegion(const unsigned et,
75  const bool overFlow,
76  const bool fineGrain,
77  const unsigned ieta,
78  const unsigned iphi,
79  const int16_t bx);
80 
81  // get/set methods for the data
82 
84  void reset() { m_data = 0; }
85 
87  uint16_t raw() const { return m_data; }
88 
90  unsigned et() const { return (isHf() ? m_data & 0xff : m_data & 0x3ff); }
91 
93  unsigned etFullScale() const { return m_data & 0xfff; }
94 
96  bool overFlow() const { return ((m_data >> 10) & 0x1) != 0; }
97 
99  bool tauVeto() const { return (isHf() ? false : fineGrain()); }
100 
102  bool fineGrain() const { return ((m_data >> 11) & 0x1) != 0; }
103 
105  bool mip() const { return ((m_data >> 12) & 0x1) != 0; }
106 
108  bool quiet() const { return ((m_data >> 13) & 0x1) != 0; }
109 
112 
115 
117  void setBx(int16_t bx);
118 
120  void setRawData(uint32_t data) { m_data = data; }
121 
123  void setMip(bool mip);
124 
126  void setQuiet(bool quiet);
127 
128  // get methods for the geographical information
129 
131  L1CaloRegionDetId id() const { return m_id; }
132 
134  bool isHf() const { return m_id.isHf(); }
135  bool isHbHe() const { return !m_id.isHf(); }
136 
138  unsigned rctCrate() const { return m_id.rctCrate(); }
139 
141  unsigned rctCard() const { return m_id.rctCard(); }
142 
144  unsigned rctRegionIndex() const { return m_id.rctRegion(); }
145 
147  unsigned rctEta() const { return m_id.rctEta(); }
148 
150  unsigned rctPhi() const { return m_id.rctPhi(); }
151 
153  unsigned gctEta() const { return m_id.ieta(); }
154 
156  unsigned gctPhi() const { return m_id.iphi(); }
157 
159  unsigned capBlock() const { return m_captureBlock; }
160 
162  unsigned capIndex() const { return m_captureIndex; }
163 
165  int16_t bx() const { return m_bx; }
166 
168  int operator==(const L1CaloRegion& c) const {
169  return ((m_data == c.raw() && m_id == c.id()) || (this->empty() && c.empty()));
170  }
171 
173  int operator!=(const L1CaloRegion& c) const { return !(*this == c); }
174 
176  bool empty() const { return (m_data == 0); }
177 
179  friend std::ostream& operator<<(std::ostream& os, const L1CaloRegion& reg);
180 
181 private:
184 
186  void pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet);
187 
189  void pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet);
190 
193 
195  uint16_t m_data;
196  uint16_t m_captureBlock;
197  uint8_t m_captureIndex;
198  int16_t m_bx;
199 };
200 
201 #endif /*L1CALOREGION_H*/
int operator==(const L1CaloRegion &c) const
equality operator, including rank, feature bits, and position
Definition: L1CaloRegion.h:168
unsigned etFullScale() const
get Et for internal GCT use
Definition: L1CaloRegion.h:93
~L1CaloRegion()
destructor
Definition: L1CaloRegion.cc:44
bool overFlow() const
get overflow
Definition: L1CaloRegion.h:96
unsigned rctCrate() const
get RCT crate ID
Definition: L1CaloRegion.h:138
unsigned rctRegion() const
return RCT region index (0-1 for barrel, 0-7 for HF)
unsigned rctPhi() const
get local phi index (within RCT crate)
Definition: L1CaloRegion.h:150
unsigned rctCard() const
get RCT reciever card ID (valid output for HB/HE)
Definition: L1CaloRegion.h:141
uint16_t m_data
region data : et, overflow, fine grain/tau veto, mip and quiet bits
Definition: L1CaloRegion.h:195
unsigned rctCrate() const
return RCT crate number (0-17)
void setRawData(uint32_t data)
set data
Definition: L1CaloRegion.h:120
L1CaloRegionDetId id() const
get global region ID
Definition: L1CaloRegion.h:131
unsigned capBlock() const
which capture block did this come from
Definition: L1CaloRegion.h:159
bool isHf() const
forward or central region
Definition: L1CaloRegion.h:134
L1CaloRegionDetId m_id
region id
Definition: L1CaloRegion.h:192
void setBx(int16_t bx)
set bx
unsigned capIndex() const
what index within capture block
Definition: L1CaloRegion.h:162
static L1CaloRegion makeHBHERegion(const unsigned et, const bool overFlow, const bool tauVeto, const bool mip, const bool quiet, const unsigned crate, const unsigned card, const unsigned rgn)
constructor HB/HE region from components
Definition: L1CaloRegion.cc:49
unsigned ieta() const
global eta index (0-21)
unsigned rctEta() const
return local RCT eta index (0-10)
uint8_t m_captureIndex
Definition: L1CaloRegion.h:197
bool isHf() const
return central or forward type
int operator!=(const L1CaloRegion &c) const
inequality operator
Definition: L1CaloRegion.h:173
void setRegionId(L1CaloRegionDetId id)
set region ID
Definition: L1CaloRegion.h:183
void setCaptureBlock(uint16_t capBlock)
set cap block
Definition: L1CaloRegion.h:111
unsigned rctRegionIndex() const
get RCT region index
Definition: L1CaloRegion.h:144
void setCaptureIndex(uint16_t capIndex)
set cap index
Definition: L1CaloRegion.h:114
void setMip(bool mip)
set MIP bit (required for GCT emulator standalone operation)
uint16_t raw() const
get raw data
Definition: L1CaloRegion.h:87
void pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet)
pack the raw data from arguments (used in constructors)
bool fineGrain() const
get fine grain bit
Definition: L1CaloRegion.h:102
int16_t bx() const
get bunch-crossing index
Definition: L1CaloRegion.h:165
bool isHbHe() const
Definition: L1CaloRegion.h:135
bool empty() const
is there any information in the candidate
Definition: L1CaloRegion.h:176
void pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet)
pack the raw data from arguments (used in constructors)
static L1CaloRegion makeGctJetRegion(const unsigned et, const bool overFlow, const bool fineGrain, const unsigned ieta, const unsigned iphi, const int16_t bx)
construct region for use in GCT internal jet-finding
Definition: L1CaloRegion.cc:89
bool mip() const
get MIP bit
Definition: L1CaloRegion.h:105
unsigned gctEta() const
get GCT eta index
Definition: L1CaloRegion.h:153
friend std::ostream & operator<<(std::ostream &os, const L1CaloRegion &reg)
print to stream
unsigned rctPhi() const
return local RCT phi index (0-1)
unsigned et() const
get Et
Definition: L1CaloRegion.h:90
static L1CaloRegion makeRegionFromGctIndices(const unsigned et, const bool overFlow, const bool fineGrain, const bool mip, const bool quiet, const unsigned ieta, const unsigned iphi)
construct region from GCT indices
Definition: L1CaloRegion.cc:68
unsigned iphi() const
global phi index (0-17)
unsigned rctEta() const
get local eta index (within RCT crate)
Definition: L1CaloRegion.h:147
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
int16_t m_bx
Definition: L1CaloRegion.h:198
void setQuiet(bool quiet)
set quiet bit (required for GCT emulator standalone operation)
unsigned gctPhi() const
get GCT phi index
Definition: L1CaloRegion.h:156
static L1CaloRegion makeHFRegion(const unsigned et, const bool fineGrain, const unsigned crate, const unsigned rgn)
construct HF region from components
Definition: L1CaloRegion.cc:59
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:21
unsigned rctCard() const
return RCT card number (0-6)
void reset()
reset the data content (not position id!)
Definition: L1CaloRegion.h:84
uint16_t m_captureBlock
Definition: L1CaloRegion.h:196
static L1CaloRegion makeRegionFromUnpacker(const uint16_t data, const unsigned ieta, const unsigned iphi, const uint16_t block, const uint16_t index, const int16_t bx)
constructor from raw data and GCT indices for unpacking
Definition: L1CaloRegion.cc:78
bool tauVeto() const
get tau veto bit
Definition: L1CaloRegion.h:99
bool quiet() const
get quiet bit
Definition: L1CaloRegion.h:108
L1CaloRegion()
default constructor
Definition: L1CaloRegion.cc:11