Skip to content

Commit

Permalink
Added ability to get ProcessBlock products in GenericConsumer
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr15Jones committed Jan 5, 2023
1 parent 9eb6ddb commit 9801ed0
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions FWCore/Modules/src/GenericConsumer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ namespace edm {
std::vector<std::string> eventLabels_;
std::vector<std::string> lumiLabels_;
std::vector<std::string> runLabels_;
std::vector<std::string> processLabels_;
};

GenericConsumer::GenericConsumer(ParameterSet const& config)
: eventLabels_(config.getUntrackedParameter<std::vector<std::string>>("eventProducts")),
lumiLabels_(config.getUntrackedParameter<std::vector<std::string>>("lumiProducts")),
runLabels_(config.getUntrackedParameter<std::vector<std::string>>("runProducts")) {
runLabels_(config.getUntrackedParameter<std::vector<std::string>>("runProducts")),
processLabels_(config.getUntrackedParameter<std::vector<std::string>>("processProducts")) {
std::sort(eventLabels_.begin(), eventLabels_.end());
std::sort(lumiLabels_.begin(), lumiLabels_.end());
std::sort(runLabels_.begin(), runLabels_.end());
std::sort(processLabels_.begin(), processLabels_.end());

callWhenNewProductsRegistered([this](edm::BranchDescription const& branch) {
static const std::string kWildcard("*");
Expand Down Expand Up @@ -72,6 +75,12 @@ namespace edm {
edm::InputTag{branch.moduleLabel(), branch.productInstanceName(), branch.processName()});
break;

case InProcess:
if (std::binary_search(processLabels_.begin(), processLabels_.end(), branch.moduleLabel()) or
std::binary_search(processLabels_.begin(), processLabels_.end(), kWildcard))
this->consumes(edm::TypeToGet{branch.unwrappedTypeID(), PRODUCT_TYPE},
edm::InputTag{branch.moduleLabel(), branch.productInstanceName(), branch.processName()});
break;
default:
throw Exception(errors::LogicError)
<< "Unexpected branch type " << branch.branchType() << "\nPlease contact a Framework developer\n";
Expand All @@ -92,11 +101,15 @@ namespace edm {
desc.addUntracked<std::vector<std::string>>("lumiProducts", {})
->setComment(
"List of modules whose lumi products this module will depend on. "
"Use \"*\" to depend on all event products.");
"Use \"*\" to depend on all lumi products.");
desc.addUntracked<std::vector<std::string>>("runProducts", {})
->setComment(
"List of modules whose run products this module will depend on. "
"Use \"*\" to depend on all event products.");
"Use \"*\" to depend on all run products.");
desc.addUntracked<std::vector<std::string>>("processProducts", {})
->setComment(
"List of modules whose process products this module will depend on. "
"Use \"*\" to depend on all process products.");
descriptions.addWithDefaultLabel(desc);
}

Expand Down

0 comments on commit 9801ed0

Please sign in to comment.