Skip to content

Commit

Permalink
Merge pull request #37047 from bsunanda/Phase2-gem67
Browse files Browse the repository at this point in the history
Phase2-gem67 Small cleanup of a test analyzer in Geometry/GEMGeometry
  • Loading branch information
cmsbuild authored Feb 26, 2022
2 parents 942cf0f + 776dbee commit a727189
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions Geometry/GEMGeometry/test/GEMDetIdAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@ class GEMDetIdAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
void endRun(edm::Run const&, edm::EventSetup const&) override {}

private:
edm::EDGetToken gemRecHit_, me0RecHit_;
bool newGEM_;
const edm::EDGetToken gemRecHit_, me0RecHit_;
const bool newGEM_;
};

GEMDetIdAnalyzer::GEMDetIdAnalyzer(const edm::ParameterSet& iConfig) {
gemRecHit_ = consumes<GEMRecHitCollection>(iConfig.getParameter<edm::InputTag>("gemInputLabel"));
me0RecHit_ = consumes<ME0RecHitCollection>(iConfig.getParameter<edm::InputTag>("me0InputLabel"));
newGEM_ = iConfig.getParameter<bool>("newGEMDetID");
}
GEMDetIdAnalyzer::GEMDetIdAnalyzer(const edm::ParameterSet& iConfig)
: gemRecHit_(consumes<GEMRecHitCollection>(iConfig.getParameter<edm::InputTag>("gemInputLabel"))),
me0RecHit_(consumes<ME0RecHitCollection>(iConfig.getParameter<edm::InputTag>("me0InputLabel"))),
newGEM_(iConfig.getParameter<bool>("newGEMDetID")) {}

void GEMDetIdAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
Expand All @@ -51,8 +50,7 @@ void GEMDetIdAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descript
}

void GEMDetIdAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {
edm::Handle<GEMRecHitCollection> gemRecHits;
iEvent.getByToken(gemRecHit_, gemRecHits);
const edm::Handle<GEMRecHitCollection>& gemRecHits = iEvent.getHandle(gemRecHit_);
if (!gemRecHits.isValid()) {
edm::LogError("GEMAnalysis") << "GEM RecHit is not valid";
} else {
Expand All @@ -65,8 +63,7 @@ void GEMDetIdAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const&
}
}

edm::Handle<ME0RecHitCollection> me0RecHits;
iEvent.getByToken(me0RecHit_, me0RecHits);
const edm::Handle<ME0RecHitCollection>& me0RecHits = iEvent.getHandle(me0RecHit_);
if (!me0RecHits.isValid()) {
edm::LogError("GEMAnalysis") << "ME0 RecHit is not valid";
} else {
Expand Down

0 comments on commit a727189

Please sign in to comment.