Skip to content

Commit

Permalink
Merge pull request #9662 from wddgit/unscheduledSubProcessEventSetupP…
Browse files Browse the repository at this point in the history
…roblem

Bug fix. Add function to get top level PSet
  • Loading branch information
cmsbuild committed Jun 18, 2015
2 parents 8a4dbda + c068623 commit e469bc2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
11 changes: 11 additions & 0 deletions FWCore/Framework/test/stubs/HistoryAnalyzer.cc
Expand Up @@ -86,6 +86,17 @@ namespace edmtest {
edm::ParameterSet proc_pset;
event.getProcessParameterSet(event.processHistory().rbegin()->processName(),proc_pset);

{
// test the function getProcessParameterSetContainingModule this is a
// convenient spot to test because this module is run in both a
// a single process and in a subprocess.
edm::ParameterSet proc_pset2 = edm::getProcessParameterSetContainingModule(moduleDescription());
assert(proc_pset2.id() == proc_pset.id());
vstring paths1 = proc_pset.getParameter<vstring>("@paths");
vstring paths2 = proc_pset2.getParameter<vstring>("@paths");
assert(paths1 == paths2);
}

edm::pset::Registry* reg = edm::pset::Registry::instance();

if (!expectedPaths_.empty()) {
Expand Down
10 changes: 10 additions & 0 deletions FWCore/Integration/test/EventHistory_SubProcess_cfg.py
Expand Up @@ -260,3 +260,13 @@
process6.ep61 = cms.EndPath(process6.out)
process6.ep62 = cms.EndPath(process6.producerOnEndPath*process6.filterOnEndPath*process6.out*process6.historytest)
process6.ep63 = cms.EndPath(process6.analyzerOnEndPath*process6.out2*process6.out)

process7 = cms.Process("SEVENTH")

process6.subProcess = cms.SubProcess(process7)

process7.dummyproducerxxx = cms.EDProducer("IntProducer",
ivalue = cms.int32(2)
)

process7.p1 = cms.Path(process7.dummyproducerxxx)
4 changes: 4 additions & 0 deletions FWCore/ParameterSet/interface/ParameterSet.h
Expand Up @@ -30,6 +30,7 @@ namespace cms {
}

namespace edm {
class ModuleDescription;
typedef std::vector<ParameterSet> VParameterSet;

class ParameterSet {
Expand Down Expand Up @@ -335,6 +336,9 @@ namespace edm {
ParameterSet const&
getParameterSet(ParameterSetID const& id);

ParameterSet const&
getProcessParameterSetContainingModule(ModuleDescription const& moduleDescription);

// specializations
// ----------------------------------------------------------------------

Expand Down
13 changes: 10 additions & 3 deletions FWCore/ParameterSet/src/ParameterSet.cc
Expand Up @@ -16,6 +16,8 @@
#include "FWCore/Utilities/interface/Digest.h"
#include "FWCore/Utilities/interface/EDMException.h"

#include "DataFormats/Provenance/interface/ModuleDescription.h"

#include <algorithm>
#include <iostream>
#include <sstream>
Expand Down Expand Up @@ -951,14 +953,19 @@ namespace edm {
// Free function to return a parameterSet given its ID.
ParameterSet const&
getParameterSet(ParameterSetID const& id) {
ParameterSet const* result = 0;
if(0 == (result = pset::Registry::instance()->getMapped(id))) {
throw Exception(errors::Configuration, "MissingParameterSet:")
ParameterSet const* result = nullptr;
if(nullptr == (result = pset::Registry::instance()->getMapped(id))) {
throw Exception(errors::LogicError, "MissingParameterSet:")
<< "Parameter Set ID '" << id << "' not found.";
}
return *result;
}

ParameterSet const&
getProcessParameterSetContainingModule(ModuleDescription const& moduleDescription) {
return getParameterSet(moduleDescription.mainParameterSetID());
}

void ParameterSet::deprecatedInputTagWarning(std::string const& name,
std::string const& label) const {
LogWarning("Configuration") << "Warning:\n\tstring " << name
Expand Down

0 comments on commit e469bc2

Please sign in to comment.