CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/DataFormats/L1CaloTrigger/interface/L1CaloRegion.h

Go to the documentation of this file.
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 
00029 
00031   L1CaloRegion(unsigned et, 
00032                bool overFlow, 
00033                bool tauVeto, 
00034                bool mip, 
00035                bool quiet, 
00036                unsigned crate, 
00037                unsigned card, 
00038                unsigned rgn);
00039   
00041   L1CaloRegion(unsigned et, 
00042                bool fineGrain, 
00043                unsigned crate, 
00044                unsigned rgn);
00045   
00047   L1CaloRegion(unsigned et, 
00048                bool overFlow, 
00049                bool fineGrain, 
00050                bool mip, 
00051                bool quiet, 
00052                unsigned ieta, 
00053                unsigned iphi);
00054   
00056   L1CaloRegion(uint16_t data, 
00057                unsigned ieta, 
00058                unsigned iphi, 
00059                int16_t bx);
00060   
00062   ~L1CaloRegion();
00063 
00064 
00065   // named ctors
00066 
00068   static L1CaloRegion makeHBHERegion(const unsigned et, 
00069                                      const bool overFlow, 
00070                                      const bool tauVeto, 
00071                                      const bool mip,
00072                                      const bool quiet, 
00073                                      const unsigned crate, 
00074                                      const unsigned card, 
00075                                      const unsigned rgn);
00076   
00078   static L1CaloRegion makeHFRegion(const unsigned et, 
00079                                    const bool fineGrain, 
00080                                    const unsigned crate, 
00081                                    const unsigned rgn);
00082   
00084   static L1CaloRegion makeRegionFromGctIndices(const unsigned et, 
00085                                                const bool overFlow, 
00086                                                const bool fineGrain, 
00087                                                const bool mip, 
00088                                                const bool quiet, 
00089                                                const unsigned ieta, 
00090                                                const unsigned iphi);
00092   static L1CaloRegion makeRegionFromUnpacker(const uint16_t data, 
00093                                              const unsigned ieta, 
00094                                              const unsigned iphi, 
00095                                              const uint16_t block, 
00096                                              const uint16_t index, 
00097                                              const int16_t bx); 
00098   
00100   static L1CaloRegion makeGctJetRegion(const unsigned et, 
00101                                             const bool overFlow, 
00102                                             const bool fineGrain,
00103                                             const unsigned ieta, 
00104                                             const unsigned iphi,
00105                                             const int16_t bx);
00106 
00107   // get/set methods for the data
00108 
00110   void reset() { m_data = 0; }
00111 
00113   uint16_t raw() const { return m_data; }
00114 
00116   unsigned et() const { return (isHf() ? m_data&0xff : m_data&0x3ff); }
00117 
00119   unsigned etFullScale() const { return m_data&0xfff; }
00120 
00122   bool overFlow() const { return ((m_data>>10) & 0x1)!=0; }
00123 
00125   bool tauVeto() const { return (isHf() ? false : fineGrain()); }
00126 
00128   bool fineGrain() const { return ((m_data>>11) & 0x1)!=0; }
00129 
00131   bool mip() const { return ((m_data>>12) & 0x1)!=0; }
00132 
00134   bool quiet() const { return ((m_data>>13) & 0x1)!=0; }
00135 
00137   void setCaptureBlock(uint16_t capBlock) { m_captureBlock = capBlock; }
00138 
00140   void setCaptureIndex(uint16_t capIndex) { m_captureIndex = capIndex; }
00141 
00143   void setBx(int16_t bx); 
00144 
00146   void setRawData(uint32_t data) { m_data = data; }
00147 
00149   void setMip(bool mip);
00150 
00152   void setQuiet(bool quiet);
00153 
00154   
00155   // get methods for the geographical information
00156 
00158   L1CaloRegionDetId id() const { return m_id; }
00159 
00161   bool isHf()   const { return m_id.isHf(); }
00162   bool isHbHe() const { return !m_id.isHf(); }
00163 
00165   unsigned rctCrate() const { return m_id.rctCrate(); }
00166 
00168   unsigned rctCard() const { return m_id.rctCard(); }
00169 
00171   unsigned rctRegionIndex() const { return m_id.rctRegion(); }
00172 
00174   unsigned rctEta() const { return m_id.rctEta(); }
00175 
00177   unsigned rctPhi() const { return m_id.rctPhi(); } 
00178 
00180   unsigned gctEta() const { return m_id.ieta(); }
00181 
00183   unsigned gctPhi() const { return m_id.iphi(); }
00184 
00186   unsigned capBlock() const { return m_captureBlock; }
00187 
00189   unsigned capIndex() const { return m_captureIndex; }
00190 
00192   int16_t bx() const { return m_bx; }
00193 
00195   int operator==(const L1CaloRegion& c) const { return ((m_data==c.raw() && m_id==c.id()) || (this->empty() && c.empty())); }
00196 
00198   int operator!=(const L1CaloRegion& c) const { return !(*this == c); }
00199 
00201   bool empty() const { return (m_data == 0); }
00202 
00204   friend std::ostream& operator << (std::ostream& os, const L1CaloRegion& reg);
00205 
00206  private:
00207 
00209   void setRegionId(L1CaloRegionDetId id) { m_id = id; }
00210 
00212   void pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet);
00213 
00215   void pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet);
00216 
00218   L1CaloRegionDetId m_id;
00219 
00221   uint16_t m_data;
00222   uint16_t m_captureBlock;
00223   uint8_t m_captureIndex;
00224   int16_t m_bx;
00225 
00226 };
00227 
00228 
00229 #endif /*L1CALOREGION_H*/