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 {
18 }
19 
20 
21 namespace HcalHitAnalyzerImpl {
22  template<class Collection>
23  void analyze(edm::Event const& e, CaloHitAnalyzer & analyzer) {
25  e.getByType(recHits);
26  for(unsigned i = 0 ; i < recHits->size(); ++i) {
27  analyzer.analyze((*recHits)[i].id().rawId(), (*recHits)[i].energy());
28  }
29  }
30 }
31 
32 
34  // Step A: Get Inputs
36  e.getByLabel("mix", "g4SimHitsHcalHits",cf);
37  //e.getByLabel("mix", "ZDCHits", zdccf);
38 
39  // test access to SimHits for HcalHits and ZDC hits
40  std::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(cf.product()));
41  //std::auto_ptr<MixCollection<PCaloHit> > zdcHits(new MixCollection<PCaloHit>(zdccf.product()));
42  hbheAnalyzer_.fillHits(*hits);
43  //hoAnalyzer_.fillHits(*hits);
44  //hfAnalyzer_.fillHits(*hits);
45  //zdcAnalyzer_.fillHits(*hits);
46  HcalHitAnalyzerImpl::analyze<HBHERecHitCollection>(e, hbheAnalyzer_);
47  HcalHitAnalyzerImpl::analyze<HORecHitCollection>(e, hoAnalyzer_);
48  HcalHitAnalyzerImpl::analyze<HFRecHitCollection>(e, hfAnalyzer_);
49  //HcalHitAnalyzerImpl::analyze<ZDCRecHitCollection>(e, zdcAnalyzer_);
50 }
51 
52 
int i
Definition: DBlmapReader.cc:9
void analyze(int detId, double recEnergy)
to be called for each RecHit
CaloHitAnalyzer hfAnalyzer_
void analyze(edm::Event const &e, CaloHitAnalyzer &analyzer)
bool getByType(Handle< PROD > &result) const
Definition: Event.h:397
HcalHitAnalyzer(edm::ParameterSet const &conf)
void fillHits(MixCollection< PCaloHit > &hits)
should be called each event
CaloHitAnalyzer hbheAnalyzer_
CaloHitAnalyzer hoAnalyzer_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
tuple conf
Definition: dbtoconf.py:185
virtual void analyze(edm::Event const &e, edm::EventSetup const &c)
T const * product() const
Definition: Handle.h:74