CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ESRecHitProducer Class Reference

#include <ESRecHitProducer.h>

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

Public Member Functions

 ESRecHitProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &es)
 
virtual ~ESRecHitProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::InputTag digiCollection_
 
std::string rechitCollection_
 
ESRecHitWorkerBaseClassworker_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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

16  {
17 
18  digiCollection_ = ps.getParameter<edm::InputTag>("ESdigiCollection");
19  rechitCollection_ = ps.getParameter<std::string>("ESrechitCollection");
20  produces<ESRecHitCollection>(rechitCollection_);
21 
22  std::string componentType = ps.getParameter<std::string>("algo");
23  worker_ = ESRecHitWorkerFactory::get()->create( componentType, ps );
24 }
T getParameter(std::string const &) const
edm::InputTag digiCollection_
std::string rechitCollection_
ESRecHitWorkerBaseClass * worker_
T get(const Candidate &c)
Definition: component.h:56
ESRecHitProducer::~ESRecHitProducer ( )
virtual

Definition at line 26 of file ESRecHitProducer.cc.

References worker_.

26  {
27 
28  delete worker_;
29 }
ESRecHitWorkerBaseClass * 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_.

31  {
32 
34  const ESDigiCollection* digi=0;
35  e.getByLabel( digiCollection_, digiHandle);
36  if ( digiHandle.isValid() ) {
37  digi = digiHandle.product();
38  LogDebug("ESRecHitInfo") << "total # ESdigis: " << digi->size();
39  } else {
40  edm::LogError("ESRecHitInfo") << "Error! can't get the product " << digiCollection_;
41  }
42 
43  // Create empty output
44  std::auto_ptr<ESRecHitCollection> rec(new ESRecHitCollection );
45 
46  if ( digi ) {
47  rec->reserve(digi->size());
48 
49  worker_->set( es );
50 
51  // run the algorithm
53  i!=digi->end(); i++) {
54  worker_->run( e, i, *rec );
55  }
56  }
57 
58  e.put(rec,rechitCollection_);
59 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
edm::InputTag digiCollection_
std::string rechitCollection_
virtual void set(const edm::EventSetup &es)=0
const_iterator begin() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
ESRecHitWorkerBaseClass * worker_
virtual bool run(const edm::Event &evt, const ESDigiCollection::const_iterator &digi, ESRecHitCollection &result)=0
T const * product() const
Definition: Handle.h:74
const_iterator end() const

Member Data Documentation

edm::InputTag ESRecHitProducer::digiCollection_
private

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