CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorHitAnalyzer.cc
Go to the documentation of this file.
4 #include<iostream>
5 
6 
8  : hitReadoutName_("CastorHits"),
9  simParameterMap_(),
10  castorFilter_(),
11  castorAnalyzer_("CASTOR", 1., &simParameterMap_, &castorFilter_)
12 {
13 }
14 
15 
16 namespace CastorHitAnalyzerImpl {
17  template<class Collection>
18  void analyze(edm::Event const& e, CaloHitAnalyzer & analyzer) {
20  e.getByType(recHits);
21  if (!recHits.isValid()) {
22  edm::LogError("CastorHitAnalyzer") << "Could not find Castor RecHitContainer ";
23  } else {
24  for(unsigned i = 0 ; i < recHits->size(); ++i) {
25  analyzer.analyze((*recHits)[i].id().rawId(), (*recHits)[i].energy());
26  }
27  }
28  }
29 }
30 
31 
34 e.getByLabel("mix", "g4SimHitsCastorFI", castorcf);
35 
36 
37  // access to SimHits
38 std::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(castorcf.product()));
40  CastorHitAnalyzerImpl::analyze<CastorRecHitCollection>(e, castorAnalyzer_);
41  }
42 
43 
44 
CastorHitAnalyzer(edm::ParameterSet const &conf)
void analyze(edm::Event const &e, CaloHitAnalyzer &analyzer)
int i
Definition: DBlmapReader.cc:9
void analyze(int detId, double recEnergy)
to be called for each RecHit
virtual void analyze(edm::Event const &e, edm::EventSetup const &c)
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
void fillHits(MixCollection< PCaloHit > &hits)
should be called each event
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
CaloHitAnalyzer castorAnalyzer_
tuple conf
Definition: dbtoconf.py:185
T const * product() const
Definition: Handle.h:74