CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/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 #include <CondFormats/EcalObjects/interface/EcalTPGStripStatus.h>
00004 
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include <iostream>
00007 
00008 
00009 //-----------------------------------------------------------------------------------------
00010 EcalFenixStripFormatEE::EcalFenixStripFormatEE() 
00011   : shift_(0)
00012 {
00013 }
00014 //------------------------------------------------------------------------------------------
00015 
00016 EcalFenixStripFormatEE::~EcalFenixStripFormatEE() {
00017 }
00018 
00019 //-----------------------------------------------------------------------------------------
00020 
00021 
00022 int EcalFenixStripFormatEE::setInput(int input, int inputPeak, int fgvb ) {
00023   inputPeak_=inputPeak;
00024   input_=input;
00025   fgvb_=fgvb;
00026   return 0;
00027 }  
00028 //-----------------------------------------------------------------------------------------
00029   
00030 int EcalFenixStripFormatEE::process(){
00031   // Bad strip - zero everything
00032   if(stripStatus_ != 0) return 0;
00033 
00034   // Peak not found - only return fgvb
00035   if(inputPeak_==0) return ((fgvb_ & 0x1) << 12);
00036     
00037   int output=input_>>shift_;
00038 
00039   //barrel saturates at 12 bits, endcap at 10!
00040   // Pascal: finally no,endcap has 12 bits as in EB (bug in FENIX!!!!)
00041   if(output>0XFFF) output=0XFFF; 
00042   output=output|((fgvb_ & 0x1) << 12); //Pascal (was 10)
00043 
00044   return output;    
00045 } 
00046 //------------------------------------------------------------------------------------------
00047 
00048 void EcalFenixStripFormatEE::process(std::vector<int> &fgvbout,std::vector<int> &peakout,
00049                                      std::vector<int> &filtout, std::vector<int> &output){
00050   if  (peakout.size()!=filtout.size()){
00051     edm::LogWarning("EcalTPG")<<" problem in EcalFenixStripFormatEE: peak_out and filt_out don't have the same size";
00052     std::cout<<" Size peak_out"<< peakout.size()<<", size filt_out:"<<filtout.size()<<std::flush<<std::endl;
00053   }
00054   for  (unsigned int i =0;i<filtout.size();i++){
00055     setInput(filtout[i],peakout[i],fgvbout[i]);
00056     output[i]=process();
00057   }
00058   return;
00059 }
00060 //-----------------------------------------------------------------------------------------
00061 
00062 void EcalFenixStripFormatEE::setParameters(uint32_t id,const EcalTPGSlidingWindow*& slWin,const EcalTPGStripStatus *stripStatus){
00063 
00064   const EcalTPGSlidingWindowMap &slwinmap = slWin -> getMap();
00065   EcalTPGSlidingWindowMapIterator it=slwinmap.find(id);
00066   if (it!=slwinmap.end()) shift_=(*it).second;
00067   else edm::LogWarning("EcalTPG")<<" could not find EcalTPGSlidingWindowMap entry for "<<id;
00068 
00069   const EcalTPGStripStatusMap &statusMap = stripStatus->getMap();
00070   EcalTPGStripStatusMapIterator sit = statusMap.find(id);
00071   if(sit != statusMap.end())
00072   {
00073     stripStatus_ = (*sit).second;
00074   }
00075   else
00076   {
00077     stripStatus_ = 0; // Assume strip OK
00078   }
00079 }
00080 //-----------------------------------------------------------------------------------------