CMS 3D CMS Logo

getProducerParameterSet.cc
Go to the documentation of this file.
2 
11 
12 #include <string>
13 
14 namespace edm {
15 
16  ParameterSet const* getProducerParameterSet(Provenance const& provenance) {
17  const std::shared_ptr<BranchDescription const>& branchDescription = provenance.constBranchDescriptionPtr();
18 
19  if (branchDescription) {
20  std::string const& process = branchDescription->processName();
21  std::string const& label = branchDescription->moduleLabel();
22  ProcessHistory const* processHistory = provenance.processHistoryPtr();
23 
24  if (processHistory) {
25  for (ProcessConfiguration const& pc : *processHistory) {
26  if (pc.processName() == process) {
27  ParameterSetID const& psetID = pc.parameterSetID();
28  pset::Registry const* psetRegistry = pset::Registry::instance();
29  ParameterSet const* processPset = psetRegistry->getMapped(psetID);
30  if (processPset) {
31  return &processPset->getParameterSet(label);
32  }
33  }
34  }
35  }
36  }
37  // This should never happen
38  throw cms::Exception("LogicError") << "getProducerParameterSet failed";
39  return nullptr;
40  }
41 } // namespace edm
Definition: Hash.h:43
ProcessHistory const * processHistoryPtr() const
Definition: Provenance.h:60
char const * label
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:17
ParameterSet const * getProducerParameterSet(Provenance const &provenance)
std::shared_ptr< BranchDescription const > const & constBranchDescriptionPtr() const
Definition: Provenance.h:46
ParameterSet const & getParameterSet(std::string const &) const
HLT enums.
static Registry * instance()
Definition: Registry.cc:12