CMS 3D CMS Logo

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 
18  template<class Collection>
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::unique_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)
void analyze(int detId, double recEnergy)
to be called for each RecHit
void analyze(edm::Event const &e, edm::EventSetup const &c) override
edm::InputTag castorRecHitCollectionTag_
void fillHits(MixCollection< PCaloHit > &hits)
should be called each event
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:475
CaloHitAnalyzer castorAnalyzer_
T const * product() const
Definition: Handle.h:81
HLT enums.