CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 * >
>, NumBranchTypes
modulesWhoseProductsAreConsumedBy_
 
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

edm::PathsAndConsumesOfModules::PathsAndConsumesOfModules ( )
default
edm::PathsAndConsumesOfModules::~PathsAndConsumesOfModules ( )
overridedefault

Member Function Documentation

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

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 48 of file PathsAndConsumesOfModules.h.

References allModuleDescriptions_.

48 { return allModuleDescriptions_; }
std::vector< ModuleDescription const * > allModuleDescriptions_
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:1451
unsigned int moduleIndex(unsigned int moduleID) const
std::vector<std::string> const& edm::PathsAndConsumesOfModules::doEndPaths ( ) const
inlineoverrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 46 of file PathsAndConsumesOfModules.h.

References endPaths_.

46 { return endPaths_; }
std::vector< std::string > endPaths_
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_
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, cuda_std::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_
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
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_
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_
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
std::vector<std::string> const& edm::PathsAndConsumesOfModules::doPaths ( ) const
inlineoverrideprivatevirtual

Implements edm::PathsAndConsumesOfModulesBase.

Definition at line 45 of file PathsAndConsumesOfModules.h.

References paths_.

45 { return paths_; }
void edm::PathsAndConsumesOfModules::initialize ( Schedule const *  schedule,
std::shared_ptr< ProductRegistry const >  preg 
)

Definition at line 17 of file PathsAndConsumesOfModules.cc.

References allModuleDescriptions_, edm::Schedule::endPaths(), endPaths_, edm::Schedule::fillModuleAndConsumesInfo(), mps_fire::i, edm::Schedule::moduleDescriptionsInEndPath(), edm::Schedule::moduleDescriptionsInPath(), moduleIDToIndex_, modulesInPreviousProcessesWhoseProductsAreConsumedBy_, modulesOnEndPaths_, modulesOnPaths_, modulesWhoseProductsAreConsumedBy_, fed_dqm_sourceclient-live_cfg::path, paths_, edm::preg, preg_, Tree_ALCARECO_cff::schedule, schedule_, and edm::Schedule::triggerPaths().

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_
preg
Definition: Schedule.cc:687
unsigned int edm::PathsAndConsumesOfModules::moduleIndex ( unsigned int  moduleID) const
private

Definition at line 132 of file PathsAndConsumesOfModules.cc.

References Exception, edm::errors::LogicError, cuda_std::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_
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
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  }
unsigned int moduleIndex(unsigned int moduleID) const
std::vector< std::vector< ModuleProcessName > > modulesInPreviousProcessesWhoseProductsAreConsumedBy_
void edm::PathsAndConsumesOfModules::removeModules ( std::vector< ModuleDescription const * > const &  modules)

Definition at line 54 of file PathsAndConsumesOfModules.cc.

References allModuleDescriptions_, SplitLinear::begin, config::checkPath, getPayloadData::description, Exception, spr::find(), newFWLiteAna::found, moduleIDToIndex_, TrackingSourceConfig_Tier0_Cosmic_cff::modules, modulesInPreviousProcessesWhoseProductsAreConsumedBy_, modulesOnEndPaths_, modulesOnPaths_, modulesWhoseProductsAreConsumedBy_, edm::NumBranchTypes, fed_dqm_sourceclient-live_cfg::path, and edm::PathsAndConsumesOfModulesBase::paths().

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  }
tuple checkPath
Definition: config.py:11
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_
std::vector< std::string > const & paths() const
std::vector< std::vector< ModuleDescription const * > > modulesOnEndPaths_

Member Data Documentation

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

Definition at line 65 of file PathsAndConsumesOfModules.h.

Referenced by doEndPaths(), and initialize().

std::vector<std::pair<unsigned int, unsigned int> > edm::PathsAndConsumesOfModules::moduleIDToIndex_
private
std::vector<std::vector<ModuleProcessName> > edm::PathsAndConsumesOfModules::modulesInPreviousProcessesWhoseProductsAreConsumedBy_
private
std::vector<std::vector<ModuleDescription const*> > edm::PathsAndConsumesOfModules::modulesOnEndPaths_
private

Definition at line 70 of file PathsAndConsumesOfModules.h.

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

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

Definition at line 69 of file PathsAndConsumesOfModules.h.

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

std::array<std::vector<std::vector<ModuleDescription const*> >, NumBranchTypes> edm::PathsAndConsumesOfModules::modulesWhoseProductsAreConsumedBy_
private
std::vector<std::string> edm::PathsAndConsumesOfModules::paths_
private
std::shared_ptr<ProductRegistry const> edm::PathsAndConsumesOfModules::preg_
private

Definition at line 80 of file PathsAndConsumesOfModules.h.

Referenced by initialize().

Schedule const* edm::PathsAndConsumesOfModules::schedule_
private