CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/L1Trigger/GlobalCaloTrigger/interface/L1GctJet.h

Go to the documentation of this file.
00001 #ifndef L1GCTJET_H_
00002 #define L1GCTJET_H_
00003 
00004 #include <boost/cstdint.hpp> //for uint16_t
00005 #include <functional>
00006 #include <vector>
00007 #include <ostream>
00008 
00009 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
00010 
00022 #include "boost/shared_ptr.hpp"
00023 
00024 class L1GctJetCand;
00025 class L1GctJetEtCalibrationLut;
00026 
00027 class L1GctJet
00028 {
00029 
00030 public:
00031   //Statics
00032   enum numberOfBits {
00033     kRawsumBitWidth = 10,
00034     kRawsumMaxValue = (1<<kRawsumBitWidth) - 1
00035   };
00036   
00037   //Typedefs
00038   typedef boost::shared_ptr<L1GctJetEtCalibrationLut> lutPtr;
00039 
00040   //Constructors/destructors
00041   L1GctJet(const uint16_t rawsum=0, const unsigned eta=0, const unsigned phi=0, const bool overFlow=false,
00042            const bool forwardJet=true, const bool tauVeto=true, const int16_t bx=0);
00043   ~L1GctJet();
00044   
00045   // set rawsum and position bits
00046   void setRawsum(const uint16_t rawsum) { m_rawsum = rawsum & kRawsumMaxValue; m_overFlow |= (rawsum > kRawsumMaxValue); }
00047   void setDetId(const L1CaloRegionDetId detId) { m_id = detId; }
00048   void setOverFlow(const bool overFlow) { m_overFlow = overFlow; }
00049   void setTauVeto(const bool tauVeto) { m_tauVeto = tauVeto; }
00050   void setForward(const bool forward) { m_forwardJet = forward; }
00051   void setBx(const int16_t bx) { m_bx = bx; }
00052   
00053   // get rawsum and position bits
00054   uint16_t rawsum()const { return m_rawsum; }
00055   L1CaloRegionDetId id() const { return m_id(); }
00056   bool tauVeto()const { return m_tauVeto; }
00057 
00059   bool overFlow() const { return m_overFlow; }
00060 
00062   bool isTauJet()     const { return (!m_forwardJet && !m_tauVeto); } 
00063 
00065   bool isCentralJet() const { return (!m_forwardJet && m_tauVeto); } 
00066 
00068   bool isForwardJet() const { return m_forwardJet; } 
00069 
00071   bool isNullJet() const { return ((m_rawsum==0) && (globalEta()==0) && (globalPhi()==0)); } 
00072 
00073   friend std::ostream& operator << (std::ostream& os, const L1GctJet& cand);
00074   
00076   bool operator== (const L1GctJet& cand) const;
00077   
00079   bool operator!= (const L1GctJet& cand) const;
00080   
00082   void setupJet(const uint16_t rawsum, const unsigned eta, const unsigned phi, const bool overFlow,
00083                 const bool forwardJet, const bool tauVeto=true, const int16_t bx=0);
00084   
00086   unsigned globalEta() const { return m_id.ieta(); } 
00087 
00089   unsigned globalPhi() const { return m_id.iphi(); } 
00090 
00092   unsigned rctEta() const { return m_id.rctEta(); } 
00093 
00095   unsigned rctPhi() const { return m_id.rctPhi(); } 
00096 
00098   unsigned hwEta() const; 
00099 
00101   unsigned hwPhi() const;
00102 
00104   int16_t bx() const { return m_bx; }
00105 
00107   L1GctJetCand jetCand(const lutPtr lut) const;
00108   L1GctJetCand jetCand(const std::vector<lutPtr>& luts) const;
00109 
00111   uint16_t rank(const lutPtr lut) const;
00112   unsigned calibratedEt(const lutPtr lut) const;
00113 
00114 
00115  private:
00116 
00117   uint16_t m_rawsum;
00119   L1CaloRegionDetId m_id;
00120   bool m_overFlow;
00121   bool m_forwardJet;
00122   bool m_tauVeto;
00123   int16_t m_bx;
00124 
00125   uint16_t lutValue (const lutPtr lut) const;
00126 
00127 };
00128 
00129 std::ostream& operator << (std::ostream& os, const L1GctJet& cand);
00130 
00131 #endif /*L1GCTJET_H_*/