CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalHitAnalyzer.cc
Go to the documentation of this file.
4 #include<iostream>
5 
6 
8 : simParameterMap_(conf),
9  hbheFilter_(),
10  hoFilter_(),
11  hfFilter_(true),
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 
24 namespace HcalHitAnalyzerImpl {
25  template<class Collection>
26  void analyze(edm::Event const& e, CaloHitAnalyzer & analyzer, edm::InputTag& tag) {
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::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(cf.product()));
44  //std::auto_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(edm::Event const &e, CaloHitAnalyzer &analyzer, edm::InputTag &tag)
int i
Definition: DBlmapReader.cc:9
void analyze(int detId, double recEnergy)
to be called for each RecHit
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:420
tuple conf
Definition: dbtoconf.py:185
virtual void analyze(edm::Event const &e, edm::EventSetup const &c)
T const * product() const
Definition: Handle.h:81