00001 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFgvbEE.h> 00002 #include <DataFormats/EcalDigi/interface/EEDataFrame.h> 00003 #include <CondFormats/EcalObjects/interface/EcalTPGFineGrainStripEE.h> 00004 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00005 #include <iostream> 00006 00007 EcalFenixStripFgvbEE::EcalFenixStripFgvbEE() 00008 { 00009 } 00010 00011 EcalFenixStripFgvbEE::~EcalFenixStripFgvbEE(){ 00012 } 00013 00014 void EcalFenixStripFgvbEE::process( std::vector<std::vector<int> > &linout ,std::vector<int> & output) 00015 { 00016 std::vector<int> indexLut(output.size()); 00017 00018 for (unsigned int i=0;i<output.size();i++) { 00019 output[i]=0; 00020 indexLut[i]=0; 00021 for (unsigned int ixtal=0;ixtal<linout.size();ixtal++) { 00022 int adc=linout[ixtal][i]; 00023 int res = (((adc & 0xffff) > threshold_fg_) || ((adc & 0x30000) != 0x0)) ? 1 : 0; 00024 indexLut[i] = indexLut[i] | (res << ixtal); 00025 } 00026 int mask = 1<<(indexLut[i]); 00027 output[i]= ((lut_fg_ & mask) == 0x0) ? 0 : 1; 00028 if(i > 0) output[i-1] = output[i]; // Delay one clock 00029 } 00030 return; 00031 } 00032 00033 void EcalFenixStripFgvbEE::setParameters(uint32_t id,const EcalTPGFineGrainStripEE * ecaltpgFgStripEE) 00034 { 00035 const EcalTPGFineGrainStripEEMap &fgmap = ecaltpgFgStripEE -> getMap(); 00036 EcalTPGFineGrainStripEEMapIterator it=fgmap.find(id); 00037 if (it!=fgmap.end()){ 00038 threshold_fg_ = it->second.threshold; 00039 lut_fg_ = it->second.lut; 00040 } 00041 else 00042 { 00043 edm::LogWarning("EcalTPG")<<" could not find EcalTPGFineGrainStripEEMap entry for "<<id; 00044 // Use the FENIX power-up values 00045 threshold_fg_ = 65535; 00046 lut_fg_ = 0x0; 00047 } 00048 00049 }