CMS 3D CMS Logo

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