CMS 3D CMS Logo

HGCalUncalibRecHitProducer.cc
Go to the documentation of this file.
2 
5 
7 
9 
11 
13  eeDigiCollection_( consumes<HGCalDigiCollection>( ps.getParameter<edm::InputTag>("HGCEEdigiCollection") ) ),
14  hefDigiCollection_( consumes<HGCalDigiCollection>( ps.getParameter<edm::InputTag>("HGCHEFdigiCollection") ) ),
15  hebDigiCollection_( consumes<HGCalDigiCollection>( ps.getParameter<edm::InputTag>("HGCHEBdigiCollection") ) ),
16  eeHitCollection_( ps.getParameter<std::string>("HGCEEhitCollection") ),
17  hefHitCollection_( ps.getParameter<std::string>("HGCHEFhitCollection") ),
18  hebHitCollection_( ps.getParameter<std::string>("HGCHEBhitCollection") ),
19  worker_{ HGCalUncalibRecHitWorkerFactory::get()->create(ps.getParameter<std::string>("algo"), ps) }
20 {
21 
22  produces< HGCeeUncalibratedRecHitCollection >(eeHitCollection_);
23  produces< HGChefUncalibratedRecHitCollection >(hefHitCollection_);
24  produces< HGChebUncalibratedRecHitCollection >(hebHitCollection_);
25 
26 }
27 
29 }
30 
31 void
33  using namespace edm;
34 
35 
36 
37  // tranparently get things from event setup
38  worker_->set(es);
39 
40  // prepare output
41  auto eeUncalibRechits = std::make_unique<HGCeeUncalibratedRecHitCollection>();
42  auto hefUncalibRechits = std::make_unique<HGChefUncalibratedRecHitCollection>();
43  auto hebUncalibRechits = std::make_unique<HGChebUncalibratedRecHitCollection>();
44 
45  // loop over HGCEE digis
47  evt.getByToken( eeDigiCollection_, pHGCEEDigis);
48  const HGCalDigiCollection* eeDigis =
49  pHGCEEDigis.product(); // get a ptr to the product
50  eeUncalibRechits->reserve(eeDigis->size());
51  for(auto itdg = eeDigis->begin(); itdg != eeDigis->end(); ++itdg) {
52  worker_->run1(evt, itdg, *eeUncalibRechits);
53  }
54 
56  evt.getByToken( hefDigiCollection_, pHGCHEFDigis);
57  const HGCalDigiCollection* hefDigis =
58  pHGCHEFDigis.product(); // get a ptr to the product
59  hefUncalibRechits->reserve(hefDigis->size());
60  for(auto itdg = hefDigis->begin(); itdg != hefDigis->end(); ++itdg) {
61  worker_->run2(evt, itdg, *hefUncalibRechits);
62  }
63 
65  evt.getByToken( hebDigiCollection_, pHGCHEBDigis);
66  const HGCalDigiCollection* hebDigis =
67  pHGCHEBDigis.product(); // get a ptr to the product
68  hebUncalibRechits->reserve(hebDigis->size());
69  for(auto itdg = hebDigis->begin(); itdg != hebDigis->end(); ++itdg) {
70  worker_->run3(evt, itdg, *hebUncalibRechits);
71  }
72 
73  // put the collection of recunstructed hits in the event
74  evt.put(std::move(eeUncalibRechits), eeHitCollection_);
75  evt.put(std::move(hefUncalibRechits), hefHitCollection_);
76  evt.put(std::move(hebUncalibRechits), hebHitCollection_);
77 }
78 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
const edm::EDGetTokenT< HGCalDigiCollection > eeDigiCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< HGCalDigiCollection > hebDigiCollection_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const_iterator end() const
T const * product() const
Definition: Handle.h:74
const edm::EDGetTokenT< HGCalDigiCollection > hefDigiCollection_
std::unique_ptr< HGCalUncalibRecHitWorkerBaseClass > worker_
HGCalUncalibRecHitProducer(const edm::ParameterSet &ps)
HLT enums.
size_type size() const
void produce(edm::Event &evt, const edm::EventSetup &es) override
void reserve(size_type n)
def move(src, dest)
Definition: eostools.py:511
T get(const Candidate &c)
Definition: component.h:55
const_iterator begin() const