00001 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEE.h> 00002 #include <CondFormats/EcalObjects/interface/EcalTPGSlidingWindow.h> 00003 00004 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00005 #include <iostream> 00006 00007 00008 //----------------------------------------------------------------------------------------- 00009 EcalFenixStripFormatEE::EcalFenixStripFormatEE() 00010 : shift_(0) 00011 { 00012 } 00013 //------------------------------------------------------------------------------------------ 00014 00015 EcalFenixStripFormatEE::~EcalFenixStripFormatEE() { 00016 } 00017 00018 //----------------------------------------------------------------------------------------- 00019 00020 00021 int EcalFenixStripFormatEE::setInput(int input, int inputPeak, int fgvb ) { 00022 inputPeak_=inputPeak; 00023 input_=input; 00024 fgvb_=fgvb; 00025 return 0; 00026 } 00027 //----------------------------------------------------------------------------------------- 00028 00029 int EcalFenixStripFormatEE::process(){ 00030 if(inputPeak_==0) return 0; 00031 // buffer_=input_>>shift_; 00032 00033 // int output=buffer_; 00034 int output=input_>>shift_; 00035 //barrel saturates at 12 bits, endcap at 10! 00036 if(output>0X3FF) output=0X3FF; 00037 output=output|(fgvb_<<10); //FIXME 00038 00039 return output; 00040 } 00041 //------------------------------------------------------------------------------------------ 00042 00043 void EcalFenixStripFormatEE::process(std::vector<int> &fgvbout,std::vector<int> &peakout, 00044 std::vector<int> &filtout, std::vector<int> &output){ 00045 if (peakout.size()!=filtout.size()){ 00046 edm::LogWarning("EcalTPG")<<" problem in EcalFenixStripFormatEE: peak_out and filt_out don't have the same size"; 00047 std::cout<<" Size peak_out"<< peakout.size()<<", size filt_out:"<<filtout.size()<<std::flush<<std::endl; 00048 } 00049 for (unsigned int i =0;i<filtout.size();i++){ 00050 setInput(filtout[i],peakout[i],fgvbout[i]); 00051 output[i]=process(); 00052 } 00053 return; 00054 } 00055 //----------------------------------------------------------------------------------------- 00056 00057 void EcalFenixStripFormatEE::setParameters(uint32_t id,const EcalTPGSlidingWindow*& slWin){ 00058 00059 const EcalTPGSlidingWindowMap &slwinmap = slWin -> getMap(); 00060 EcalTPGSlidingWindowMapIterator it=slwinmap.find(id); 00061 if (it!=slwinmap.end()) shift_=(*it).second; 00062 else edm::LogWarning("EcalTPG")<<" could not find EcalTPGSlidingWindowMap entry for "<<id; 00063 } 00064 //-----------------------------------------------------------------------------------------