CMS 3D CMS Logo

CastorHitAnalyzer.cc
Go to the documentation of this file.
4 #include <iostream>
5 
7  : hitReadoutName_("CastorHits"),
8  simParameterMap_(),
9  castorFilter_(),
10  castorAnalyzer_("CASTOR", 1., &simParameterMap_, &castorFilter_),
11  castorRecHitCollectionTag_(conf.getParameter<edm::InputTag>("castorRecHitCollectionTag")) {}
12 
14  template <class Collection>
17  e.getByLabel(tag, recHits);
18  if (!recHits.isValid()) {
19  edm::LogError("CastorHitAnalyzer") << "Could not find Castor RecHitContainer ";
20  } else {
21  for (unsigned i = 0; i < recHits->size(); ++i) {
22  analyzer.analyze((*recHits)[i].id().rawId(), (*recHits)[i].energy());
23  }
24  }
25  }
26 } // namespace CastorHitAnalyzerImpl
27 
30  e.getByLabel("mix", "g4SimHitsCastorFI", castorcf);
31 
32  // access to SimHits
33  std::unique_ptr<MixCollection<PCaloHit>> hits(new MixCollection<PCaloHit>(castorcf.product()));
35  CastorHitAnalyzerImpl::analyze<CastorRecHitCollection>(e, castorAnalyzer_, castorRecHitCollectionTag_);
36 }
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:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
CaloHitAnalyzer castorAnalyzer_
T const * product() const
Definition: Handle.h:69
HLT enums.