CMS 3D CMS Logo

Public Member Functions | Private Attributes

ESRecHitProducer Class Reference

#include <ESRecHitProducer.h>

Inheritance diagram for ESRecHitProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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_
ESRecHitWorkerBaseClassworker_

Detailed Description

Definition at line 15 of file ESRecHitProducer.h.


Constructor & Destructor Documentation

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]

Definition at line 26 of file ESRecHitProducer.cc.

References worker_.

                                    {

  delete worker_;
}

Member Function Documentation

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_);
}

Member Data Documentation

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().

Definition at line 28 of file ESRecHitProducer.h.

Referenced by ESRecHitProducer(), produce(), and ~ESRecHitProducer().