00001 #ifndef L1GCTJET_H_
00002 #define L1GCTJET_H_
00003
00004 #include <boost/cstdint.hpp>
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
00032 enum numberOfBits {
00033 kRawsumBitWidth = 10,
00034 kRawsumMaxValue = (1<<kRawsumBitWidth) - 1
00035 };
00036
00037
00038 typedef boost::shared_ptr<L1GctJetEtCalibrationLut> lutPtr;
00039
00040
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
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
00054 uint16_t rawsum()const { return m_rawsum; }
00055 bool tauVeto()const { return m_tauVeto; }
00056
00058 bool overFlow() const { return m_overFlow; }
00059
00061 bool isTauJet() const { return (!m_forwardJet && !m_tauVeto); }
00062
00064 bool isCentralJet() const { return (!m_forwardJet && m_tauVeto); }
00065
00067 bool isForwardJet() const { return m_forwardJet; }
00068
00070 bool isNullJet() const { return ((m_rawsum==0) && (globalEta()==0) && (globalPhi()==0)); }
00071
00072 friend std::ostream& operator << (std::ostream& os, const L1GctJet& cand);
00073
00075 bool operator== (const L1GctJet& cand) const;
00076
00078 bool operator!= (const L1GctJet& cand) const;
00079
00081 void setupJet(const uint16_t rawsum, const unsigned eta, const unsigned phi, const bool overFlow,
00082 const bool forwardJet, const bool tauVeto=true, const int16_t bx=0);
00083
00085 unsigned globalEta() const { return m_id.ieta(); }
00086
00088 unsigned globalPhi() const { return m_id.iphi(); }
00089
00091 unsigned rctEta() const { return m_id.rctEta(); }
00092
00094 unsigned rctPhi() const { return m_id.rctPhi(); }
00095
00097 unsigned hwEta() const;
00098
00100 unsigned hwPhi() const;
00101
00103 int16_t bx() const { return m_bx; }
00104
00106 L1GctJetCand jetCand(const lutPtr lut) const;
00107 L1GctJetCand jetCand(const std::vector<lutPtr> luts) const;
00108
00110 uint16_t rank(const lutPtr lut) const;
00111 unsigned calibratedEt(const lutPtr lut) const;
00112
00113
00114 private:
00115
00116 uint16_t m_rawsum;
00118 L1CaloRegionDetId m_id;
00119 bool m_overFlow;
00120 bool m_forwardJet;
00121 bool m_tauVeto;
00122 int16_t m_bx;
00123
00124 uint16_t lutValue (const lutPtr lut) const;
00125
00126 };
00127
00128 std::ostream& operator << (std::ostream& os, const L1GctJet& cand);
00129
00130 #endif