CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ESRecHitProducer.cc
Go to the documentation of this file.
2 
4 
10 
15 
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 }
25 
27 
28  delete worker_;
29 }
30 
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  for (i=digi->begin(); i!=digi->end(); i++) {
54  worker_->run( e, i, *rec );
55  }
56  }
57 
58  e.put(rec,rechitCollection_);
59 }
60 
63 
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
edm::InputTag digiCollection_
std::string rechitCollection_
ESRecHitProducer(const edm::ParameterSet &ps)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void set(const edm::EventSetup &es)=0
std::vector< T >::const_iterator const_iterator
virtual void produce(edm::Event &e, const edm::EventSetup &es)
virtual ~ESRecHitProducer()
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
ESRecHitWorkerBaseClass * worker_
const_iterator end() const
virtual bool run(const edm::Event &evt, const ESDigiCollection::const_iterator &digi, ESRecHitCollection &result)=0
T const * product() const
Definition: Handle.h:74
size_type size() const
T get(const Candidate &c)
Definition: component.h:56
const_iterator begin() const