CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/L1Trigger/GlobalCaloTrigger/src/L1GctHfEtSumsLut.cc

Go to the documentation of this file.
00001 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctHfEtSumsLut.h"
00002 
00003 #include "CondFormats/L1TObjects/interface/L1CaloEtScale.h"
00004 
00005 //DEFINE STATICS
00006 const int L1GctHfEtSumsLut::NAddress=8;
00007 const int L1GctHfEtSumsLut::NData   =3;
00008 
00009 L1GctHfEtSumsLut::L1GctHfEtSumsLut(const L1GctHfEtSumsLut::hfLutType& type, const L1CaloEtScale* const scale) :
00010   L1GctLut<NAddress,NData>(),
00011   m_lutFunction(scale),
00012   m_lutType(type)
00013 {
00014   if (scale != 0) m_setupOk = true;
00015 }
00016 
00017 L1GctHfEtSumsLut::L1GctHfEtSumsLut(const L1GctHfEtSumsLut::hfLutType& type) :
00018   L1GctLut<NAddress,NData>(),
00019   m_lutFunction(0),
00020   m_lutType(type)
00021 {
00022 }
00023 
00024 L1GctHfEtSumsLut::L1GctHfEtSumsLut() :
00025   L1GctLut<NAddress,NData>(),
00026   m_lutFunction(0),
00027   m_lutType()
00028 {
00029 }
00030 
00031 L1GctHfEtSumsLut::L1GctHfEtSumsLut(const L1GctHfEtSumsLut& lut) :
00032   L1GctLut<NAddress,NData>(),
00033   m_lutFunction(lut.lutFunction()),
00034   m_lutType(lut.lutType())
00035 {
00036 }
00037 
00038 L1GctHfEtSumsLut::~L1GctHfEtSumsLut()
00039 {
00040 }
00041 
00042 
00043 uint16_t L1GctHfEtSumsLut::value (const uint16_t lutAddress) const
00044 {
00045   return m_lutFunction->rank(lutAddress) ;
00046 }
00047 
00048 std::vector<double>   L1GctHfEtSumsLut::getThresholdsGeV() const
00049 {
00050   return m_lutFunction->getThresholds();
00051 }
00052 
00053 std::vector<unsigned> L1GctHfEtSumsLut::getThresholdsGct() const
00054 {
00055  std::vector<unsigned> result;
00056  std::vector<double> thresholdsGeV = m_lutFunction->getThresholds();
00057  for (std::vector<double>::const_iterator thr=thresholdsGeV.begin();
00058         thr != thresholdsGeV.end(); thr++) {
00059    result.push_back(static_cast<unsigned>((*thr)/(m_lutFunction->linearLsb())));
00060  }
00061  return result;
00062 }
00063 
00064 L1GctHfEtSumsLut L1GctHfEtSumsLut::operator= (const L1GctHfEtSumsLut& lut)
00065 {
00066   L1GctHfEtSumsLut temp(lut);
00067   return temp;
00068 }
00069 
00070 std::ostream& operator << (std::ostream& os, const L1GctHfEtSumsLut& lut)
00071 {
00072   os << "===L1GctHfEtSumsLut===" << std::endl;
00073   std::vector<double> thresholds = lut.m_lutFunction->getThresholds();
00074   std::vector<double>::const_iterator thr = thresholds.begin();
00075   os << "Thresholds are: " << *(thr++);
00076   for ( ; thr != thresholds.end(); thr++) {
00077     os << ", " << *thr;
00078   }
00079   os << std::endl;
00080   os << "\n===Lookup table contents===\n" << std::endl;
00081   const L1GctLut<L1GctHfEtSumsLut::NAddress,L1GctHfEtSumsLut::NData>* temp=&lut;
00082   os << *temp;
00083   return os;
00084 }
00085 
00086 template class L1GctLut<L1GctHfEtSumsLut::NAddress,L1GctHfEtSumsLut::NData>;
00087 
00088