Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to get ProcessBlock products in GenericConsumer #40424

Merged
merged 1 commit into from
Jan 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 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,13 @@ 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::InProcess>(
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 +102,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