LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
CachedProducts.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_CachedProducts_h
2 #define art_Framework_Core_CachedProducts_h
3 
4 // -------------------------------------------------------------------
5 //
6 // CachedProducts: This class is used by OutputModule to interact with
7 // the TriggerResults objects upon which the decision to write out an
8 // event is made.
9 //
10 //
11 // -------------------------------------------------------------------
12 
19 
20 #include <string>
21 #include <vector>
22 
23 namespace art {
24  namespace detail {
25 
26  // Match events based on the trigger results from a given process name.
28  public:
29  explicit ProcessAndEventSelector(std::string const& process_name,
30  EventSelector const& event_selector)
31  : processNameSelector_{process_name}, eventSelector_{event_selector}
32  {}
33 
34  // Trigger results.
35  void
37  {
38  e.get(/*in=*/processNameSelector_, /*out=*/triggerResults_);
39  }
42  {
43  return triggerResults_;
44  }
45  void
47  {
48  triggerResults_.clear();
49  }
50 
51  // Event selection.
52  bool
54  {
56  }
57 
58  private:
59  // Select events based on a process name.
61  // Select events based on criteria applied to trigger path results.
63  // Fetched trigger path results for the given process name.
65  };
66 
67  class PVSentry;
68 
69  // Handle the SelectEvents configuration parameter of modules on the end
70  // path.
72  public:
73  void setupDefault(std::vector<std::string> const& trigger_names);
74  void setup(
75  std::vector<std::pair<std::string, std::string>> const& path_specs,
76  std::vector<std::string> const& trigger_names,
77  std::string const& process_name);
78  bool wantEvent(Event const&);
79  art::Handle<art::TriggerResults> getOneTriggerResults(Event const&) const;
80 
81  private:
82  void clearTriggerResults();
83  void loadTriggerResults(Event const&);
84 
85  friend class PVSentry;
86  std::vector<ProcessAndEventSelector> p_and_e_selectors_{};
87  bool loadDone_{false};
88  unsigned long numberFound_{};
89  };
90 
91  class PVSentry {
92  public:
93  explicit PVSentry(CachedProducts& p_and_e_selectors)
94  : p_and_e_selectors_(p_and_e_selectors)
95  {}
96 
97  ~PVSentry() noexcept(false) { p_and_e_selectors_.clearTriggerResults(); }
98 
99  PVSentry(PVSentry const&) = delete;
100  PVSentry& operator=(PVSentry const&) = delete;
101 
102  private:
104  };
105 
106  } // namespace detail
107 } // namespace art
108 
109 #endif /* art_Framework_Core_CachedProducts_h */
110 
111 // Local Variables:
112 // mode: c++
113 // End:
bool get(SelectorBase const &, Handle< PROD > &result) const
Definition: DataViewImpl.h:307
ProcessAndEventSelector(std::string const &process_name, EventSelector const &event_selector)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
CachedProducts & p_and_e_selectors_
~PVSentry() noexcept(false)
art::Handle< art::TriggerResults > triggerResults() const
void loadTriggerResults(Event const &e)
art::Handle< art::TriggerResults > triggerResults_
HLT enums.
ProcessNameSelector processNameSelector_
Float_t e
Definition: plot.C:34
PVSentry(CachedProducts &p_and_e_selectors)
bool acceptEvent(TriggerResults const &)