CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalSchedule.cc
Go to the documentation of this file.
4 
11 
12 #include <algorithm>
13 #include <cassert>
14 #include <cstdlib>
15 #include <functional>
16 #include <map>
17 
18 namespace edm {
19  GlobalSchedule::GlobalSchedule(std::shared_ptr<TriggerResultInserter> inserter,
20  std::shared_ptr<ModuleRegistry> modReg,
21  std::vector<std::string> const& iModulesToUse,
22  ParameterSet& proc_pset,
23  ProductRegistry& pregistry,
26  std::shared_ptr<ActivityRegistry> areg,
27  std::shared_ptr<ProcessConfiguration> processConfiguration,
28  ProcessContext const* processContext) :
29  workerManager_(modReg,areg,actions),
30  actReg_(areg),
31  processContext_(processContext)
32  {
33  for (auto const& moduleLabel : iModulesToUse) {
34  bool isTracked;
35  ParameterSet* modpset = proc_pset.getPSetForUpdate(moduleLabel, isTracked);
36  if (modpset == 0) {
38  "The unknown module label \"" << moduleLabel <<
39  "\"\n please check spelling";
40  }
41  assert(isTracked);
42 
43  //side effect keeps this module around
44  addToAllWorkers(workerManager_.getWorker(*modpset, pregistry, &prealloc,processConfiguration, moduleLabel));
45 
46  }
47  if(inserter) {
48  results_inserter_ = WorkerPtr(new edm::WorkerT<TriggerResultInserter::ModuleType>(inserter, inserter->moduleDescription(), &actions)); // propagate_const<T> has no reset() function
49  inserter->doPreallocate(prealloc);
50  results_inserter_->setActivityRegistry(actReg_);
52  }
53 
54  } // GlobalSchedule::GlobalSchedule
55 
56 
58  workerManager_.endJob(collector);
59  }
60 
61  void GlobalSchedule::beginJob(ProductRegistry const& iRegistry) {
62  workerManager_.beginJob(iRegistry);
63  }
64 
66  std::string const& iLabel) {
67  Worker* found = nullptr;
68  for (auto const& worker : allWorkers()) {
69  if (worker->description().moduleLabel() == iLabel) {
70  found = worker;
71  break;
72  }
73  }
74  if (nullptr == found) {
75  return;
76  }
77 
78  iMod->replaceModuleFor(found);
79  found->beginJob();
80  }
81 
82  std::vector<ModuleDescription const*>
84  std::vector<ModuleDescription const*> result;
85  result.reserve(allWorkers().size());
86 
87  for (auto const& worker : allWorkers()) {
88  ModuleDescription const* p = worker->descPtr();
89  result.push_back(p);
90  }
91  return result;
92  }
93 
94  void
97  }
98 
99 }
edm::propagate_const< WorkerPtr > results_inserter_
void replaceModule(maker::ModuleHolder *iMod, std::string const &iLabel)
clone the type of module with label iLabel but configure with iPSet.
const double w
Definition: UKUtility.cc:23
virtual void replaceModuleFor(Worker *) const =0
assert(m_qm.get())
void beginJob(ProductRegistry const &iRegistry)
processConfiguration
Definition: Schedule.cc:384
void addToAllWorkers(Worker *w)
actions
Definition: Schedule.cc:384
void beginJob(ProductRegistry const &)
tuple result
Definition: mps_fire.py:84
GlobalSchedule(std::shared_ptr< TriggerResultInserter > inserter, std::shared_ptr< ModuleRegistry > modReg, std::vector< std::string > const &modulesToUse, ParameterSet &proc_pset, ProductRegistry &pregistry, PreallocationConfiguration const &prealloc, ExceptionToActionTable const &actions, std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ProcessConfiguration > processConfiguration, ProcessContext const *processContext)
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
std::shared_ptr< Worker > WorkerPtr
void endJob(ExceptionCollector &collector)
element_type const * get() const
areg
Definition: Schedule.cc:384
std::shared_ptr< ActivityRegistry > actReg_
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
void beginJob()
Definition: Worker.cc:231
WorkerManager workerManager_
tuple size
Write out results.
Worker * getWorker(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &label)
prealloc
Definition: Schedule.cc:384
void addToAllWorkers(Worker *w)
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)