CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/SimCalorimetry/EcalTrigPrimAlgos/src/EcalFenixStripFormatEE.cc

Go to the documentation of this file.
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 // Pascal: finally no,endcap has 12 bits as in EB (bug in FENIX!!!!)
00037   if(output>0XFFF) output=0XFFF; 
00038   output=output|(fgvb_<<12); //Pascal (was 10)
00039 
00040   return output;    
00041 } 
00042 //------------------------------------------------------------------------------------------
00043 
00044 void EcalFenixStripFormatEE::process(std::vector<int> &fgvbout,std::vector<int> &peakout,
00045                                      std::vector<int> &filtout, std::vector<int> &output){
00046   if  (peakout.size()!=filtout.size()){
00047     edm::LogWarning("EcalTPG")<<" problem in EcalFenixStripFormatEE: peak_out and filt_out don't have the same size";
00048     std::cout<<" Size peak_out"<< peakout.size()<<", size filt_out:"<<filtout.size()<<std::flush<<std::endl;
00049   }
00050   for  (unsigned int i =0;i<filtout.size();i++){
00051     setInput(filtout[i],peakout[i],fgvbout[i]);
00052     output[i]=process();
00053   }
00054   return;
00055 }
00056 //-----------------------------------------------------------------------------------------
00057 
00058 void EcalFenixStripFormatEE::setParameters(uint32_t id,const EcalTPGSlidingWindow*& slWin){
00059 
00060   const EcalTPGSlidingWindowMap &slwinmap = slWin -> getMap();
00061   EcalTPGSlidingWindowMapIterator it=slwinmap.find(id);
00062   if (it!=slwinmap.end()) shift_=(*it).second;
00063   else edm::LogWarning("EcalTPG")<<" could not find EcalTPGSlidingWindowMap entry for "<<id;
00064 }
00065 //-----------------------------------------------------------------------------------------