CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::PathsAndConsumesOfModules Class Reference

#include <PathsAndConsumesOfModules.h>

Inheritance diagram for edm::PathsAndConsumesOfModules:
edm::PathsAndConsumesOfModulesBase

Public Member Functions

void initialize (Schedule const *, std::shared_ptr< ProductRegistry const >)
 
std::vector< ModuleProcessName > const & modulesInPreviousProcessesWhoseProductsAreConsumedBy (unsigned int moduleID) const
 
 PathsAndConsumesOfModules ()
 
void removeModules (std::vector< ModuleDescription const *> const &modules)
 
 ~PathsAndConsumesOfModules () override
 
- Public Member Functions inherited from edm::PathsAndConsumesOfModulesBase
std::vector< ModuleDescription const * > const & allModules () const
 
std::vector< ConsumesInfoconsumesInfo (unsigned int moduleID) const
 
std::vector< std::string > const & endPaths () const
 
unsigned int largestModuleID () const
 
ModuleDescription const * moduleDescription (unsigned int moduleID) const
 
std::vector< ModuleDescription const * > const & modulesOnEndPath (unsigned int endPathIndex) const
 
std::vector< ModuleDescription const * > const & modulesOnPath (unsigned int pathIndex) const
 
std::vector< ModuleDescription const * > const & modulesWhoseProductsAreConsumedBy (unsigned int moduleID, BranchType branchType=InEvent) const
 
std::vector< std::string > const & paths () const
 
virtual ~PathsAndConsumesOfModulesBase ()
 

Private Member Functions

std::vector< ModuleDescription const * > const & doAllModules () const override
 
std::vector< ConsumesInfodoConsumesInfo (unsigned int moduleID) const override
 
std::vector< std::string > const & doEndPaths () const override
 
unsigned int doLargestModuleID () const override
 
ModuleDescription const * doModuleDescription (unsigned int moduleID) const override
 
std::vector< ModuleDescription const * > const & doModulesOnEndPath (unsigned int endPathIndex) const override
 
std::vector< ModuleDescription const * > const & doModulesOnPath (unsigned int pathIndex) const override
 
std::vector< ModuleDescription const * > const & doModulesWhoseProductsAreConsumedBy (unsigned int moduleID, BranchType branchType) const override
 
std::vector< std::string > const & doPaths () const override
 
unsigned int moduleIndex (unsigned int moduleID) const
 

Private Attributes

std::vector< ModuleDescription const * > allModuleDescriptions_
 
std::vector< std::string > endPaths_
 
std::vector< std::pair< unsigned int, unsigned int > > moduleIDToIndex_
 
std::vector< std::vector< ModuleProcessName > > modulesInPreviousProcessesWhoseProductsAreConsumedBy_
 
std::vector< std::vector< ModuleDescription const * > > modulesOnEndPaths_
 
std::vector< std::vector< ModuleDescription const * > > modulesOnPaths_
 
std::array< std::vector< std::vector< ModuleDescription const * > >, NumBranchTypesmodulesWhoseProductsAreConsumedBy_
 
std::vector< std::string > paths_
 
std::shared_ptr< ProductRegistry const > preg_
 
Schedule const * schedule_
 

Detailed Description

Description: See comments in the base class

Usage:

Definition at line 33 of file PathsAndConsumesOfModules.h.

Constructor & Destructor Documentation

◆ PathsAndConsumesOfModules()

edm::PathsAndConsumesOfModules::PathsAndConsumesOfModules ( )
default

◆ ~PathsAndConsumesOfModules()

edm::PathsAndConsumesOfModules::~PathsAndConsumesOfModules ( )
overridedefault

Member Function Documentation

◆ doAllModules()

std::vector<ModuleDescription const*> const& edm::PathsAndConsumesOfModules::doAllModules ( ) const
inlineoverrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 49 of file PathsAndConsumesOfModules.h.

References allModuleDescriptions_.

49 { return allModuleDescriptions_; }
std::vector< ModuleDescription const * > allModuleDescriptions_

◆ doConsumesInfo()

std::vector< ConsumesInfo > edm::PathsAndConsumesOfModules::doConsumesInfo ( unsigned int  moduleID) const
overrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 122 of file PathsAndConsumesOfModules.cc.

References edm::Schedule::allWorkers(), edm::Worker::consumesInfo(), moduleIndex(), and schedule_.

122  {
123  Worker const* worker = schedule_->allWorkers().at(moduleIndex(moduleID));
124  return worker->consumesInfo();
125  }
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
Definition: Schedule.cc:1292
unsigned int moduleIndex(unsigned int moduleID) const

◆ doEndPaths()

std::vector<std::string> const& edm::PathsAndConsumesOfModules::doEndPaths ( ) const
inlineoverrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 47 of file PathsAndConsumesOfModules.h.

References endPaths_.

47 { return endPaths_; }
std::vector< std::string > endPaths_

◆ doLargestModuleID()

unsigned int edm::PathsAndConsumesOfModules::doLargestModuleID ( ) const
overrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 127 of file PathsAndConsumesOfModules.cc.

References moduleIDToIndex_.

127  {
128  // moduleIDToIndex_ is sorted, so last element has the largest ID
129  return moduleIDToIndex_.empty() ? 0 : moduleIDToIndex_.back().first;
130  }
std::vector< std::pair< unsigned int, unsigned int > > moduleIDToIndex_

◆ doModuleDescription()

ModuleDescription const * edm::PathsAndConsumesOfModules::doModuleDescription ( unsigned int  moduleID) const
overrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 96 of file PathsAndConsumesOfModules.cc.

References allModuleDescriptions_, Exception, edm::errors::LogicError, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, moduleIDToIndex_, and filterCSVwithJSON::target.

96  {
97  unsigned int dummy = 0;
98  auto target = std::make_pair(moduleID, dummy);
99  std::vector<std::pair<unsigned int, unsigned int>>::const_iterator iter =
101  if (iter == moduleIDToIndex_.end() || iter->first != moduleID) {
103  << "PathsAndConsumesOfModules::moduleDescription: Unknown moduleID " << moduleID << "\n";
104  }
105  return allModuleDescriptions_.at(iter->second);
106  }
std::vector< std::pair< unsigned int, unsigned int > > moduleIDToIndex_
std::vector< ModuleDescription const * > allModuleDescriptions_

◆ doModulesOnEndPath()

std::vector< ModuleDescription const * > const & edm::PathsAndConsumesOfModules::doModulesOnEndPath ( unsigned int  endPathIndex) const
overrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 112 of file PathsAndConsumesOfModules.cc.

References modulesOnEndPaths_.

113  {
114  return modulesOnEndPaths_.at(endPathIndex);
115  }
std::vector< std::vector< ModuleDescription const * > > modulesOnEndPaths_

◆ doModulesOnPath()

std::vector< ModuleDescription const * > const & edm::PathsAndConsumesOfModules::doModulesOnPath ( unsigned int  pathIndex) const
overrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 108 of file PathsAndConsumesOfModules.cc.

References modulesOnPaths_.

108  {
109  return modulesOnPaths_.at(pathIndex);
110  }
std::vector< std::vector< ModuleDescription const * > > modulesOnPaths_

◆ doModulesWhoseProductsAreConsumedBy()

std::vector< ModuleDescription const * > const & edm::PathsAndConsumesOfModules::doModulesWhoseProductsAreConsumedBy ( unsigned int  moduleID,
BranchType  branchType 
) const
overrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 117 of file PathsAndConsumesOfModules.cc.

References moduleIndex(), and modulesWhoseProductsAreConsumedBy_.

118  {
119  return modulesWhoseProductsAreConsumedBy_[branchType].at(moduleIndex(moduleID));
120  }
std::array< std::vector< std::vector< ModuleDescription const * > >, NumBranchTypes > modulesWhoseProductsAreConsumedBy_
unsigned int moduleIndex(unsigned int moduleID) const

◆ doPaths()

std::vector<std::string> const& edm::PathsAndConsumesOfModules::doPaths ( ) const
inlineoverrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 46 of file PathsAndConsumesOfModules.h.

References paths_.

46 { return paths_; }

◆ initialize()

void edm::PathsAndConsumesOfModules::initialize ( Schedule const *  schedule,
std::shared_ptr< ProductRegistry const >  preg 
)

Definition at line 17 of file PathsAndConsumesOfModules.cc.

References allModuleDescriptions_, convertToRaw::endpath, endPaths_, mps_fire::i, moduleIDToIndex_, modulesInPreviousProcessesWhoseProductsAreConsumedBy_, modulesOnEndPaths_, modulesOnPaths_, modulesWhoseProductsAreConsumedBy_, EnsembleCalibrationLA_cfg::path, paths_, preg_, produceCalibrationTree_cfg::schedule, and schedule_.

Referenced by edm::EventProcessor::beginJob(), and edm::SubProcess::keepOnlyConsumedUnscheduledModules().

17  {
19  preg_ = preg;
20 
21  paths_.clear();
22  schedule->triggerPaths(paths_);
23 
24  endPaths_.clear();
25  schedule->endPaths(endPaths_);
26 
27  modulesOnPaths_.resize(paths_.size());
28  unsigned int i = 0;
29  unsigned int hint = 0;
30  for (auto const& path : paths_) {
31  schedule->moduleDescriptionsInPath(path, modulesOnPaths_.at(i), hint);
32  if (!modulesOnPaths_.at(i).empty())
33  ++hint;
34  ++i;
35  }
36 
37  modulesOnEndPaths_.resize(endPaths_.size());
38  i = 0;
39  hint = 0;
40  for (auto const& endpath : endPaths_) {
41  schedule->moduleDescriptionsInEndPath(endpath, modulesOnEndPaths_.at(i), hint);
42  if (!modulesOnEndPaths_.at(i).empty())
43  ++hint;
44  ++i;
45  }
46 
47  schedule->fillModuleAndConsumesInfo(allModuleDescriptions_,
51  *preg);
52  }
std::array< std::vector< std::vector< ModuleDescription const * > >, NumBranchTypes > modulesWhoseProductsAreConsumedBy_
std::vector< std::pair< unsigned int, unsigned int > > moduleIDToIndex_
std::vector< ModuleDescription const * > allModuleDescriptions_
std::vector< std::vector< ModuleDescription const * > > modulesOnPaths_
std::vector< std::vector< ModuleProcessName > > modulesInPreviousProcessesWhoseProductsAreConsumedBy_
std::vector< std::string > endPaths_
std::shared_ptr< ProductRegistry const > preg_
std::vector< std::vector< ModuleDescription const * > > modulesOnEndPaths_

◆ moduleIndex()

unsigned int edm::PathsAndConsumesOfModules::moduleIndex ( unsigned int  moduleID) const
private

Definition at line 132 of file PathsAndConsumesOfModules.cc.

References Exception, edm::errors::LogicError, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, moduleIDToIndex_, and filterCSVwithJSON::target.

Referenced by doConsumesInfo(), doModulesWhoseProductsAreConsumedBy(), and modulesInPreviousProcessesWhoseProductsAreConsumedBy().

132  {
133  unsigned int dummy = 0;
134  auto target = std::make_pair(moduleID, dummy);
135  std::vector<std::pair<unsigned int, unsigned int>>::const_iterator iter =
137  if (iter == moduleIDToIndex_.end() || iter->first != moduleID) {
139  << "PathsAndConsumesOfModules::moduleIndex: Unknown moduleID " << moduleID << "\n";
140  }
141  return iter->second;
142  }
std::vector< std::pair< unsigned int, unsigned int > > moduleIDToIndex_

◆ modulesInPreviousProcessesWhoseProductsAreConsumedBy()

std::vector< ModuleProcessName > const & edm::PathsAndConsumesOfModules::modulesInPreviousProcessesWhoseProductsAreConsumedBy ( unsigned int  moduleID) const

Definition at line 91 of file PathsAndConsumesOfModules.cc.

References moduleIndex(), and modulesInPreviousProcessesWhoseProductsAreConsumedBy_.

Referenced by edm::SubProcess::keepOnlyConsumedUnscheduledModules().

92  {
94  }
std::vector< std::vector< ModuleProcessName > > modulesInPreviousProcessesWhoseProductsAreConsumedBy_
unsigned int moduleIndex(unsigned int moduleID) const

◆ removeModules()

void edm::PathsAndConsumesOfModules::removeModules ( std::vector< ModuleDescription const *> const &  modules)

Definition at line 54 of file PathsAndConsumesOfModules.cc.

References allModuleDescriptions_, config::checkPath, makeListRunsInFiles::description, Exception, spr::find(), newFWLiteAna::found, moduleIDToIndex_, LogMessageMonitor_cff::modules, modulesInPreviousProcessesWhoseProductsAreConsumedBy_, modulesOnEndPaths_, modulesOnPaths_, modulesWhoseProductsAreConsumedBy_, edm::NumBranchTypes, EnsembleCalibrationLA_cfg::path, edm::PathsAndConsumesOfModulesBase::paths(), and mitigatedMETSequence_cff::U.

Referenced by edm::EventProcessor::beginJob(), and edm::SubProcess::keepOnlyConsumedUnscheduledModules().

54  {
55  // First check that no modules on Paths are removed
56  auto checkPath = [&modules](auto const& paths) {
57  for (auto const& path : paths) {
58  for (auto const& description : path) {
59  if (std::find(modules.begin(), modules.end(), description) != modules.end()) {
60  throw cms::Exception("Assert")
61  << "PathsAndConsumesOfModules::removeModules() is trying to remove a module with label "
62  << description->moduleLabel() << " id " << description->id() << " from a Path, this should not happen.";
63  }
64  }
65  }
66  };
69 
70  // Remove the modules and adjust the indices in idToIndex map
71  for (auto iModule = 0U; iModule != allModuleDescriptions_.size(); ++iModule) {
72  auto found = std::find(modules.begin(), modules.end(), allModuleDescriptions_[iModule]);
73  if (found != modules.end()) {
74  allModuleDescriptions_.erase(allModuleDescriptions_.begin() + iModule);
75  for (auto iBranchType = 0U; iBranchType != NumBranchTypes; ++iBranchType) {
76  modulesWhoseProductsAreConsumedBy_[iBranchType].erase(
77  modulesWhoseProductsAreConsumedBy_[iBranchType].begin() + iModule);
78  }
81  for (auto& idToIndex : moduleIDToIndex_) {
82  if (idToIndex.second >= iModule) {
83  idToIndex.second--;
84  }
85  }
86  --iModule;
87  }
88  }
89  }
std::array< std::vector< std::vector< ModuleDescription const * > >, NumBranchTypes > modulesWhoseProductsAreConsumedBy_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< std::pair< unsigned int, unsigned int > > moduleIDToIndex_
std::vector< ModuleDescription const * > allModuleDescriptions_
std::vector< std::vector< ModuleDescription const * > > modulesOnPaths_
std::vector< std::vector< ModuleProcessName > > modulesInPreviousProcessesWhoseProductsAreConsumedBy_
checkPath
Definition: config.py:11
std::vector< std::vector< ModuleDescription const * > > modulesOnEndPaths_
std::vector< std::string > const & paths() const

Member Data Documentation

◆ allModuleDescriptions_

std::vector<ModuleDescription const*> edm::PathsAndConsumesOfModules::allModuleDescriptions_
private

◆ endPaths_

std::vector<std::string> edm::PathsAndConsumesOfModules::endPaths_
private

Definition at line 66 of file PathsAndConsumesOfModules.h.

Referenced by doEndPaths(), and initialize().

◆ moduleIDToIndex_

std::vector<std::pair<unsigned int, unsigned int> > edm::PathsAndConsumesOfModules::moduleIDToIndex_
private

◆ modulesInPreviousProcessesWhoseProductsAreConsumedBy_

std::vector<std::vector<ModuleProcessName> > edm::PathsAndConsumesOfModules::modulesInPreviousProcessesWhoseProductsAreConsumedBy_
private

◆ modulesOnEndPaths_

std::vector<std::vector<ModuleDescription const*> > edm::PathsAndConsumesOfModules::modulesOnEndPaths_
private

Definition at line 71 of file PathsAndConsumesOfModules.h.

Referenced by doModulesOnEndPath(), initialize(), and removeModules().

◆ modulesOnPaths_

std::vector<std::vector<ModuleDescription const*> > edm::PathsAndConsumesOfModules::modulesOnPaths_
private

Definition at line 70 of file PathsAndConsumesOfModules.h.

Referenced by doModulesOnPath(), initialize(), and removeModules().

◆ modulesWhoseProductsAreConsumedBy_

std::array<std::vector<std::vector<ModuleDescription const*> >, NumBranchTypes> edm::PathsAndConsumesOfModules::modulesWhoseProductsAreConsumedBy_
private

◆ paths_

std::vector<std::string> edm::PathsAndConsumesOfModules::paths_
private

◆ preg_

std::shared_ptr<ProductRegistry const> edm::PathsAndConsumesOfModules::preg_
private

Definition at line 81 of file PathsAndConsumesOfModules.h.

Referenced by initialize().

◆ schedule_

Schedule const* edm::PathsAndConsumesOfModules::schedule_
private