test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PathsAndConsumesOfModules.cc
Go to the documentation of this file.
2 
6 
7 #include <algorithm>
8 
9 namespace edm {
10 
12  }
13 
14  void PathsAndConsumesOfModules::initialize(Schedule const* schedule, std::shared_ptr<ProductRegistry const> preg) {
15 
17  preg_ = preg;
18 
19  paths_.clear();
20  schedule->triggerPaths(paths_);
21 
22  endPaths_.clear();
23  schedule->endPaths(endPaths_);
24 
25  modulesOnPaths_.resize(paths_.size());
26  unsigned int i = 0;
27  unsigned int hint = 0;
28  for(auto const& path : paths_) {
29  schedule->moduleDescriptionsInPath(path, modulesOnPaths_.at(i), hint);
30  if(!modulesOnPaths_.at(i).empty()) ++hint;
31  ++i;
32  }
33 
34  modulesOnEndPaths_.resize(endPaths_.size());
35  i = 0;
36  hint = 0;
37  for(auto const& endpath : endPaths_) {
38  schedule->moduleDescriptionsInEndPath(endpath, modulesOnEndPaths_.at(i), hint);
39  if(!modulesOnEndPaths_.at(i).empty()) ++hint;
40  ++i;
41  }
42 
46  *preg);
47  }
48 
49  ModuleDescription const*
50  PathsAndConsumesOfModules::doModuleDescription(unsigned int moduleID) const {
51  unsigned int dummy = 0;
52  auto target = std::make_pair(moduleID, dummy);
53  std::vector<std::pair<unsigned int, unsigned int> >::const_iterator iter =
54  std::lower_bound(moduleIDToIndex_.begin(), moduleIDToIndex_.end(), target);
55  if (iter == moduleIDToIndex_.end() || iter->first != moduleID) {
57  << "PathsAndConsumesOfModules::moduleDescription: Unknown moduleID\n";
58  }
59  return allModuleDescriptions_.at(iter->second);
60  }
61 
62  std::vector<ModuleDescription const*> const&
63  PathsAndConsumesOfModules::doModulesOnPath(unsigned int pathIndex) const {
64  return modulesOnPaths_.at(pathIndex);
65  }
66 
67  std::vector<ModuleDescription const*> const&
68  PathsAndConsumesOfModules::doModulesOnEndPath(unsigned int endPathIndex) const {
69  return modulesOnEndPaths_.at(endPathIndex);
70  }
71 
72  std::vector<ModuleDescription const*> const&
75  }
76 
77  std::vector<ConsumesInfo>
78  PathsAndConsumesOfModules::doConsumesInfo(unsigned int moduleID) const {
79  Worker const* worker = schedule_->allWorkers().at(moduleIndex(moduleID));
80  return worker->consumesInfo();
81  }
82 
83  unsigned int
84  PathsAndConsumesOfModules::moduleIndex(unsigned int moduleID) const {
85  unsigned int dummy = 0;
86  auto target = std::make_pair(moduleID, dummy);
87  std::vector<std::pair<unsigned int, unsigned int> >::const_iterator iter =
88  std::lower_bound(moduleIDToIndex_.begin(), moduleIDToIndex_.end(), target);
89  if (iter == moduleIDToIndex_.end() || iter->first != moduleID) {
91  << "PathsAndConsumesOfModules::moduleIndex: Unknown moduleID\n";
92  }
93  return iter->second;
94  }
95 }
int i
Definition: DBlmapReader.cc:9
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:1010
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
Definition: Schedule.cc:970
std::vector< std::vector< ModuleDescription const * > > modulesWhoseProductsAreConsumedBy_
virtual std::vector< ModuleDescription const * > const & doModulesWhoseProductsAreConsumedBy(unsigned int moduleID) const override
unsigned int moduleIndex(unsigned int moduleID) const
void moduleDescriptionsInEndPath(std::string const &iEndPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:1003
virtual std::vector< ModuleDescription const * > const & doModulesOnPath(unsigned int pathIndex) const override
std::vector< std::pair< unsigned int, unsigned int > > moduleIDToIndex_
std::vector< ModuleDescription const * > allModuleDescriptions_
void initialize(Schedule const *, std::shared_ptr< ProductRegistry const >)
std::vector< std::vector< ModuleDescription const * > > modulesOnPaths_
void triggerPaths(std::vector< std::string > &oLabelsToFill) const
Definition: Schedule.cc:980
virtual std::vector< ConsumesInfo > consumesInfo() const =0
std::vector< std::string > endPaths_
std::shared_ptr< ProductRegistry const > preg_
virtual ModuleDescription const * doModuleDescription(unsigned int moduleID) const override
virtual std::vector< ConsumesInfo > doConsumesInfo(unsigned int moduleID) const override
virtual std::vector< ModuleDescription const * > const & doModulesOnEndPath(unsigned int endPathIndex) const override
std::vector< std::vector< ModuleDescription const * > > modulesOnEndPaths_
preg
Definition: Schedule.cc:374
void endPaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all end paths in the process
Definition: Schedule.cc:985
void moduleDescriptionsInPath(std::string const &iPathLabel, std::vector< ModuleDescription const * > &descriptions, unsigned int hint) const
Definition: Schedule.cc:996