@@ -68,13 +68,13 @@ namespace edm {
6868 // Here we make the trigger results inserter directly. This should
6969 // probably be a utility in the WorkerRegistry or elsewhere.
7070
71- std::shared_ptr<TriggerResultInserter> makeInserter (
72- ParameterSet& proc_pset ,
73- PreallocationConfiguration const & iPrealloc ,
74- SignallingProductRegistryFiller& preg ,
75- ExceptionToActionTable const & actions ,
76- std::shared_ptr<ActivityRegistry> areg ,
77- std::shared_ptr<ProcessConfiguration const > processConfiguration ) {
71+ std::shared_ptr<TriggerResultInserter> makeInserter (ParameterSet& proc_pset,
72+ PreallocationConfiguration const & iPrealloc ,
73+ SignallingProductRegistryFiller& preg ,
74+ ExceptionToActionTable const & actions ,
75+ std::shared_ptr<ActivityRegistry> areg ,
76+ std::shared_ptr<ProcessConfiguration const > processConfiguration ,
77+ ModuleRegistry& moduleRegistry ) {
7878 ParameterSet* trig_pset = proc_pset.getPSetForUpdate (" @trigger_paths" );
7979 trig_pset->registerIt ();
8080
@@ -85,27 +85,13 @@ namespace edm {
8585 processConfiguration.get (),
8686 ModuleDescription::getUniqueID ());
8787
88- areg->preModuleConstructionSignal_ (md);
89- bool postCalled = false ;
90- std::shared_ptr<TriggerResultInserter> returnValue;
91- // Caught exception is rethrown
92- CMS_SA_ALLOW try {
93- auto module = make_shared_noexcept_false<TriggerResultInserter>(*trig_pset, iPrealloc.numberOfStreams ());
94- maker::ModuleHolderT<TriggerResultInserter::ModuleType>::finishModuleInitialization (
95- *module , md, iPrealloc, &preg);
96- returnValue = module ;
97- postCalled = true ;
98- // if exception then post will be called in the catch block
99- areg->postModuleConstructionSignal_ (md);
100- } catch (...) {
101- if (!postCalled) {
102- CMS_SA_ALLOW try { areg->postModuleConstructionSignal_ (md); } catch (...) {
103- // If post throws an exception ignore it because we are already handling another exception
104- }
105- }
106- throw ;
107- }
108- return returnValue;
88+ return moduleRegistry.makeExplicitModule <TriggerResultInserter>(md,
89+ iPrealloc,
90+ &preg,
91+ areg->preModuleConstructionSignal_ ,
92+ areg->postModuleConstructionSignal_ ,
93+ *trig_pset,
94+ iPrealloc.numberOfStreams ());
10995 }
11096
11197 template <typename T>
@@ -115,6 +101,7 @@ namespace edm {
115101 SignallingProductRegistryFiller& preg,
116102 std::shared_ptr<ActivityRegistry> areg,
117103 std::shared_ptr<ProcessConfiguration const > processConfiguration,
104+ ModuleRegistry& moduleRegistry,
118105 std::string const & moduleTypeName) {
119106 ParameterSet pset;
120107 pset.addParameter <std::string>(" @module_type" , moduleTypeName);
@@ -126,25 +113,13 @@ namespace edm {
126113 for (auto const & pathName : pathNames) {
127114 ModuleDescription md (
128115 pset.id (), moduleTypeName, pathName, processConfiguration.get (), ModuleDescription::getUniqueID ());
129-
130- areg->preModuleConstructionSignal_ (md);
131- bool postCalled = false ;
132- // Caught exception is rethrown
133- CMS_SA_ALLOW try {
134- auto module = make_shared_noexcept_false<T>(iPrealloc.numberOfStreams ());
135- maker::ModuleHolderT<typename T::ModuleType>::finishModuleInitialization (*module , md, iPrealloc, &preg);
136- pathStatusInserters.emplace_back (module );
137- postCalled = true ;
138- // if exception then post will be called in the catch block
139- areg->postModuleConstructionSignal_ (md);
140- } catch (...) {
141- if (!postCalled) {
142- CMS_SA_ALLOW try { areg->postModuleConstructionSignal_ (md); } catch (...) {
143- // If post throws an exception ignore it because we are already handling another exception
144- }
145- }
146- throw ;
147- }
116+ auto module = moduleRegistry.makeExplicitModule <T>(md,
117+ iPrealloc,
118+ &preg,
119+ areg->preModuleConstructionSignal_ ,
120+ areg->postModuleConstructionSignal_ ,
121+ iPrealloc.numberOfStreams ());
122+ pathStatusInserters.emplace_back (std::move (module ));
148123 }
149124 }
150125
@@ -494,10 +469,11 @@ namespace edm {
494469 ProcessContext const * processContext,
495470 ModuleTypeResolverMaker const * resolverMaker)
496471 : // Only create a resultsInserter if there is a trigger path
497- resultsInserter_{tns.getTrigPaths ().empty ()
498- ? std::shared_ptr<TriggerResultInserter>{}
499- : makeInserter (proc_pset, prealloc, preg, actions, areg, processConfiguration)},
500472 moduleRegistry_ (std::make_shared<ModuleRegistry>(resolverMaker)),
473+ resultsInserter_{
474+ tns.getTrigPaths ().empty ()
475+ ? std::shared_ptr<TriggerResultInserter>{}
476+ : makeInserter (proc_pset, prealloc, preg, actions, areg, processConfiguration, *moduleRegistry_)},
501477 all_output_communicators_ (),
502478 preallocConfig_ (prealloc),
503479 pathNames_ (&tns.getTrigPaths()),
@@ -509,6 +485,7 @@ namespace edm {
509485 preg,
510486 areg,
511487 processConfiguration,
488+ *moduleRegistry_,
512489 std::string (" PathStatusInserter" ));
513490
514491 if (endPathNames_->size () > 1 ) {
@@ -518,6 +495,7 @@ namespace edm {
518495 preg,
519496 areg,
520497 processConfiguration,
498+ *moduleRegistry_,
521499 std::string (" EndPathStatusInserter" ));
522500 }
523501
@@ -539,8 +517,6 @@ namespace edm {
539517 processContext));
540518 }
541519
542- // TriggerResults are injected automatically by StreamSchedules and are
543- // unknown to the ModuleRegistry
544520 const std::string kTriggerResults (" TriggerResults" );
545521 std::vector<std::string> modulesToUse;
546522 modulesToUse.reserve (streamSchedules_[0 ]->allWorkersLumisAndEvents ().size ());
0 commit comments