8 #ifndef ICARUSCODE_UTILITIES_ARTDATAPRODUCTSELECTORS_H
9 #define ICARUSCODE_UTILITIES_ARTDATAPRODUCTSELECTORS_H
12 #include "art/Framework/Principal/SelectorBase.h"
21 namespace art {
class InputTag;
class BranchDescription; }
24 namespace util {
class RegexDataProductSelector; }
79 template <
typename SpecColl>
80 static std::vector<ProductRegex>
makePatterns(SpecColl
const& specs);
88 virtual bool doMatch(art::BranchDescription
const& brDescr)
const override;
91 virtual std::string
doPrint(std::string
const& indent)
const override;
104 template <
typename SpecColl>
106 (SpecColl
const& specs) -> std::vector<ProductRegex>
109 std::vector<ProductRegex> ptns;
110 ptns.reserve(
size(specs));
111 for (
auto const& spec: specs)
112 ptns.push_back(makePattern(art::InputTag{ spec }));
120 #endif // ICARUSCODE_UTILITIES_ARTDATAPRODUCTSELECTORS_H
Matches products by regex on process, module label and instance name.
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).
std::vector< ProductRegex > fPatterns
All the selection patterns.
std::size_t size(FixedBins< T, C > const &) noexcept
virtual std::string doPrint(std::string const &indent) const override
Part of the message used when no data product matches.
static std::vector< ProductRegex > makePatterns(SpecColl const &specs)
Parses a sequence of input tags to create data product patterns.
bool matchPattern(art::InputTag const &tag, ProductRegex const &ptn) const
Returns whether the input tag matches the pattern ptn.
std::optional< std::regex > process
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.