CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/SimGeneral/MixingModule/src/DigiAccumulatorMixModFactory.cc

Go to the documentation of this file.
00001 
00002 #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h"
00003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00004 #include "FWCore/Utilities/interface/DebugMacros.h"
00005 #include "FWCore/Utilities/interface/EDMException.h"
00006 
00007 #include <iostream>
00008 
00009 EDM_REGISTER_PLUGINFACTORY(edm::DigiAccumulatorMixModPluginFactory,"DigiAccumulator");
00010 
00011 namespace edm {
00012   class EDProducer;
00013 
00014   DigiAccumulatorMixModFactory::~DigiAccumulatorMixModFactory() {
00015   }
00016 
00017   DigiAccumulatorMixModFactory::DigiAccumulatorMixModFactory() {
00018   }
00019 
00020   DigiAccumulatorMixModFactory DigiAccumulatorMixModFactory::singleInstance_;
00021 
00022   DigiAccumulatorMixModFactory* DigiAccumulatorMixModFactory::get() {
00023     // will not work with plugin factories
00024     //static DigiAccumulatorMixModFactory f;
00025     //return &f;
00026 
00027     return &singleInstance_;
00028   }
00029 
00030   std::auto_ptr<DigiAccumulatorMixMod>
00031   DigiAccumulatorMixModFactory::makeDigiAccumulator(ParameterSet const& conf, EDProducer& mixMod) const {
00032     std::string accumulatorType = conf.getParameter<std::string>("accumulatorType");
00033     FDEBUG(1) << "DigiAccumulatorMixModFactory: digi_accumulator_type = " << accumulatorType << std::endl;
00034     std::auto_ptr<DigiAccumulatorMixMod> wm;
00035     wm = std::auto_ptr<DigiAccumulatorMixMod>(DigiAccumulatorMixModPluginFactory::get()->create(accumulatorType, conf, mixMod));
00036     
00037     if(wm.get()==0) {
00038         throw edm::Exception(errors::Configuration,"NoSourceModule")
00039           << "DigiAccumulator Factory:\n"
00040           << "Cannot find dig type from ParameterSet: "
00041           << accumulatorType << "\n"
00042           << "Perhaps your source type is misspelled or is not an EDM Plugin?\n"
00043           << "Try running EdmPluginDump to obtain a list of available Plugins.";
00044     }
00045 
00046     FDEBUG(1) << "DigiAccumulatorMixModFactory: created a Digi Accumulator "
00047               << accumulatorType
00048               << std::endl;
00049 
00050     return wm;
00051   }
00052 }