CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ESRecHitProducer.cc
Go to the documentation of this file.
2 
4 
10 
14 
16  : digiToken_(consumes<ESDigiCollection>(ps.getParameter<edm::InputTag>("ESdigiCollection"))),
17  rechitCollection_(ps.getParameter<std::string>("ESrechitCollection")),
18  worker_{ESRecHitWorkerFactory::get()->create(ps.getParameter<std::string>("algo"), ps, consumesCollector())} {
19  produces<ESRecHitCollection>(rechitCollection_);
20 }
21 
23 
26  const ESDigiCollection* digi = nullptr;
27  e.getByToken(digiToken_, digiHandle);
28 
29  digi = digiHandle.product();
30  LogDebug("ESRecHitInfo") << "total # ESdigis: " << digi->size();
31 
32  // Create empty output
33  auto rec = std::make_unique<ESRecHitCollection>();
34 
35  if (digi) {
36  rec->reserve(digi->size());
37 
38  worker_->set(es);
39 
40  // run the algorithm
41  for (ESDigiCollection::const_iterator i(digi->begin()); i != digi->end(); i++) {
42  worker_->run(i, *rec);
43  }
44  }
45 
47 }
48 
std::unique_ptr< ESRecHitWorkerBaseClass > worker_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
ESRecHitProducer(const edm::ParameterSet &ps)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
~ESRecHitProducer() override
const_iterator begin() const
The iterator returned can not safely be used across threads.
const std::string rechitCollection_
def move
Definition: eostools.py:511
void produce(edm::Event &e, const edm::EventSetup &es) override
const edm::EDGetTokenT< ESDigiCollection > digiToken_
T const * product() const
Definition: Handle.h:70
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const_iterator end() const
#define get
#define LogDebug(id)