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