CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #include <SimCalorimetry/EcalTrigPrimAlgos/interface/EcalFenixStripFormatEB.h>
00002 #include <CondFormats/EcalObjects/interface/EcalTPGSlidingWindow.h>
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 
00005   EcalFenixStripFormatEB::EcalFenixStripFormatEB() 
00006     : shift_(0)
00007 {
00008 }
00009 
00010   EcalFenixStripFormatEB::~EcalFenixStripFormatEB() {
00011   }
00012 
00013   int EcalFenixStripFormatEB::setInput(int input, int inputPeak, int inputsFGVB) 
00014   {
00015     inputsFGVB_ = inputsFGVB;
00016     inputPeak_=inputPeak;
00017     input_=input;
00018     return 0;
00019   }  
00020   
00021   int EcalFenixStripFormatEB::process()
00022   {
00023     //    buffer_=input_>>shift_;  //FIXME: buffer why?
00024 
00025     if(inputPeak_==0) return ((inputsFGVB_&0x1)<<12);
00026     //    int output=buffer_;
00027     int output=input_>>shift_;
00028     if(output>0XFFF) output=0XFFF;   //ok: barrel saturates at 12 bits
00029     // Add stripFGVB
00030     output |= ((inputsFGVB_&0x1)<<12);
00031    
00032     return output;    
00033   } 
00034 
00035 void EcalFenixStripFormatEB::process(std::vector<int> &sFGVBout, std::vector<int> &peakout, std::vector<int> &filtout, std::vector<int> & output)
00036 {
00037   if  (peakout.size()!=filtout.size() || sFGVBout.size()!=filtout.size()){
00038     edm::LogWarning("EcalTPG")<<" problem in EcalFenixStripFormatEB: sfgvb_out, peak_out and filt_out don't have the same size";
00039   }
00040   for  (unsigned int i =0;i<filtout.size();i++){
00041     setInput(filtout[i],peakout[i], sFGVBout[i]);
00042 
00043     output[i]=process();
00044   }
00045   return;
00046 }
00047 
00048 void EcalFenixStripFormatEB::setParameters(uint32_t& id, const EcalTPGSlidingWindow*& slWin)
00049 {
00050 
00051   const EcalTPGSlidingWindowMap &slwinmap = slWin -> getMap();
00052   EcalTPGSlidingWindowMapIterator it=slwinmap.find(id);
00053   if (it!=slwinmap.end()) shift_=(*it).second;
00054   else edm::LogWarning("EcalTPG")<<" could not find EcalTPGSlidingWindowMap entry for "<<id;
00055 }