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 {
20 
21  produces< HGCeeUncalibratedRecHitCollection >(eeHitCollection_);
22  produces< HGChefUncalibratedRecHitCollection >(hefHitCollection_);
23  produces< HGChebUncalibratedRecHitCollection >(hebHitCollection_);
24 
25  const std::string& componentType = ps.getParameter<std::string>("algo");
26  worker_.reset( HGCalUncalibRecHitWorkerFactory::get()->create(componentType, ps) );
27 
28 }
29 
31 }
32 
33 void
35  using namespace edm;
36 
37 
38 
39  // tranparently get things from event setup
40  worker_->set(es);
41 
42  // prepare output
43  auto eeUncalibRechits = std::make_unique<HGCeeUncalibratedRecHitCollection>();
44  auto hefUncalibRechits = std::make_unique<HGChefUncalibratedRecHitCollection>();
45  auto hebUncalibRechits = std::make_unique<HGChebUncalibratedRecHitCollection>();
46 
47  // loop over HGCEE digis
49  evt.getByToken( eeDigiCollection_, pHGCEEDigis);
50  const HGCalDigiCollection* eeDigis =
51  pHGCEEDigis.product(); // get a ptr to the product
52  eeUncalibRechits->reserve(eeDigis->size());
53  for(auto itdg = eeDigis->begin(); itdg != eeDigis->end(); ++itdg) {
54  worker_->run1(evt, itdg, *eeUncalibRechits);
55  }
56 
58  evt.getByToken( hefDigiCollection_, pHGCHEFDigis);
59  const HGCalDigiCollection* hefDigis =
60  pHGCHEFDigis.product(); // get a ptr to the product
61  hefUncalibRechits->reserve(hefDigis->size());
62  for(auto itdg = hefDigis->begin(); itdg != hefDigis->end(); ++itdg) {
63  worker_->run2(evt, itdg, *hefUncalibRechits);
64  }
65 
67  evt.getByToken( hebDigiCollection_, pHGCHEBDigis);
68  const HGCalDigiCollection* hebDigis =
69  pHGCHEBDigis.product(); // get a ptr to the product
70  hebUncalibRechits->reserve(hebDigis->size());
71  for(auto itdg = hebDigis->begin(); itdg != hebDigis->end(); ++itdg) {
72  worker_->run3(evt, itdg, *hebUncalibRechits);
73  }
74 
75  // put the collection of recunstructed hits in the event
76  evt.put(std::move(eeUncalibRechits), eeHitCollection_);
77  evt.put(std::move(hefUncalibRechits), hefHitCollection_);
78  evt.put(std::move(hebUncalibRechits), hebHitCollection_);
79 }
80 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
const edm::EDGetTokenT< HGCalDigiCollection > eeDigiCollection_
def create(alignables, pedeDump, additionalData, outputFile, config)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< HGCalDigiCollection > hebDigiCollection_
const_iterator end() const
T const * product() const
Definition: Handle.h:81
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