Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate rest of MuonIdProducer to EventSetup consumes #31762

Merged
merged 1 commit into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion RecoMuon/MuonIdentification/interface/MuonShowerDigiFiller.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
Expand All @@ -36,6 +35,7 @@

#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"

#include "DataFormats/MuonReco/interface/MuonChamberMatch.h"
#include "TrackingTools/TrackAssociator/interface/TAMuonChamberMatch.h"
Expand All @@ -60,6 +60,9 @@ class MuonShowerDigiFiller {
edm::EDGetTokenT<DTDigiCollection> m_dtDigisToken;
edm::EDGetTokenT<CSCStripDigiCollection> m_cscDigisToken;

edm::ESGetToken<DTGeometry, MuonGeometryRecord> m_dtGeometryToken;
edm::ESGetToken<CSCGeometry, MuonGeometryRecord> m_cscGeometryToken;

edm::ESHandle<DTGeometry> m_dtGeometry;
edm::ESHandle<CSCGeometry> m_cscGeometry;

Expand Down
13 changes: 5 additions & 8 deletions RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@

#include "RecoMuon/MuonIdentification/interface/MuonKinkFinder.h"

MuonIdProducer::MuonIdProducer(const edm::ParameterSet& iConfig) {
MuonIdProducer::MuonIdProducer(const edm::ParameterSet& iConfig)
: geomTokenRun_(esConsumes<edm::Transition::BeginRun>()),
propagatorToken_(esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))) {
LogTrace("MuonIdentification") << "RecoMuon/MuonIdProducer :: Constructor called";

produces<reco::MuonCollection>();
Expand Down Expand Up @@ -195,9 +197,7 @@ void MuonIdProducer::init(edm::Event& iEvent, const edm::EventSetup& iSetup) {
pickyCollectionHandle_.clear();
dytCollectionHandle_.clear();

edm::ESHandle<Propagator> propagator;
iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny", propagator);
trackAssociator_.setPropagator(propagator.product());
trackAssociator_.setPropagator(&iSetup.getData(propagatorToken_));

if (fillTrackerKink_)
trackerKinkFinder_->init(iSetup);
Expand Down Expand Up @@ -411,10 +411,7 @@ int MuonIdProducer::overlap(const reco::Muon& muon, const reco::Track& track) {
}

void MuonIdProducer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
edm::ESHandle<CSCGeometry> geomHandle;
iSetup.get<MuonGeometryRecord>().get(geomHandle);

meshAlgo_->setCSCGeometry(geomHandle.product());
meshAlgo_->setCSCGeometry(&iSetup.getData(geomTokenRun_));

if (fillShowerDigis_ && fillMatching_)
theShowerDigiFiller_->getES(iSetup);
Expand Down
3 changes: 3 additions & 0 deletions RecoMuon/MuonIdentification/plugins/MuonIdProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ class MuonIdProducer : public edm::stream::EDProducer<> {
edm::Handle<RPCRecHitCollection> rpcHitHandle_;
edm::Handle<edm::ValueMap<reco::MuonQuality> > glbQualHandle_;

const edm::ESGetToken<CSCGeometry, MuonGeometryRecord> geomTokenRun_;
const edm::ESGetToken<Propagator, TrackingComponentsRecord> propagatorToken_;

MuonCaloCompatibility muonCaloCompatibility_;
std::unique_ptr<reco::isodeposit::IsoDepositExtractor> muIsoExtractorCalo_;
std::unique_ptr<reco::isodeposit::IsoDepositExtractor> muIsoExtractorTrack_;
Expand Down
10 changes: 5 additions & 5 deletions RecoMuon/MuonIdentification/src/MuonShowerDigiFiller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
// user include files
#include "RecoMuon/MuonIdentification/interface/MuonShowerDigiFiller.h"

#include "Geometry/Records/interface/MuonGeometryRecord.h"

//
// constructors and destructor
//
Expand All @@ -30,15 +28,17 @@ MuonShowerDigiFiller::MuonShowerDigiFiller(const edm::ParameterSet& iConfig, edm
: m_digiMaxDistanceX(iConfig.getParameter<double>("digiMaxDistanceX")),
m_dtDigisToken(iC.consumes<DTDigiCollection>(iConfig.getParameter<edm::InputTag>("dtDigiCollectionLabel"))),
m_cscDigisToken(
iC.consumes<CSCStripDigiCollection>(iConfig.getParameter<edm::InputTag>("cscDigiCollectionLabel"))) {}
iC.consumes<CSCStripDigiCollection>(iConfig.getParameter<edm::InputTag>("cscDigiCollectionLabel"))),
m_dtGeometryToken(iC.esConsumes<edm::Transition::BeginRun>()),
m_cscGeometryToken(iC.esConsumes<edm::Transition::BeginRun>()) {}

//
// member functions
//

void MuonShowerDigiFiller::getES(const edm::EventSetup& iSetup) {
iSetup.get<MuonGeometryRecord>().get(m_dtGeometry);
iSetup.get<MuonGeometryRecord>().get(m_cscGeometry);
m_dtGeometry = iSetup.getHandle(m_dtGeometryToken);
m_cscGeometry = iSetup.getHandle(m_cscGeometryToken);
}

void MuonShowerDigiFiller::getDigis(edm::Event& iEvent) {
Expand Down