57 using std::placeholders::_1;
59 bool binary_search_string(std::vector<std::string>
const&
v,
std::string const&
s) {
60 return std::binary_search(v.begin(), v.end(),
s);
66 std::shared_ptr<TriggerResultInserter> makeInserter(
ParameterSet& proc_pset,
67 PreallocationConfiguration
const& iPrealloc,
68 ProductRegistry&
preg,
69 ExceptionToActionTable
const&
actions,
70 std::shared_ptr<ActivityRegistry>
areg,
72 ParameterSet* trig_pset = proc_pset.getPSetForUpdate(
"@trigger_paths");
73 trig_pset->registerIt();
75 WorkerParams work_args(trig_pset, preg, &iPrealloc, processConfiguration, actions);
76 ModuleDescription md(trig_pset->id(),
77 "TriggerResultInserter",
79 processConfiguration.get(),
82 areg->preModuleConstructionSignal_(md);
83 bool postCalled =
false;
84 std::shared_ptr<TriggerResultInserter> returnValue;
87 maker::ModuleHolderT<TriggerResultInserter> holder(
88 make_shared_noexcept_false<TriggerResultInserter>(*trig_pset, iPrealloc.numberOfStreams()),
89 static_cast<Maker const*>(
nullptr));
90 holder.setModuleDescription(md);
91 holder.registerProductsAndCallbacks(&preg);
92 returnValue = holder.module();
95 areg->postModuleConstructionSignal_(md);
98 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
107 template <
typename T>
109 std::vector<std::string>
const& pathNames,
110 PreallocationConfiguration
const& iPrealloc,
111 ProductRegistry& preg,
112 std::shared_ptr<ActivityRegistry> areg,
113 std::shared_ptr<ProcessConfiguration> processConfiguration,
116 pset.addParameter<
std::string>(
"@module_type", moduleTypeName);
117 pset.addParameter<
std::string>(
"@module_edm_type",
"EDProducer");
120 pathStatusInserters.reserve(pathNames.size());
122 for (
auto const&
pathName : pathNames) {
123 ModuleDescription md(
126 areg->preModuleConstructionSignal_(md);
127 bool postCalled =
false;
130 maker::ModuleHolderT<T> holder(make_shared_noexcept_false<T>(iPrealloc.numberOfStreams()),
131 static_cast<Maker const*>(
nullptr));
132 holder.setModuleDescription(md);
133 holder.registerProductsAndCallbacks(&preg);
134 pathStatusInserters.emplace_back(holder.module());
137 areg->postModuleConstructionSignal_(md);
140 CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); }
catch (...) {
149 void checkAndInsertAlias(
std::string const& friendlyClassName,
155 ProductRegistry
const& preg,
156 std::multimap<BranchKey, BranchKey>& aliasMap,
157 std::map<BranchKey, BranchKey>& aliasKeys) {
160 BranchKey
key(friendlyClassName, moduleLabel, productInstanceName, processName);
161 if (preg.productList().find(
key) == preg.productList().end()) {
164 for (
auto const& product : preg.productList()) {
165 if (moduleLabel == product.first.moduleLabel() && processName == product.first.processName()) {
167 <<
"There are no products of type '" << friendlyClassName <<
"'\n"
168 <<
"with module label '" << moduleLabel <<
"' and instance name '" << productInstanceName <<
"'.\n";
173 if (
auto iter = aliasMap.find(
key); iter != aliasMap.end()) {
175 if (iter->second.moduleLabel() ==
alias) {
177 <<
"The module label alias '" << alias <<
"' is used for multiple products of type '" << friendlyClassName
178 <<
"' with module label '" << moduleLabel <<
"' and instance name '" << productInstanceName
179 <<
"'. One alias has the instance name '" << iter->first.productInstanceName()
180 <<
"' and the other has the instance name '" << instanceAlias <<
"'.";
184 std::string const& theInstanceAlias(instanceAlias == star ? productInstanceName : instanceAlias);
185 BranchKey aliasKey(friendlyClassName, alias, theInstanceAlias, processName);
186 if (preg.productList().find(aliasKey) != preg.productList().end()) {
188 <<
"A product of type '" << friendlyClassName <<
"'\n"
189 <<
"with module label '" << alias <<
"' and instance name '" << theInstanceAlias <<
"'\n"
190 <<
"already exists.\n";
192 auto iter = aliasKeys.find(aliasKey);
193 if (iter != aliasKeys.end()) {
195 if (iter->second !=
key) {
197 <<
"The module label alias '" << alias <<
"' and product instance alias '" << theInstanceAlias <<
"'\n"
198 <<
"are used for multiple products of type '" << friendlyClassName <<
"'\n"
199 <<
"One has module label '" << moduleLabel <<
"' and product instance name '" << productInstanceName
201 <<
"the other has module label '" << iter->second.moduleLabel() <<
"' and product instance name '"
202 << iter->second.productInstanceName() <<
"'.\n";
205 auto prodIter = preg.productList().find(
key);
206 if (prodIter != preg.productList().end()) {
207 if (!prodIter->second.produced()) {
209 <<
"The module label alias '" << alias <<
"' and product instance alias '" << theInstanceAlias <<
"'\n"
210 <<
"are used for a product of type '" << friendlyClassName <<
"'\n"
211 <<
"with module label '" << moduleLabel <<
"' and product instance name '" << productInstanceName
213 <<
"An EDAlias can only be used for products produced in the current process. This one is not.\n";
215 aliasMap.insert(std::make_pair(
key, aliasKey));
216 aliasKeys.insert(std::make_pair(aliasKey,
key));
222 std::vector<std::string>
aliases = proc_pset.getParameter<std::vector<std::string>>(
"@all_aliases");
223 if (aliases.empty()) {
230 desc.add<
std::string>(
"fromProductInstance", star);
233 std::multimap<BranchKey, BranchKey> aliasMap;
235 std::map<BranchKey, BranchKey> aliasKeys;
238 std::multimap<std::string, BranchKey> moduleLabelToBranches;
239 for (
auto const& prod : preg.productList()) {
240 if (processName == prod.second.processName()) {
241 moduleLabelToBranches.emplace(prod.first.moduleLabel(), prod.first);
247 ParameterSet const& aliasPSet = proc_pset.getParameterSet(alias);
248 std::vector<std::string> vPSetNames = aliasPSet.getParameterNamesForType<
VParameterSet>();
249 for (
std::string const& moduleLabel : vPSetNames) {
257 if (friendlyClassName == star) {
258 bool processHasLabel =
false;
260 for (
auto it = moduleLabelToBranches.lower_bound(moduleLabel);
261 it != moduleLabelToBranches.end() && it->first == moduleLabel;
263 processHasLabel =
true;
264 if (productInstanceName != star and productInstanceName != it->second.productInstanceName()) {
269 checkAndInsertAlias(it->second.friendlyClassName(),
271 it->second.productInstanceName(),
279 if (not match and processHasLabel) {
285 <<
"There are no products with module label '" << moduleLabel <<
"' and product instance name '"
286 << productInstanceName <<
"'.\n";
288 }
else if (productInstanceName == star) {
290 BranchKey lowerBound(friendlyClassName, moduleLabel,
empty,
empty);
291 for (ProductRegistry::ProductList::const_iterator it = preg.productList().lower_bound(lowerBound);
292 it != preg.productList().end() && it->first.friendlyClassName() == friendlyClassName &&
293 it->first.moduleLabel() == moduleLabel;
300 checkAndInsertAlias(friendlyClassName,
302 it->first.productInstanceName(),
313 for (
auto const& product : preg.productList()) {
314 if (moduleLabel == product.first.moduleLabel() && processName == product.first.processName()) {
316 <<
"There are no products of type '" << friendlyClassName <<
"'\n"
317 <<
"with module label '" << moduleLabel <<
"'.\n";
322 checkAndInsertAlias(friendlyClassName,
337 for (
auto const& aliasEntry : aliasMap) {
338 ProductRegistry::ProductList::const_iterator it = preg.productList().find(aliasEntry.first);
339 assert(it != preg.productList().end());
340 preg.addLabelAlias(it->second, aliasEntry.second.moduleLabel(), aliasEntry.second.productInstanceName());
344 typedef std::vector<std::string>
vstring;
346 void processSwitchProducers(
ParameterSet const& proc_pset,
std::string const& processName, ProductRegistry& preg) {
348 struct BranchesCases {
349 BranchesCases(std::vector<std::string> cases) : caseLabels{
std::move(cases)} {}
350 std::vector<BranchKey> chosenBranches;
351 std::vector<std::string> caseLabels;
353 std::map<std::string, BranchesCases> switchMap;
354 for (
auto& prod : preg.productListUpdator()) {
355 if (prod.second.isSwitchAlias()) {
356 auto it = switchMap.find(prod.second.moduleLabel());
357 if (it == switchMap.end()) {
358 auto const& switchPSet = proc_pset.getParameter<
edm::ParameterSet>(prod.second.moduleLabel());
359 auto inserted = switchMap.emplace(prod.second.moduleLabel(),
360 switchPSet.getParameter<std::vector<std::string>>(
"@all_cases"));
366 for (
auto const& productIter : preg.productList()) {
367 BranchKey
const& branchKey = productIter.first;
376 BranchDescription
const& desc = productIter.second;
377 if (desc.branchType() == prod.second.branchType() and
378 desc.unwrappedTypeID().typeInfo() == prod.second.unwrappedTypeID().typeInfo() and
379 branchKey.moduleLabel() == prod.second.switchAliasModuleLabel() and
380 branchKey.productInstanceName() == prod.second.productInstanceName()) {
381 prod.second.setSwitchAliasForBranch(desc);
382 it->second.chosenBranches.push_back(prod.first);
388 ex <<
"Trying to find a BranchDescription to be aliased-for by SwitchProducer with\n"
389 <<
" friendly class name = " << prod.second.friendlyClassName() <<
"\n"
390 <<
" module label = " << prod.second.moduleLabel() <<
"\n"
391 <<
" product instance name = " << prod.second.productInstanceName() <<
"\n"
392 <<
" process name = " << processName
393 <<
"\n\nbut did not find any. Please contact a framework developer.";
394 ex.addContext(
"Calling Schedule.cc:processSwitchProducers()");
399 if (switchMap.empty())
402 for (
auto& elem : switchMap) {
403 std::sort(elem.second.chosenBranches.begin(), elem.second.chosenBranches.end());
407 std::map<std::string, std::vector<BranchKey>> caseBranches;
408 for (
auto const&
item : preg.productList()) {
412 if (
auto found =
std::find(caseLabels.begin(), caseLabels.end(),
item.first.moduleLabel());
413 found != caseLabels.end()) {
414 caseBranches[*
found].push_back(
item.first);
418 for (
auto const& caseLabel : caseLabels) {
419 ex <<
"Products for case " << caseLabel <<
" (friendly class name, product instance name):\n";
420 auto& branches = caseBranches[caseLabel];
421 std::sort(branches.begin(), branches.end());
422 for (
auto const& branch : branches) {
423 ex <<
" " << branch.friendlyClassName() <<
" " << branch.productInstanceName() <<
"\n";
430 std::vector<bool> foundBranches;
431 for (
auto const& switchItem : switchMap) {
432 auto const& switchLabel = switchItem.first;
433 auto const& chosenBranches = switchItem.second.chosenBranches;
434 auto const& caseLabels = switchItem.second.caseLabels;
435 foundBranches.resize(chosenBranches.size());
436 for (
auto const& caseLabel : caseLabels) {
437 std::fill(foundBranches.begin(), foundBranches.end(),
false);
438 for (
auto& nonConstItem : preg.productListUpdator()) {
439 auto const&
item = nonConstItem;
449 nonConstItem.second.setTransient(
true);
451 auto range = std::equal_range(chosenBranches.begin(),
452 chosenBranches.end(),
453 BranchKey(
item.first.friendlyClassName(),
455 item.first.productInstanceName(),
456 item.first.processName()));
459 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel <<
" with a product "
460 <<
item.first <<
" that is not produced by the chosen case "
462 .getUntrackedParameter<std::string>(
"@chosen_case")
463 <<
". If the intention is to produce only a subset of the products listed below, each case with "
464 "more products needs to be replaced with an EDAlias to only the necessary products, and the "
465 "EDProducer itself needs to be moved to a Task.\n\n";
466 addProductsToException(caseLabels, ex);
473 auto const&
bd =
item.second;
474 if (not bd.branchAliases().empty()) {
476 <<
"SwitchProducer does not support ROOT branch aliases. Got the following ROOT branch "
477 "aliases for SwitchProducer with label "
478 << switchLabel <<
" for case " << caseLabel <<
":";
479 for (
auto const& branchAlias : bd.branchAliases()) {
480 ex <<
" " << branchAlias;
487 for (
size_t i = 0;
i < chosenBranches.size();
i++) {
488 if (not foundBranches[
i]) {
490 .getUntrackedParameter<std::string>(
"@chosen_case");
492 ex <<
"SwitchProducer " << switchLabel <<
" has a case " << caseLabel
493 <<
" that does not produce a product " << chosenBranches[
i] <<
" that is produced by the chosen case "
495 <<
". If the intention is to produce only a subset of the products listed below, each case with more "
496 "products needs to be replaced with an EDAlias to only the necessary products, and the "
497 "EDProducer itself needs to be moved to a Task.\n\n";
498 addProductsToException(caseLabels, ex);
507 vstring const& end_path_name_list,
509 std::set<std::string>
const& usedModuleLabels,
524 std::string const moduleEdmType(
"@module_edm_type");
530 std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
534 vstring scheduledPaths = proc_pset.getParameter<
vstring>(
"@paths");
535 std::set<std::string> modulesOnPaths;
537 std::set<std::string> noEndPaths(scheduledPaths.begin(), scheduledPaths.end());
538 for (
auto const& endPath : end_path_name_list) {
539 noEndPaths.erase(endPath);
543 for (
auto const&
path : noEndPaths) {
545 modulesOnPaths.insert(labels.begin(), labels.end());
551 std::vector<std::string> labelsToBeDropped;
552 labelsToBeDropped.reserve(modulesInConfigSet.size());
554 modulesInConfigSet.end(),
555 usedModuleLabels.begin(),
556 usedModuleLabels.end(),
557 std::back_inserter(labelsToBeDropped));
559 const unsigned int sizeBeforeOutputModules = labelsToBeDropped.size();
560 for (
auto const& modLabel : usedModuleLabels) {
564 edmType = proc_pset.getParameterSet(modLabel).getParameter<
std::string>(moduleEdmType);
565 if (edmType == outputModule) {
566 outputModuleLabels.push_back(modLabel);
567 labelsToBeDropped.push_back(modLabel);
569 if (edmType == edAnalyzer) {
570 if (modulesOnPaths.end() == modulesOnPaths.find(modLabel)) {
571 labelsToBeDropped.push_back(modLabel);
578 labelsToBeDropped.begin(), labelsToBeDropped.begin() + sizeBeforeOutputModules, labelsToBeDropped.end());
584 vstring::iterator endAfterRemove =
585 std::remove_if(modulesInConfig.begin(),
586 modulesInConfig.end(),
587 std::bind(binary_search_string, std::ref(labelsToBeDropped), _1));
588 modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
594 for (vstring::const_iterator iEndPath = end_path_name_list.begin(), endEndPath = end_path_name_list.end();
595 iEndPath != endEndPath;
597 labels = proc_pset.getParameter<
vstring>(*iEndPath);
598 vstring::iterator iSave = labels.begin();
599 vstring::iterator iBegin = labels.begin();
601 for (vstring::iterator iLabel = labels.begin(), iEnd = labels.end(); iLabel != iEnd; ++iLabel) {
602 if (binary_search_string(labelsToBeDropped, *iLabel)) {
603 if (binary_search_string(outputModuleLabels, *iLabel)) {
604 outputModulePathPositions[*iLabel].emplace_back(*iEndPath, iSave - iBegin);
607 if (iSave != iLabel) {
608 iSave->swap(*iLabel);
613 labels.erase(iSave, labels.end());
614 if (labels.empty()) {
616 proc_pset.eraseSimpleParameter(*iEndPath);
617 endPathsToBeDropped.push_back(*iEndPath);
625 endAfterRemove = std::remove_if(scheduledPaths.begin(),
626 scheduledPaths.end(),
627 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
628 scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
632 vstring scheduledEndPaths = proc_pset.getParameter<
vstring>(
"@end_paths");
633 endAfterRemove = std::remove_if(scheduledEndPaths.begin(),
634 scheduledEndPaths.end(),
635 std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
636 scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
640 class RngEDConsumer :
public EDConsumerBase {
642 explicit RngEDConsumer(std::set<TypeID>& typesConsumed) {
644 if (rng.isAvailable()) {
645 rng->consumes(consumesCollector());
646 for (
auto const& consumesInfo : this->consumesInfo()) {
647 typesConsumed.emplace(consumesInfo.type());
653 template <
typename F>
654 auto doCleanup(
F&& iF) {
659 iTask.doneWaiting(*iPtr);
679 std::shared_ptr<ActivityRegistry> areg,
680 std::shared_ptr<ProcessConfiguration> processConfiguration,
681 bool hasSubprocesses,
686 ? std::shared_ptr<TriggerResultInserter>{}
687 : makeInserter(proc_pset, prealloc, preg, actions, areg, processConfiguration)},
691 pathNames_(&
tns.getTrigPaths()),
692 endPathNames_(&
tns.getEndPaths()),
693 wantSummary_(
tns.wantSummary()) {
694 makePathStatusInserters(pathStatusInserters_,
699 processConfiguration,
702 makePathStatusInserters(endPathStatusInserters_,
707 processConfiguration,
711 streamSchedules_.reserve(
prealloc.numberOfStreams());
712 for (
unsigned int i = 0;
i <
prealloc.numberOfStreams(); ++
i) {
713 streamSchedules_.emplace_back(make_shared_noexcept_false<StreamSchedule>(resultsInserter(),
714 pathStatusInserters_,
715 endPathStatusInserters_,
724 processConfiguration,
732 const std::string kTriggerResults(
"TriggerResults");
733 std::vector<std::string> modulesToUse;
734 modulesToUse.reserve(streamSchedules_[0]->allWorkers().
size());
735 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
736 if (worker->description()->moduleLabel() != kTriggerResults) {
737 modulesToUse.push_back(worker->description()->moduleLabel());
741 unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
742 if (nUnscheduledModules > 0) {
743 std::vector<std::string>
temp;
744 temp.reserve(modulesToUse.size());
745 auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
746 std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(temp));
747 std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(temp));
748 temp.swap(modulesToUse);
752 globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
753 pathStatusInserters_,
754 endPathStatusInserters_,
767 std::set<std::string> usedModuleLabels;
768 for (
auto const& worker : allWorkers()) {
769 if (worker->description()->moduleLabel() != kTriggerResults) {
770 usedModuleLabels.insert(worker->description()->moduleLabel());
773 std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string>>(
"@all_modules"));
774 std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
775 reduceParameterSet(proc_pset,
tns.getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
776 processEDAliases(proc_pset, processConfiguration->processName(),
preg);
780 if (nUnscheduledModules > 0) {
781 std::set<std::string> unscheduledModules(modulesToUse.begin(), modulesToUse.begin() + nUnscheduledModules);
782 preg.setUnscheduledProducts(unscheduledModules);
785 processSwitchProducers(proc_pset, processConfiguration->processName(),
preg);
786 proc_pset.registerIt();
787 processConfiguration->setParameterSetID(proc_pset.id());
788 processConfiguration->setProcessConfigurationID();
792 size_t all_workers_count = allWorkers().size();
801 limitOutput(proc_pset, branchIDListHelper.branchIDLists(), subProcessParentageHelper);
805 assert(all_workers_count == allWorkers().
size());
807 branchIDListHelper.updateFromRegistry(preg);
809 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
810 worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
813 processBlockHelper.updateForNewProcess(preg, processConfiguration->processName());
818 c->selectProducts(preg, thinnedAssociationsHelper, processBlockHelper);
821 for (
auto& product : preg.productListUpdator()) {
827 std::set<TypeID> productTypesConsumed;
828 std::set<TypeID> elementTypesConsumed;
830 for (
auto const& worker : allWorkers()) {
831 for (
auto const& consumesInfo : worker->consumesInfo()) {
833 productTypesConsumed.emplace(consumesInfo.type());
835 elementTypesConsumed.emplace(consumesInfo.type());
840 if (hasSubprocesses) {
844 { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
845 preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
848 for (
auto&
c : all_output_communicators_) {
849 c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
853 std::vector<const ModuleDescription*> modDesc;
854 const auto&
workers = allWorkers();
855 modDesc.reserve(
workers.size());
859 std::back_inserter(modDesc),
863 summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(prealloc.numberOfStreams(), modDesc,
tns, processContext);
864 auto timeKeeperPtr = summaryTimeKeeper_.get();
896 int maxEventSpecs = 0;
897 int maxEventsOut = -1;
904 std::vector<std::string> psetNamesE;
911 if (maxEventSpecs > 1) {
913 <<
"\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
918 if (vMaxEventsOut !=
nullptr && !vMaxEventsOut->
empty()) {
919 std::string const& moduleLabel =
c->description().moduleLabel();
924 <<
"\nNo entry in 'maxEvents' for output module label '" << moduleLabel <<
"'.\n";
936 if (!
c->limitReached()) {
941 LogInfo(
"SuccessfulTermination") <<
"The job is terminating successfully because each output module\n"
942 <<
"has reached its configured limit.\n";
966 <<
"---------- Event Summary ------------";
980 <<
"---------- Path Summary ------------";
981 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
982 <<
" " << std::right << std::setw(10) <<
"Executed"
983 <<
" " << std::right << std::setw(10) <<
"Passed"
984 <<
" " << std::right << std::setw(10) <<
"Failed"
985 <<
" " << std::right << std::setw(10) <<
"Error"
990 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
991 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" "
992 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
993 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
994 <<
p.timesExcept <<
" " <<
p.name <<
"";
1016 <<
"-------End-Path Summary ------------";
1017 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1018 <<
" " << std::right << std::setw(10) <<
"Executed"
1019 <<
" " << std::right << std::setw(10) <<
"Passed"
1020 <<
" " << std::right << std::setw(10) <<
"Failed"
1021 <<
" " << std::right << std::setw(10) <<
"Error"
1026 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1027 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" "
1028 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
1029 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
1030 <<
p.timesExcept <<
" " <<
p.name <<
"";
1036 <<
"---------- Modules in Path: " <<
p.name <<
" ------------";
1037 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1038 <<
" " << std::right << std::setw(10) <<
"Visited"
1039 <<
" " << std::right << std::setw(10) <<
"Passed"
1040 <<
" " << std::right << std::setw(10) <<
"Failed"
1041 <<
" " << std::right << std::setw(10) <<
"Error"
1046 unsigned int bitpos = 0;
1047 for (
auto const&
mod :
p.moduleInPathSummaries) {
1048 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
1049 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" "
1050 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
1051 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
1052 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
1060 <<
"------ Modules in End-Path: " <<
p.name <<
" ------------";
1061 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1062 <<
" " << std::right << std::setw(10) <<
"Visited"
1063 <<
" " << std::right << std::setw(10) <<
"Passed"
1064 <<
" " << std::right << std::setw(10) <<
"Failed"
1065 <<
" " << std::right << std::setw(10) <<
"Error"
1070 unsigned int bitpos = 0;
1071 for (
auto const&
mod :
p.moduleInPathSummaries) {
1072 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1073 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" "
1074 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
1075 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
1076 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
1083 <<
"---------- Module Summary ------------";
1084 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Visited"
1085 <<
" " << std::right << std::setw(10) <<
"Executed"
1086 <<
" " << std::right << std::setw(10) <<
"Passed"
1087 <<
" " << std::right << std::setw(10) <<
"Failed"
1088 <<
" " << std::right << std::setw(10) <<
"Error"
1093 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) << worker.timesVisited <<
" "
1094 << std::right << std::setw(10) << worker.timesRun <<
" " << std::right
1095 << std::setw(10) << worker.timesPassed <<
" " << std::right << std::setw(10)
1096 << worker.timesFailed <<
" " << std::right << std::setw(10) << worker.timesExcept
1097 <<
" " << worker.moduleLabel <<
"";
1108 <<
"---------- Event Summary ---[sec]----";
1109 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport" << std::setprecision(6) << std::fixed
1111 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport" << std::setprecision(6) << std::fixed
1113 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport" << std::setprecision(6) << std::fixed
1115 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport" << std::setprecision(6) << std::fixed
1116 <<
" efficiency CPU/Real/thread = "
1120 constexpr
int kColumn1Size = 10;
1121 constexpr
int kColumn2Size = 12;
1122 constexpr
int kColumn3Size = 12;
1125 <<
"---------- Path Summary ---[Real sec]----";
1126 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1127 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1130 const int timesRun =
std::max(1,
p.timesRun);
1131 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1132 << std::setw(kColumn1Size) <<
p.realTime / totalEvents <<
" " << std::right
1133 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
1135 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1136 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1142 <<
"-------End-Path Summary ---[Real sec]----";
1143 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1144 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1148 const int timesRun =
std::max(1,
p.timesRun);
1150 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1151 << std::setw(kColumn1Size) <<
p.realTime / totalEvents <<
" " << std::right
1152 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
1154 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1155 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1162 <<
"---------- Modules in Path: " <<
p.name <<
" ---[Real sec]----";
1163 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1164 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1167 for (
auto const&
mod :
p.moduleInPathSummaries) {
1168 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1169 << std::setw(kColumn1Size) <<
mod.realTime / totalEvents <<
" " << std::right
1170 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" "
1171 <<
mod.moduleLabel <<
"";
1175 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1176 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1183 <<
"------ Modules in End-Path: " <<
p.name <<
" ---[Real sec]----";
1184 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1185 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1188 for (
auto const&
mod :
p.moduleInPathSummaries) {
1189 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1190 << std::setw(kColumn1Size) <<
mod.realTime / totalEvents <<
" " << std::right
1191 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" "
1192 <<
mod.moduleLabel <<
"";
1196 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1197 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1203 <<
"---------- Module Summary ---[Real sec]----";
1204 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1205 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1206 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit"
1210 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1211 << std::setw(kColumn1Size) << worker.realTime / totalEvents <<
" " << std::right
1212 << std::setw(kColumn2Size) << worker.realTime /
std::max(1, worker.timesRun) <<
" "
1213 << std::right << std::setw(kColumn3Size)
1214 << worker.realTime /
std::max(1, worker.timesVisited) <<
" " << worker.moduleLabel
1217 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1218 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1219 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit"
1230 using std::placeholders::_1;
1233 worker->respondToCloseOutputFile();
1238 using std::placeholders::_1;
1255 using namespace edm::waiting_task;
1264 c->writeRunAsync(nextTask, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1287 using namespace edm::waiting_task;
1294 c->writeProcessBlockAsync(nextTask, pbp, processContext, activityRegistry);
1317 using namespace edm::waiting_task;
1323 c->writeLumiAsync(nextTask, lbp, processContext, activityRegistry);
1335 using std::placeholders::_1;
1344 using std::placeholders::_1;
1349 using std::placeholders::_1;
1356 globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase);
1370 unsigned int iStreamID,
1383 if (worker->description()->moduleLabel() == iLabel) {
1388 if (
nullptr == found) {
1397 s->replaceModule(newMod, iLabel);
1412 auto const& processName = newMod->moduleDescription().processName();
1413 auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(processName);
1414 auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(processName);
1415 auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(processName);
1416 auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(processName);
1429 stream->deleteModule(iLabel);
1435 std::vector<ModuleDescription const*>
result;
1440 result.push_back(p);
1449 worker->convertCurrentProcessAlias(processName);
1466 std::vector<ModuleDescription const*>& descriptions,
1467 unsigned int hint)
const {
1468 streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1472 std::vector<ModuleDescription const*>& descriptions,
1473 unsigned int hint)
const {
1474 streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1478 std::vector<ModuleDescription const*>& allModuleDescriptions,
1479 std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1481 std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1483 allModuleDescriptions.clear();
1484 moduleIDToIndex.clear();
1485 for (
auto iBranchType = 0U; iBranchType <
NumBranchTypes; ++iBranchType) {
1486 modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1488 modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1492 for (
auto iBranchType = 0U; iBranchType <
NumBranchTypes; ++iBranchType) {
1493 modulesWhoseProductsAreConsumedBy[iBranchType].resize(
allWorkers().
size());
1495 modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(
allWorkers().
size());
1497 std::map<std::string, ModuleDescription const*> labelToDesc;
1501 allModuleDescriptions.push_back(p);
1502 moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(p->
id(),
i));
1510 std::array<std::vector<ModuleDescription const*>*, NumBranchTypes>
modules;
1511 for (
auto iBranchType = 0U; iBranchType <
NumBranchTypes; ++iBranchType) {
1512 modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(i);
1515 std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1516 modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(i);
1518 worker->modulesWhoseProductsAreConsumed(modules, modulesInPreviousProcesses, preg, labelToDesc);
1520 ex.
addContext(
"Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1521 worker->description()->moduleLabel());
1533 s->getTriggerReport(rep);
1546 int returnValue = 0;
1548 returnValue += s->totalEvents();
1554 int returnValue = 0;
1556 returnValue += s->totalEventsPassed();
1562 int returnValue = 0;
1564 returnValue += s->totalEventsFailed();
RunPrincipal const & runPrincipal() const
std::vector< PathSummary > endPathSummaries
T getUntrackedParameter(std::string const &, T const &) const
std::vector< PathTimingSummary > endPathSummaries
pathNames_ & tns()), endPathNames_(&tns.getEndPaths()), wantSummary_(tns.wantSummary()
PostModuleDestruction postModuleDestructionSignal_
const edm::EventSetup & c
void stopEvent(StreamContext const &)
void startProcessingLoop()
std::vector< BranchIDList > BranchIDLists
virtual void openFile(FileBlock const &fb)=0
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
void writeProcessBlockAsync(WaitingTaskHolder iTask, ProcessBlockPrincipal const &, ProcessContext const *, ActivityRegistry *)
Timestamp const & beginTime() const
static Timestamp invalidTimestamp()
preallocConfig_(prealloc)
void restartModuleEvent(StreamContext const &, ModuleCallingContext const &)
all_output_communicators_()
void respondToCloseInputFile(FileBlock const &fb)
void startModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::vector< Worker * > AllWorkers
std::vector< ParameterSet > VParameterSet
void removeModuleIfExists(ModuleDescription const &module)
std::vector< std::string > const * pathNames_
void convertCurrentProcessAlias(std::string const &processName)
Convert "@currentProcess" in InputTag process names to the actual current process name...
void fillModuleAndConsumesInfo(std::vector< ModuleDescription const * > &allModuleDescriptions, std::vector< std::pair< unsigned int, unsigned int >> &moduleIDToIndex, std::array< std::vector< std::vector< ModuleDescription const * >>, NumBranchTypes > &modulesWhoseProductsAreConsumedBy, std::vector< std::vector< ModuleProcessName >> &modulesInPreviousProcessesWhoseProductsAreConsumedBy, ProductRegistry const &preg) const
void endStream(unsigned int)
unsigned int numberOfThreads() const
LuminosityBlockIndex index() const
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
virtual void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &)=0
PostGlobalEndLumi postGlobalWriteLumiSignal_
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
std::vector< WorkerSummary > workerSummaries
edm::propagate_const< std::unique_ptr< SystemTimeKeeper > > summaryTimeKeeper_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
PreModuleDestruction preModuleDestructionSignal_
ServiceToken presentToken() const
constexpr auto then(O &&iO)
std::string const & moduleLabel() const
void processOneEventAsync(WaitingTaskHolder iTask, unsigned int iStreamID, EventTransitionInfo &, ServiceToken const &token)
void stopProcessingLoop()
void startEvent(StreamID)
static unsigned int getUniqueID()
Returns a unique id each time called. Intended to be passed to ModuleDescription's constructor's modI...
int totalEventsFailed() const
edm::propagate_const< std::unique_ptr< GlobalSchedule > > globalSchedule_
const uint16_t range(const Frame &aFrame)
void eraseOrSetUntrackedParameterSet(std::string const &name)
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
static RunIndex invalidRunIndex()
void deleteModule(std::string const &iLabel, ActivityRegistry *areg)
Deletes module with label iLabel.
int totalEventsPassed() const
void triggerPaths(std::vector< std::string > &oLabelsToFill) const
std::vector< PathSummary > trigPathSummaries
EventSummary eventSummary
void beginJob(ProductRegistry const &, eventsetup::ESRecordsToProxyIndices const &, ProcessBlockHelperBase const &)
auto runLast(edm::WaitingTaskHolder iTask)
std::vector< edm::propagate_const< std::shared_ptr< PathStatusInserter > > > pathStatusInserters_
virtual void resolvePutIndicies(BranchType iBranchType, std::unordered_multimap< std::string, std::tuple< TypeID const *, const char *, edm::ProductResolverIndex >> const &iIndicies)=0
EventTimingSummary eventSummary
void clearCounters()
Clear all the counters in the trigger report.
PostGlobalWriteRun postGlobalWriteRunSignal_
tuple key
prepare the HTCondor submission files and eventually submit them
static ServiceRegistry & instance()
Timestamp const & endTime() const
std::vector< PathTimingSummary > trigPathSummaries
void limitOutput(ParameterSet const &proc_pset, BranchIDLists const &branchIDLists, SubProcessParentageHelper const *subProcessParentageHelper)
bool terminate() const
Return whether each output module has reached its maximum count.
void respondToOpenInputFile(FileBlock const &fb)
edm::propagate_const< std::shared_ptr< ModuleRegistry > > moduleRegistry_
void writeRunAsync(WaitingTaskHolder iTask, RunPrincipal const &rp, ProcessContext const *, ActivityRegistry *, MergeableRunProductMetadata const *)
void stopPath(StreamContext const &, PathContext const &, HLTPathStatus const &)
static LuminosityBlockIndex invalidLuminosityBlockIndex()
PreGlobalWriteRun preGlobalWriteRunSignal_
void stopModuleEvent(StreamContext const &, ModuleCallingContext const &)
void getTriggerReport(TriggerReport &rep) const
virtual bool shouldWeCloseFile() const =0
Log< level::Info, false > LogInfo
PreallocationConfiguration preallocConfig_
Log< level::FwkInfo, true > LogFwkVerbatim
PreWriteProcessBlock preWriteProcessBlockSignal_
moduleRegistry_(new ModuleRegistry())
std::vector< edm::propagate_const< std::shared_ptr< StreamSchedule > > > streamSchedules_
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
void respondToOpenInputFile(FileBlock const &fb)
void startPath(StreamContext const &, PathContext const &)
bool search_all(ForwardSequence const &s, Datum const &d)
PostWriteProcessBlock postWriteProcessBlockSignal_
void addContext(std::string const &context)
virtual std::unique_ptr< OutputModuleCommunicator > createOutputModuleCommunicator()=0
AllOutputModuleCommunicators all_output_communicators_
void modulesInPath(std::string const &iPathLabel, std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill in execution order the labels of all modules in path iPathLabel ...
void pauseModuleEvent(StreamContext const &, ModuleCallingContext const &)
std::shared_ptr< ProductResolverIndexHelper const > productLookup(BranchType branchType) const
PreGlobalEndLumi preGlobalWriteLumiSignal_
void beginStream(unsigned int)
void respondToCloseInputFile(FileBlock const &fb)
std::vector< std::string > const * endPathNames_
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
Strings const & getTrigPaths() const
virtual void closeFile()=0
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
void openOutputFiles(FileBlock &fb)
void writeLumiAsync(WaitingTaskHolder iTask, LuminosityBlockPrincipal const &lbp, ProcessContext const *, ActivityRegistry *)
std::vector< WorkerTimingSummary > workerSummaries
T mod(const T &a, const T &b)
void endJob(ExceptionCollector &collector)
void getTriggerTimingReport(TriggerTimingReport &rep) const
Schedule(ParameterSet &proc_pset, service::TriggerNamesService const &tns, ProductRegistry &pregistry, BranchIDListHelper &branchIDListHelper, ProcessBlockHelperBase &, ThinnedAssociationsHelper &thinnedAssociationsHelper, SubProcessParentageHelper const *subProcessParentageHelper, ExceptionToActionTable const &actions, std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ProcessConfiguration > processConfiguration, bool hasSubprocesses, PreallocationConfiguration const &config, ProcessContext const *processContext)
bool shouldWeCloseOutput() const
bool changeModule(std::string const &iLabel, ParameterSet const &iPSet, const ProductRegistry &iRegistry, eventsetup::ESRecordsToProxyIndices const &)
std::vector< std::string > vstring
void setIsMergeable(BranchDescription &)
tuple size
Write out results.
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
LuminosityBlockID id() const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)