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  castorRecHitCollectionTag_(conf.getParameter<edm::InputTag>("castorRecHitCollectionTag"))
13 {
14 }
15 
16 
17 namespace CastorHitAnalyzerImpl {
18  template<class Collection>
19  void analyze(edm::Event const& e, CaloHitAnalyzer & analyzer, edm::InputTag& tag) {
21  e.getByLabel(tag, recHits);
22  if (!recHits.isValid()) {
23  edm::LogError("CastorHitAnalyzer") << "Could not find Castor RecHitContainer ";
24  } else {
25  for(unsigned i = 0 ; i < recHits->size(); ++i) {
26  analyzer.analyze((*recHits)[i].id().rawId(), (*recHits)[i].energy());
27  }
28  }
29  }
30 }
31 
32 
35 e.getByLabel("mix", "g4SimHitsCastorFI", castorcf);
36 
37 
38  // access to SimHits
39 std::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(castorcf.product()));
41  CastorHitAnalyzerImpl::analyze<CastorRecHitCollection>(e, castorAnalyzer_, castorRecHitCollectionTag_);
42  }
43 
44 
45 
CastorHitAnalyzer(edm::ParameterSet const &conf)
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)
void analyze(edm::Event const &e, CaloHitAnalyzer &analyzer, edm::InputTag &tag)
edm::InputTag castorRecHitCollectionTag_
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:361
CaloHitAnalyzer castorAnalyzer_
tuple conf
Definition: dbtoconf.py:185
T const * product() const
Definition: Handle.h:74