CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixPeakFinder.cc

Go to the documentation of this file.
00001 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixPeakFinder.h>
00002   
00003 EcalFenixPeakFinder::EcalFenixPeakFinder()
00004   :inputsAlreadyIn_(0){ 
00005 }
00006 
00007   
00008 EcalFenixPeakFinder::~EcalFenixPeakFinder(){
00009 }
00010 
00011 int EcalFenixPeakFinder::setInput(int input)
00012 {
00013   if(inputsAlreadyIn_<3)
00014     {
00015       buffer_[inputsAlreadyIn_]=input;
00016       inputsAlreadyIn_++;
00017     }
00018   else
00019     {
00020       for(int i=0; i<2; i++) buffer_[i]=buffer_[i+1];
00021       buffer_[2]=input;
00022     }
00023   return 1;
00024 }
00025   
00026 int EcalFenixPeakFinder::process()
00027 {
00028 
00029   if(inputsAlreadyIn_<3) return 0;
00030   if(buffer_[1]>buffer_[0] && buffer_[1]>buffer_[2]) return 1;
00031   else return 0;
00032     
00033 }
00034 
00035 std::vector<int> EcalFenixPeakFinder::process(std::vector<int> &filtout, std::vector<int> & output)
00036 {
00037   
00038   // FIXME: 3
00039   inputsAlreadyIn_=0;
00040   for (unsigned int i =0;i<3;i++) buffer_[i]=0;
00041 
00042   //  std::vector<int> output;
00043   
00044   // attention, we have to shift by one, because the peak is found one too late
00045   for (unsigned int i =0;i<filtout.size();i++){
00046     
00047     setInput(filtout[i]);
00048     if (i>0) {
00049       //      int outone = process();
00050       //      output.push_back(outone);
00051       output[i-1]= process();
00052     }
00053   }
00054   //  output.resize(filtout.size());
00055 
00056   return output;
00057 }
00058 
00059