EventIDFilter_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: EventIDFilter
3 // Plugin Type: filter (art v2_06_03)
4 // File: EventIDFilter_module.cc
5 //
6 // Generated at Thu May 18 09:14:09 2017 by Kyle Knoepfel using cetskelgen
7 // from cetlib version v2_03_00.
8 ////////////////////////////////////////////////////////////////////////
9 
15 
16 #include <string>
17 
18 using namespace fhicl;
19 using namespace std;
20 
21 namespace art {
22  class EventIDFilter;
23 }
24 
25 namespace {
26  std::string const parameter_comment{
27  R"(The 'idsToMatch' parameter value is a sequence of patterns,
28 each of which are composed three fields:
29 
30  <run>:<subrun>:<event>
31 
32 Each of the run, subrun, and event fields can be represented
33 by a number, or set of numbers. The '*' wildcard can be used to
34 represent any number, and the ',' and '-' characters can be used
35 to sets or ranges of numbers. For example:
36 
37  "1:*:*" // Accept Run 1, any SubRun, any Event
38  "1:2:*" // Accept Run 1, SubRun 2, any Event
39  "1:2:3" // Accept Run 1, SubRun 2, Event 3
40  "1:*:4" // Accept Run 1, any SubRun, Event 4
41  "1:2-5:*" // Accept Run 1, SubRuns 2 through 5 (inclusive), any Event
42  "*:9:10,11" // Accept any Run, SubRun 9, Events 10 and 11
43  "7:2-5,8:*" // Accept Run 7, SubRuns 2 through 5 (inclusive) and 8, any Event
44 
45 Specifying multiple patterns in the sequence corresponds to a
46 logical OR of the patterns. In other words, if the event in question
47 matches any (not all) of the patterns, the event is accepted.
48 )"};
49 }
50 
51 // ==============================================
53 public:
54  struct Config {
55  Sequence<string> idsToMatch{Name{"idsToMatch"}, Comment{parameter_comment}};
56  };
57 
59  explicit EventIDFilter(Parameters const& p, ProcessingFrame const&);
60 
61 private:
62  bool filter(Event&, ProcessingFrame const&) override;
63 
65 };
66 
68  : SharedFilter{p}, matcher_{p().idsToMatch()}
69 {
70  async<InEvent>();
71 }
72 
73 bool
75 {
76  return matcher_(e.id());
77 }
78 
bool filter(Event &, ProcessingFrame const &) override
std::string string
Definition: nybbler.cc:12
EventIDFilter(Parameters const &p, ProcessingFrame const &)
STL namespace.
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
p
Definition: test.py:223
EventIDMatcher const matcher_
EventID id() const
Definition: Event.cc:34