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  hfnoseDigiCollection_(consumes<HGCalDigiCollection>(ps.getParameter<edm::InputTag>("HGCHFNosedigiCollection"))),
17  eeHitCollection_(ps.getParameter<std::string>("HGCEEhitCollection")),
18  hefHitCollection_(ps.getParameter<std::string>("HGCHEFhitCollection")),
19  hebHitCollection_(ps.getParameter<std::string>("HGCHEBhitCollection")),
20  hfnoseHitCollection_(ps.getParameter<std::string>("HGCHFNosehitCollection")),
21  worker_{HGCalUncalibRecHitWorkerFactory::get()->create(
22  ps.getParameter<std::string>("algo"), ps, consumesCollector())} {
23  produces<HGCeeUncalibratedRecHitCollection>(eeHitCollection_);
24  produces<HGChefUncalibratedRecHitCollection>(hefHitCollection_);
25  produces<HGChebUncalibratedRecHitCollection>(hebHitCollection_);
26  produces<HGChfnoseUncalibratedRecHitCollection>(hfnoseHitCollection_);
27 }
28 
30 
32  using namespace edm;
33 
34  // tranparently get things from event setup
35  worker_->set(es);
36 
37  // prepare output
38  auto eeUncalibRechits = std::make_unique<HGCeeUncalibratedRecHitCollection>();
39  auto hefUncalibRechits = std::make_unique<HGChefUncalibratedRecHitCollection>();
40  auto hebUncalibRechits = std::make_unique<HGChebUncalibratedRecHitCollection>();
41  auto hfnoseUncalibRechits = std::make_unique<HGChfnoseUncalibratedRecHitCollection>();
42 
43  // loop over HGCEE digis
45  evt.getByToken(eeDigiCollection_, pHGCEEDigis);
46  const HGCalDigiCollection* eeDigis = pHGCEEDigis.product();
47  eeUncalibRechits->reserve(eeDigis->size());
48  for (auto itdg = eeDigis->begin(); itdg != eeDigis->end(); ++itdg) {
49  worker_->runHGCEE(itdg, *eeUncalibRechits);
50  }
51 
52  // loop over HGCHEsil digis
54  evt.getByToken(hefDigiCollection_, pHGCHEFDigis);
55  const HGCalDigiCollection* hefDigis = pHGCHEFDigis.product();
56  hefUncalibRechits->reserve(hefDigis->size());
57  for (auto itdg = hefDigis->begin(); itdg != hefDigis->end(); ++itdg) {
58  worker_->runHGCHEsil(itdg, *hefUncalibRechits);
59  }
60 
61  // loop over HGCHEscint digis
63  evt.getByToken(hebDigiCollection_, pHGCHEBDigis);
64  const HGCalDigiCollection* hebDigis = pHGCHEBDigis.product();
65  hebUncalibRechits->reserve(hebDigis->size());
66  for (auto itdg = hebDigis->begin(); itdg != hebDigis->end(); ++itdg) {
67  worker_->runHGCHEscint(itdg, *hebUncalibRechits);
68  }
69 
70  // loop over HFNose digis
71  edm::Handle<HGCalDigiCollection> pHGCHFNoseDigis;
72  evt.getByToken(hfnoseDigiCollection_, pHGCHFNoseDigis);
73  if (pHGCHFNoseDigis.isValid()) {
74  const HGCalDigiCollection* hfnoseDigis = pHGCHFNoseDigis.product();
75  if (!(hfnoseDigis->empty())) {
76  hfnoseUncalibRechits->reserve(hfnoseDigis->size());
77  for (auto itdg = hfnoseDigis->begin(); itdg != hfnoseDigis->end(); ++itdg)
78  worker_->runHGCHFNose(itdg, *hfnoseUncalibRechits);
79  }
80  }
81 
82  // put the collection of recunstructed hits in the event
83  evt.put(std::move(eeUncalibRechits), eeHitCollection_);
84  evt.put(std::move(hefUncalibRechits), hefHitCollection_);
85  evt.put(std::move(hebUncalibRechits), hebHitCollection_);
86  if (pHGCHFNoseDigis.isValid())
87  evt.put(std::move(hfnoseUncalibRechits), hfnoseHitCollection_);
88 }
89 
91 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EDGetTokenT< HGCalDigiCollection > eeDigiCollection_
size_type size() const
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< HGCalDigiCollection > hebDigiCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const_iterator begin() const
edm::EDGetTokenT< HGCalDigiCollection > hfnoseDigiCollection_
const_iterator end() const
const edm::EDGetTokenT< HGCalDigiCollection > hefDigiCollection_
std::unique_ptr< HGCalUncalibRecHitWorkerBaseClass > worker_
bool isValid() const
Definition: HandleBase.h:70
HGCalUncalibRecHitProducer(const edm::ParameterSet &ps)
HLT enums.
void produce(edm::Event &evt, const edm::EventSetup &es) override
void reserve(size_type n)
#define get
def move(src, dest)
Definition: eostools.py:511