CMS 3D CMS Logo

HcalHitAnalyzer.cc
Go to the documentation of this file.
4 #include <iostream>
5 
7  : simParameterMap_(conf),
8  hbheFilter_(),
9  hoFilter_(),
10  hfFilter_(),
11  zdcFilter_(),
12  hbheAnalyzer_("HBHE", 1., &simParameterMap_, &hbheFilter_),
13  hoAnalyzer_("HO", 1., &simParameterMap_, &hoFilter_),
14  hfAnalyzer_("HF", 1., &simParameterMap_, &hfFilter_),
15  zdcAnalyzer_("ZDC", 1., &simParameterMap_, &zdcFilter_),
16  hbheRecHitCollectionTag_(conf.getParameter<edm::InputTag>("hbheRecHitCollectionTag")),
17  hoRecHitCollectionTag_(conf.getParameter<edm::InputTag>("hoRecHitCollectionTag")),
18  hfRecHitCollectionTag_(conf.getParameter<edm::InputTag>("hfRecHitCollectionTag")) {}
19 
21  template <class Collection>
24  e.getByLabel(tag, recHits);
25  for (unsigned i = 0; i < recHits->size(); ++i) {
26  analyzer.analyze((*recHits)[i].id().rawId(), (*recHits)[i].energy());
27  }
28  }
29 } // namespace HcalHitAnalyzerImpl
30 
32  // Step A: Get Inputs
34  e.getByLabel("mix", "g4SimHitsHcalHits", cf);
35  // e.getByLabel("mix", "ZDCHits", zdccf);
36 
37  // test access to SimHits for HcalHits and ZDC hits
38  std::unique_ptr<MixCollection<PCaloHit>> hits(new MixCollection<PCaloHit>(cf.product()));
39  // std::unique_ptr<MixCollection<PCaloHit> > zdcHits(new
40  // MixCollection<PCaloHit>(zdccf.product()));
41  hbheAnalyzer_.fillHits(*hits);
42  // hoAnalyzer_.fillHits(*hits);
43  // hfAnalyzer_.fillHits(*hits);
44  // zdcAnalyzer_.fillHits(*hits);
45  HcalHitAnalyzerImpl::analyze<HBHERecHitCollection>(e, hbheAnalyzer_, hbheRecHitCollectionTag_);
46  HcalHitAnalyzerImpl::analyze<HORecHitCollection>(e, hoAnalyzer_, hoRecHitCollectionTag_);
47  HcalHitAnalyzerImpl::analyze<HFRecHitCollection>(e, hfAnalyzer_, hfRecHitCollectionTag_);
48  // HcalHitAnalyzerImpl::analyze<ZDCRecHitCollection>(e, zdcAnalyzer_);
49 }
void analyze(int detId, double recEnergy)
to be called for each RecHit
void analyze(edm::Event const &e, edm::EventSetup const &c) override
CaloHitAnalyzer hfAnalyzer_
HcalHitAnalyzer(edm::ParameterSet const &conf)
edm::InputTag hbheRecHitCollectionTag_
edm::InputTag hoRecHitCollectionTag_
void fillHits(MixCollection< PCaloHit > &hits)
should be called each event
CaloHitAnalyzer hbheAnalyzer_
edm::InputTag hfRecHitCollectionTag_
CaloHitAnalyzer hoAnalyzer_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
T const * product() const
Definition: Handle.h:74
HLT enums.