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 }
00023
00024 std::auto_ptr<SiStripPedestalsSubtractor> SiStripRawProcessingFactory::
00025 create_SubtractorPed(const edm::ParameterSet& conf) {
00026 bool fedMode = conf.getParameter<bool>("PedestalSubtractionFedMode");
00027 return std::auto_ptr<SiStripPedestalsSubtractor>( new SiStripPedestalsSubtractor(fedMode) );
00028 }
00029
00030 std::auto_ptr<SiStripCommonModeNoiseSubtractor> SiStripRawProcessingFactory::
00031 create_SubtractorCMN(const edm::ParameterSet& conf) {
00032 std::string mode = conf.getParameter<std::string>("CommonModeNoiseSubtractionMode");
00033
00034 if ( mode == "Median")
00035 return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new MedianCMNSubtractor() );
00036
00037 if ( mode == "Percentile") {
00038 double percentile = conf.getParameter<double>("Percentile");
00039 return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new PercentileCMNSubtractor(percentile) );
00040 }
00041
00042 if ( mode == "IteratedMedian") {
00043 double cutToAvoidSignal = conf.getParameter<double>("CutToAvoidSignal");
00044 int iterations = conf.getParameter<int>("Iterations");
00045 return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new IteratedMedianCMNSubtractor(cutToAvoidSignal,iterations) );
00046 }
00047
00048 if ( mode == "FastLinear")
00049 return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new FastLinearCMNSubtractor() );
00050
00051 if ( mode == "TT6") {
00052 double cutToAvoidSignal = conf.getParameter<double>("CutToAvoidSignal");
00053 return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new TT6CMNSubtractor(cutToAvoidSignal) );
00054 }
00055
00056 edm::LogError("SiStripRawProcessingFactory::create_SubtractorCMN")
00057 << "Unregistered Algorithm: "<<mode<<". Use one of {Median, Percentile, IteratedMedian, FastLinear, TT6}";
00058 return std::auto_ptr<SiStripCommonModeNoiseSubtractor>( new MedianCMNSubtractor() );
00059 }
00060
00061 std::auto_ptr<SiStripFedZeroSuppression> SiStripRawProcessingFactory::
00062 create_Suppressor(const edm::ParameterSet& conf) {
00063 uint32_t mode = conf.getParameter<uint32_t>("SiStripFedZeroSuppressionMode");
00064 bool trunc = conf.getParameter<bool>("TruncateInSuppressor");
00065 switch(mode) {
00066 case 1: case 2: case 3: case 4:
00067 return std::auto_ptr<SiStripFedZeroSuppression>( new SiStripFedZeroSuppression(mode,trunc));
00068 default:
00069 edm::LogError("SiStripRawProcessingFactory::createSuppressor")
00070 << "Unregistered mode: "<<mode<<". Use one of {1,2,3,4}.";
00071 return std::auto_ptr<SiStripFedZeroSuppression>( new SiStripFedZeroSuppression(4,true));
00072 }
00073 }
00074
00075 std::auto_ptr<SiStripAPVRestorer> SiStripRawProcessingFactory::
00076 create_Restorer( const edm::ParameterSet& conf) {
00077 if(!conf.exists("APVRestoreMode")) {
00078 return std::auto_ptr<SiStripAPVRestorer>( 0 );
00079 } else {
00080 return std::auto_ptr<SiStripAPVRestorer> (new SiStripAPVRestorer(conf));
00081 }
00082 }
00083