CMS 3D CMS Logo

CastorHitAnalyzer.cc
Go to the documentation of this file.
1 
16 
17 #include <iostream>
18 #include <string>
19 
21 public:
22  explicit CastorHitAnalyzer(edm::ParameterSet const &conf);
23  void analyze(edm::Event const &e, edm::EventSetup const &c) override;
24 
25 private:
32 };
33 
35  : hitReadoutName_("CastorHits"),
36  simParameterMap_(),
37  castorFilter_(),
38  castorAnalyzer_("CASTOR", 1., &simParameterMap_, &castorFilter_),
39  castorRecHitToken_(
40  consumes<CastorRecHitCollection>(conf.getParameter<edm::InputTag>("castorRecHitCollectionTag"))),
41  castorcfToken_(consumes<CrossingFrame<PCaloHit>>(edm::InputTag("mix", "g4SimHitsCastorFI"))) {}
42 
44  template <class Collection>
46  const edm::Handle<Collection> &recHits = e.getHandle(token);
47  if (!recHits.isValid()) {
48  edm::LogError("CastorHitAnalyzer") << "Could not find Castor RecHitContainer ";
49  } else {
50  for (unsigned i = 0; i < recHits->size(); ++i) {
51  analyzer.analyze((*recHits)[i].id().rawId(), (*recHits)[i].energy());
52  }
53  }
54  }
55 } // namespace CastorHitAnalyzerImpl
56 
58  const edm::Handle<CrossingFrame<PCaloHit>> &castorcf = e.getHandle(castorcfToken_);
59 
60  // access to SimHits
61  std::unique_ptr<MixCollection<PCaloHit>> hits(new MixCollection<PCaloHit>(castorcf.product()));
63  CastorHitAnalyzerImpl::analyze<CastorRecHitCollection>(e, castorAnalyzer_, castorRecHitToken_);
64 }
65 
67 
CastorHitAnalyzer(edm::ParameterSet const &conf)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
T const * product() const
Definition: Handle.h:70
Log< level::Error, false > LogError
CastorHitFilter castorFilter_
void analyze(edm::Event const &e, edm::EventSetup const &c) override
void fillHits(MixCollection< PCaloHit > &hits)
should be called each event
CastorSimParameterMap simParameterMap_
CaloHitAnalyzer castorAnalyzer_
const edm::EDGetTokenT< CrossingFrame< PCaloHit > > castorcfToken_
std::string hitReadoutName_
const edm::EDGetTokenT< CastorRecHitCollection > castorRecHitToken_
void analyze(edm::Event const &e, CaloHitAnalyzer &analyzer, const edm::EDGetTokenT< Collection > &token)
HLT enums.