00001 #include "CommonTools/SiStripClusterization/interface/SiStripClusterizerFactory.h"
00002 #include "CommonTools/SiStripClusterization/interface/SiStripDummyAlgo.h"
00003 #include "CommonTools/SiStripClusterization/interface/SiStripFrontEndDriverAlgo.h"
00004 #include "CommonTools/SiStripClusterization/interface/SiStripThreeThresholdAlgo.h"
00005 #include "string"
00006
00007 SiStripClusterizerFactory::SiStripClusterizerFactory( const edm::ParameterSet& pset )
00008 : algorithms_(),
00009 algorithm_(0),
00010 factory_(0)
00011 {
00012
00013
00014 std::string algo = pset.getUntrackedParameter<std::string>("ClusterizerAlgorithm","DummyAlgorithm");
00015 if ( algo == "DummyAlgorithm" ) {
00016 algorithm_ = new SiStripDummyAlgo(pset);
00017 } else if ( algo == "FrontEndDriver" ) {
00018 algorithm_ = new SiStripFrontEndDriverAlgo(pset);
00019 } else if ( algo == "ThreeThreshold" ) {
00020 algorithm_ = new SiStripThreeThresholdAlgo(pset);
00021 } else {
00022 edm::LogWarning("UNDEFINED_CATEGORY")
00023 << "[SiStripClusterizerFactory::" << __func__ << "]"
00024 << " Unknown clusterizer specified in .cfg file: \""
00025 << algo
00026 << "\". Defaulting to 'FrontEndDriver' algorithm...";
00027 algorithm_ = new SiStripFrontEndDriverAlgo(pset);
00028 }
00029
00030
00031 bool zero_suppr = pset.getUntrackedParameter<bool>("PerformZeroSuppression",false);
00032 if ( zero_suppr ) { factory_ = NULL; }
00033
00034 }
00035
00036 SiStripClusterizerFactory::~SiStripClusterizerFactory() {
00037 delete algorithm_;
00038 }
00039
00040 void SiStripClusterizerFactory::clusterize( const edm::DetSetVector<SiStripDigi>& digis, edm::DetSetVector<SiStripCluster>& clusters ) {
00041
00042 edm::DetSetVector<SiStripDigi>::const_iterator idigis = digis.begin();
00043 for ( ; idigis != digis.end(); idigis++ ) {
00044 clusterize( *idigis, clusters );
00045 }
00046 }
00047
00048 void SiStripClusterizerFactory::clusterize( const edm::DetSet<SiStripDigi>& digis, edm::DetSetVector<SiStripCluster>& clusters ) {
00049 if (algorithm()) algorithm()->clusterize( digis, clusters );
00050 }
00051
00052 void SiStripClusterizerFactory::clusterize( const edm::DetSetVector<SiStripRawDigi>& raw_digis, edm::DetSetVector<SiStripCluster>& clusters ) {}
00053
00054 void SiStripClusterizerFactory::clusterize( const edm::DetSet<SiStripRawDigi>& raw_digis, edm::DetSetVector<SiStripCluster>& clusters ) {}
00055
00056 void SiStripClusterizerFactory::eventSetup( const edm::EventSetup& setup) {
00057 if (algorithm()) algorithm()->eventSetup(setup);
00058 }
00059