1111#include " FWCore/Framework/interface/DelayedReader.h"
1212#include " FWCore/Framework/interface/TransitionInfoTypes.h"
1313#include " FWCore/Framework/interface/ProductProvenanceRetriever.h"
14+ #include " FWCore/ServiceRegistry/interface/CurrentModuleOnThread.h"
1415#include " DataFormats/Provenance/interface/BranchKey.h"
1516#include " DataFormats/Provenance/interface/ParentageRegistry.h"
1617#include " FWCore/MessageLogger/interface/MessageLogger.h"
@@ -176,11 +177,15 @@ namespace edm {
176177 // The file may already be closed so the reader is invalid
177178 return ;
178179 }
179- if (mcc and branchType == InEvent and aux_) {
180- aux_->preModuleDelayedGetSignal_ .emit (*(mcc->getStreamContext ()), *mcc);
180+ auto context = mcc;
181+ if (!context) {
182+ context = CurrentModuleOnThread::getCurrentModuleOnThread ();
183+ }
184+ if (context and branchType == InEvent and aux_) {
185+ aux_->preModuleDelayedGetSignal_ .emit (*(context->getStreamContext ()), *context);
181186 }
182187
183- auto sentry (make_sentry (mcc , [this , branchType](ModuleCallingContext const * iContext) {
188+ auto sentry (make_sentry (context , [this , branchType](ModuleCallingContext const * iContext) {
184189 if (branchType == InEvent and aux_) {
185190 aux_->postModuleDelayedGetSignal_ .emit (*(iContext->getStreamContext ()), *iContext);
186191 }
@@ -194,13 +199,13 @@ namespace edm {
194199 if (not productResolved ()) {
195200 try {
196201 // another thread could have beaten us here
197- setProduct (reader->getProduct (productDescription ().branchID (), &principal, mcc ));
202+ setProduct (reader->getProduct (productDescription ().branchID (), &principal, context ));
198203 } catch (cms::Exception& e) {
199- extendException (e, productDescription (), mcc );
204+ extendException (e, productDescription (), context );
200205 throw ;
201206 } catch (std::exception const & e) {
202207 auto newExcept = edm::Exception (errors::StdException) << e.what ();
203- extendException (newExcept, productDescription (), mcc );
208+ extendException (newExcept, productDescription (), context );
204209 throw newExcept;
205210 }
206211 }
0 commit comments