13 #include "canvas/Persistency/Provenance/BranchDescription.h"
14 #include "canvas/Utilities/InputTag.h"
24 (std::vector<ProductRegex> patterns)
25 : fPatterns(std::move(patterns))
34 auto const regexIfNotEmpty = [](std::string
const& ptn)
35 {
return ptn.empty()? std::nullopt: std::optional{ std::regex{ ptn }}; };
38 regexIfNotEmpty(spec.process())
39 , regexIfNotEmpty(spec.label())
40 , regexIfNotEmpty(spec.instance())
48 (art::BranchDescription
const& brDescr)
const
50 art::InputTag
const& tag = brDescr.inputTag();
52 if (matchPattern(tag,
pattern))
return true;
59 (std::string
const& indent)
const
70 if (ptn.
process && !std::regex_match(tag.process(), *(ptn.
process) ))
72 if (ptn.
module && !std::regex_match(tag.label(), *(ptn.
module) ))
virtual bool doMatch(art::BranchDescription const &brDescr) const override
Returns whether data product described by brDescr matches.
std::optional< std::regex > instance
A pattern on a input tag (empty matches everything).
virtual std::string doPrint(std::string const &indent) const override
Part of the message used when no data product matches.
bool matchPattern(art::InputTag const &tag, ProductRegex const &ptn) const
Returns whether the input tag matches the pattern ptn.
Helpers to pass to art::Event::getMany() and similar.
std::optional< std::regex > process
std::string to_string(WindowPattern const &pattern)
RegexDataProductSelector(std::vector< ProductRegex > patterns)
Initializes the selector with all the supported patterns.
std::optional< std::regex > module
static ProductRegex makePattern(art::InputTag const &spec)
Parses a input tag to create a single data product pattern.