CMS 3D CMS Logo

HcalHitAnalyzer.cc
Go to the documentation of this file.
4 #include<iostream>
5 
6 
8 : simParameterMap_(conf),
9  hbheFilter_(),
10  hoFilter_(),
11  hfFilter_(),
12  zdcFilter_(),
13  hbheAnalyzer_("HBHE", 1., &simParameterMap_, &hbheFilter_),
14  hoAnalyzer_("HO", 1., &simParameterMap_, &hoFilter_),
15  hfAnalyzer_("HF", 1., &simParameterMap_, &hfFilter_),
16  zdcAnalyzer_("ZDC", 1., &simParameterMap_, &zdcFilter_),
17  hbheRecHitCollectionTag_(conf.getParameter<edm::InputTag>("hbheRecHitCollectionTag")),
18  hoRecHitCollectionTag_(conf.getParameter<edm::InputTag>("hoRecHitCollectionTag")),
19  hfRecHitCollectionTag_(conf.getParameter<edm::InputTag>("hfRecHitCollectionTag"))
20 {
21 }
22 
23 
25  template<class Collection>
28  e.getByLabel(tag, recHits);
29  for(unsigned i = 0 ; i < recHits->size(); ++i) {
30  analyzer.analyze((*recHits)[i].id().rawId(), (*recHits)[i].energy());
31  }
32  }
33 }
34 
35 
37  // Step A: Get Inputs
39  e.getByLabel("mix", "g4SimHitsHcalHits",cf);
40  //e.getByLabel("mix", "ZDCHits", zdccf);
41 
42  // test access to SimHits for HcalHits and ZDC hits
43  std::unique_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(cf.product()));
44  //std::unique_ptr<MixCollection<PCaloHit> > zdcHits(new MixCollection<PCaloHit>(zdccf.product()));
45  hbheAnalyzer_.fillHits(*hits);
46  //hoAnalyzer_.fillHits(*hits);
47  //hfAnalyzer_.fillHits(*hits);
48  //zdcAnalyzer_.fillHits(*hits);
49  HcalHitAnalyzerImpl::analyze<HBHERecHitCollection>(e, hbheAnalyzer_, hbheRecHitCollectionTag_);
50  HcalHitAnalyzerImpl::analyze<HORecHitCollection>(e, hoAnalyzer_, hoRecHitCollectionTag_);
51  HcalHitAnalyzerImpl::analyze<HFRecHitCollection>(e, hfAnalyzer_, hfRecHitCollectionTag_);
52  //HcalHitAnalyzerImpl::analyze<ZDCRecHitCollection>(e, zdcAnalyzer_);
53 }
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:464
T const * product() const
Definition: Handle.h:81
HLT enums.