00001 #ifndef L1CALOREGION_H
00002 #define L1CALOREGION_H
00003
00004 #include <ostream>
00005
00006 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
00007
00022 class L1CaloRegion
00023 {
00024 public:
00025
00027 L1CaloRegion();
00028
00030 L1CaloRegion(unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn);
00031
00033 L1CaloRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn);
00034
00036 L1CaloRegion(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi);
00037
00039 L1CaloRegion(uint16_t data, unsigned ieta, unsigned iphi, int16_t bx);
00040
00042 ~L1CaloRegion();
00043
00044
00045
00046
00048 void reset() { m_data = 0; }
00049
00051 uint16_t raw() const { return m_data; }
00052
00054 unsigned et() const { return (isHf() ? m_data&0xff : m_data&0x3ff); }
00055
00057 bool overFlow() const { return ((m_data>>10) & 0x1)!=0; }
00058
00060 bool tauVeto() const { return (isHf() ? false : fineGrain()); }
00061
00063 bool fineGrain() const { return ((m_data>>11) & 0x1)!=0; }
00064
00066 bool mip() const { return ((m_data>>12) & 0x1)!=0; }
00067
00069 bool quiet() const { return ((m_data>>13) & 0x1)!=0; }
00070
00072 void setBx(int16_t bx);
00073
00075 void setMip(bool mip);
00076
00078 void setQuiet(bool quiet);
00079
00080
00081
00082
00084 L1CaloRegionDetId id() const { return m_id; }
00085
00087 bool isHf() const { return m_id.isHf(); }
00088 bool isHbHe() const { return !m_id.isHf(); }
00089
00091 unsigned rctCrate() const { return m_id.rctCrate(); }
00092
00094 unsigned rctCard() const { return m_id.rctCard(); }
00095
00097 unsigned rctRegionIndex() const { return m_id.rctRegion(); }
00098
00100 unsigned rctEta() const { return m_id.rctEta(); }
00101
00103 unsigned rctPhi() const { return m_id.rctPhi(); }
00104
00106 unsigned gctEta() const { return m_id.ieta(); }
00107
00109 unsigned gctPhi() const { return m_id.iphi(); }
00110
00112 int16_t bx() const { return m_bx; }
00113
00115 int operator==(const L1CaloRegion& c) const { return ((m_data==c.raw() && m_id==c.id()) || (this->empty() && c.empty())); }
00116
00118 int operator!=(const L1CaloRegion& c) const { return !(*this == c); }
00119
00121 bool empty() const { return (m_data == 0); }
00122
00124 friend std::ostream& operator << (std::ostream& os, const L1CaloRegion& reg);
00125
00126 private:
00127
00129 void pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet);
00130
00132 L1CaloRegionDetId m_id;
00133
00135 uint16_t m_data;
00136 int16_t m_bx;
00137
00138 };
00139
00140
00141 #endif