CMS 3D CMS Logo

Schedule.cc
Go to the documentation of this file.
2 
37 
38 #include <algorithm>
39 #include <cassert>
40 #include <cstdlib>
41 #include <functional>
42 #include <iomanip>
43 #include <list>
44 #include <map>
45 #include <set>
46 #include <exception>
47 #include <sstream>
48 
50 
51 namespace edm {
52 
53  class Maker;
54 
55  namespace {
56  using std::placeholders::_1;
57 
58  bool binary_search_string(std::vector<std::string> const& v, std::string const& s) {
59  return std::binary_search(v.begin(), v.end(), s);
60  }
61 
62  // Here we make the trigger results inserter directly. This should
63  // probably be a utility in the WorkerRegistry or elsewhere.
64 
65  std::shared_ptr<TriggerResultInserter> makeInserter(ParameterSet& proc_pset,
66  PreallocationConfiguration const& iPrealloc,
67  ProductRegistry& preg,
68  ExceptionToActionTable const& actions,
69  std::shared_ptr<ActivityRegistry> areg,
70  std::shared_ptr<ProcessConfiguration> processConfiguration) {
71  ParameterSet* trig_pset = proc_pset.getPSetForUpdate("@trigger_paths");
72  trig_pset->registerIt();
73 
74  WorkerParams work_args(trig_pset, preg, &iPrealloc, processConfiguration, actions);
75  ModuleDescription md(trig_pset->id(),
76  "TriggerResultInserter",
77  "TriggerResults",
78  processConfiguration.get(),
80 
81  areg->preModuleConstructionSignal_(md);
82  bool postCalled = false;
83  std::shared_ptr<TriggerResultInserter> returnValue;
84  // Caught exception is rethrown
85  CMS_SA_ALLOW try {
86  maker::ModuleHolderT<TriggerResultInserter> holder(
87  make_shared_noexcept_false<TriggerResultInserter>(*trig_pset, iPrealloc.numberOfStreams()),
88  static_cast<Maker const*>(nullptr));
89  holder.setModuleDescription(md);
90  holder.registerProductsAndCallbacks(&preg);
91  returnValue = holder.module();
92  postCalled = true;
93  // if exception then post will be called in the catch block
94  areg->postModuleConstructionSignal_(md);
95  } catch (...) {
96  if (!postCalled) {
97  CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); } catch (...) {
98  // If post throws an exception ignore it because we are already handling another exception
99  }
100  }
101  throw;
102  }
103  return returnValue;
104  }
105 
106  template <typename T>
107  void makePathStatusInserters(std::vector<edm::propagate_const<std::shared_ptr<T>>>& pathStatusInserters,
108  std::vector<std::string> const& pathNames,
109  PreallocationConfiguration const& iPrealloc,
110  ProductRegistry& preg,
111  std::shared_ptr<ActivityRegistry> areg,
112  std::shared_ptr<ProcessConfiguration> processConfiguration,
113  std::string const& moduleTypeName) {
115  pset.addParameter<std::string>("@module_type", moduleTypeName);
116  pset.addParameter<std::string>("@module_edm_type", "EDProducer");
117  pset.registerIt();
118 
119  pathStatusInserters.reserve(pathNames.size());
120 
121  for (auto const& pathName : pathNames) {
122  ModuleDescription md(
123  pset.id(), moduleTypeName, pathName, processConfiguration.get(), ModuleDescription::getUniqueID());
124 
125  areg->preModuleConstructionSignal_(md);
126  bool postCalled = false;
127  // Caught exception is rethrown
128  CMS_SA_ALLOW try {
129  maker::ModuleHolderT<T> holder(make_shared_noexcept_false<T>(iPrealloc.numberOfStreams()),
130  static_cast<Maker const*>(nullptr));
131  holder.setModuleDescription(md);
132  holder.registerProductsAndCallbacks(&preg);
133  pathStatusInserters.emplace_back(holder.module());
134  postCalled = true;
135  // if exception then post will be called in the catch block
136  areg->postModuleConstructionSignal_(md);
137  } catch (...) {
138  if (!postCalled) {
139  CMS_SA_ALLOW try { areg->postModuleConstructionSignal_(md); } catch (...) {
140  // If post throws an exception ignore it because we are already handling another exception
141  }
142  }
143  throw;
144  }
145  }
146  }
147 
148  void checkAndInsertAlias(std::string const& friendlyClassName,
149  std::string const& moduleLabel,
150  std::string const& productInstanceName,
151  std::string const& processName,
152  std::string const& alias,
153  std::string const& instanceAlias,
154  ProductRegistry const& preg,
155  std::multimap<BranchKey, BranchKey>& aliasMap,
156  std::map<BranchKey, BranchKey>& aliasKeys) {
157  std::string const star("*");
158 
159  BranchKey key(friendlyClassName, moduleLabel, productInstanceName, processName);
160  if (preg.productList().find(key) == preg.productList().end()) {
161  // No product was found matching the alias.
162  // We throw an exception only if a module with the specified module label was created in this process.
163  for (auto const& product : preg.productList()) {
164  if (moduleLabel == product.first.moduleLabel() && processName == product.first.processName()) {
165  throw Exception(errors::Configuration, "EDAlias does not match data\n")
166  << "There are no products of type '" << friendlyClassName << "'\n"
167  << "with module label '" << moduleLabel << "' and instance name '" << productInstanceName << "'.\n";
168  }
169  }
170  }
171 
172  if (auto iter = aliasMap.find(key); iter != aliasMap.end()) {
173  // If the same EDAlias defines multiple products pointing to the same product, throw
174  if (iter->second.moduleLabel() == alias) {
175  throw Exception(errors::Configuration, "EDAlias conflict\n")
176  << "The module label alias '" << alias << "' is used for multiple products of type '" << friendlyClassName
177  << "' with module label '" << moduleLabel << "' and instance name '" << productInstanceName
178  << "'. One alias has the instance name '" << iter->first.productInstanceName()
179  << "' and the other has the instance name '" << instanceAlias << "'.";
180  }
181  }
182 
183  std::string const& theInstanceAlias(instanceAlias == star ? productInstanceName : instanceAlias);
184  BranchKey aliasKey(friendlyClassName, alias, theInstanceAlias, processName);
185  if (preg.productList().find(aliasKey) != preg.productList().end()) {
186  throw Exception(errors::Configuration, "EDAlias conflicts with data\n")
187  << "A product of type '" << friendlyClassName << "'\n"
188  << "with module label '" << alias << "' and instance name '" << theInstanceAlias << "'\n"
189  << "already exists.\n";
190  }
191  auto iter = aliasKeys.find(aliasKey);
192  if (iter != aliasKeys.end()) {
193  // The alias matches a previous one. If the same alias is used for different product, throw.
194  if (iter->second != key) {
195  throw Exception(errors::Configuration, "EDAlias conflict\n")
196  << "The module label alias '" << alias << "' and product instance alias '" << theInstanceAlias << "'\n"
197  << "are used for multiple products of type '" << friendlyClassName << "'\n"
198  << "One has module label '" << moduleLabel << "' and product instance name '" << productInstanceName
199  << "',\n"
200  << "the other has module label '" << iter->second.moduleLabel() << "' and product instance name '"
201  << iter->second.productInstanceName() << "'.\n";
202  }
203  } else {
204  auto prodIter = preg.productList().find(key);
205  if (prodIter != preg.productList().end()) {
206  if (!prodIter->second.produced()) {
207  throw Exception(errors::Configuration, "EDAlias\n")
208  << "The module label alias '" << alias << "' and product instance alias '" << theInstanceAlias << "'\n"
209  << "are used for a product of type '" << friendlyClassName << "'\n"
210  << "with module label '" << moduleLabel << "' and product instance name '" << productInstanceName
211  << "',\n"
212  << "An EDAlias can only be used for products produced in the current process. This one is not.\n";
213  }
214  aliasMap.insert(std::make_pair(key, aliasKey));
215  aliasKeys.insert(std::make_pair(aliasKey, key));
216  }
217  }
218  }
219 
220  void processEDAliases(ParameterSet const& proc_pset, std::string const& processName, ProductRegistry& preg) {
221  std::vector<std::string> aliases = proc_pset.getParameter<std::vector<std::string>>("@all_aliases");
222  if (aliases.empty()) {
223  return;
224  }
225  std::string const star("*");
226  std::string const empty("");
228  desc.add<std::string>("type");
229  desc.add<std::string>("fromProductInstance", star);
230  desc.add<std::string>("toProductInstance", star);
231 
232  std::multimap<BranchKey, BranchKey> aliasMap;
233 
234  std::map<BranchKey, BranchKey> aliasKeys; // Used to search for duplicates or clashes.
235 
236  // Auxiliary search structure to support wildcard for friendlyClassName
237  std::multimap<std::string, BranchKey> moduleLabelToBranches;
238  for (auto const& prod : preg.productList()) {
239  if (processName == prod.second.processName()) {
240  moduleLabelToBranches.emplace(prod.first.moduleLabel(), prod.first);
241  }
242  }
243 
244  // Now, loop over the alias information and store it in aliasMap.
245  for (std::string const& alias : aliases) {
246  ParameterSet const& aliasPSet = proc_pset.getParameterSet(alias);
247  std::vector<std::string> vPSetNames = aliasPSet.getParameterNamesForType<VParameterSet>();
248  for (std::string const& moduleLabel : vPSetNames) {
249  VParameterSet vPSet = aliasPSet.getParameter<VParameterSet>(moduleLabel);
250  for (ParameterSet& pset : vPSet) {
251  desc.validate(pset);
252  std::string friendlyClassName = pset.getParameter<std::string>("type");
253  std::string productInstanceName = pset.getParameter<std::string>("fromProductInstance");
254  std::string instanceAlias = pset.getParameter<std::string>("toProductInstance");
255 
256  if (friendlyClassName == star) {
257  bool processHasLabel = false;
258  bool match = false;
259  for (auto it = moduleLabelToBranches.lower_bound(moduleLabel);
260  it != moduleLabelToBranches.end() && it->first == moduleLabel;
261  ++it) {
262  processHasLabel = true;
263  if (productInstanceName != star and productInstanceName != it->second.productInstanceName()) {
264  continue;
265  }
266  match = true;
267 
268  checkAndInsertAlias(it->second.friendlyClassName(),
269  moduleLabel,
270  it->second.productInstanceName(),
271  processName,
272  alias,
273  instanceAlias,
274  preg,
275  aliasMap,
276  aliasKeys);
277  }
278  if (not match and processHasLabel) {
279  // No product was found matching the alias.
280  // We throw an exception only if a module with the specified module label was created in this process.
281  // Note that if that condition is ever relatex, it might be best to throw an exception with different
282  // message (omitting productInstanceName) in case 'productInstanceName == start'
283  throw Exception(errors::Configuration, "EDAlias parameter set mismatch\n")
284  << "There are no products with module label '" << moduleLabel << "' and product instance name '"
285  << productInstanceName << "'.\n";
286  }
287  } else if (productInstanceName == star) {
288  bool match = false;
289  BranchKey lowerBound(friendlyClassName, moduleLabel, empty, empty);
290  for (ProductRegistry::ProductList::const_iterator it = preg.productList().lower_bound(lowerBound);
291  it != preg.productList().end() && it->first.friendlyClassName() == friendlyClassName &&
292  it->first.moduleLabel() == moduleLabel;
293  ++it) {
294  if (it->first.processName() != processName) {
295  continue;
296  }
297  match = true;
298 
299  checkAndInsertAlias(friendlyClassName,
300  moduleLabel,
301  it->first.productInstanceName(),
302  processName,
303  alias,
304  instanceAlias,
305  preg,
306  aliasMap,
307  aliasKeys);
308  }
309  if (!match) {
310  // No product was found matching the alias.
311  // We throw an exception only if a module with the specified module label was created in this process.
312  for (auto const& product : preg.productList()) {
313  if (moduleLabel == product.first.moduleLabel() && processName == product.first.processName()) {
314  throw Exception(errors::Configuration, "EDAlias parameter set mismatch\n")
315  << "There are no products of type '" << friendlyClassName << "'\n"
316  << "with module label '" << moduleLabel << "'.\n";
317  }
318  }
319  }
320  } else {
321  checkAndInsertAlias(friendlyClassName,
322  moduleLabel,
323  productInstanceName,
324  processName,
325  alias,
326  instanceAlias,
327  preg,
328  aliasMap,
329  aliasKeys);
330  }
331  }
332  }
333  }
334 
335  // Now add the new alias entries to the product registry.
336  for (auto const& aliasEntry : aliasMap) {
337  ProductRegistry::ProductList::const_iterator it = preg.productList().find(aliasEntry.first);
338  assert(it != preg.productList().end());
339  preg.addLabelAlias(it->second, aliasEntry.second.moduleLabel(), aliasEntry.second.productInstanceName());
340  }
341  }
342 
343  typedef std::vector<std::string> vstring;
344 
345  void processSwitchProducers(ParameterSet const& proc_pset, std::string const& processName, ProductRegistry& preg) {
346  // Update Switch BranchDescriptions for the chosen case
347  struct BranchesCases {
348  BranchesCases(std::vector<std::string> cases) : caseLabels{std::move(cases)} {}
349  std::vector<BranchKey> chosenBranches;
350  std::vector<std::string> caseLabels;
351  };
352  std::map<std::string, BranchesCases> switchMap;
353  for (auto& prod : preg.productListUpdator()) {
354  if (prod.second.isSwitchAlias()) {
355  auto it = switchMap.find(prod.second.moduleLabel());
356  if (it == switchMap.end()) {
357  auto const& switchPSet = proc_pset.getParameter<edm::ParameterSet>(prod.second.moduleLabel());
358  auto inserted = switchMap.emplace(prod.second.moduleLabel(),
359  switchPSet.getParameter<std::vector<std::string>>("@all_cases"));
360  assert(inserted.second);
361  it = inserted.first;
362  }
363 
364  bool found = false;
365  for (auto const& productIter : preg.productList()) {
366  BranchKey const& branchKey = productIter.first;
367  // The alias-for product must be in the same process as
368  // the SwitchProducer (earlier processes or SubProcesses
369  // may contain products with same type, module label, and
370  // instance name)
371  if (branchKey.processName() != processName) {
372  continue;
373  }
374 
375  BranchDescription const& desc = productIter.second;
376  if (desc.branchType() == prod.second.branchType() and
377  desc.unwrappedTypeID().typeInfo() == prod.second.unwrappedTypeID().typeInfo() and
378  branchKey.moduleLabel() == prod.second.switchAliasModuleLabel() and
379  branchKey.productInstanceName() == prod.second.productInstanceName()) {
380  prod.second.setSwitchAliasForBranch(desc);
381  it->second.chosenBranches.push_back(prod.first); // with moduleLabel of the Switch
382  found = true;
383  }
384  }
385  if (not found) {
387  ex << "Trying to find a BranchDescription to be aliased-for by SwitchProducer with\n"
388  << " friendly class name = " << prod.second.friendlyClassName() << "\n"
389  << " module label = " << prod.second.moduleLabel() << "\n"
390  << " product instance name = " << prod.second.productInstanceName() << "\n"
391  << " process name = " << processName
392  << "\n\nbut did not find any. Please contact a framework developer.";
393  ex.addContext("Calling Schedule.cc:processSwitchProducers()");
394  throw ex;
395  }
396  }
397  }
398  if (switchMap.empty())
399  return;
400 
401  for (auto& elem : switchMap) {
402  std::sort(elem.second.chosenBranches.begin(), elem.second.chosenBranches.end());
403  }
404 
405  auto addProductsToException = [&preg, &processName](auto const& caseLabels, edm::Exception& ex) {
406  std::map<std::string, std::vector<BranchKey>> caseBranches;
407  for (auto const& item : preg.productList()) {
408  if (item.first.processName() != processName)
409  continue;
410 
411  if (auto found = std::find(caseLabels.begin(), caseLabels.end(), item.first.moduleLabel());
412  found != caseLabels.end()) {
413  caseBranches[*found].push_back(item.first);
414  }
415  }
416 
417  for (auto const& caseLabel : caseLabels) {
418  ex << "Products for case " << caseLabel << " (friendly class name, product instance name):\n";
419  auto& branches = caseBranches[caseLabel];
420  std::sort(branches.begin(), branches.end());
421  for (auto const& branch : branches) {
422  ex << " " << branch.friendlyClassName() << " " << branch.productInstanceName() << "\n";
423  }
424  }
425  };
426 
427  // Check that non-chosen cases declare exactly the same branches
428  // Also set the alias-for branches to transient
429  std::vector<bool> foundBranches;
430  for (auto const& switchItem : switchMap) {
431  auto const& switchLabel = switchItem.first;
432  auto const& chosenBranches = switchItem.second.chosenBranches;
433  auto const& caseLabels = switchItem.second.caseLabels;
434  foundBranches.resize(chosenBranches.size());
435  for (auto const& caseLabel : caseLabels) {
436  std::fill(foundBranches.begin(), foundBranches.end(), false);
437  for (auto& nonConstItem : preg.productListUpdator()) {
438  auto const& item = nonConstItem;
439  if (item.first.moduleLabel() == caseLabel and item.first.processName() == processName) {
440  // Set the alias-for branch as transient so it gets fully ignored in output.
441  // I tried first to implicitly drop all branches with
442  // '@' in ProductSelector, but that gave problems on
443  // input (those branches would be implicitly dropped on
444  // input as well, leading to the SwitchProducer branches
445  // do be dropped as dependent ones, as the alias
446  // detection logic in RootFile says that the
447  // SwitchProducer branches are not alias branches)
448  nonConstItem.second.setTransient(true);
449 
450  auto range = std::equal_range(chosenBranches.begin(),
451  chosenBranches.end(),
452  BranchKey(item.first.friendlyClassName(),
453  switchLabel,
454  item.first.productInstanceName(),
455  item.first.processName()));
456  if (range.first == range.second) {
458  ex << "SwitchProducer " << switchLabel << " has a case " << caseLabel << " with a product "
459  << item.first << " that is not produced by the chosen case "
460  << proc_pset.getParameter<edm::ParameterSet>(switchLabel)
461  .getUntrackedParameter<std::string>("@chosen_case")
462  << ". If the intention is to produce only a subset of the products listed below, each case with "
463  "more products needs to be replaced with an EDAlias to only the necessary products, and the "
464  "EDProducer itself needs to be moved to a Task.\n\n";
465  addProductsToException(caseLabels, ex);
466  throw ex;
467  }
468  assert(std::distance(range.first, range.second) == 1);
469  foundBranches[std::distance(chosenBranches.begin(), range.first)] = true;
470 
471  // Check that there are no BranchAliases for any of the cases
472  auto const& bd = item.second;
473  if (not bd.branchAliases().empty()) {
475  << "SwitchProducer does not support ROOT branch aliases. Got the following ROOT branch "
476  "aliases for SwitchProducer with label "
477  << switchLabel << " for case " << caseLabel << ":";
478  for (auto const& branchAlias : bd.branchAliases()) {
479  ex << " " << branchAlias;
480  }
481  throw ex;
482  }
483  }
484  }
485 
486  for (size_t i = 0; i < chosenBranches.size(); i++) {
487  if (not foundBranches[i]) {
488  auto chosenLabel = proc_pset.getParameter<edm::ParameterSet>(switchLabel)
489  .getUntrackedParameter<std::string>("@chosen_case");
491  ex << "SwitchProducer " << switchLabel << " has a case " << caseLabel
492  << " that does not produce a product " << chosenBranches[i] << " that is produced by the chosen case "
493  << chosenLabel
494  << ". If the intention is to produce only a subset of the products listed below, each case with more "
495  "products needs to be replaced with an EDAlias to only the necessary products, and the "
496  "EDProducer itself needs to be moved to a Task.\n\n";
497  addProductsToException(caseLabels, ex);
498  throw ex;
499  }
500  }
501  }
502  }
503  }
504 
505  void reduceParameterSet(ParameterSet& proc_pset,
506  vstring const& end_path_name_list,
507  vstring& modulesInConfig,
508  std::set<std::string> const& usedModuleLabels,
509  std::map<std::string, std::vector<std::pair<std::string, int>>>& outputModulePathPositions) {
510  // Before calculating the ParameterSetID of the top level ParameterSet or
511  // saving it in the registry drop from the top level ParameterSet all
512  // OutputModules and EDAnalyzers not on trigger paths. If unscheduled
513  // production is not enabled also drop all the EDFilters and EDProducers
514  // that are not scheduled. Drop the ParameterSet used to configure the module
515  // itself. Also drop the other traces of these labels in the top level
516  // ParameterSet: Remove that labels from @all_modules and from all the
517  // end paths. If this makes any end paths empty, then remove the end path
518  // name from @end_paths, and @paths.
519 
520  // First make a list of labels to drop
521  vstring outputModuleLabels;
522  std::string edmType;
523  std::string const moduleEdmType("@module_edm_type");
524  std::string const outputModule("OutputModule");
525  std::string const edAnalyzer("EDAnalyzer");
526  std::string const edFilter("EDFilter");
527  std::string const edProducer("EDProducer");
528 
529  std::set<std::string> modulesInConfigSet(modulesInConfig.begin(), modulesInConfig.end());
530 
531  //need a list of all modules on paths in order to determine
532  // if an EDAnalyzer only appears on an end path
533  vstring scheduledPaths = proc_pset.getParameter<vstring>("@paths");
534  std::set<std::string> modulesOnPaths;
535  {
536  std::set<std::string> noEndPaths(scheduledPaths.begin(), scheduledPaths.end());
537  for (auto const& endPath : end_path_name_list) {
538  noEndPaths.erase(endPath);
539  }
540  {
541  vstring labels;
542  for (auto const& path : noEndPaths) {
543  labels = proc_pset.getParameter<vstring>(path);
544  modulesOnPaths.insert(labels.begin(), labels.end());
545  }
546  }
547  }
548  //Initially fill labelsToBeDropped with all module mentioned in
549  // the configuration but which are not being used by the system
550  std::vector<std::string> labelsToBeDropped;
551  labelsToBeDropped.reserve(modulesInConfigSet.size());
552  std::set_difference(modulesInConfigSet.begin(),
553  modulesInConfigSet.end(),
554  usedModuleLabels.begin(),
555  usedModuleLabels.end(),
556  std::back_inserter(labelsToBeDropped));
557 
558  const unsigned int sizeBeforeOutputModules = labelsToBeDropped.size();
559  for (auto const& modLabel : usedModuleLabels) {
560  // Do nothing for modules that do not have a ParameterSet. Modules of type
561  // PathStatusInserter and EndPathStatusInserter will not have a ParameterSet.
562  if (proc_pset.existsAs<ParameterSet>(modLabel)) {
563  edmType = proc_pset.getParameterSet(modLabel).getParameter<std::string>(moduleEdmType);
564  if (edmType == outputModule) {
565  outputModuleLabels.push_back(modLabel);
566  labelsToBeDropped.push_back(modLabel);
567  }
568  if (edmType == edAnalyzer) {
569  if (modulesOnPaths.end() == modulesOnPaths.find(modLabel)) {
570  labelsToBeDropped.push_back(modLabel);
571  }
572  }
573  }
574  }
575  //labelsToBeDropped must be sorted
576  std::inplace_merge(
577  labelsToBeDropped.begin(), labelsToBeDropped.begin() + sizeBeforeOutputModules, labelsToBeDropped.end());
578 
579  // drop the parameter sets used to configure the modules
580  for_all(labelsToBeDropped, std::bind(&ParameterSet::eraseOrSetUntrackedParameterSet, std::ref(proc_pset), _1));
581 
582  // drop the labels from @all_modules
583  vstring::iterator endAfterRemove =
584  std::remove_if(modulesInConfig.begin(),
585  modulesInConfig.end(),
586  std::bind(binary_search_string, std::ref(labelsToBeDropped), _1));
587  modulesInConfig.erase(endAfterRemove, modulesInConfig.end());
588  proc_pset.addParameter<vstring>(std::string("@all_modules"), modulesInConfig);
589 
590  // drop the labels from all end paths
591  vstring endPathsToBeDropped;
592  vstring labels;
593  for (vstring::const_iterator iEndPath = end_path_name_list.begin(), endEndPath = end_path_name_list.end();
594  iEndPath != endEndPath;
595  ++iEndPath) {
596  labels = proc_pset.getParameter<vstring>(*iEndPath);
597  vstring::iterator iSave = labels.begin();
598  vstring::iterator iBegin = labels.begin();
599 
600  for (vstring::iterator iLabel = labels.begin(), iEnd = labels.end(); iLabel != iEnd; ++iLabel) {
601  if (binary_search_string(labelsToBeDropped, *iLabel)) {
602  if (binary_search_string(outputModuleLabels, *iLabel)) {
603  outputModulePathPositions[*iLabel].emplace_back(*iEndPath, iSave - iBegin);
604  }
605  } else {
606  if (iSave != iLabel) {
607  iSave->swap(*iLabel);
608  }
609  ++iSave;
610  }
611  }
612  labels.erase(iSave, labels.end());
613  if (labels.empty()) {
614  // remove empty end paths and save their names
615  proc_pset.eraseSimpleParameter(*iEndPath);
616  endPathsToBeDropped.push_back(*iEndPath);
617  } else {
618  proc_pset.addParameter<vstring>(*iEndPath, labels);
619  }
620  }
621  sort_all(endPathsToBeDropped);
622 
623  // remove empty end paths from @paths
624  endAfterRemove = std::remove_if(scheduledPaths.begin(),
625  scheduledPaths.end(),
626  std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
627  scheduledPaths.erase(endAfterRemove, scheduledPaths.end());
628  proc_pset.addParameter<vstring>(std::string("@paths"), scheduledPaths);
629 
630  // remove empty end paths from @end_paths
631  vstring scheduledEndPaths = proc_pset.getParameter<vstring>("@end_paths");
632  endAfterRemove = std::remove_if(scheduledEndPaths.begin(),
633  scheduledEndPaths.end(),
634  std::bind(binary_search_string, std::ref(endPathsToBeDropped), _1));
635  scheduledEndPaths.erase(endAfterRemove, scheduledEndPaths.end());
636  proc_pset.addParameter<vstring>(std::string("@end_paths"), scheduledEndPaths);
637  }
638 
639  class RngEDConsumer : public EDConsumerBase {
640  public:
641  explicit RngEDConsumer(std::set<TypeID>& typesConsumed) {
643  if (rng.isAvailable()) {
644  rng->consumes(consumesCollector());
645  for (auto const& consumesInfo : this->consumesInfo()) {
646  typesConsumed.emplace(consumesInfo.type());
647  }
648  }
649  }
650  };
651  } // namespace
652  // -----------------------------
653 
654  typedef std::vector<std::string> vstring;
655 
656  // -----------------------------
657 
659  service::TriggerNamesService const& tns,
660  ProductRegistry& preg,
661  BranchIDListHelper& branchIDListHelper,
662  ProcessBlockHelperBase& processBlockHelper,
663  ThinnedAssociationsHelper& thinnedAssociationsHelper,
664  SubProcessParentageHelper const* subProcessParentageHelper,
666  std::shared_ptr<ActivityRegistry> areg,
667  std::shared_ptr<ProcessConfiguration> processConfiguration,
668  bool hasSubprocesses,
669  PreallocationConfiguration const& prealloc,
670  ProcessContext const* processContext)
671  : //Only create a resultsInserter if there is a trigger path
672  resultsInserter_{tns.getTrigPaths().empty()
673  ? std::shared_ptr<TriggerResultInserter>{}
674  : makeInserter(proc_pset, prealloc, preg, actions, areg, processConfiguration)},
675  moduleRegistry_(new ModuleRegistry()),
676  all_output_communicators_(),
677  preallocConfig_(prealloc),
678  pathNames_(&tns.getTrigPaths()),
679  endPathNames_(&tns.getEndPaths()),
680  wantSummary_(tns.wantSummary()),
681  endpathsAreActive_(true) {
682  makePathStatusInserters(pathStatusInserters_,
683  *pathNames_,
684  prealloc,
685  preg,
686  areg,
687  processConfiguration,
688  std::string("PathStatusInserter"));
689 
690  makePathStatusInserters(endPathStatusInserters_,
691  *endPathNames_,
692  prealloc,
693  preg,
694  areg,
695  processConfiguration,
696  std::string("EndPathStatusInserter"));
697 
698  assert(0 < prealloc.numberOfStreams());
699  streamSchedules_.reserve(prealloc.numberOfStreams());
700  for (unsigned int i = 0; i < prealloc.numberOfStreams(); ++i) {
701  streamSchedules_.emplace_back(make_shared_noexcept_false<StreamSchedule>(resultsInserter(),
702  pathStatusInserters_,
703  endPathStatusInserters_,
704  moduleRegistry(),
705  proc_pset,
706  tns,
707  prealloc,
708  preg,
709  branchIDListHelper,
710  actions,
711  areg,
712  processConfiguration,
713  !hasSubprocesses,
714  StreamID{i},
715  processContext));
716  }
717 
718  //TriggerResults are injected automatically by StreamSchedules and are
719  // unknown to the ModuleRegistry
720  const std::string kTriggerResults("TriggerResults");
721  std::vector<std::string> modulesToUse;
722  modulesToUse.reserve(streamSchedules_[0]->allWorkers().size());
723  for (auto const& worker : streamSchedules_[0]->allWorkers()) {
724  if (worker->description()->moduleLabel() != kTriggerResults) {
725  modulesToUse.push_back(worker->description()->moduleLabel());
726  }
727  }
728  //The unscheduled modules are at the end of the list, but we want them at the front
729  unsigned int const nUnscheduledModules = streamSchedules_[0]->numberOfUnscheduledModules();
730  if (nUnscheduledModules > 0) {
731  std::vector<std::string> temp;
732  temp.reserve(modulesToUse.size());
733  auto itBeginUnscheduled = modulesToUse.begin() + modulesToUse.size() - nUnscheduledModules;
734  std::copy(itBeginUnscheduled, modulesToUse.end(), std::back_inserter(temp));
735  std::copy(modulesToUse.begin(), itBeginUnscheduled, std::back_inserter(temp));
736  temp.swap(modulesToUse);
737  }
738 
739  // propagate_const<T> has no reset() function
740  globalSchedule_ = std::make_unique<GlobalSchedule>(resultsInserter(),
741  pathStatusInserters_,
742  endPathStatusInserters_,
743  moduleRegistry(),
744  modulesToUse,
745  proc_pset,
746  preg,
747  prealloc,
748  actions,
749  areg,
750  processConfiguration,
751  processContext);
752 
753  //TriggerResults is not in the top level ParameterSet so the call to
754  // reduceParameterSet would fail to find it. Just remove it up front.
755  std::set<std::string> usedModuleLabels;
756  for (auto const& worker : allWorkers()) {
757  if (worker->description()->moduleLabel() != kTriggerResults) {
758  usedModuleLabels.insert(worker->description()->moduleLabel());
759  }
760  }
761  std::vector<std::string> modulesInConfig(proc_pset.getParameter<std::vector<std::string>>("@all_modules"));
762  std::map<std::string, std::vector<std::pair<std::string, int>>> outputModulePathPositions;
763  reduceParameterSet(proc_pset, tns.getEndPaths(), modulesInConfig, usedModuleLabels, outputModulePathPositions);
764  processEDAliases(proc_pset, processConfiguration->processName(), preg);
765 
766  // At this point all BranchDescriptions are created. Mark now the
767  // ones of unscheduled workers to be on-demand.
768  if (nUnscheduledModules > 0) {
769  std::set<std::string> unscheduledModules(modulesToUse.begin(), modulesToUse.begin() + nUnscheduledModules);
770  preg.setUnscheduledProducts(unscheduledModules);
771  }
772 
773  processSwitchProducers(proc_pset, processConfiguration->processName(), preg);
774  proc_pset.registerIt();
775  processConfiguration->setParameterSetID(proc_pset.id());
776  processConfiguration->setProcessConfigurationID();
777 
778  // This is used for a little sanity-check to make sure no code
779  // modifications alter the number of workers at a later date.
780  size_t all_workers_count = allWorkers().size();
781 
782  moduleRegistry_->forAllModuleHolders([this](maker::ModuleHolder* iHolder) {
783  auto comm = iHolder->createOutputModuleCommunicator();
784  if (comm) {
785  all_output_communicators_.emplace_back(std::shared_ptr<OutputModuleCommunicator>{comm.release()});
786  }
787  });
788  // Now that the output workers are filled in, set any output limits or information.
789  limitOutput(proc_pset, branchIDListHelper.branchIDLists(), subProcessParentageHelper);
790 
791  // Sanity check: make sure nobody has added a worker after we've
792  // already relied on the WorkerManager being full.
793  assert(all_workers_count == allWorkers().size());
794 
795  branchIDListHelper.updateFromRegistry(preg);
796 
797  for (auto const& worker : streamSchedules_[0]->allWorkers()) {
798  worker->registerThinnedAssociations(preg, thinnedAssociationsHelper);
799  }
800 
801  processBlockHelper.updateForNewProcess(preg, processConfiguration->processName());
802 
803  // The output modules consume products in kept branches.
804  // So we must set this up before freezing.
805  for (auto& c : all_output_communicators_) {
806  c->selectProducts(preg, thinnedAssociationsHelper, processBlockHelper);
807  }
808 
809  for (auto& product : preg.productListUpdator()) {
810  setIsMergeable(product.second);
811  }
812 
813  {
814  // We now get a collection of types that may be consumed.
815  std::set<TypeID> productTypesConsumed;
816  std::set<TypeID> elementTypesConsumed;
817  // Loop over all modules
818  for (auto const& worker : allWorkers()) {
819  for (auto const& consumesInfo : worker->consumesInfo()) {
820  if (consumesInfo.kindOfType() == PRODUCT_TYPE) {
821  productTypesConsumed.emplace(consumesInfo.type());
822  } else {
823  elementTypesConsumed.emplace(consumesInfo.type());
824  }
825  }
826  }
827  // The SubProcess class is not a module, yet it may consume.
828  if (hasSubprocesses) {
829  productTypesConsumed.emplace(typeid(TriggerResults));
830  }
831  // The RandomNumberGeneratorService is not a module, yet it consumes.
832  { RngEDConsumer rngConsumer = RngEDConsumer(productTypesConsumed); }
833  preg.setFrozen(productTypesConsumed, elementTypesConsumed, processConfiguration->processName());
834  }
835 
836  for (auto& c : all_output_communicators_) {
837  c->setEventSelectionInfo(outputModulePathPositions, preg.anyProductProduced());
838  }
839 
840  if (wantSummary_) {
841  std::vector<const ModuleDescription*> modDesc;
842  const auto& workers = allWorkers();
843  modDesc.reserve(workers.size());
844 
845  std::transform(workers.begin(),
846  workers.end(),
847  std::back_inserter(modDesc),
848  [](const Worker* iWorker) -> const ModuleDescription* { return iWorker->description(); });
849 
850  // propagate_const<T> has no reset() function
851  summaryTimeKeeper_ = std::make_unique<SystemTimeKeeper>(prealloc.numberOfStreams(), modDesc, tns, processContext);
852  auto timeKeeperPtr = summaryTimeKeeper_.get();
853 
854  areg->watchPreModuleDestruction(timeKeeperPtr, &SystemTimeKeeper::removeModuleIfExists);
855 
856  areg->watchPreModuleEvent(timeKeeperPtr, &SystemTimeKeeper::startModuleEvent);
857  areg->watchPostModuleEvent(timeKeeperPtr, &SystemTimeKeeper::stopModuleEvent);
858  areg->watchPreModuleEventAcquire(timeKeeperPtr, &SystemTimeKeeper::restartModuleEvent);
859  areg->watchPostModuleEventAcquire(timeKeeperPtr, &SystemTimeKeeper::stopModuleEvent);
860  areg->watchPreModuleEventDelayedGet(timeKeeperPtr, &SystemTimeKeeper::pauseModuleEvent);
861  areg->watchPostModuleEventDelayedGet(timeKeeperPtr, &SystemTimeKeeper::restartModuleEvent);
862 
863  areg->watchPreSourceEvent(timeKeeperPtr, &SystemTimeKeeper::startEvent);
864  areg->watchPostEvent(timeKeeperPtr, &SystemTimeKeeper::stopEvent);
865 
866  areg->watchPrePathEvent(timeKeeperPtr, &SystemTimeKeeper::startPath);
867  areg->watchPostPathEvent(timeKeeperPtr, &SystemTimeKeeper::stopPath);
868 
869  areg->watchPostBeginJob(timeKeeperPtr, &SystemTimeKeeper::startProcessingLoop);
870  areg->watchPreEndJob(timeKeeperPtr, &SystemTimeKeeper::stopProcessingLoop);
871  //areg->preModuleEventSignal_.connect([timeKeeperPtr](StreamContext const& iContext, ModuleCallingContext const& iMod) {
872  //timeKeeperPtr->startModuleEvent(iContext,iMod);
873  //});
874  }
875 
876  } // Schedule::Schedule
877 
878  void Schedule::limitOutput(ParameterSet const& proc_pset,
879  BranchIDLists const& branchIDLists,
880  SubProcessParentageHelper const* subProcessParentageHelper) {
881  std::string const output("output");
882 
883  ParameterSet const& maxEventsPSet = proc_pset.getUntrackedParameterSet("maxEvents");
884  int maxEventSpecs = 0;
885  int maxEventsOut = -1;
886  ParameterSet const* vMaxEventsOut = nullptr;
887  std::vector<std::string> intNamesE = maxEventsPSet.getParameterNamesForType<int>(false);
888  if (search_all(intNamesE, output)) {
889  maxEventsOut = maxEventsPSet.getUntrackedParameter<int>(output);
890  ++maxEventSpecs;
891  }
892  std::vector<std::string> psetNamesE;
893  maxEventsPSet.getParameterSetNames(psetNamesE, false);
894  if (search_all(psetNamesE, output)) {
895  vMaxEventsOut = &maxEventsPSet.getUntrackedParameterSet(output);
896  ++maxEventSpecs;
897  }
898 
899  if (maxEventSpecs > 1) {
901  << "\nAt most, one form of 'output' may appear in the 'maxEvents' parameter set";
902  }
903 
904  for (auto& c : all_output_communicators_) {
905  OutputModuleDescription desc(branchIDLists, maxEventsOut, subProcessParentageHelper);
906  if (vMaxEventsOut != nullptr && !vMaxEventsOut->empty()) {
907  std::string const& moduleLabel = c->description().moduleLabel();
908  try {
909  desc.maxEvents_ = vMaxEventsOut->getUntrackedParameter<int>(moduleLabel);
910  } catch (Exception const&) {
912  << "\nNo entry in 'maxEvents' for output module label '" << moduleLabel << "'.\n";
913  }
914  }
915  c->configure(desc);
916  }
917  }
918 
919  bool Schedule::terminate() const {
920  if (all_output_communicators_.empty()) {
921  return false;
922  }
923  for (auto& c : all_output_communicators_) {
924  if (!c->limitReached()) {
925  // Found an output module that has not reached output event count.
926  return false;
927  }
928  }
929  LogInfo("SuccessfulTermination") << "The job is terminating successfully because each output module\n"
930  << "has reached its configured limit.\n";
931  return true;
932  }
933 
935  globalSchedule_->endJob(collector);
936  if (collector.hasThrown()) {
937  return;
938  }
939 
940  if (wantSummary_ == false)
941  return;
942  {
943  TriggerReport tr;
944  getTriggerReport(tr);
945 
946  // The trigger report (pass/fail etc.):
947 
948  LogFwkVerbatim("FwkSummary") << "";
949  if (streamSchedules_[0]->context().processContext()->isSubProcess()) {
950  LogFwkVerbatim("FwkSummary") << "TrigReport Process: "
951  << streamSchedules_[0]->context().processContext()->processName();
952  }
953  LogFwkVerbatim("FwkSummary") << "TrigReport "
954  << "---------- Event Summary ------------";
955  if (!tr.trigPathSummaries.empty()) {
956  LogFwkVerbatim("FwkSummary") << "TrigReport"
957  << " Events total = " << tr.eventSummary.totalEvents
958  << " passed = " << tr.eventSummary.totalEventsPassed
959  << " failed = " << tr.eventSummary.totalEventsFailed << "";
960  } else {
961  LogFwkVerbatim("FwkSummary") << "TrigReport"
962  << " Events total = " << tr.eventSummary.totalEvents
963  << " passed = " << tr.eventSummary.totalEvents << " failed = 0";
964  }
965 
966  LogFwkVerbatim("FwkSummary") << "";
967  LogFwkVerbatim("FwkSummary") << "TrigReport "
968  << "---------- Path Summary ------------";
969  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
970  << " " << std::right << std::setw(10) << "Executed"
971  << " " << std::right << std::setw(10) << "Passed"
972  << " " << std::right << std::setw(10) << "Failed"
973  << " " << std::right << std::setw(10) << "Error"
974  << " "
975  << "Name"
976  << "";
977  for (auto const& p : tr.trigPathSummaries) {
978  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
979  << p.bitPosition << " " << std::right << std::setw(10) << p.timesRun << " "
980  << std::right << std::setw(10) << p.timesPassed << " " << std::right
981  << std::setw(10) << p.timesFailed << " " << std::right << std::setw(10)
982  << p.timesExcept << " " << p.name << "";
983  }
984 
985  /*
986  std::vector<int>::const_iterator epi = empty_trig_paths_.begin();
987  std::vector<int>::const_iterator epe = empty_trig_paths_.end();
988  std::vector<std::string>::const_iterator epn = empty_trig_path_names_.begin();
989  for (; epi != epe; ++epi, ++epn) {
990 
991  LogFwkVerbatim("FwkSummary") << "TrigReport "
992  << std::right << std::setw(5) << 1
993  << std::right << std::setw(5) << *epi << " "
994  << std::right << std::setw(10) << totalEvents() << " "
995  << std::right << std::setw(10) << totalEvents() << " "
996  << std::right << std::setw(10) << 0 << " "
997  << std::right << std::setw(10) << 0 << " "
998  << *epn << "";
999  }
1000  */
1001 
1002  LogFwkVerbatim("FwkSummary") << "";
1003  LogFwkVerbatim("FwkSummary") << "TrigReport "
1004  << "-------End-Path Summary ------------";
1005  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
1006  << " " << std::right << std::setw(10) << "Executed"
1007  << " " << std::right << std::setw(10) << "Passed"
1008  << " " << std::right << std::setw(10) << "Failed"
1009  << " " << std::right << std::setw(10) << "Error"
1010  << " "
1011  << "Name"
1012  << "";
1013  for (auto const& p : tr.endPathSummaries) {
1014  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1015  << p.bitPosition << " " << std::right << std::setw(10) << p.timesRun << " "
1016  << std::right << std::setw(10) << p.timesPassed << " " << std::right
1017  << std::setw(10) << p.timesFailed << " " << std::right << std::setw(10)
1018  << p.timesExcept << " " << p.name << "";
1019  }
1020 
1021  for (auto const& p : tr.trigPathSummaries) {
1022  LogFwkVerbatim("FwkSummary") << "";
1023  LogFwkVerbatim("FwkSummary") << "TrigReport "
1024  << "---------- Modules in Path: " << p.name << " ------------";
1025  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
1026  << " " << std::right << std::setw(10) << "Visited"
1027  << " " << std::right << std::setw(10) << "Passed"
1028  << " " << std::right << std::setw(10) << "Failed"
1029  << " " << std::right << std::setw(10) << "Error"
1030  << " "
1031  << "Name"
1032  << "";
1033 
1034  unsigned int bitpos = 0;
1035  for (auto const& mod : p.moduleInPathSummaries) {
1036  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 1 << std::right << std::setw(5)
1037  << bitpos << " " << std::right << std::setw(10) << mod.timesVisited << " "
1038  << std::right << std::setw(10) << mod.timesPassed << " " << std::right
1039  << std::setw(10) << mod.timesFailed << " " << std::right << std::setw(10)
1040  << mod.timesExcept << " " << mod.moduleLabel << "";
1041  ++bitpos;
1042  }
1043  }
1044 
1045  for (auto const& p : tr.endPathSummaries) {
1046  LogFwkVerbatim("FwkSummary") << "";
1047  LogFwkVerbatim("FwkSummary") << "TrigReport "
1048  << "------ Modules in End-Path: " << p.name << " ------------";
1049  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Trig Bit#"
1050  << " " << std::right << std::setw(10) << "Visited"
1051  << " " << std::right << std::setw(10) << "Passed"
1052  << " " << std::right << std::setw(10) << "Failed"
1053  << " " << std::right << std::setw(10) << "Error"
1054  << " "
1055  << "Name"
1056  << "";
1057 
1058  unsigned int bitpos = 0;
1059  for (auto const& mod : p.moduleInPathSummaries) {
1060  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(5) << 0 << std::right << std::setw(5)
1061  << bitpos << " " << std::right << std::setw(10) << mod.timesVisited << " "
1062  << std::right << std::setw(10) << mod.timesPassed << " " << std::right
1063  << std::setw(10) << mod.timesFailed << " " << std::right << std::setw(10)
1064  << mod.timesExcept << " " << mod.moduleLabel << "";
1065  ++bitpos;
1066  }
1067  }
1068 
1069  LogFwkVerbatim("FwkSummary") << "";
1070  LogFwkVerbatim("FwkSummary") << "TrigReport "
1071  << "---------- Module Summary ------------";
1072  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << "Visited"
1073  << " " << std::right << std::setw(10) << "Executed"
1074  << " " << std::right << std::setw(10) << "Passed"
1075  << " " << std::right << std::setw(10) << "Failed"
1076  << " " << std::right << std::setw(10) << "Error"
1077  << " "
1078  << "Name"
1079  << "";
1080  for (auto const& worker : tr.workerSummaries) {
1081  LogFwkVerbatim("FwkSummary") << "TrigReport " << std::right << std::setw(10) << worker.timesVisited << " "
1082  << std::right << std::setw(10) << worker.timesRun << " " << std::right
1083  << std::setw(10) << worker.timesPassed << " " << std::right << std::setw(10)
1084  << worker.timesFailed << " " << std::right << std::setw(10) << worker.timesExcept
1085  << " " << worker.moduleLabel << "";
1086  }
1087  LogFwkVerbatim("FwkSummary") << "";
1088  }
1089  // The timing report (CPU and Real Time):
1092 
1093  const int totalEvents = std::max(1, tr.eventSummary.totalEvents);
1094 
1095  LogFwkVerbatim("FwkSummary") << "TimeReport "
1096  << "---------- Event Summary ---[sec]----";
1097  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1098  << " event loop CPU/event = " << tr.eventSummary.cpuTime / totalEvents;
1099  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1100  << " event loop Real/event = " << tr.eventSummary.realTime / totalEvents;
1101  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1102  << " sum Streams Real/event = " << tr.eventSummary.sumStreamRealTime / totalEvents;
1103  LogFwkVerbatim("FwkSummary") << "TimeReport" << std::setprecision(6) << std::fixed
1104  << " efficiency CPU/Real/thread = "
1107 
1108  constexpr int kColumn1Size = 10;
1109  constexpr int kColumn2Size = 12;
1110  constexpr int kColumn3Size = 12;
1111  LogFwkVerbatim("FwkSummary") << "";
1112  LogFwkVerbatim("FwkSummary") << "TimeReport "
1113  << "---------- Path Summary ---[Real sec]----";
1114  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1115  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1116  << " Name";
1117  for (auto const& p : tr.trigPathSummaries) {
1118  const int timesRun = std::max(1, p.timesRun);
1119  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1120  << std::setw(kColumn1Size) << p.realTime / totalEvents << " " << std::right
1121  << std::setw(kColumn2Size) << p.realTime / timesRun << " " << p.name << "";
1122  }
1123  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1124  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1125  << " Name"
1126  << "";
1127 
1128  LogFwkVerbatim("FwkSummary") << "";
1129  LogFwkVerbatim("FwkSummary") << "TimeReport "
1130  << "-------End-Path Summary ---[Real sec]----";
1131  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1132  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1133  << " Name"
1134  << "";
1135  for (auto const& p : tr.endPathSummaries) {
1136  const int timesRun = std::max(1, p.timesRun);
1137 
1138  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1139  << std::setw(kColumn1Size) << p.realTime / totalEvents << " " << std::right
1140  << std::setw(kColumn2Size) << p.realTime / timesRun << " " << p.name << "";
1141  }
1142  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1143  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1144  << " Name"
1145  << "";
1146 
1147  for (auto const& p : tr.trigPathSummaries) {
1148  LogFwkVerbatim("FwkSummary") << "";
1149  LogFwkVerbatim("FwkSummary") << "TimeReport "
1150  << "---------- Modules in Path: " << p.name << " ---[Real sec]----";
1151  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1152  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1153  << " Name"
1154  << "";
1155  for (auto const& mod : p.moduleInPathSummaries) {
1156  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1157  << std::setw(kColumn1Size) << mod.realTime / totalEvents << " " << std::right
1158  << std::setw(kColumn2Size) << mod.realTime / std::max(1, mod.timesVisited) << " "
1159  << mod.moduleLabel << "";
1160  }
1161  }
1162  if (not tr.trigPathSummaries.empty()) {
1163  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1164  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1165  << " Name"
1166  << "";
1167  }
1168  for (auto const& p : tr.endPathSummaries) {
1169  LogFwkVerbatim("FwkSummary") << "";
1170  LogFwkVerbatim("FwkSummary") << "TimeReport "
1171  << "------ Modules in End-Path: " << p.name << " ---[Real sec]----";
1172  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1173  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1174  << " Name"
1175  << "";
1176  for (auto const& mod : p.moduleInPathSummaries) {
1177  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1178  << std::setw(kColumn1Size) << mod.realTime / totalEvents << " " << std::right
1179  << std::setw(kColumn2Size) << mod.realTime / std::max(1, mod.timesVisited) << " "
1180  << mod.moduleLabel << "";
1181  }
1182  }
1183  if (not tr.endPathSummaries.empty()) {
1184  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1185  << " " << std::right << std::setw(kColumn2Size) << "per visit"
1186  << " Name"
1187  << "";
1188  }
1189  LogFwkVerbatim("FwkSummary") << "";
1190  LogFwkVerbatim("FwkSummary") << "TimeReport "
1191  << "---------- Module Summary ---[Real sec]----";
1192  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1193  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1194  << " " << std::right << std::setw(kColumn3Size) << "per visit"
1195  << " Name"
1196  << "";
1197  for (auto const& worker : tr.workerSummaries) {
1198  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::setprecision(6) << std::fixed << std::right
1199  << std::setw(kColumn1Size) << worker.realTime / totalEvents << " " << std::right
1200  << std::setw(kColumn2Size) << worker.realTime / std::max(1, worker.timesRun) << " "
1201  << std::right << std::setw(kColumn3Size)
1202  << worker.realTime / std::max(1, worker.timesVisited) << " " << worker.moduleLabel
1203  << "";
1204  }
1205  LogFwkVerbatim("FwkSummary") << "TimeReport " << std::right << std::setw(kColumn1Size) << "per event"
1206  << " " << std::right << std::setw(kColumn2Size) << "per exec"
1207  << " " << std::right << std::setw(kColumn3Size) << "per visit"
1208  << " Name"
1209  << "";
1210 
1211  LogFwkVerbatim("FwkSummary") << "";
1212  LogFwkVerbatim("FwkSummary") << "T---Report end!"
1213  << "";
1214  LogFwkVerbatim("FwkSummary") << "";
1215  }
1216 
1218  using std::placeholders::_1;
1220  for (auto& worker : allWorkers()) {
1221  worker->respondToCloseOutputFile();
1222  }
1223  }
1224 
1226  using std::placeholders::_1;
1227  for_all(all_output_communicators_, std::bind(&OutputModuleCommunicator::openFile, _1, std::cref(fb)));
1228  }
1229 
1231  RunPrincipal const& rp,
1232  ProcessContext const* processContext,
1233  ActivityRegistry* activityRegistry,
1234  MergeableRunProductMetadata const* mergeableRunProductMetadata) {
1237  LuminosityBlockID(rp.run(), 0),
1238  rp.index(),
1240  rp.endTime(),
1241  processContext);
1242  auto t =
1243  make_waiting_task([task, activityRegistry, globalContext, token](std::exception_ptr const* iExcept) mutable {
1244  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1245  CMS_SA_ALLOW try {
1246  //services can depend on other services
1248 
1249  activityRegistry->postGlobalWriteRunSignal_(globalContext);
1250  } catch (...) {
1251  }
1252  std::exception_ptr ptr;
1253  if (iExcept) {
1254  ptr = *iExcept;
1255  }
1256  task.doneWaiting(ptr);
1257  });
1258  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1259  CMS_SA_ALLOW try { activityRegistry->preGlobalWriteRunSignal_(globalContext); } catch (...) {
1260  }
1261  WaitingTaskHolder tHolder(*task.group(), t);
1262 
1263  for (auto& c : all_output_communicators_) {
1264  c->writeRunAsync(tHolder, rp, processContext, activityRegistry, mergeableRunProductMetadata);
1265  }
1266  }
1267 
1269  ProcessBlockPrincipal const& pbp,
1270  ProcessContext const* processContext,
1271  ActivityRegistry* activityRegistry) {
1278  processContext);
1279 
1280  auto t =
1281  make_waiting_task([task, activityRegistry, globalContext, token](std::exception_ptr const* iExcept) mutable {
1282  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1283  CMS_SA_ALLOW try {
1284  //services can depend on other services
1286 
1287  activityRegistry->postWriteProcessBlockSignal_(globalContext);
1288  } catch (...) {
1289  }
1290  std::exception_ptr ptr;
1291  if (iExcept) {
1292  ptr = *iExcept;
1293  }
1294  task.doneWaiting(ptr);
1295  });
1296  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1297  CMS_SA_ALLOW try { activityRegistry->preWriteProcessBlockSignal_(globalContext); } catch (...) {
1298  }
1299  WaitingTaskHolder tHolder(*task.group(), t);
1300 
1301  for (auto& c : all_output_communicators_) {
1302  c->writeProcessBlockAsync(tHolder, pbp, processContext, activityRegistry);
1303  }
1304  }
1305 
1307  LuminosityBlockPrincipal const& lbp,
1308  ProcessContext const* processContext,
1309  ActivityRegistry* activityRegistry) {
1312  lbp.id(),
1313  lbp.runPrincipal().index(),
1314  lbp.index(),
1315  lbp.beginTime(),
1316  processContext);
1317 
1318  auto t =
1319  make_waiting_task([task, activityRegistry, globalContext, token](std::exception_ptr const* iExcept) mutable {
1320  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1321  CMS_SA_ALLOW try {
1322  //services can depend on other services
1324 
1325  activityRegistry->postGlobalWriteLumiSignal_(globalContext);
1326  } catch (...) {
1327  }
1328  std::exception_ptr ptr;
1329  if (iExcept) {
1330  ptr = *iExcept;
1331  }
1332  task.doneWaiting(ptr);
1333  });
1334  // Propagating the exception would be nontrivial, and signal actions are not supposed to throw exceptions
1335  CMS_SA_ALLOW try { activityRegistry->preGlobalWriteLumiSignal_(globalContext); } catch (...) {
1336  }
1337  WaitingTaskHolder tHolder(*task.group(), t);
1338  for (auto& c : all_output_communicators_) {
1339  c->writeLumiAsync(tHolder, lbp, processContext, activityRegistry);
1340  }
1341  }
1342 
1344  using std::placeholders::_1;
1345  // Return true iff at least one output module returns true.
1346  return (std::find_if(all_output_communicators_.begin(),
1350  }
1351 
1353  using std::placeholders::_1;
1354  for_all(allWorkers(), std::bind(&Worker::respondToOpenInputFile, _1, std::cref(fb)));
1355  }
1356 
1358  using std::placeholders::_1;
1359  for_all(allWorkers(), std::bind(&Worker::respondToCloseInputFile, _1, std::cref(fb)));
1360  }
1361 
1362  void Schedule::beginJob(ProductRegistry const& iRegistry,
1363  eventsetup::ESRecordsToProxyIndices const& iESIndices,
1364  ProcessBlockHelperBase const& processBlockHelperBase) {
1365  globalSchedule_->beginJob(iRegistry, iESIndices, processBlockHelperBase);
1366  }
1367 
1368  void Schedule::beginStream(unsigned int iStreamID) {
1369  assert(iStreamID < streamSchedules_.size());
1370  streamSchedules_[iStreamID]->beginStream();
1371  }
1372 
1373  void Schedule::endStream(unsigned int iStreamID) {
1374  assert(iStreamID < streamSchedules_.size());
1375  streamSchedules_[iStreamID]->endStream();
1376  }
1377 
1379  unsigned int iStreamID,
1381  ServiceToken const& token) {
1382  assert(iStreamID < streamSchedules_.size());
1383  streamSchedules_[iStreamID]->processOneEventAsync(std::move(iTask), info, token, pathStatusInserters_);
1384  }
1385 
1387  ParameterSet const& iPSet,
1388  const ProductRegistry& iRegistry,
1389  eventsetup::ESRecordsToProxyIndices const& iIndices) {
1390  Worker* found = nullptr;
1391  for (auto const& worker : allWorkers()) {
1392  if (worker->description()->moduleLabel() == iLabel) {
1393  found = worker;
1394  break;
1395  }
1396  }
1397  if (nullptr == found) {
1398  return false;
1399  }
1400 
1401  auto newMod = moduleRegistry_->replaceModule(iLabel, iPSet, preallocConfig_);
1402 
1403  globalSchedule_->replaceModule(newMod, iLabel);
1404 
1405  for (auto& s : streamSchedules_) {
1406  s->replaceModule(newMod, iLabel);
1407  }
1408 
1409  {
1410  //Need to updateLookup in order to make getByToken work
1411  auto const processBlockLookup = iRegistry.productLookup(InProcess);
1412  auto const runLookup = iRegistry.productLookup(InRun);
1413  auto const lumiLookup = iRegistry.productLookup(InLumi);
1414  auto const eventLookup = iRegistry.productLookup(InEvent);
1415  found->updateLookup(InProcess, *runLookup);
1416  found->updateLookup(InRun, *runLookup);
1417  found->updateLookup(InLumi, *lumiLookup);
1418  found->updateLookup(InEvent, *eventLookup);
1419  found->updateLookup(iIndices);
1420 
1421  auto const& processName = newMod->moduleDescription().processName();
1422  auto const& processBlockModuleToIndicies = processBlockLookup->indiciesForModulesInProcess(processName);
1423  auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(processName);
1424  auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(processName);
1425  auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(processName);
1426  found->resolvePutIndicies(InProcess, processBlockModuleToIndicies);
1427  found->resolvePutIndicies(InRun, runModuleToIndicies);
1428  found->resolvePutIndicies(InLumi, lumiModuleToIndicies);
1429  found->resolvePutIndicies(InEvent, eventModuleToIndicies);
1430  }
1431 
1432  return true;
1433  }
1434 
1436  globalSchedule_->deleteModule(iLabel);
1437  for (auto& stream : streamSchedules_) {
1438  stream->deleteModule(iLabel);
1439  }
1440  moduleRegistry_->deleteModule(iLabel, areg->preModuleDestructionSignal_, areg->postModuleDestructionSignal_);
1441  }
1442 
1443  std::vector<ModuleDescription const*> Schedule::getAllModuleDescriptions() const {
1444  std::vector<ModuleDescription const*> result;
1445  result.reserve(allWorkers().size());
1446 
1447  for (auto const& worker : allWorkers()) {
1448  ModuleDescription const* p = worker->description();
1449  result.push_back(p);
1450  }
1451  return result;
1452  }
1453 
1454  Schedule::AllWorkers const& Schedule::allWorkers() const { return globalSchedule_->allWorkers(); }
1455 
1457  for (auto const& worker : allWorkers()) {
1458  worker->convertCurrentProcessAlias(processName);
1459  }
1460  }
1461 
1462  void Schedule::availablePaths(std::vector<std::string>& oLabelsToFill) const {
1463  streamSchedules_[0]->availablePaths(oLabelsToFill);
1464  }
1465 
1466  void Schedule::triggerPaths(std::vector<std::string>& oLabelsToFill) const { oLabelsToFill = *pathNames_; }
1467 
1468  void Schedule::endPaths(std::vector<std::string>& oLabelsToFill) const { oLabelsToFill = *endPathNames_; }
1469 
1470  void Schedule::modulesInPath(std::string const& iPathLabel, std::vector<std::string>& oLabelsToFill) const {
1471  streamSchedules_[0]->modulesInPath(iPathLabel, oLabelsToFill);
1472  }
1473 
1475  std::vector<ModuleDescription const*>& descriptions,
1476  unsigned int hint) const {
1477  streamSchedules_[0]->moduleDescriptionsInPath(iPathLabel, descriptions, hint);
1478  }
1479 
1481  std::vector<ModuleDescription const*>& descriptions,
1482  unsigned int hint) const {
1483  streamSchedules_[0]->moduleDescriptionsInEndPath(iEndPathLabel, descriptions, hint);
1484  }
1485 
1487  std::vector<ModuleDescription const*>& allModuleDescriptions,
1488  std::vector<std::pair<unsigned int, unsigned int>>& moduleIDToIndex,
1489  std::array<std::vector<std::vector<ModuleDescription const*>>, NumBranchTypes>& modulesWhoseProductsAreConsumedBy,
1490  std::vector<std::vector<ModuleProcessName>>& modulesInPreviousProcessesWhoseProductsAreConsumedBy,
1491  ProductRegistry const& preg) const {
1492  allModuleDescriptions.clear();
1493  moduleIDToIndex.clear();
1494  for (auto iBranchType = 0U; iBranchType < NumBranchTypes; ++iBranchType) {
1495  modulesWhoseProductsAreConsumedBy[iBranchType].clear();
1496  }
1497  modulesInPreviousProcessesWhoseProductsAreConsumedBy.clear();
1498 
1499  allModuleDescriptions.reserve(allWorkers().size());
1500  moduleIDToIndex.reserve(allWorkers().size());
1501  for (auto iBranchType = 0U; iBranchType < NumBranchTypes; ++iBranchType) {
1502  modulesWhoseProductsAreConsumedBy[iBranchType].resize(allWorkers().size());
1503  }
1504  modulesInPreviousProcessesWhoseProductsAreConsumedBy.resize(allWorkers().size());
1505 
1506  std::map<std::string, ModuleDescription const*> labelToDesc;
1507  unsigned int i = 0;
1508  for (auto const& worker : allWorkers()) {
1509  ModuleDescription const* p = worker->description();
1510  allModuleDescriptions.push_back(p);
1511  moduleIDToIndex.push_back(std::pair<unsigned int, unsigned int>(p->id(), i));
1512  labelToDesc[p->moduleLabel()] = p;
1513  ++i;
1514  }
1515  sort_all(moduleIDToIndex);
1516 
1517  i = 0;
1518  for (auto const& worker : allWorkers()) {
1519  std::array<std::vector<ModuleDescription const*>*, NumBranchTypes> modules;
1520  for (auto iBranchType = 0U; iBranchType < NumBranchTypes; ++iBranchType) {
1521  modules[iBranchType] = &modulesWhoseProductsAreConsumedBy[iBranchType].at(i);
1522  }
1523 
1524  std::vector<ModuleProcessName>& modulesInPreviousProcesses =
1525  modulesInPreviousProcessesWhoseProductsAreConsumedBy.at(i);
1526  try {
1527  worker->modulesWhoseProductsAreConsumed(modules, modulesInPreviousProcesses, preg, labelToDesc);
1528  } catch (cms::Exception& ex) {
1529  ex.addContext("Calling Worker::modulesWhoseProductsAreConsumed() for module " +
1530  worker->description()->moduleLabel());
1531  throw;
1532  }
1533  ++i;
1534  }
1535  }
1536 
1537  void Schedule::enableEndPaths(bool active) {
1538  endpathsAreActive_ = active;
1539  for (auto& s : streamSchedules_) {
1540  s->enableEndPaths(active);
1541  }
1542  }
1543 
1545 
1547  rep.eventSummary.totalEvents = 0;
1548  rep.eventSummary.totalEventsPassed = 0;
1549  rep.eventSummary.totalEventsFailed = 0;
1550  for (auto& s : streamSchedules_) {
1551  s->getTriggerReport(rep);
1552  }
1553  sort_all(rep.workerSummaries);
1554  }
1555 
1557  rep.eventSummary.totalEvents = 0;
1558  rep.eventSummary.cpuTime = 0.;
1559  rep.eventSummary.realTime = 0.;
1560  summaryTimeKeeper_->fillTriggerTimingReport(rep);
1561  }
1562 
1564  int returnValue = 0;
1565  for (auto& s : streamSchedules_) {
1566  returnValue += s->totalEvents();
1567  }
1568  return returnValue;
1569  }
1570 
1572  int returnValue = 0;
1573  for (auto& s : streamSchedules_) {
1574  returnValue += s->totalEventsPassed();
1575  }
1576  return returnValue;
1577  }
1578 
1580  int returnValue = 0;
1581  for (auto& s : streamSchedules_) {
1582  returnValue += s->totalEventsFailed();
1583  }
1584  return returnValue;
1585  }
1586 
1588  for (auto& s : streamSchedules_) {
1589  s->clearCounters();
1590  }
1591  }
1592 } // namespace edm
edm::Schedule::Schedule
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)
Definition: Schedule.cc:658
edm::EventTransitionInfo
Definition: TransitionInfoTypes.h:26
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
edm::StreamID
Definition: StreamID.h:30
edm::ActivityRegistry::preGlobalWriteLumiSignal_
PreGlobalEndLumi preGlobalWriteLumiSignal_
Definition: ActivityRegistry.h:432
ThinnedAssociationsHelper.h
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
edm::RunPrincipal::endTime
Timestamp const & endTime() const
Definition: RunPrincipal.h:69
edm::LuminosityBlockPrincipal::runPrincipal
RunPrincipal const & runPrincipal() const
Definition: LuminosityBlockPrincipal.h:45
edm::EventTimingSummary::sumStreamRealTime
double sumStreamRealTime
Definition: TriggerTimingReport.h:21
ProductResolverIndexHelper.h
mps_fire.i
i
Definition: mps_fire.py:428
edm::TriggerTimingReport::eventSummary
EventTimingSummary eventSummary
Definition: TriggerTimingReport.h:53
edm::Schedule::limitOutput
void limitOutput(ParameterSet const &proc_pset, BranchIDLists const &branchIDLists, SubProcessParentageHelper const *subProcessParentageHelper)
Definition: Schedule.cc:878
edm::SubProcessParentageHelper
Definition: SubProcessParentageHelper.h:21
edm::Schedule::fillModuleAndConsumesInfo
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
Definition: Schedule.cc:1486
edm::Schedule::pathNames_
std::vector< std::string > const * pathNames_
Definition: Schedule.h:319
LogMessageMonitor_cff.modules
modules
Definition: LogMessageMonitor_cff.py:7
MessageLogger.h
edm::eventsetup::ESRecordsToProxyIndices
Definition: ESRecordsToProxyIndices.h:35
edm::LogFwkVerbatim
Log< level::FwkInfo, true > LogFwkVerbatim
Definition: MessageLogger.h:129
cms::Exception::addContext
void addContext(std::string const &context)
Definition: Exception.cc:165
edm::PRODUCT_TYPE
Definition: ProductKindOfType.h:5
edm::Schedule::endStream
void endStream(unsigned int)
Definition: Schedule.cc:1373
edm::Schedule::writeRunAsync
void writeRunAsync(WaitingTaskHolder iTask, RunPrincipal const &rp, ProcessContext const *, ActivityRegistry *, MergeableRunProductMetadata const *)
Definition: Schedule.cc:1230
edm::EventSummary::totalEvents
int totalEvents
Definition: TriggerReport.h:19
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
TriggerResults.h
edm::setIsMergeable
void setIsMergeable(BranchDescription &)
Definition: setIsMergeable.cc:15
edm::TriggerTimingReport::trigPathSummaries
std::vector< PathTimingSummary > trigPathSummaries
Definition: TriggerTimingReport.h:54
edm::sort_all
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:92
edm::ParameterSet::getUntrackedParameterSet
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: ParameterSet.cc:2136
edm::errors::LogicError
Definition: EDMException.h:37
edm::SystemTimeKeeper::removeModuleIfExists
void removeModuleIfExists(ModuleDescription const &module)
Definition: SystemTimeKeeper.cc:109
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
BranchIDListHelper.h
edm::ActivityRegistry::postGlobalWriteRunSignal_
PostGlobalWriteRun postGlobalWriteRunSignal_
Definition: ActivityRegistry.h:375
TriggerNamesService.h
WaitingTaskHolder.h
edm::PreallocationConfiguration::numberOfThreads
unsigned int numberOfThreads() const
Definition: PreallocationConfiguration.h:34
modules
Definition: MuonCleanerBySegments.cc:35
edm::ParameterSet::eraseOrSetUntrackedParameterSet
void eraseOrSetUntrackedParameterSet(std::string const &name)
Definition: ParameterSet.cc:138
MicroEventContent_cff.branch
branch
Definition: MicroEventContent_cff.py:174
edm::Schedule::modulesInPath
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
Definition: Schedule.cc:1470
edm
HLT enums.
Definition: AlignableModifier.h:19
RandomNumberGenerator.h
edm::ProcessContext
Definition: ProcessContext.h:27
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
edm::EventTimingSummary::cpuTime
double cpuTime
Definition: TriggerTimingReport.h:19
edm::Schedule::clearCounters
void clearCounters()
Clear all the counters in the trigger report.
Definition: Schedule.cc:1587
TriggerTimingReport.h
edm::TriggerTimingReport::endPathSummaries
std::vector< PathTimingSummary > endPathSummaries
Definition: TriggerTimingReport.h:55
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
cms::cuda::stream
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition: HistoContainer.h:51
Algorithms.h
edm::ModuleDescription::getUniqueID
static unsigned int getUniqueID()
Returns a unique id each time called. Intended to be passed to ModuleDescription's constructor's modI...
Definition: ModuleDescription.cc:87
edm::GlobalContext::Transition::kWriteProcessBlock
cms::cuda::assert
assert(be >=bs)
edm::Worker::respondToOpenInputFile
void respondToOpenInputFile(FileBlock const &fb)
Definition: Worker.h:173
edm::VParameterSet
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:34
TypeID.h
edm::Schedule::openOutputFiles
void openOutputFiles(FileBlock &fb)
Definition: Schedule.cc:1225
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::SystemTimeKeeper::startProcessingLoop
void startProcessingLoop()
Definition: SystemTimeKeeper.cc:205
mps_check.array
array
Definition: mps_check.py:216
edm::ProductRegistry::productLookup
std::shared_ptr< ProductResolverIndexHelper const > productLookup(BranchType branchType) const
Definition: ProductRegistry.cc:145
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
PreallocationConfiguration.h
ProductRegistry.h
edm::Schedule::moduleDescriptionsInEndPath
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:1480
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Schedule::totalEvents
int totalEvents() const
Definition: Schedule.cc:1563
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::SystemTimeKeeper::stopProcessingLoop
void stopProcessingLoop()
Definition: SystemTimeKeeper.cc:207
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Schedule::totalEventsFailed
int totalEventsFailed() const
Definition: Schedule.cc:1579
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::InRun
Definition: BranchType.h:11
edm::ProcessBlockPrincipal
Definition: ProcessBlockPrincipal.h:22
CMS_SA_ALLOW
#define CMS_SA_ALLOW
Definition: thread_safety_macros.h:5
edm::Schedule::closeOutputFiles
void closeOutputFiles()
Definition: Schedule.cc:1217
edm::Schedule::wantSummary_
bool wantSummary_
Definition: Schedule.h:321
edm::SystemTimeKeeper::startModuleEvent
void startModuleEvent(StreamContext const &, ModuleCallingContext const &)
Definition: SystemTimeKeeper.cc:165
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::NumBranchTypes
Definition: BranchType.h:11
edm::TriggerReport::trigPathSummaries
std::vector< PathSummary > trigPathSummaries
Definition: TriggerReport.h:58
edm::Exception
Definition: EDMException.h:77
edm::Schedule::convertCurrentProcessAlias
void convertCurrentProcessAlias(std::string const &processName)
Convert "@currentProcess" in InputTag process names to the actual current process name.
Definition: Schedule.cc:1456
edm::for_all
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:14
edm::ProductRegistry
Definition: ProductRegistry.h:37
ActivityRegistry.h
visDQMUpload.context
context
Definition: visDQMUpload.py:37
edm::Schedule::availablePaths
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
Definition: Schedule.cc:1462
edm::FileBlock
Definition: FileBlock.h:22
TriggerReport.h
edm::ServiceToken
Definition: ServiceToken.h:42
edm::InProcess
Definition: BranchType.h:11
edm::ActivityRegistry::postWriteProcessBlockSignal_
PostWriteProcessBlock postWriteProcessBlockSignal_
Definition: ActivityRegistry.h:363
edm::ActivityRegistry::postGlobalWriteLumiSignal_
PostGlobalEndLumi postGlobalWriteLumiSignal_
Definition: ActivityRegistry.h:439
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::propagate_const
Definition: propagate_const.h:32
ProcessBlockHelper.h
OutputModuleCommunicator.h
edm::vstring
std::vector< std::string > vstring
Definition: Schedule.cc:654
edm::SystemTimeKeeper::startEvent
void startEvent(StreamID)
Definition: SystemTimeKeeper.cc:136
edm::Schedule::beginJob
void beginJob(ProductRegistry const &, eventsetup::ESRecordsToProxyIndices const &, ProcessBlockHelperBase const &)
Definition: Schedule.cc:1362
OutputModuleDescription.h
ProcessConfiguration.h
hltMonBTagIPClient_cfi.pathName
pathName
Definition: hltMonBTagIPClient_cfi.py:5
edm::ExceptionCollector
Definition: ExceptionCollector.h:33
edm::TriggerReport::workerSummaries
std::vector< WorkerSummary > workerSummaries
Definition: TriggerReport.h:60
edm::Schedule::shouldWeCloseOutput
bool shouldWeCloseOutput() const
Definition: Schedule.cc:1343
TrackValidation_cff.task
task
Definition: TrackValidation_cff.py:253
edm::Schedule::endJob
void endJob(ExceptionCollector &collector)
Definition: Schedule.cc:934
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
edm::ActivityRegistry
Definition: ActivityRegistry.h:134
edm::TriggerTimingReport
Definition: TriggerTimingReport.h:52
edm::Schedule::changeModule
bool changeModule(std::string const &iLabel, ParameterSet const &iPSet, const ProductRegistry &iRegistry, eventsetup::ESRecordsToProxyIndices const &)
Definition: Schedule.cc:1386
edm::MergeableRunProductMetadata
Definition: MergeableRunProductMetadata.h:52
Service
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
edm::Schedule::beginStream
void beginStream(unsigned int)
Definition: Schedule.cc:1368
edm::InEvent
Definition: BranchType.h:11
ConvertException.h
ExceptionCollector.h
ParameterSetDescription.h
edm::LuminosityBlockID
Definition: LuminosityBlockID.h:31
edm::Worker
Definition: Worker.h:91
edm::BranchIDLists
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::RunPrincipal::index
RunIndex index() const
Definition: RunPrincipal.h:57
edm::Schedule::getTriggerReport
void getTriggerReport(TriggerReport &rep) const
Definition: Schedule.cc:1546
edm::ExceptionCollector::hasThrown
bool hasThrown() const
Definition: ExceptionCollector.cc:28
edm::OutputModuleCommunicator::shouldWeCloseFile
virtual bool shouldWeCloseFile() const =0
edm::GlobalContext::Transition::kWriteLuminosityBlock
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:37
edm::GlobalContext
Definition: GlobalContext.h:29
edm::Schedule::streamSchedules_
std::vector< edm::propagate_const< std::shared_ptr< StreamSchedule > > > streamSchedules_
Definition: Schedule.h:310
edm::ProcessBlockHelperBase
Definition: ProcessBlockHelperBase.h:18
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Schedule::endPathsEnabled
bool endPathsEnabled() const
Definition: Schedule.cc:1544
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
EDConsumerBase.h
edm::make_waiting_task
FunctorWaitingTask< F > * make_waiting_task(F f)
Definition: WaitingTask.h:101
edm::LuminosityBlockIndex::invalidLuminosityBlockIndex
static LuminosityBlockIndex invalidLuminosityBlockIndex()
Definition: LuminosityBlockIndex.cc:9
edm::TriggerReport::eventSummary
EventSummary eventSummary
Definition: TriggerReport.h:57
ParameterSet
Definition: Functions.h:16
edm::WaitingTaskHolder
Definition: WaitingTaskHolder.h:32
edm::InLumi
Definition: BranchType.h:11
edm::Schedule::terminate
bool terminate() const
Return whether each output module has reached its maximum count.
Definition: Schedule.cc:919
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::OutputModuleCommunicator::openFile
virtual void openFile(FileBlock const &fb)=0
edm::Schedule::pathStatusInserters_
std::vector< edm::propagate_const< std::shared_ptr< PathStatusInserter > > > pathStatusInserters_
Definition: Schedule.h:307
edm::ServiceRegistry::presentToken
ServiceToken presentToken() const
Definition: ServiceRegistry.cc:63
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
edm::Schedule::writeProcessBlockAsync
void writeProcessBlockAsync(WaitingTaskHolder iTask, ProcessBlockPrincipal const &, ProcessContext const *, ActivityRegistry *)
Definition: Schedule.cc:1268
Exception
thread_safety_macros.h
TriggerResultInserter.h
edm::BranchIDListHelper
Definition: BranchIDListHelper.h:15
edm::RunPrincipal::run
RunNumber_t run() const
Definition: RunPrincipal.h:61
Schedule.h
edm::ParameterSet::getParameterNamesForType
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
edm::Schedule::endpathsAreActive_
volatile bool endpathsAreActive_
Definition: Schedule.h:323
edm::Schedule::respondToCloseInputFile
void respondToCloseInputFile(FileBlock const &fb)
Definition: Schedule.cc:1357
cuy.rep
rep
Definition: cuy.py:1189
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::SystemTimeKeeper::stopPath
void stopPath(StreamContext const &, PathContext const &, HLTPathStatus const &)
Definition: SystemTimeKeeper.cc:152
edm::Schedule::AllWorkers
std::vector< Worker * > AllWorkers
Definition: Schedule.h:125
edm::GlobalContext::Transition::kWriteRun
edm::Worker::respondToCloseInputFile
void respondToCloseInputFile(FileBlock const &fb)
Definition: Worker.h:174
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::SystemTimeKeeper::stopModuleEvent
void stopModuleEvent(StreamContext const &, ModuleCallingContext const &)
Definition: SystemTimeKeeper.cc:172
edm::EventTimingSummary::totalEvents
int totalEvents
Definition: TriggerTimingReport.h:18
edm::ExceptionToActionTable
Definition: ExceptionActions.h:16
edm::Schedule::all_output_communicators_
AllOutputModuleCommunicators all_output_communicators_
Definition: Schedule.h:314
edm::EventSummary::totalEventsPassed
int totalEventsPassed
Definition: TriggerReport.h:20
PathStatusInserter.h
edm::ServiceRegistry::instance
static ServiceRegistry & instance()
Definition: ServiceRegistry.cc:90
edm::TriggerReport
Definition: TriggerReport.h:56
edm::RunIndex::invalidRunIndex
static RunIndex invalidRunIndex()
Definition: RunIndex.cc:9
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Schedule::respondToOpenInputFile
void respondToOpenInputFile(FileBlock const &fb)
Definition: Schedule.cc:1352
SubProcess.h
EndPathStatusInserter.h
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
edm::Schedule::endPaths
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
Definition: Schedule.cc:1468
edm::Schedule::totalEventsPassed
int totalEventsPassed() const
Definition: Schedule.cc:1571
edm::service::TriggerNamesService
Definition: TriggerNamesService.h:42
edm::Schedule::enableEndPaths
void enableEndPaths(bool active)
Definition: Schedule.cc:1537
edm::Schedule::endPathNames_
std::vector< std::string > const * endPathNames_
Definition: Schedule.h:320
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::Timestamp::invalidTimestamp
static Timestamp invalidTimestamp()
Definition: Timestamp.h:82
edm::TriggerTimingReport::workerSummaries
std::vector< WorkerTimingSummary > workerSummaries
Definition: TriggerTimingReport.h:56
ModuleRegistry.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::Schedule::allWorkers
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
Definition: Schedule.cc:1454
edm::ModuleRegistry
Definition: ModuleRegistry.h:40
edm::match
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
Definition: BranchDescription.cc:351
edm::Schedule::moduleDescriptionsInPath
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:1474
edm::SystemTimeKeeper::startPath
void startPath(StreamContext const &, PathContext const &)
Definition: SystemTimeKeeper.cc:145
edm::service::TriggerNamesService::getTrigPaths
Strings const & getTrigPaths() const
Definition: TriggerNamesService.h:55
ModuleHolder.h
edm::LuminosityBlockPrincipal::id
LuminosityBlockID id() const
Definition: LuminosityBlockPrincipal.h:53
edm::Schedule::summaryTimeKeeper_
edm::propagate_const< std::unique_ptr< SystemTimeKeeper > > summaryTimeKeeper_
Definition: Schedule.h:317
setIsMergeable.h
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:128
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:245
edm::SystemTimeKeeper::pauseModuleEvent
void pauseModuleEvent(StreamContext const &, ModuleCallingContext const &)
Definition: SystemTimeKeeper.cc:185
edm::Schedule::processOneEventAsync
void processOneEventAsync(WaitingTaskHolder iTask, unsigned int iStreamID, EventTransitionInfo &, ServiceToken const &token)
Definition: Schedule.cc:1378
edm::OutputModuleCommunicator::closeFile
virtual void closeFile()=0
ParameterSetDescription
vstring
vector< string > vstring
Definition: ExoticaDQM.cc:8
edm::Schedule::writeLumiAsync
void writeLumiAsync(WaitingTaskHolder iTask, LuminosityBlockPrincipal const &lbp, ProcessContext const *, ActivityRegistry *)
Definition: Schedule.cc:1306
edm::Schedule::globalSchedule_
edm::propagate_const< std::unique_ptr< GlobalSchedule > > globalSchedule_
Definition: Schedule.h:312
edm::ActivityRegistry::preGlobalWriteRunSignal_
PreGlobalWriteRun preGlobalWriteRunSignal_
Definition: ActivityRegistry.h:370
edm::ActivityRegistry::preModuleDestructionSignal_
PreModuleDestruction preModuleDestructionSignal_
Definition: ActivityRegistry.h:730
actions
roAction_t actions[nactions]
Definition: GenABIO.cc:181
mps_fire.result
result
Definition: mps_fire.py:311
edm::Schedule::deleteModule
void deleteModule(std::string const &iLabel, ActivityRegistry *areg)
Deletes module with label iLabel.
Definition: Schedule.cc:1435
edm::search_all
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:36
cms::Exception
Definition: Exception.h:70
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
genParticles_cff.map
map
Definition: genParticles_cff.py:11
edm::Schedule::moduleRegistry_
edm::propagate_const< std::shared_ptr< ModuleRegistry > > moduleRegistry_
Definition: Schedule.h:309
edm::OutputModuleDescription
Definition: OutputModuleDescription.h:17
ParameterSet.h
edm::LuminosityBlockPrincipal::index
LuminosityBlockIndex index() const
Definition: LuminosityBlockPrincipal.h:51
edm::LuminosityBlockPrincipal::beginTime
Timestamp const & beginTime() const
Definition: LuminosityBlockPrincipal.h:55
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
edm::RunPrincipal
Definition: RunPrincipal.h:34
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::TriggerReport::endPathSummaries
std::vector< PathSummary > endPathSummaries
Definition: TriggerReport.h:59
edm::ActivityRegistry::preWriteProcessBlockSignal_
PreWriteProcessBlock preWriteProcessBlockSignal_
Definition: ActivityRegistry.h:356
edm::EventSummary::totalEventsFailed
int totalEventsFailed
Definition: TriggerReport.h:21
edm::Schedule::getAllModuleDescriptions
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
Definition: Schedule.cc:1443
edm::SystemTimeKeeper::stopEvent
void stopEvent(StreamContext const &)
Definition: SystemTimeKeeper.cc:141
HLTObjectsMonitor_cfi.TriggerResults
TriggerResults
Definition: HLTObjectsMonitor_cfi.py:9
edm::Schedule::triggerPaths
void triggerPaths(std::vector< std::string > &oLabelsToFill) const
Definition: Schedule.cc:1466
Factory.h
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7746
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
crabWrapper.key
key
Definition: crabWrapper.py:19
ConsumesInfo.h
edm::ServiceRegistry::Operate
Definition: ServiceRegistry.h:40
edm::errors::Configuration
Definition: EDMException.h:36
edm::EventTimingSummary::realTime
double realTime
Definition: TriggerTimingReport.h:20
EcalCalibMonitorClient_cfi.workers
workers
Definition: EcalCalibMonitorClient_cfi.py:19
edm::SystemTimeKeeper::restartModuleEvent
void restartModuleEvent(StreamContext const &, ModuleCallingContext const &)
Definition: SystemTimeKeeper.cc:198
make_shared_noexcept_false.h
edm::errors::UnimplementedFeature
Definition: EDMException.h:38
edm::Schedule::preallocConfig_
PreallocationConfiguration preallocConfig_
Definition: Schedule.h:315
edm::Schedule::getTriggerTimingReport
void getTriggerTimingReport(TriggerTimingReport &rep) const
Definition: Schedule.cc:1556
edm::ParameterSet::empty
bool empty() const
Definition: ParameterSet.h:201
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::ActivityRegistry::postModuleDestructionSignal_
PostModuleDestruction postModuleDestructionSignal_
Definition: ActivityRegistry.h:739
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316
edm::ParameterSet::getParameterSetNames
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
Definition: ParameterSet.cc:724