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 #include <vector>
18 
19 using namespace fhicl;
20 using namespace std;
21 
22 namespace art {
23  class EventIDFilter;
24 }
25 
26 namespace {
27  std::string const parameter_comment{
28  R"(The 'idsToMatch' parameter value is a sequence of patterns,
29 each of which are composed three fields:
30 
31  <run>:<subrun>:<event>
32 
33 Each of the run, subrun, and event fields can be represented
34 by a number, or set of numbers. The '*' wildcard can be used to
35 represent any number, and the ',' and '-' characters can be used
36 to sets or ranges of numbers. For example:
37 
38  "1:*:*" // Accept Run 1, any SubRun, any Event
39  "1:2:*" // Accept Run 1, SubRun 2, any Event
40  "1:2:3" // Accept Run 1, SubRun 2, Event 3
41  "1:*:4" // Accept Run 1, any SubRun, Event 4
42  "1:2-5:*" // Accept Run 1, SubRuns 2 through 5 (inclusive), any Event
43  "*:9:10,11" // Accept any Run, SubRun 9, Events 10 and 11
44  "7:2-5,8:*" // Accept Run 7, SubRuns 2 through 5 (inclusive) and 8, any Event
45 
46 Specifying multiple patterns in the sequence corresponds to a
47 logical OR of the patterns. In other words, if the event in question
48 matches any (not all) of the patterns, the event is accepted.
49 )"};
50 }
51 
52 // ==============================================
53 class art::EventIDFilter final : public EDFilter {
54 public:
55  struct Config {
56  Sequence<string> idsToMatch{Name{"idsToMatch"}, Comment{parameter_comment}};
57  };
58 
60  explicit EventIDFilter(Parameters const& p);
61 
62  bool filter(art::Event&) override;
63 
64 private:
66 };
67 
69  : matcher_{p().idsToMatch()}
70 {}
71 
72 bool
74 {
75  return matcher_(e.id());
76 }
77 
EventIDFilter(Parameters const &p)
const char * p
Definition: xmltok.h:285
DEFINE_ART_MODULE(TestTMapFile)
Module that kips a configurable number of events between each that it allows through. Note that this module really skips (N-1) events, it uses a simple modular division as its critera. This module will cut down the data sample to 1/N of its original size.
bool filter(art::Event &) override
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
Float_t e
Definition: plot.C:35
EventID id() const
Definition: Event.h:56
enum BeamMode string