Go to the documentation of this file.00001 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJet.h"
00002 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetEtCalibrationLut.h"
00003
00004 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h"
00005
00006
00007
00008 L1GctJet::L1GctJet(const uint16_t rawsum, const unsigned eta, const unsigned phi, const bool overFlow,
00009 const bool forwardJet, const bool tauVeto, const int16_t bx) :
00010 m_rawsum(rawsum & kRawsumMaxValue),
00011 m_id(eta, phi),
00012 m_overFlow(overFlow || (rawsum>kRawsumMaxValue)),
00013 m_forwardJet(forwardJet),
00014 m_tauVeto(tauVeto || forwardJet),
00015 m_bx(bx)
00016 {
00017 }
00018
00019 L1GctJet::~L1GctJet()
00020 {
00021 }
00022
00023 std::ostream& operator << (std::ostream& os, const L1GctJet& cand)
00024 {
00025 os << "L1 Gct jet";
00026 os << " energy sum " << cand.m_rawsum;
00027 if (cand.overFlow()) { os << ", overflow bit set;"; }
00028 os << " Eta " << cand.globalEta();
00029 os << " Phi " << cand.globalPhi();
00030 if (cand.isForwardJet()) { os << ", Forward jet"; }
00031 if (cand.isCentralJet()) { os << ", Central jet"; }
00032 if (cand.isTauJet()) { os << ", Tau jet"; }
00033 if (cand.isNullJet()) { os << ", Null jet"; }
00034
00035 return os;
00036 }
00037
00039 bool L1GctJet::operator== (const L1GctJet& cand) const
00040 {
00041 bool result=true;
00042 result &= (this->rawsum()==cand.rawsum());
00043 result &= (this->overFlow()==cand.overFlow());
00044 result &= (this->isForwardJet()==cand.isForwardJet());
00045 result &= (this->tauVeto()==cand.tauVeto());
00046 result &= (this->globalEta()==cand.globalEta());
00047 result &= (this->globalPhi()==cand.globalPhi());
00048 result |= (this->isNullJet() && cand.isNullJet());
00049 return result;
00050 }
00051
00053 bool L1GctJet::operator!= (const L1GctJet& cand) const
00054 {
00055 bool result=false;
00056 result |= !(this->rawsum()==cand.rawsum());
00057 result |= !(this->overFlow()==cand.overFlow());
00058 result |= !(this->isForwardJet()==cand.isForwardJet());
00059 result |= !(this->tauVeto()==cand.tauVeto());
00060 result |= !(this->globalEta()==cand.globalEta());
00061 result |= !(this->globalPhi()==cand.globalPhi());
00062 result &= !(this->isNullJet() && cand.isNullJet());
00063 return result;
00064 }
00065
00066 void L1GctJet::setupJet(const uint16_t rawsum, const unsigned eta, const unsigned phi, const bool overFlow,
00067 const bool forwardJet, const bool tauVeto, const int16_t bx)
00068 {
00069 L1CaloRegionDetId temp(eta, phi);
00070 m_rawsum = rawsum & kRawsumMaxValue;
00071 m_id = temp;
00072 m_overFlow = (overFlow || rawsum>kRawsumMaxValue);
00073 m_forwardJet = forwardJet;
00074 m_tauVeto = tauVeto || forwardJet;
00075 m_bx = bx;
00076 }
00077
00079 unsigned L1GctJet::hwEta() const
00080 {
00081
00082
00083 return (((m_id.rctEta() % 7) & 0x7) | (m_id.ieta()<11 ? 0x8 : 0));
00084 }
00085
00087 unsigned L1GctJet::hwPhi() const
00088 {
00089
00090 return m_id.iphi() & 0x1f;
00091 }
00092
00094 L1GctJetCand L1GctJet::jetCand(const lutPtr lut) const
00095 {
00096 return L1GctJetCand(rank(lut), hwPhi(), hwEta(), isTauJet(), isForwardJet(), (uint16_t) 0, (uint16_t) 0, m_bx);
00097 }
00098
00100 L1GctJetCand L1GctJet::jetCand(const std::vector<lutPtr> luts) const
00101 {
00102 L1GctJetCand result;
00103 if (rctEta() < luts.size()) result = jetCand(luts.at(rctEta()));
00104 return result;
00105 }
00106
00108 uint16_t L1GctJet::rank(const lutPtr lut) const
00109 {
00110 return lutValue(lut);
00111 }
00112
00113 unsigned L1GctJet::calibratedEt(const lutPtr lut) const
00114 {
00115 return m_rawsum;
00116 }
00117
00118
00119 uint16_t L1GctJet::lutValue(const lutPtr lut) const
00120 {
00121 uint16_t result;
00122 if (m_overFlow) {
00123
00124 result = 0x3f;
00125 } else {
00126 unsigned addrBits = m_rawsum;
00127
00128 if (!m_tauVeto && !m_forwardJet) {
00129 addrBits |= 1 << (L1GctJetEtCalibrationLut::JET_ENERGY_BITWIDTH);
00130 }
00131 uint16_t address = static_cast<uint16_t>(addrBits);
00132 result = lut->lutValue(address);
00133 }
00134 return result;
00135 }