CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingAlgorithms.cc

Go to the documentation of this file.
00001 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingAlgorithms.h"
00002 
00003 #include "FWCore/Framework/interface/Event.h"
00004 #include "FWCore/Framework/interface/EventSetup.h"
00005 #include "DataFormats/Common/interface/Handle.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007 #include "DataFormats/Common/interface/DetSetVector.h"
00008 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00009 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
00010 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h"
00011 #include <memory>
00012 
00013 
00014 SiStripRawProcessingAlgorithms::SiStripRawProcessingAlgorithms(std::auto_ptr<SiStripPedestalsSubtractor> ped,
00015                                  std::auto_ptr<SiStripCommonModeNoiseSubtractor> cmn,
00016                                  std::auto_ptr<SiStripFedZeroSuppression> zs,
00017                                  std::auto_ptr<SiStripAPVRestorer> res,
00018                                  bool doAPVRest,
00019                                  bool useCMMap)
00020     :  subtractorPed(ped),
00021        subtractorCMN(cmn),
00022        suppressor(zs),
00023        restorer(res),
00024        doAPVRestore(doAPVRest),
00025        useCMMeanMap(useCMMap)
00026     {}
00027 
00028 
00029 void SiStripRawProcessingAlgorithms::initialize(const edm::EventSetup& es) {
00030     subtractorPed->init(es);
00031     subtractorCMN->init(es);
00032     suppressor->init(es);
00033     if(restorer.get()) restorer->init(es);
00034 } 
00035 
00036 void SiStripRawProcessingAlgorithms::initialize(const edm::EventSetup& es, const edm::Event& e){
00037   this->initialize(es);
00038   if(restorer.get()&&doAPVRestore&&useCMMeanMap) restorer->LoadMeanCMMap(e);
00039   
00040 }
00041 
00042 int16_t SiStripRawProcessingAlgorithms::SuppressVirginRawData(const uint32_t& id, const uint16_t& firstAPV, std::vector<int16_t>& processedRawDigis , edm::DetSet<SiStripDigi>& suppressedDigis ){
00043       
00044       subtractorPed->subtract( id, firstAPV*128,processedRawDigis);
00045       return this->SuppressProcessedRawData(id, firstAPV, processedRawDigis , suppressedDigis );
00046  
00047 }
00048 
00049 int16_t SiStripRawProcessingAlgorithms::SuppressVirginRawData(const edm::DetSet<SiStripRawDigi>& rawDigis, edm::DetSet<SiStripDigi>& suppressedDigis){
00050    
00051    std::vector<int16_t> RawDigis;
00052    RawDigis.clear();
00053    edm::DetSet<SiStripRawDigi>::const_iterator itrawDigis = rawDigis.begin();
00054    for(; itrawDigis != rawDigis.end(); ++itrawDigis) RawDigis.push_back(itrawDigis->adc());
00055    return this->SuppressVirginRawData(rawDigis.id, 0,RawDigis , suppressedDigis);
00056 }
00057   
00058 
00059 
00060 
00061 int16_t SiStripRawProcessingAlgorithms::SuppressProcessedRawData(const uint32_t& id, const uint16_t& firstAPV, std::vector<int16_t>& processedRawDigis , edm::DetSet<SiStripDigi>& suppressedDigis ){
00062       std::vector<int16_t>  processedRawDigisPedSubtracted ;
00063       
00064       int16_t nAPVFlagged =0;
00065       if( doAPVRestore ) processedRawDigisPedSubtracted.assign(processedRawDigis.begin(), processedRawDigis.end());
00066       subtractorCMN->subtract(id, firstAPV,  processedRawDigis);
00067       if( doAPVRestore ) nAPVFlagged = restorer->InspectAndRestore(id, firstAPV, processedRawDigisPedSubtracted, processedRawDigis, subtractorCMN->getAPVsCM() );
00068       suppressor->suppress( processedRawDigis, firstAPV,  suppressedDigis ); 
00069       return nAPVFlagged;
00070 }
00071 
00072 
00073 int16_t SiStripRawProcessingAlgorithms::SuppressProcessedRawData(const edm::DetSet<SiStripRawDigi>& rawDigis, edm::DetSet<SiStripDigi>& suppressedDigis){
00074    std::vector<int16_t> RawDigis;
00075    RawDigis.clear();
00076    edm::DetSet<SiStripRawDigi>::const_iterator itrawDigis = rawDigis.begin();
00077    for(; itrawDigis != rawDigis.end(); ++itrawDigis) RawDigis.push_back(itrawDigis->adc());
00078     return this->SuppressProcessedRawData(rawDigis.id, 0, RawDigis , suppressedDigis );
00079 }