34 #include <boost/algorithm/string/replace.hpp> 45 struct ProductBranch {
48 static const char kSeparator =
'_';
49 static const char kWildcard =
'*';
50 static const std::regex kAny{
".*"};
53 if (
label == kWildcard) {
56 productInstanceName_ = kAny;
65 moduleLabel_ = glob_to_regex(
label);
66 productInstanceName_ = kAny;
90 return (std::regex_match(
branch.friendlyClassName(), type_) and
91 std::regex_match(
branch.moduleLabel(), moduleLabel_) and
92 std::regex_match(
branch.productInstanceName(), productInstanceName_) and
93 std::regex_match(
branch.processName(), processName_));
98 boost::replace_all(
pattern,
"*",
".*");
99 boost::replace_all(
pattern,
"?",
".");
104 std::regex moduleLabel_;
105 std::regex productInstanceName_;
106 std::regex processName_;
109 std::vector<ProductBranch> make_patterns(std::vector<std::string>
const&
labels) {
110 std::vector<ProductBranch> patterns;
111 patterns.reserve(
labels.size());
113 patterns.emplace_back(
label);
143 verbose_(
config.getUntrackedParameter<
bool>(
"verbose")) {
145 static const std::string kPathStatus(
"edm::PathStatus");
146 static const std::string kEndPathStatus(
"edm::EndPathStatus");
148 switch (
branch.branchType()) {
150 if (
branch.className() == kPathStatus
or branch.className() == kEndPathStatus)
158 <<
label_ <<
" consumes Event product " <<
branch.friendlyClassName() <<
'_' <<
branch.moduleLabel()
159 <<
'_' <<
branch.productInstanceName() <<
'_' <<
branch.processName() <<
'\n';
168 this->consumes<edm::InLumi>(
173 <<
label_ <<
" consumes LuminosityBlock product " <<
branch.friendlyClassName() <<
'_' 174 <<
branch.moduleLabel() <<
'_' <<
branch.productInstanceName() <<
'_' <<
branch.processName()
184 this->consumes<edm::InRun>(
189 <<
label_ <<
" consumes Run product " <<
branch.friendlyClassName() <<
'_' <<
branch.moduleLabel()
190 <<
'_' <<
branch.productInstanceName() <<
'_' <<
branch.processName() <<
'\n';
199 this->consumes<edm::InProcess>(
204 <<
label_ <<
" consumes Process product " <<
branch.friendlyClassName() <<
'_' 205 <<
branch.moduleLabel() <<
'_' <<
branch.productInstanceName() <<
'_' <<
branch.processName()
214 <<
"Unexpected branch type " <<
branch.branchType() <<
"\nPlease contact a Framework developer\n";
221 R
"(This EDAnalyzer will depend on all the event, lumi, run or process products declared by its configuration, both transient and persistent. 223 The dependencies can be specified either as module labels (e.g. "<module label>") or as branch names (e.g. "<product type>_<module label>_<instance name>_<process name>"). 224 If a module label is used, no underscore ("_") must be present; this module will depend all the products produced by that module, including those produced by the Transformer functionality (such as the implicitly copied-to-host products in case of Alpaka-based modules). 225 If a branch name is used, all four fields must be present, separated by underscores; this module will depend only on the matching product(s). 227 Glob expressions ("?" and "*") are supported in module labels and within the individual fields of branch names, similar to an OutputModule's "keep" statements. 228 Use "*" to depend on all products of a given category. 230 For example, in the case of Alpaka-based modules running on a device, using 232 eventProducts = cms.untracked.vstring( "module" ) 234 will cause "module" to run, along with automatic copy of its device products to the host. 235 To avoid the copy, the DeviceProduct branch can be specified explicitly with 237 eventProducts = cms.untracked.vstring( "*DeviceProduct_module_*_*" ) 242 desc.addUntracked<std::vector<std::string>>("eventProducts", {})
243 ->setComment(
"List of modules or branches whose event products this module will depend on.");
244 desc.addUntracked<std::vector<std::string>>(
"lumiProducts", {})
245 ->setComment(
"List of modules or branches whose lumi products this module will depend on.");
246 desc.addUntracked<std::vector<std::string>>(
"runProducts", {})
247 ->setComment(
"List of modules or branches whose run products this module will depend on.");
248 desc.addUntracked<std::vector<std::string>>(
"processProducts", {})
249 ->setComment(
"List of modules or branches whose process products this module will depend on.");
250 desc.addUntracked<
bool>(
"verbose",
false)
251 ->setComment(
"Print the actual branch names for which the dependency are declared.");
Log< level::Info, true > LogVerbatim
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
~GenericConsumer() override=default
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
GenericConsumer(ParameterSet const &)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< ProductBranch > runProducts_
std::vector< ProductBranch > eventProducts_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::vector< ProductBranch > processProducts_
#define DEFINE_FWK_MODULE(type)
void analyze(StreamID, Event const &, EventSetup const &) const override
void setComment(std::string const &value)
std::vector< ProductBranch > lumiProducts_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.