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,
731 const std::string kTriggerResults(
"TriggerResults");
732 std::vector<std::string> modulesToUse;
733 modulesToUse.reserve(streamSchedules_[0]->allWorkers().
size());
734 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
735 if (worker->description()->moduleLabel() != kTriggerResults) {
736 modulesToUse.push_back(worker->description()->moduleLabel());
740 unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
741 if (nUnscheduledModules > 0) {
742 std::vector<std::string>
temp;
743 temp.reserve(modulesToUse.size());
744 auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
745 std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(temp));
746 std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(temp));
747 temp.swap(modulesToUse);
751 globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
752 pathStatusInserters_,
753 endPathStatusInserters_,
766 std::set<std::string> usedModuleLabels;
767 for (
auto const& worker : allWorkers()) {
768 if (worker->description()->moduleLabel() != kTriggerResults) {
769 usedModuleLabels.insert(worker->description()->moduleLabel());
772 std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string>>(
"@all_modules"));
773 std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
774 reduceParameterSet(proc_pset,
tns.getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
775 processEDAliases(proc_pset, processConfiguration->processName(),
preg);
779 if (nUnscheduledModules > 0) {
780 std::set<std::string> unscheduledModules(modulesToUse.begin(), modulesToUse.begin() + nUnscheduledModules);
781 preg.setUnscheduledProducts(unscheduledModules);
784 processSwitchProducers(proc_pset, processConfiguration->processName(),
preg);
785 proc_pset.registerIt();
786 processConfiguration->setParameterSetID(proc_pset.id());
787 processConfiguration->setProcessConfigurationID();
791 size_t all_workers_count = allWorkers().size();
800 limitOutput(proc_pset, branchIDListHelper.branchIDLists(), subProcessParentageHelper);
804 assert(all_workers_count == allWorkers().
size());
806 branchIDListHelper.updateFromRegistry(preg);
808 for (
auto const& worker : streamSchedules_[0]->allWorkers()) {
809 worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
812 processBlockHelper.updateForNewProcess(preg, processConfiguration->processName());
817 c->selectProducts(preg, thinnedAssociationsHelper, processBlockHelper);
820 for (
auto& product : preg.productListUpdator()) {
826 std::set<TypeID> productTypesConsumed;
827 std::set<TypeID> elementTypesConsumed;
829 for (
auto const& worker : allWorkers()) {
830 for (
auto const& consumesInfo : worker->consumesInfo()) {
832 productTypesConsumed.emplace(consumesInfo.type());
834 elementTypesConsumed.emplace(consumesInfo.type());
839 if (hasSubprocesses) {
843 { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
844 preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
847 for (
auto&
c : all_output_communicators_) {
848 c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
852 std::vector<const ModuleDescription*> modDesc;
853 const auto&
workers = allWorkers();
854 modDesc.reserve(
workers.size());
858 std::back_inserter(modDesc),
862 summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(prealloc.numberOfStreams(), modDesc,
tns, processContext);
863 auto timeKeeperPtr = summaryTimeKeeper_.get();
895 int maxEventSpecs = 0;
896 int maxEventsOut = -1;
903 std::vector<std::string> psetNamesE;
910 if (maxEventSpecs > 1) {
912 <<
"\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
917 if (vMaxEventsOut !=
nullptr && !vMaxEventsOut->
empty()) {
918 std::string const& moduleLabel =
c->description().moduleLabel();
923 <<
"\nNo entry in 'maxEvents' for output module label '" << moduleLabel <<
"'.\n";
935 if (!
c->limitReached()) {
940 LogInfo(
"SuccessfulTermination") <<
"The job is terminating successfully because each output module\n"
941 <<
"has reached its configured limit.\n";
965 <<
"---------- Event Summary ------------";
979 <<
"---------- Path Summary ------------";
980 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
981 <<
" " << std::right << std::setw(10) <<
"Executed"
982 <<
" " << std::right << std::setw(10) <<
"Passed"
983 <<
" " << std::right << std::setw(10) <<
"Failed"
984 <<
" " << std::right << std::setw(10) <<
"Error"
989 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
990 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" "
991 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
992 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
993 <<
p.timesExcept <<
" " <<
p.name <<
"";
1015 <<
"-------End-Path Summary ------------";
1016 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1017 <<
" " << std::right << std::setw(10) <<
"Executed"
1018 <<
" " << std::right << std::setw(10) <<
"Passed"
1019 <<
" " << std::right << std::setw(10) <<
"Failed"
1020 <<
" " << std::right << std::setw(10) <<
"Error"
1025 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1026 <<
p.bitPosition <<
" " << std::right << std::setw(10) <<
p.timesRun <<
" "
1027 << std::right << std::setw(10) <<
p.timesPassed <<
" " << std::right
1028 << std::setw(10) <<
p.timesFailed <<
" " << std::right << std::setw(10)
1029 <<
p.timesExcept <<
" " <<
p.name <<
"";
1035 <<
"---------- Modules in Path: " <<
p.name <<
" ------------";
1036 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1037 <<
" " << std::right << std::setw(10) <<
"Visited"
1038 <<
" " << std::right << std::setw(10) <<
"Passed"
1039 <<
" " << std::right << std::setw(10) <<
"Failed"
1040 <<
" " << std::right << std::setw(10) <<
"Error"
1045 unsigned int bitpos = 0;
1046 for (
auto const&
mod :
p.moduleInPathSummaries) {
1047 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
1048 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" "
1049 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
1050 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
1051 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
1059 <<
"------ Modules in End-Path: " <<
p.name <<
" ------------";
1060 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Trig Bit#"
1061 <<
" " << std::right << std::setw(10) <<
"Visited"
1062 <<
" " << std::right << std::setw(10) <<
"Passed"
1063 <<
" " << std::right << std::setw(10) <<
"Failed"
1064 <<
" " << std::right << std::setw(10) <<
"Error"
1069 unsigned int bitpos = 0;
1070 for (
auto const&
mod :
p.moduleInPathSummaries) {
1071 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1072 << bitpos <<
" " << std::right << std::setw(10) <<
mod.timesVisited <<
" "
1073 << std::right << std::setw(10) <<
mod.timesPassed <<
" " << std::right
1074 << std::setw(10) <<
mod.timesFailed <<
" " << std::right << std::setw(10)
1075 <<
mod.timesExcept <<
" " <<
mod.moduleLabel <<
"";
1082 <<
"---------- Module Summary ------------";
1083 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) <<
"Visited"
1084 <<
" " << std::right << std::setw(10) <<
"Executed"
1085 <<
" " << std::right << std::setw(10) <<
"Passed"
1086 <<
" " << std::right << std::setw(10) <<
"Failed"
1087 <<
" " << std::right << std::setw(10) <<
"Error"
1092 LogFwkVerbatim(
"FwkSummary") <<
"TrigReport " << std::right << std::setw(10) << worker.timesVisited <<
" "
1093 << std::right << std::setw(10) << worker.timesRun <<
" " << std::right
1094 << std::setw(10) << worker.timesPassed <<
" " << std::right << std::setw(10)
1095 << worker.timesFailed <<
" " << std::right << std::setw(10) << worker.timesExcept
1096 <<
" " << worker.moduleLabel <<
"";
1107 <<
"---------- Event Summary ---[sec]----";
1108 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport" << std::setprecision(6) << std::fixed
1110 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport" << std::setprecision(6) << std::fixed
1112 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport" << std::setprecision(6) << std::fixed
1114 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport" << std::setprecision(6) << std::fixed
1115 <<
" efficiency CPU/Real/thread = "
1119 constexpr
int kColumn1Size = 10;
1120 constexpr
int kColumn2Size = 12;
1121 constexpr
int kColumn3Size = 12;
1124 <<
"---------- Path Summary ---[Real sec]----";
1125 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1126 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1129 const int timesRun =
std::max(1,
p.timesRun);
1130 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1131 << std::setw(kColumn1Size) <<
p.realTime / totalEvents <<
" " << std::right
1132 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
1134 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1135 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1141 <<
"-------End-Path Summary ---[Real sec]----";
1142 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1143 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1147 const int timesRun =
std::max(1,
p.timesRun);
1149 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1150 << std::setw(kColumn1Size) <<
p.realTime / totalEvents <<
" " << std::right
1151 << std::setw(kColumn2Size) <<
p.realTime / timesRun <<
" " <<
p.name <<
"";
1153 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1154 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1161 <<
"---------- Modules in Path: " <<
p.name <<
" ---[Real sec]----";
1162 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1163 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1166 for (
auto const&
mod :
p.moduleInPathSummaries) {
1167 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1168 << std::setw(kColumn1Size) <<
mod.realTime / totalEvents <<
" " << std::right
1169 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" "
1170 <<
mod.moduleLabel <<
"";
1174 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1175 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1182 <<
"------ Modules in End-Path: " <<
p.name <<
" ---[Real sec]----";
1183 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1184 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1187 for (
auto const&
mod :
p.moduleInPathSummaries) {
1188 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1189 << std::setw(kColumn1Size) <<
mod.realTime / totalEvents <<
" " << std::right
1190 << std::setw(kColumn2Size) <<
mod.realTime /
std::max(1,
mod.timesVisited) <<
" "
1191 <<
mod.moduleLabel <<
"";
1195 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1196 <<
" " << std::right << std::setw(kColumn2Size) <<
"per visit"
1202 <<
"---------- Module Summary ---[Real sec]----";
1203 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1204 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1205 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit"
1209 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::setprecision(6) << std::fixed << std::right
1210 << std::setw(kColumn1Size) << worker.realTime / totalEvents <<
" " << std::right
1211 << std::setw(kColumn2Size) << worker.realTime /
std::max(1, worker.timesRun) <<
" "
1212 << std::right << std::setw(kColumn3Size)
1213 << worker.realTime /
std::max(1, worker.timesVisited) <<
" " << worker.moduleLabel
1216 LogFwkVerbatim(
"FwkSummary") <<
"TimeReport " << std::right << std::setw(kColumn1Size) <<
"per event"
1217 <<
" " << std::right << std::setw(kColumn2Size) <<
"per exec"
1218 <<
" " << std::right << std::setw(kColumn3Size) <<
"per visit"
1229 using std::placeholders::_1;
1232 worker->respondToCloseOutputFile();
1237 using std::placeholders::_1;
1254 using namespace edm::waiting_task;
1263 c->writeRunAsync(nextTask, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1286 using namespace edm::waiting_task;
1293 c->writeProcessBlockAsync(nextTask, pbp, processContext, activityRegistry);
1316 using namespace edm::waiting_task;
1322 c->writeLumiAsync(nextTask, lbp, processContext, activityRegistry);
1334 using std::placeholders::_1;
1343 using std::placeholders::_1;
1348 using std::placeholders::_1;
1355 globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase);
1369 unsigned int iStreamID,
1382 if (worker->description()->moduleLabel() == iLabel) {
1387 if (
nullptr == found) {
1396 s->replaceModule(newMod, iLabel);
1411 auto const& processName = newMod->moduleDescription().processName();
1412 auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(processName);
1413 auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(processName);
1414 auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(processName);
1415 auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(processName);
1428 stream->deleteModule(iLabel);
1441 std::vector<ModuleDescription const*>
result;
1446 result.push_back(p);
1455 worker->convertCurrentProcessAlias(processName);
1472 std::vector<ModuleDescription const*>& descriptions,
1473 unsigned int hint)
const {
1474 streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1478 std::vector<ModuleDescription const*>& descriptions,
1479 unsigned int hint)
const {
1480 streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1484 std::vector<ModuleDescription const*>& allModuleDescriptions,
1485 std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1487 std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1489 allModuleDescriptions.clear();
1490 moduleIDToIndex.clear();
1491 for (
auto iBranchType = 0U; iBranchType <
NumBranchTypes; ++iBranchType) {
1492 modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1494 modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1498 for (
auto iBranchType = 0U; iBranchType <
NumBranchTypes; ++iBranchType) {
1499 modulesWhoseProductsAreConsumedBy[iBranchType].resize(
allWorkers().
size());
1501 modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(
allWorkers().
size());
1503 std::map<std::string, ModuleDescription const*> labelToDesc;
1507 allModuleDescriptions.push_back(p);
1508 moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(p->
id(),
i));
1516 std::array<std::vector<ModuleDescription const*>*, NumBranchTypes>
modules;
1517 for (
auto iBranchType = 0U; iBranchType <
NumBranchTypes; ++iBranchType) {
1518 modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(i);
1521 std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1522 modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(i);
1524 worker->modulesWhoseProductsAreConsumed(modules, modulesInPreviousProcesses, preg, labelToDesc);
1526 ex.
addContext(
"Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1527 worker->description()->moduleLabel());
1539 s->getTriggerReport(rep);
1552 int returnValue = 0;
1554 returnValue += s->totalEvents();
1560 int returnValue = 0;
1562 returnValue += s->totalEventsPassed();
1568 int returnValue = 0;
1570 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::shared_ptr< ModuleRegistry const > moduleRegistry() 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
void initializeEarlyDelete(std::vector< std::string > const &branchesToDeleteEarly, edm::ProductRegistry const &preg)
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)