LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Observer.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_Observer_h
2 #define art_Framework_Core_Observer_h
3 // vim: set sw=2 expandtab :
4 
5 // Common base class for module which do not modify events, such as
6 // OutputModule and EDAnalyzer.
7 
12 #include "fhiclcpp/fwd.h"
14 
15 #include <string>
16 
17 namespace art {
18  class ModuleDescription;
19 
20  class Observer : public ModuleBase {
21  public:
22  ~Observer() noexcept;
23  Observer(Observer const&) = delete;
24  Observer(Observer&&) = delete;
25  Observer& operator=(Observer const&) = delete;
26  Observer& operator=(Observer&&) = delete;
27 
28  protected:
29  std::string const& processName() const;
30  bool
31  wantAllEvents() const noexcept
32  {
33  return wantAllEvents_;
34  }
35  bool wantEvent(ScheduleID id, Event const& e) const;
37 
38  struct EOConfig {
40  fhicl::Name("SelectEvents"),
42  "Events are selected based on the trigger-path entries provided in\n"
43  "the 'SelectEvents' and 'RejectEvents' parameters. For example, a\n"
44  "configuration of\n\n"
45  " SelectEvents: [A, B]\n"
46  " RejectEvents: [C, D]\n\n"
47  "would accept events that satisfy trigger-path criteria A or B and\n"
48  "fail criteria C or D. In other words, the event is accepted if "
49  "the\n"
50  "following Boolean expression evaluates to true:\n\n"
51  " (A || B) and not (C || D)\n\n"
52  "For the majority of cases, a trigger-path criterion may be:\n\n"
53  " 1. A trigger-path name in the current process (e.g. tp)\n"
54  " 2. A negated trigger-path name in the current process (e.g. "
55  "\"!tp\")\n"
56  " 3. A trigger-path name from a previous process (e.g. "
57  "\"previousProcess:tp\")\n\n"
58  "More complicated expressions are allowed--see\n"
59  " "
60  "https://cdcvs.fnal.gov/redmine/projects/art/wiki/"
61  "Filtering_events\n\n"
62  "The default 'SelectEvents' and `RejectEvents` lists are empty,\n"
63  "which is equivalent to selecting all events."},
64  std::vector<std::string>{}};
66  std::vector<std::string>{}};
67  };
68 
69  explicit Observer(fhicl::ParameterSet const& config);
70  explicit Observer(std::vector<std::string> const& select_paths,
71  std::vector<std::string> const& reject_paths);
72 
73  private:
74  // True if no selectors configured.
76  std::string process_name_;
77  // The process and event selectors and rejectors, as specified by
78  // the SelectEvents and RejectEvents configuration parameters.
79  std::optional<detail::ProcessAndEventSelectors> selectors_;
80  std::optional<detail::ProcessAndEventSelectors> rejectors_;
81  // ID of the ParameterSet that configured the event selector
82  // subsystem.
84  };
85 
86 } // namespace art
87 
88 #endif /* art_Framework_Core_Observer_h */
89 
90 // Local Variables:
91 // mode: c++
92 // End:
std::string const & processName() const
Definition: Observer.cc:57
Handle< TriggerResults > getTriggerResults(Event const &e) const
Definition: Observer.cc:75
bool wantAllEvents() const noexcept
Definition: Observer.h:31
bool wantAllEvents_
Definition: Observer.h:75
std::string process_name_
Definition: Observer.h:76
fhicl::Sequence< std::string > rejectEvents
Definition: Observer.h:65
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:63
~Observer() noexcept
Observer & operator=(Observer const &)=delete
fhicl::ParameterSetID selector_config_id_
Definition: Observer.h:83
Definition: MVAAlg.h:12
std::optional< detail::ProcessAndEventSelectors > rejectors_
Definition: Observer.h:80
Observer(Observer const &)=delete
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79
fhicl::Sequence< std::string > selectEvents
Definition: Observer.h:39