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*
17  getProducerParameterSet(Provenance const& provenance) {
18 
19  const std::shared_ptr<BranchDescription const>& branchDescription =
20  provenance.constBranchDescriptionPtr();
21 
22  if (branchDescription) {
23  std::string const& process = branchDescription->processName();
24  std::string const& label = branchDescription->moduleLabel();
25  ProcessHistory const* processHistory = provenance.processHistoryPtr();
26 
27  if (processHistory) {
28  for (ProcessConfiguration const& pc : *processHistory) {
29  if (pc.processName() == process) {
30  ParameterSetID const& psetID = pc.parameterSetID();
31  pset::Registry const* psetRegistry = pset::Registry::instance();
32  ParameterSet const* processPset = psetRegistry->getMapped(psetID);
33  if (processPset) {
34  return &processPset->getParameterSet(label);
35  }
36  }
37  }
38  }
39  }
40  // This should never happen
41  throw cms::Exception("LogicError")
42  << "getProducerParameterSet failed";
43  return nullptr;
44  }
45 }
Definition: Hash.h:43
ProcessHistory const * processHistoryPtr() const
Definition: Provenance.h:57
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:18
ParameterSet const * getProducerParameterSet(Provenance const &provenance)
std::shared_ptr< BranchDescription const > const & constBranchDescriptionPtr() const
Definition: Provenance.h:44
ParameterSet const & getParameterSet(std::string const &) const
HLT enums.
static Registry * instance()
Definition: Registry.cc:12