LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
EventIDFilter_module.cc
Go to the documentation of this file.
1 // 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.
9 
14 
15 #include <string>
16 
17 using namespace fhicl;
18 using namespace std;
19 
20 namespace art {
21  class EventIDFilter;
22 }
23 
24 namespace {
25  std::string const parameter_comment{
26  R"(The 'idsToMatch' parameter value is a sequence of patterns,
27 each of which are composed three fields:
28 
29  <run>:<subrun>:<event>
30 
31 Each of the run, subrun, and event fields can be represented
32 by a number, or set of numbers. The '*' wildcard can be used to
33 represent any number, and the ',' and '-' characters can be used
34 to sets or ranges of numbers. For example:
35 
36  "1:*:*" // Accept Run 1, any SubRun, any Event
37  "1:2:*" // Accept Run 1, SubRun 2, any Event
38  "1:2:3" // Accept Run 1, SubRun 2, Event 3
39  "1:*:4" // Accept Run 1, any SubRun, Event 4
40  "1:2-5:*" // Accept Run 1, SubRuns 2 through 5 (inclusive), any Event
41  "*:9:10,11" // Accept any Run, SubRun 9, Events 10 and 11
42  "7:2-5,8:*" // Accept Run 7, SubRuns 2 through 5 (inclusive) and 8, any Event
43 
44 Specifying multiple patterns in the sequence corresponds to a
45 logical OR of the patterns. In other words, if the event in question
46 matches any (not all) of the patterns, the event is accepted.
47 )"};
48 }
49 
50 // ==============================================
52 public:
53  struct Config {
54  Sequence<string> idsToMatch{Name{"idsToMatch"}, Comment{parameter_comment}};
55  };
56 
58  explicit EventIDFilter(Parameters const& p, ProcessingFrame const&);
59 
60 private:
61  bool filter(Event&, ProcessingFrame const&) override;
62 
64 };
65 
67  : SharedFilter{p}, matcher_{p().idsToMatch()}
68 {
69  async<InEvent>();
70 }
71 
72 bool
74 {
75  return matcher_(e.id());
76 }
77 
bool filter(Event &, ProcessingFrame const &) override
EventIDFilter(Parameters const &p, ProcessingFrame const &)
STL namespace.
Framework includes.
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
parameter set interface
EventIDMatcher const matcher_
Definition: MVAAlg.h:12
Float_t e
Definition: plot.C:35
EventID id() const
Definition: Event.cc:23