Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:09

0001 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctHfEtSumsLut.h"
0002 
0003 #include "CondFormats/L1TObjects/interface/L1CaloEtScale.h"
0004 
0005 //DEFINE STATICS
0006 const int L1GctHfEtSumsLut::NAddress = 8;
0007 const int L1GctHfEtSumsLut::NData = 3;
0008 
0009 L1GctHfEtSumsLut::L1GctHfEtSumsLut(const L1GctHfEtSumsLut::hfLutType& type, const L1CaloEtScale* const scale)
0010     : L1GctLut<NAddress, NData>(), m_lutFunction(scale), m_lutType(type) {
0011   if (scale != nullptr)
0012     m_setupOk = true;
0013 }
0014 
0015 L1GctHfEtSumsLut::L1GctHfEtSumsLut(const L1GctHfEtSumsLut::hfLutType& type)
0016     : L1GctLut<NAddress, NData>(), m_lutFunction(nullptr), m_lutType(type) {}
0017 
0018 L1GctHfEtSumsLut::L1GctHfEtSumsLut() : L1GctLut<NAddress, NData>(), m_lutFunction(nullptr), m_lutType() {}
0019 
0020 L1GctHfEtSumsLut::L1GctHfEtSumsLut(const L1GctHfEtSumsLut& lut)
0021     : L1GctLut<NAddress, NData>(), m_lutFunction(lut.lutFunction()), m_lutType(lut.lutType()) {}
0022 
0023 L1GctHfEtSumsLut::~L1GctHfEtSumsLut() {}
0024 
0025 uint16_t L1GctHfEtSumsLut::value(const uint16_t lutAddress) const { return m_lutFunction->rank(lutAddress); }
0026 
0027 std::vector<double> L1GctHfEtSumsLut::getThresholdsGeV() const { return m_lutFunction->getThresholds(); }
0028 
0029 std::vector<unsigned> L1GctHfEtSumsLut::getThresholdsGct() const {
0030   std::vector<unsigned> result;
0031   std::vector<double> thresholdsGeV = m_lutFunction->getThresholds();
0032   for (std::vector<double>::const_iterator thr = thresholdsGeV.begin(); thr != thresholdsGeV.end(); thr++) {
0033     result.push_back(static_cast<unsigned>((*thr) / (m_lutFunction->linearLsb())));
0034   }
0035   return result;
0036 }
0037 
0038 L1GctHfEtSumsLut L1GctHfEtSumsLut::operator=(const L1GctHfEtSumsLut& lut) {
0039   const L1GctHfEtSumsLut& temp(lut);
0040   return temp;
0041 }
0042 
0043 std::ostream& operator<<(std::ostream& os, const L1GctHfEtSumsLut& lut) {
0044   os << "===L1GctHfEtSumsLut===" << std::endl;
0045   std::vector<double> thresholds = lut.m_lutFunction->getThresholds();
0046   std::vector<double>::const_iterator thr = thresholds.begin();
0047   os << "Thresholds are: " << *(thr++);
0048   for (; thr != thresholds.end(); thr++) {
0049     os << ", " << *thr;
0050   }
0051   os << std::endl;
0052   os << "\n===Lookup table contents===\n" << std::endl;
0053   const L1GctLut<L1GctHfEtSumsLut::NAddress, L1GctHfEtSumsLut::NData>* temp = &lut;
0054   os << *temp;
0055   return os;
0056 }
0057 
0058 template class L1GctLut<L1GctHfEtSumsLut::NAddress, L1GctHfEtSumsLut::NData>;