#include <ESRecHitProducer.h>
Public Member Functions | |
ESRecHitProducer (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &e, const edm::EventSetup &es) |
virtual | ~ESRecHitProducer () |
Private Attributes | |
edm::InputTag | digiCollection_ |
std::string | rechitCollection_ |
ESRecHitWorkerBaseClass * | worker_ |
Definition at line 15 of file ESRecHitProducer.h.
ESRecHitProducer::ESRecHitProducer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 16 of file ESRecHitProducer.cc.
References digiCollection_, reco::get(), edm::ParameterSet::getParameter(), rechitCollection_, and worker_.
{ digiCollection_ = ps.getParameter<edm::InputTag>("ESdigiCollection"); rechitCollection_ = ps.getParameter<std::string>("ESrechitCollection"); produces<ESRecHitCollection>(rechitCollection_); std::string componentType = ps.getParameter<std::string>("algo"); worker_ = ESRecHitWorkerFactory::get()->create( componentType, ps ); }
ESRecHitProducer::~ESRecHitProducer | ( | ) | [virtual] |
void ESRecHitProducer::produce | ( | edm::Event & | e, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 31 of file ESRecHitProducer.cc.
References edm::DataFrameContainer::begin(), digiCollection_, edm::DataFrameContainer::end(), edm::Event::getByLabel(), i, edm::HandleBase::isValid(), LogDebug, edm::Handle< T >::product(), edm::Event::put(), rechitCollection_, ESRecHitWorkerBaseClass::run(), ESRecHitWorkerBaseClass::set(), edm::DataFrameContainer::size(), and worker_.
{ edm::Handle<ESDigiCollection> digiHandle; const ESDigiCollection* digi=0; e.getByLabel( digiCollection_, digiHandle); if ( digiHandle.isValid() ) { digi = digiHandle.product(); LogDebug("ESRecHitInfo") << "total # ESdigis: " << digi->size(); } else { edm::LogError("ESRecHitInfo") << "Error! can't get the product " << digiCollection_; } // Create empty output std::auto_ptr<ESRecHitCollection> rec(new ESRecHitCollection ); if ( digi ) { rec->reserve(digi->size()); worker_->set( es ); // run the algorithm for (ESDigiCollection::const_iterator i (digi->begin()); i!=digi->end(); i++) { worker_->run( e, i, *rec ); } } e.put(rec,rechitCollection_); }
Definition at line 25 of file ESRecHitProducer.h.
Referenced by ESRecHitProducer(), and produce().
std::string ESRecHitProducer::rechitCollection_ [private] |
Definition at line 26 of file ESRecHitProducer.h.
Referenced by ESRecHitProducer(), and produce().
ESRecHitWorkerBaseClass* ESRecHitProducer::worker_ [private] |
Definition at line 28 of file ESRecHitProducer.h.
Referenced by ESRecHitProducer(), produce(), and ~ESRecHitProducer().