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 32 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 48 of file PathsAndConsumesOfModules.h.

48 { return allModuleDescriptions_; }

References allModuleDescriptions_.

◆ doConsumesInfo()

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

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 121 of file PathsAndConsumesOfModules.cc.

121  {
122  Worker const* worker = schedule_->allWorkers().at(moduleIndex(moduleID));
123  return worker->consumesInfo();
124  }

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

◆ doEndPaths()

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

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 46 of file PathsAndConsumesOfModules.h.

46 { return endPaths_; }

References endPaths_.

◆ doLargestModuleID()

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

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 126 of file PathsAndConsumesOfModules.cc.

126  {
127  // moduleIDToIndex_ is sorted, so last element has the largest ID
128  return moduleIDToIndex_.empty() ? 0 : moduleIDToIndex_.back().first;
129  }

References moduleIDToIndex_.

◆ doModuleDescription()

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

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 95 of file PathsAndConsumesOfModules.cc.

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

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

◆ doModulesOnEndPath()

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

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 111 of file PathsAndConsumesOfModules.cc.

112  {
113  return modulesOnEndPaths_.at(endPathIndex);
114  }

References modulesOnEndPaths_.

◆ doModulesOnPath()

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

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 107 of file PathsAndConsumesOfModules.cc.

107  {
108  return modulesOnPaths_.at(pathIndex);
109  }

References modulesOnPaths_.

◆ doModulesWhoseProductsAreConsumedBy()

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

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 116 of file PathsAndConsumesOfModules.cc.

117  {
118  return modulesWhoseProductsAreConsumedBy_[branchType].at(moduleIndex(moduleID));
119  }

References moduleIndex(), and modulesWhoseProductsAreConsumedBy_.

◆ doPaths()

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

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 45 of file PathsAndConsumesOfModules.h.

45 { return paths_; }

References paths_.

◆ initialize()

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

Definition at line 16 of file PathsAndConsumesOfModules.cc.

16  {
18  preg_ = preg;
19 
20  paths_.clear();
21  schedule->triggerPaths(paths_);
22 
23  endPaths_.clear();
24  schedule->endPaths(endPaths_);
25 
26  modulesOnPaths_.resize(paths_.size());
27  unsigned int i = 0;
28  unsigned int hint = 0;
29  for (auto const& path : paths_) {
30  schedule->moduleDescriptionsInPath(path, modulesOnPaths_.at(i), hint);
31  if (!modulesOnPaths_.at(i).empty())
32  ++hint;
33  ++i;
34  }
35 
36  modulesOnEndPaths_.resize(endPaths_.size());
37  i = 0;
38  hint = 0;
39  for (auto const& endpath : endPaths_) {
40  schedule->moduleDescriptionsInEndPath(endpath, modulesOnEndPaths_.at(i), hint);
41  if (!modulesOnEndPaths_.at(i).empty())
42  ++hint;
43  ++i;
44  }
45 
46  schedule->fillModuleAndConsumesInfo(allModuleDescriptions_,
50  *preg);
51  }

References allModuleDescriptions_, endPaths_, mps_fire::i, moduleIDToIndex_, modulesInPreviousProcessesWhoseProductsAreConsumedBy_, modulesOnEndPaths_, modulesOnPaths_, modulesWhoseProductsAreConsumedBy_, castor_dqm_sourceclient_file_cfg::path, paths_, preg_, filterRecHits_cfg::schedule, and schedule_.

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

◆ moduleIndex()

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

Definition at line 131 of file PathsAndConsumesOfModules.cc.

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

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

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

◆ modulesInPreviousProcessesWhoseProductsAreConsumedBy()

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

◆ removeModules()

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

Definition at line 53 of file PathsAndConsumesOfModules.cc.

53  {
54  // First check that no modules on Paths are removed
55  auto checkPath = [&modules](auto const& paths) {
56  for (auto const& path : paths) {
57  for (auto const& description : path) {
58  if (std::find(modules.begin(), modules.end(), description) != modules.end()) {
59  throw cms::Exception("Assert")
60  << "PathsAndConsumesOfModules::removeModules() is trying to remove a module with label "
61  << description->moduleLabel() << " id " << description->id() << " from a Path, this should not happen.";
62  }
63  }
64  }
65  };
68 
69  // Remove the modules and adjust the indices in idToIndex map
70  for (auto iModule = 0U; iModule != allModuleDescriptions_.size(); ++iModule) {
71  auto found = std::find(modules.begin(), modules.end(), allModuleDescriptions_[iModule]);
72  if (found != modules.end()) {
73  allModuleDescriptions_.erase(allModuleDescriptions_.begin() + iModule);
74  for (auto iBranchType = 0U; iBranchType != NumBranchTypes; ++iBranchType) {
75  modulesWhoseProductsAreConsumedBy_[iBranchType].erase(
76  modulesWhoseProductsAreConsumedBy_[iBranchType].begin() + iModule);
77  }
80  for (auto& idToIndex : moduleIDToIndex_) {
81  if (idToIndex.second >= iModule) {
82  idToIndex.second--;
83  }
84  }
85  --iModule;
86  }
87  }
88  }

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

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

Member Data Documentation

◆ allModuleDescriptions_

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

◆ endPaths_

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

Definition at line 65 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 70 of file PathsAndConsumesOfModules.h.

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

◆ modulesOnPaths_

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

Definition at line 69 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 80 of file PathsAndConsumesOfModules.h.

Referenced by initialize().

◆ schedule_

Schedule const* edm::PathsAndConsumesOfModules::schedule_
private
mps_fire.i
i
Definition: mps_fire.py:428
LogMessageMonitor_cff.modules
modules
Definition: LogMessageMonitor_cff.py:7
edm::PathsAndConsumesOfModules::modulesOnPaths_
std::vector< std::vector< ModuleDescription const * > > modulesOnPaths_
Definition: PathsAndConsumesOfModules.h:69
edm::errors::LogicError
Definition: EDMException.h:37
modules
Definition: MuonCleanerBySegments.cc:35
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
edm::PathsAndConsumesOfModules::modulesOnEndPaths_
std::vector< std::vector< ModuleDescription const * > > modulesOnEndPaths_
Definition: PathsAndConsumesOfModules.h:70
edm::PathsAndConsumesOfModules::modulesWhoseProductsAreConsumedBy_
std::array< std::vector< std::vector< ModuleDescription const * > >, NumBranchTypes > modulesWhoseProductsAreConsumedBy_
Definition: PathsAndConsumesOfModules.h:76
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::NumBranchTypes
Definition: BranchType.h:11
edm::PathsAndConsumesOfModules::modulesInPreviousProcessesWhoseProductsAreConsumedBy_
std::vector< std::vector< ModuleProcessName > > modulesInPreviousProcessesWhoseProductsAreConsumedBy_
Definition: PathsAndConsumesOfModules.h:77
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::PathsAndConsumesOfModules::paths_
std::vector< std::string > paths_
Definition: PathsAndConsumesOfModules.h:64
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
edm::PathsAndConsumesOfModules::preg_
std::shared_ptr< ProductRegistry const > preg_
Definition: PathsAndConsumesOfModules.h:80
edm::PathsAndConsumesOfModules::moduleIDToIndex_
std::vector< std::pair< unsigned int, unsigned int > > moduleIDToIndex_
Definition: PathsAndConsumesOfModules.h:74
edm::PathsAndConsumesOfModules::endPaths_
std::vector< std::string > endPaths_
Definition: PathsAndConsumesOfModules.h:65
edm::PathsAndConsumesOfModules::allModuleDescriptions_
std::vector< ModuleDescription const * > allModuleDescriptions_
Definition: PathsAndConsumesOfModules.h:67
edm::Schedule::allWorkers
AllWorkers const & allWorkers() const
returns the collection of pointers to workers
Definition: Schedule.cc:1445
edm::PathsAndConsumesOfModules::schedule_
Schedule const * schedule_
Definition: PathsAndConsumesOfModules.h:79
edm::PathsAndConsumesOfModulesBase::paths
std::vector< std::string > const & paths() const
Definition: PathsAndConsumesOfModulesBase.h:39
Exception
Definition: hltDiff.cc:245
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
config.checkPath
checkPath
Definition: config.py:11
dummy
Definition: DummySelector.h:38
filterRecHits_cfg.schedule
schedule
Definition: filterRecHits_cfg.py:62
edm::PathsAndConsumesOfModules::moduleIndex
unsigned int moduleIndex(unsigned int moduleID) const
Definition: PathsAndConsumesOfModules.cc:131