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  // FIXME: One could obviate the need for this trivial implementation
29  // by putting some type logic in WorkerT.
33 
34  protected:
35  std::string const& processName() const;
36  bool
37  wantAllEvents() const noexcept
38  {
39  return wantAllEvents_;
40  }
41  bool wantEvent(ScheduleID id, Event const& e) const;
43 
44  struct EOConfig {
46  fhicl::Name("SelectEvents"),
48  "Events are selected based on the trigger-path entries provided in\n"
49  "the 'SelectEvents' and 'RejectEvents' parameters. For example, a\n"
50  "configuration of\n\n"
51  " SelectEvents: [A, B]\n"
52  " RejectEvents: [C, D]\n\n"
53  "would accept events that satisfy trigger-path criteria A or B and\n"
54  "fail criteria C or D. In other words, the event is accepted if "
55  "the\n"
56  "following Boolean expression evaluates to true:\n\n"
57  " (A || B) and not (C || D)\n\n"
58  "For the majority of cases, a trigger-path criterion may be:\n\n"
59  " 1. A trigger-path name in the current process (e.g. tp)\n"
60  " 2. A negated trigger-path name in the current process (e.g. "
61  "\"!tp\")\n"
62  " 3. A trigger-path name from a previous process (e.g. "
63  "\"previousProcess:tp\")\n\n"
64  "More complicated expressions are allowed--see\n"
65  " "
66  "https://cdcvs.fnal.gov/redmine/projects/art/wiki/"
67  "Filtering_events\n\n"
68  "The default 'SelectEvents' and `RejectEvents` lists are empty,\n"
69  "which is equivalent to selecting all events."},
70  std::vector<std::string>{}};
72  std::vector<std::string>{}};
73  };
74 
75  explicit Observer(fhicl::ParameterSet const& config);
76  explicit Observer(std::vector<std::string> const& select_paths,
77  std::vector<std::string> const& reject_paths,
78  fhicl::ParameterSet const& config);
79 
80  private:
81  // True if no selectors configured.
84  // The process and event selectors and rejectors, as specified by
85  // the SelectEvents and RejectEvents configuration parameters.
86  std::optional<detail::ProcessAndEventSelectors> selectors_;
87  std::optional<detail::ProcessAndEventSelectors> rejectors_;
88  // ID of the ParameterSet that configured the event selector
89  // subsystem.
91  };
92 
93 } // namespace art
94 
95 #endif /* art_Framework_Core_Observer_h */
96 
97 // Local Variables:
98 // mode: c++
99 // End:
std::string const & processName() const
Definition: Observer.cc:68
Handle< TriggerResults > getTriggerResults(Event const &e) const
Definition: Observer.cc:92
bool wantAllEvents() const noexcept
Definition: Observer.h:37
std::string string
Definition: nybbler.cc:12
bool wantAllEvents_
Definition: Observer.h:82
void registerProducts(ProductDescriptions &, ModuleDescription const &)
Definition: Observer.cc:60
ChannelGroupService::Name Name
std::string process_name_
Definition: Observer.h:83
std::vector< BranchDescription > ProductDescriptions
const double e
fhicl::Sequence< std::string > rejectEvents
Definition: Observer.h:71
static Config * config
Definition: config.cpp:1054
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:74
~Observer() noexcept
void fillDescriptions(ModuleDescription const &)
Definition: Observer.cc:64
Observer & operator=(Observer const &)=delete
fhicl::ParameterSetID selector_config_id_
Definition: Observer.h:90
std::optional< detail::ProcessAndEventSelectors > rejectors_
Definition: Observer.h:87
Observer(Observer const &)=delete
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:86
fhicl::Sequence< std::string > selectEvents
Definition: Observer.h:45
fhicl::ParameterSetID selectorConfig() const
Definition: Observer.cc:86