From 0dab1ebc1cac1af386c39749f8c3958f747caf83 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 25 Aug 2022 14:47:31 -0500 Subject: [PATCH] Declare production of Track collection after TrackExtra collection This change works around a rare scheduling bug in the framework when these modules are run as scheduled, see https://github.com/cms-sw/cmssw/issues/39064 --- RecoMuon/L2MuonProducer/plugins/L2MuonProducer.cc | 7 +++++-- RecoMuon/L3MuonProducer/src/L3MuonProducer.cc | 10 ++++++++-- .../PixelTrackFitting/plugins/PixelTrackProducer.cc | 5 ++++- .../plugins/PixelTrackProducerFromSoA.cc | 5 ++++- .../plugins/AnalyticalTrackSelector.cc | 5 ++++- .../FinalTrackSelectors/plugins/TrackListMerger.cc | 8 ++++++-- RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc | 5 ++++- RecoTracker/TrackProducer/plugins/TrackProducer.cc | 5 ++++- 8 files changed, 39 insertions(+), 11 deletions(-) diff --git a/RecoMuon/L2MuonProducer/plugins/L2MuonProducer.cc b/RecoMuon/L2MuonProducer/plugins/L2MuonProducer.cc index 8ab7e9047d06e..6e4a7a5f624b0 100644 --- a/RecoMuon/L2MuonProducer/plugins/L2MuonProducer.cc +++ b/RecoMuon/L2MuonProducer/plugins/L2MuonProducer.cc @@ -111,10 +111,13 @@ L2MuonProducer::L2MuonProducer(const edm::ParameterSet& parameterSet) { std::make_unique(true), iC); - produces(); - produces("UpdatedAtVtx"); produces(); produces(); + // TrackCollection refers to TrackingRechit and TrackExtra + // collections, need to declare its production after them to work + // around a rare race condition in framework scheduling + produces(); + produces("UpdatedAtVtx"); produces(); produces>(); diff --git a/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc b/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc index 9ebc80f4e5c49..0542b51f97d39 100644 --- a/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc +++ b/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc @@ -63,15 +63,21 @@ L3MuonProducer::L3MuonProducer(const ParameterSet& parameterSet) { theL2SeededTkLabel = trackLoaderParameters.getUntrackedParameter("MuonSeededTracksInstance", std::string()); - produces(theL2SeededTkLabel); produces(theL2SeededTkLabel); produces(theL2SeededTkLabel); + // TrackCollection refers to TrackingRechit and TrackExtra + // collections, need to declare its production after them to work + // around a rare race condition in framework scheduling + produces(theL2SeededTkLabel); produces>(theL2SeededTkLabel); produces(theL2SeededTkLabel); - produces(); produces(); produces(); + // TrackCollection refers to TrackingRechit and TrackExtra + // collections, need to declare its production after them to work + // around a rare race condition in framework scheduling + produces(); produces>(); produces(); diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.cc index 96571c998b180..79f45a6ad3d79 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.cc @@ -38,9 +38,12 @@ class PixelTrackProducer : public edm::stream::EDProducer<> { explicit PixelTrackProducer(const edm::ParameterSet& cfg) : theReconstruction(cfg, consumesCollector()), htTopoToken_(esConsumes()) { edm::LogInfo("PixelTrackProducer") << " construction..."; - produces(); produces(); produces(); + // TrackCollection refers to TrackingRechit and TrackExtra + // collections, need to declare its production after them to work + // around a rare race condition in framework scheduling + produces(); } ~PixelTrackProducer() override = default; diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc index 5796c4bea503c..59ba877e9e626 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc @@ -82,9 +82,12 @@ PixelTrackProducerFromSoA::PixelTrackProducerFromSoA(const edm::ParameterSet &iC throw cms::Exception("PixelTrackConfiguration") << iConfig.getParameter("minQuality") + " not supported"; } - produces(); produces(); produces(); + // TrackCollection refers to TrackingRechit and TrackExtra + // collections, need to declare its production after them to work + // around a rare race condition in framework scheduling + produces(); produces(); } diff --git a/RecoTracker/FinalTrackSelectors/plugins/AnalyticalTrackSelector.cc b/RecoTracker/FinalTrackSelectors/plugins/AnalyticalTrackSelector.cc index 4cf398f4b80af..23ec80416ac60 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/AnalyticalTrackSelector.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/AnalyticalTrackSelector.cc @@ -217,7 +217,6 @@ AnalyticalTrackSelector::AnalyticalTrackSelector(const edm::ParameterSet& cfg) : } std::string alias(cfg.getParameter("@module_label")); - produces().setBranchAlias(alias + "Tracks"); if (copyExtras_) { produces().setBranchAlias(alias + "TrackExtras"); produces().setBranchAlias(alias + "RecHits"); @@ -226,6 +225,10 @@ AnalyticalTrackSelector::AnalyticalTrackSelector(const edm::ParameterSet& cfg) : produces>().setBranchAlias(alias + "Trajectories"); produces().setBranchAlias(alias + "TrajectoryTrackAssociations"); } + // TrackCollection refers to TrackingRechit and TrackExtra + // collections, need to declare its production after them to work + // around a rare race condition in framework scheduling + produces().setBranchAlias(alias + "Tracks"); } AnalyticalTrackSelector::~AnalyticalTrackSelector() {} diff --git a/RecoTracker/FinalTrackSelectors/plugins/TrackListMerger.cc b/RecoTracker/FinalTrackSelectors/plugins/TrackListMerger.cc index 3be2d7e3db08a..caa8dda515fb3 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/TrackListMerger.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/TrackListMerger.cc @@ -276,8 +276,6 @@ TrackListMerger::TrackListMerger(edm::ParameterSet const& conf) { produces>(); produces("QualityMasks"); } else { - produces(); - makeReKeyedSeeds_ = conf.getUntrackedParameter("makeReKeyedSeeds", false); if (makeReKeyedSeeds_) { copyExtras_ = true; @@ -288,6 +286,12 @@ TrackListMerger::TrackListMerger(edm::ParameterSet const& conf) { produces(); produces(); } + + // TrackCollection refers to TrackingRechit and TrackExtra + // collections, need to declare its production after them to work + // around a rare race condition in framework scheduling + produces(); + produces>(); produces(); } diff --git a/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc b/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc index 457f6af4998cd..aaebab166fdfa 100644 --- a/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc +++ b/RecoTracker/TrackProducer/plugins/GsfTrackProducer.cc @@ -36,10 +36,13 @@ GsfTrackProducer::GsfTrackProducer(const edm::ParameterSet& iConfig) // string a = alias_; // a.erase(a.size()-6,a.size()); //register your products - produces().setBranchAlias(alias_ + "GsfTracks"); produces().setBranchAlias(alias_ + "TrackExtras"); produces().setBranchAlias(alias_ + "GsfTrackExtras"); produces().setBranchAlias(alias_ + "RecHits"); + // GsfTrackCollection refers to TrackingRechit, TrackExtra, and + // GsfTrackExtra collections, need to declare its production after + // them to work around a rare race condition in framework scheduling + produces().setBranchAlias(alias_ + "GsfTracks"); produces >(); produces(); } diff --git a/RecoTracker/TrackProducer/plugins/TrackProducer.cc b/RecoTracker/TrackProducer/plugins/TrackProducer.cc index 2b31cb49f6741..ea5fa655e4a8a 100644 --- a/RecoTracker/TrackProducer/plugins/TrackProducer.cc +++ b/RecoTracker/TrackProducer/plugins/TrackProducer.cc @@ -32,9 +32,12 @@ TrackProducer::TrackProducer(const edm::ParameterSet& iConfig) } //register your products - produces().setBranchAlias(alias_ + "Tracks"); produces().setBranchAlias(alias_ + "TrackExtras"); produces().setBranchAlias(alias_ + "RecHits"); + // TrackCollection refers to TrackingRechit and TrackExtra + // collections, need to declare its production after them to work + // around a rare race condition in framework scheduling + produces().setBranchAlias(alias_ + "Tracks"); produces >(); produces >(); produces();