CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingFactory.cc

Go to the documentation of this file.
00001 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h"
00002 
00003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00004 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingAlgorithms.h"
00005 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripPedestalsSubtractor.h"
00006 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h"
00007 #include "RecoLocalTracker/SiStripZeroSuppression/interface/MedianCMNSubtractor.h"
00008 #include "RecoLocalTracker/SiStripZeroSuppression/interface/PercentileCMNSubtractor.h"
00009 #include "RecoLocalTracker/SiStripZeroSuppression/interface/IteratedMedianCMNSubtractor.h"
00010 #include "RecoLocalTracker/SiStripZeroSuppression/interface/FastLinearCMNSubtractor.h"
00011 #include "RecoLocalTracker/SiStripZeroSuppression/interface/TT6CMNSubtractor.h"
00012 
00013 
00014 std::auto_ptr<SiStripRawProcessingAlgorithms> SiStripRawProcessingFactory::
00015 create(const edm::ParameterSet& conf) {
00016   return std::auto_ptr<SiStripRawProcessingAlgorithms>(
00017                    new SiStripRawProcessingAlgorithms(
00018                                                       create_SubtractorPed(conf),
00019                                                       create_SubtractorCMN(conf),
00020                                                       create_Suppressor(conf),
00021                                                       create_Restorer(conf),
00022                                                       create_doAPVRestorer(conf),
00023                                                       create_useCMMeanMap(conf)));
00024 }
00025 
00026 bool SiStripRawProcessingFactory::create_doAPVRestorer(const edm::ParameterSet& conf){
00027    bool doAPVRestore = conf.getParameter<bool>("doAPVRestore");
00028    return doAPVRestore; 
00029 }
00030   
00031 bool SiStripRawProcessingFactory::create_useCMMeanMap(const edm::ParameterSet&conf){
00032    bool useCMMeanMap = conf.getParameter<bool>("useCMMeanMap");
00033    return useCMMeanMap; 
00034 }
00035 
00036 std::auto_ptr<SiStripPedestalsSubtractor> SiStripRawProcessingFactory::
00037 create_SubtractorPed(const edm::ParameterSet& conf) {
00038   bool fedMode = conf.getParameter<bool>("PedestalSubtractionFedMode");
00039   return std::auto_ptr<SiStripPedestalsSubtractor>( new SiStripPedestalsSubtractor(fedMode) );
00040 }
00041 
00042 std::auto_ptr<SiStripCommonModeNoiseSubtractor> SiStripRawProcessingFactory::
00043 create_SubtractorCMN(const edm::ParameterSet& conf) {
00044   std::string mode = conf.getParameter<std::string>("CommonModeNoiseSubtractionMode");
00045 
00046   if ( mode == "Median")
00047     return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new MedianCMNSubtractor() );
00048 
00049   if ( mode == "Percentile") {
00050     double percentile = conf.getParameter<double>("Percentile");
00051     return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new PercentileCMNSubtractor(percentile) );
00052   }
00053 
00054   if ( mode == "IteratedMedian") {
00055     double cutToAvoidSignal = conf.getParameter<double>("CutToAvoidSignal");
00056     int iterations = conf.getParameter<int>("Iterations");
00057     return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new IteratedMedianCMNSubtractor(cutToAvoidSignal,iterations) );
00058   }
00059 
00060   if ( mode == "FastLinear")
00061     return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new FastLinearCMNSubtractor() );
00062 
00063   if ( mode == "TT6") {
00064     double cutToAvoidSignal = conf.getParameter<double>("CutToAvoidSignal");
00065     return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new TT6CMNSubtractor(cutToAvoidSignal) );
00066   }
00067   
00068   edm::LogError("SiStripRawProcessingFactory::create_SubtractorCMN")
00069     << "Unregistered Algorithm: "<<mode<<". Use one of {Median, Percentile, IteratedMedian, FastLinear, TT6}";
00070   return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new MedianCMNSubtractor() );
00071 }
00072 
00073 std::auto_ptr<SiStripFedZeroSuppression> SiStripRawProcessingFactory::
00074 create_Suppressor(const edm::ParameterSet& conf) {
00075   uint32_t mode = conf.getParameter<uint32_t>("SiStripFedZeroSuppressionMode");
00076   bool trunc = conf.getParameter<bool>("TruncateInSuppressor");
00077   switch(mode) {
00078   case 1: case 2: case 3:  case 4:
00079     return std::auto_ptr<SiStripFedZeroSuppression>( new SiStripFedZeroSuppression(mode,trunc));
00080   default:
00081     edm::LogError("SiStripRawProcessingFactory::createSuppressor")
00082       << "Unregistered mode: "<<mode<<". Use one of {1,2,3,4}.";
00083     return std::auto_ptr<SiStripFedZeroSuppression>( new SiStripFedZeroSuppression(4,true));
00084   }
00085 }
00086 
00087 std::auto_ptr<SiStripAPVRestorer> SiStripRawProcessingFactory::
00088 create_Restorer( const edm::ParameterSet& conf) {
00089   if(!conf.exists("APVRestoreMode")) {
00090     return std::auto_ptr<SiStripAPVRestorer>( 0 );
00091   } else {
00092     return std::auto_ptr<SiStripAPVRestorer> (new SiStripAPVRestorer(conf));
00093   }
00094 }
00095