00001 00002 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetEtCalibrationLut.h" 00003 00004 #include "CondFormats/L1TObjects/interface/L1GctJetFinderParams.h" 00005 #include "CondFormats/L1TObjects/interface/L1CaloEtScale.h" 00006 00007 //DEFINE STATICS 00008 const int L1GctJetEtCalibrationLut::NAddress=JET_ET_CAL_LUT_ADD_BITS; 00009 const int L1GctJetEtCalibrationLut::NData=JET_ET_CAL_LUT_DAT_BITS; 00010 const unsigned L1GctJetEtCalibrationLut::JET_ENERGY_BITWIDTH = 10; 00011 00012 L1GctJetEtCalibrationLut::L1GctJetEtCalibrationLut() : 00013 L1GctLut<NAddress,NData>() 00014 { 00015 } 00016 00017 00018 L1GctJetEtCalibrationLut::~L1GctJetEtCalibrationLut() 00019 { 00020 } 00021 00022 void L1GctJetEtCalibrationLut::setFunction(const L1GctJetFinderParams* const lutfn) 00023 { 00024 m_lutFunction = lutfn; 00025 m_setupOk = (lutfn!=0); 00026 } 00027 00028 void L1GctJetEtCalibrationLut::setOutputEtScale(const L1CaloEtScale* const scale) { 00029 m_outputEtScale = scale; 00030 } 00031 00032 void L1GctJetEtCalibrationLut::setEtaBin(const unsigned eta) { 00033 static const unsigned nEtaBits = 4; 00034 static const uint8_t etaMask = static_cast<uint8_t>((1 << nEtaBits) - 1); 00035 m_etaBin = static_cast<uint8_t>(eta) & etaMask; 00036 } 00037 00038 uint16_t L1GctJetEtCalibrationLut::value (const uint16_t lutAddress) const 00039 { 00040 static const uint16_t maxEtMask = static_cast<uint16_t>((1 << JET_ENERGY_BITWIDTH) - 1); 00041 static const uint16_t tauBitMask = static_cast<uint16_t>( 1 << (JET_ENERGY_BITWIDTH)); 00042 static const uint16_t ovrFlowOut = 0x3f; 00043 uint16_t jetEt = lutAddress & maxEtMask; 00044 // Check for saturation 00045 if (jetEt == maxEtMask) { 00046 return ovrFlowOut; 00047 } else { 00048 double uncoEt = static_cast<double>(jetEt) * m_outputEtScale->linearLsb(); 00049 bool tauVeto = ((lutAddress & tauBitMask)==0); 00050 00051 double corrEt = m_lutFunction->correctedEtGeV(uncoEt, etaBin(), tauVeto); 00052 return m_outputEtScale->rank(corrEt); 00053 } 00054 } 00055 00056 std::ostream& operator << (std::ostream& os, const L1GctJetEtCalibrationLut& lut) 00057 { 00058 os << std::endl; 00059 os << "==================================================" << std::endl; 00060 os << "===Level-1 Trigger: GCT Jet Et Calibration Lut===" << std::endl; 00061 os << "==================================================" << std::endl; 00062 os << "===Parameter settings for eta bin " << lut.etaBin() << "===" << std::endl; 00063 os << *lut.getFunction() << std::endl; 00064 os << "\n===Lookup table contents===\n" << std::endl; 00065 const L1GctLut<L1GctJetEtCalibrationLut::NAddress,L1GctJetEtCalibrationLut::NData>* temp=&lut; 00066 os << *temp; 00067 return os; 00068 } 00069 00070 template class L1GctLut<L1GctJetEtCalibrationLut::NAddress,L1GctJetEtCalibrationLut::NData>; 00071