CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoLocalTracker/SiStripClusterizer/src/StripClusterizerAlgorithmFactory.cc

Go to the documentation of this file.
00001 #include "RecoLocalTracker/SiStripClusterizer/interface/StripClusterizerAlgorithmFactory.h"
00002 
00003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00004 #include "RecoLocalTracker/SiStripClusterizer/interface/StripClusterizerAlgorithm.h"
00005 #include "RecoLocalTracker/SiStripClusterizer/interface/ThreeThresholdAlgorithm.h"
00006 #include "RecoLocalTracker/SiStripClusterizer/interface/OldThreeThresholdAlgorithm.h"
00007 
00008 std::auto_ptr<StripClusterizerAlgorithm> StripClusterizerAlgorithmFactory::
00009 create(const edm::ParameterSet& conf) {
00010   std::string algorithm = conf.getParameter<std::string>("Algorithm");
00011 
00012   bool setDetId=false;
00013   if (conf.exists("setDetId"))
00014     setDetId = conf.getParameter<bool>("setDetId");
00015   if(algorithm == "ThreeThresholdAlgorithm") {
00016     return std::auto_ptr<StripClusterizerAlgorithm>(
00017            new ThreeThresholdAlgorithm(
00018                conf.getParameter<double>("ChannelThreshold"),
00019                conf.getParameter<double>("SeedThreshold"),
00020                conf.getParameter<double>("ClusterThreshold"),
00021                conf.getParameter<unsigned>("MaxSequentialHoles"),
00022                conf.getParameter<unsigned>("MaxSequentialBad"),
00023                conf.getParameter<unsigned>("MaxAdjacentBad"),
00024                conf.getParameter<std::string>("QualityLabel"),
00025                setDetId,
00026                conf.getParameter<bool>("RemoveApvShots")));
00027   }
00028 
00029   if(algorithm == "OldThreeThresholdAlgorithm") {
00030     return std::auto_ptr<StripClusterizerAlgorithm>(
00031            new OldThreeThresholdAlgorithm(
00032                conf.getParameter<double>("ChannelThreshold"),
00033                conf.getParameter<double>("SeedThreshold"),
00034                conf.getParameter<double>("ClusterThreshold"),
00035                conf.getParameter<unsigned>("MaxSequentialHoles"),
00036                conf.getParameter<std::string>("QualityLabel"),
00037                setDetId));
00038   }
00039 
00040   throw cms::Exception("[StripClusterizerAlgorithmFactory] Unregistered Algorithm")
00041     << algorithm << " is not a registered StripClusterizerAlgorithm";
00042 }