CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1CaloRegion.h
Go to the documentation of this file.
1 #ifndef L1CALOREGION_H
2 #define L1CALOREGION_H
3 
4 #include <ostream>
5 
7 
23 {
24 public:
25 
27  L1CaloRegion();
28 
29 
31  L1CaloRegion(unsigned et,
32  bool overFlow,
33  bool tauVeto,
34  bool mip,
35  bool quiet,
36  unsigned crate,
37  unsigned card,
38  unsigned rgn);
39 
41  L1CaloRegion(unsigned et,
42  bool fineGrain,
43  unsigned crate,
44  unsigned rgn);
45 
47  L1CaloRegion(unsigned et,
48  bool overFlow,
49  bool fineGrain,
50  bool mip,
51  bool quiet,
52  unsigned ieta,
53  unsigned iphi);
54 
56  L1CaloRegion(uint16_t data,
57  unsigned ieta,
58  unsigned iphi,
59  int16_t bx);
60 
62  ~L1CaloRegion();
63 
64 
65  // named ctors
66 
68  static L1CaloRegion makeHBHERegion(const unsigned et,
69  const bool overFlow,
70  const bool tauVeto,
71  const bool mip,
72  const bool quiet,
73  const unsigned crate,
74  const unsigned card,
75  const unsigned rgn);
76 
78  static L1CaloRegion makeHFRegion(const unsigned et,
79  const bool fineGrain,
80  const unsigned crate,
81  const unsigned rgn);
82 
84  static L1CaloRegion makeRegionFromGctIndices(const unsigned et,
85  const bool overFlow,
86  const bool fineGrain,
87  const bool mip,
88  const bool quiet,
89  const unsigned ieta,
90  const unsigned iphi);
92  static L1CaloRegion makeRegionFromUnpacker(const uint16_t data,
93  const unsigned ieta,
94  const unsigned iphi,
95  const uint16_t block,
96  const uint16_t index,
97  const int16_t bx);
98 
100  static L1CaloRegion makeGctJetRegion(const unsigned et,
101  const bool overFlow,
102  const bool fineGrain,
103  const unsigned ieta,
104  const unsigned iphi,
105  const int16_t bx);
106 
107  // get/set methods for the data
108 
110  void reset() { m_data = 0; }
111 
113  uint16_t raw() const { return m_data; }
114 
116  unsigned et() const { return (isHf() ? m_data&0xff : m_data&0x3ff); }
117 
119  unsigned etFullScale() const { return m_data&0xfff; }
120 
122  bool overFlow() const { return ((m_data>>10) & 0x1)!=0; }
123 
125  bool tauVeto() const { return (isHf() ? false : fineGrain()); }
126 
128  bool fineGrain() const { return ((m_data>>11) & 0x1)!=0; }
129 
131  bool mip() const { return ((m_data>>12) & 0x1)!=0; }
132 
134  bool quiet() const { return ((m_data>>13) & 0x1)!=0; }
135 
138 
141 
143  void setBx(int16_t bx);
144 
146  void setRawData(uint32_t data) { m_data = data; }
147 
149  void setMip(bool mip);
150 
152  void setQuiet(bool quiet);
153 
154 
155  // get methods for the geographical information
156 
158  L1CaloRegionDetId id() const { return m_id; }
159 
161  bool isHf() const { return m_id.isHf(); }
162  bool isHbHe() const { return !m_id.isHf(); }
163 
165  unsigned rctCrate() const { return m_id.rctCrate(); }
166 
168  unsigned rctCard() const { return m_id.rctCard(); }
169 
171  unsigned rctRegionIndex() const { return m_id.rctRegion(); }
172 
174  unsigned rctEta() const { return m_id.rctEta(); }
175 
177  unsigned rctPhi() const { return m_id.rctPhi(); }
178 
180  unsigned gctEta() const { return m_id.ieta(); }
181 
183  unsigned gctPhi() const { return m_id.iphi(); }
184 
186  unsigned capBlock() const { return m_captureBlock; }
187 
189  unsigned capIndex() const { return m_captureIndex; }
190 
192  int16_t bx() const { return m_bx; }
193 
195  int operator==(const L1CaloRegion& c) const { return ((m_data==c.raw() && m_id==c.id()) || (this->empty() && c.empty())); }
196 
198  int operator!=(const L1CaloRegion& c) const { return !(*this == c); }
199 
201  bool empty() const { return (m_data == 0); }
202 
204  friend std::ostream& operator << (std::ostream& os, const L1CaloRegion& reg);
205 
206  private:
207 
210 
212  void pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet);
213 
215  void pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet);
216 
219 
221  uint16_t m_data;
222  uint16_t m_captureBlock;
223  uint8_t m_captureIndex;
224  int16_t m_bx;
225 
226 };
227 
228 
229 #endif /*L1CALOREGION_H*/
int16_t bx() const
get bunch-crossing index
Definition: L1CaloRegion.h:192
unsigned capIndex() const
what index within capture block
Definition: L1CaloRegion.h:189
~L1CaloRegion()
destructor
Definition: L1CaloRegion.cc:57
unsigned et() const
get Et
Definition: L1CaloRegion.h:116
bool overFlow() const
get overflow
Definition: L1CaloRegion.h:122
uint16_t m_data
region data : et, overflow, fine grain/tau veto, mip and quiet bits
Definition: L1CaloRegion.h:221
unsigned ieta() const
global eta index (0-21)
unsigned rctEta() const
get local eta index (within RCT crate)
Definition: L1CaloRegion.h:174
unsigned rctCrate() const
get RCT crate ID
Definition: L1CaloRegion.h:165
unsigned rctCard() const
get RCT reciever card ID (valid output for HB/HE)
Definition: L1CaloRegion.h:168
void setRawData(uint32_t data)
set data
Definition: L1CaloRegion.h:146
L1CaloRegionDetId m_id
region id
Definition: L1CaloRegion.h:218
unsigned rctPhi() const
return local RCT phi index (0-1)
void setBx(int16_t bx)
set bx
unsigned rctEta() const
return local RCT eta index (0-10)
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:62
L1CaloRegionDetId id() const
get global region ID
Definition: L1CaloRegion.h:158
bool empty() const
is there any information in the candidate
Definition: L1CaloRegion.h:201
unsigned rctRegionIndex() const
get RCT region index
Definition: L1CaloRegion.h:171
uint8_t m_captureIndex
Definition: L1CaloRegion.h:223
unsigned rctRegion() const
return RCT region index (0-1 for barrel, 0-7 for HF)
bool quiet() const
get quiet bit
Definition: L1CaloRegion.h:134
void setRegionId(L1CaloRegionDetId id)
set region ID
Definition: L1CaloRegion.h:209
void setCaptureBlock(uint16_t capBlock)
set cap block
Definition: L1CaloRegion.h:137
bool tauVeto() const
get tau veto bit
Definition: L1CaloRegion.h:125
void setCaptureIndex(uint16_t capIndex)
set cap index
Definition: L1CaloRegion.h:140
bool mip() const
get MIP bit
Definition: L1CaloRegion.h:131
unsigned rctPhi() const
get local phi index (within RCT crate)
Definition: L1CaloRegion.h:177
void setMip(bool mip)
set MIP bit (required for GCT emulator standalone operation)
bool isHf() const
return central or forward type
void pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet)
pack the raw data from arguments (used in constructors)
bool isHbHe() const
Definition: L1CaloRegion.h:162
uint16_t raw() const
get raw data
Definition: L1CaloRegion.h:113
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
friend std::ostream & operator<<(std::ostream &os, const L1CaloRegion &reg)
print to stream
bool fineGrain() const
get fine grain bit
Definition: L1CaloRegion.h:128
int operator==(const L1CaloRegion &c) const
equality operator, including rank, feature bits, and position
Definition: L1CaloRegion.h:195
unsigned gctEta() const
get GCT eta index
Definition: L1CaloRegion.h:180
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:90
unsigned rctCard() const
return RCT card number (0-6)
int operator!=(const L1CaloRegion &c) const
inequality operator
Definition: L1CaloRegion.h:198
unsigned gctPhi() const
get GCT phi index
Definition: L1CaloRegion.h:183
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
unsigned rctCrate() const
return RCT crate number (0-17)
int16_t m_bx
Definition: L1CaloRegion.h:224
void setQuiet(bool quiet)
set quiet bit (required for GCT emulator standalone operation)
static L1CaloRegion makeHFRegion(const unsigned et, const bool fineGrain, const unsigned crate, const unsigned rgn)
construct HF region from components
Definition: L1CaloRegion.cc:78
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:22
unsigned iphi() const
global phi index (0-17)
unsigned etFullScale() const
get Et for internal GCT use
Definition: L1CaloRegion.h:119
bool isHf() const
forward or central region
Definition: L1CaloRegion.h:161
void reset()
reset the data content (not position id!)
Definition: L1CaloRegion.h:110
uint16_t m_captureBlock
Definition: L1CaloRegion.h:222
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
unsigned capBlock() const
which capture block did this come from
Definition: L1CaloRegion.h:186
L1CaloRegion()
default constructor
Definition: L1CaloRegion.cc:11