CMS 3D CMS Logo

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,
24  PreallocationConfiguration const& prealloc,
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 }
size
Write out results.
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.
roAction_t actions[nactions]
Definition: GenABIO.cc:187
const double w
Definition: UKUtility.cc:23
virtual void replaceModuleFor(Worker *) const =0
void beginJob(ProductRegistry const &iRegistry)
void addToAllWorkers(Worker *w)
void beginJob(ProductRegistry const &)
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
std::shared_ptr< ActivityRegistry > actReg_
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
HLT enums.
void beginJob()
Definition: Worker.cc:245
WorkerManager workerManager_
Worker * getWorker(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string const &label)
void addToAllWorkers(Worker *w)
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)