LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
EventSelector.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_EventSelector_h
2 #define art_Framework_Core_EventSelector_h
3 
4 // ======================================================================
5 //
6 // EventSelector
7 //
8 // ======================================================================
9 
12 #include "fhiclcpp/ParameterSet.h"
14 
15 #include <memory>
16 #include <string>
17 #include <vector>
18 
19 // ----------------------------------------------------------------------
20 
21 namespace art {
22 
23  // possible return codes for the testSelectionOverlap
24  // method defined below.
25  namespace evtSel {
28  NoOverlap = 1,
31  };
32  } // evtSel
33 
34  class EventSelector {
35  public:
36  using Strings = std::vector<std::string>;
37 
38  EventSelector(Strings const& pathspecs, Strings const& names);
39 
40  explicit EventSelector(Strings const& pathspecs);
41 
42  EventSelector(fhicl::ParameterSet const& pset, Strings const& triggernames);
43 
44  bool
45  wantAll() const
46  {
47  return accept_all_;
48  }
49  bool acceptEvent(TriggerResults const&);
50 
51  std::shared_ptr<TriggerResults> maskTriggerResults(
52  TriggerResults const& inputResults);
53 
54  private:
55  void init(Strings const& paths, Strings const& triggernames);
56 
57  struct BitInfo {
58  BitInfo(unsigned const pos, bool const state)
59  : pos_{pos}, accept_state_{state}
60  {}
61  unsigned int pos_{};
62  bool accept_state_{false};
63  };
64 
65  using Bits = std::vector<BitInfo>;
66 
67  bool accept_all_{false};
68  Bits absolute_acceptors_{};
69  Bits conditional_acceptors_{};
70  Bits exception_acceptors_{};
71  std::vector<Bits> all_must_fail_{};
72  std::vector<Bits> all_must_fail_noex_{};
73 
74  bool results_from_current_process_{true};
75  bool psetID_initialized_{false};
77 
78  Strings paths_{};
79 
80  int nTriggerNames_{0};
81  bool notStarPresent_{false};
82 
83  bool acceptOneBit(Bits const& b,
84  HLTGlobalStatus const& tr,
85  hlt::HLTState const& s = hlt::Ready) const;
86  bool acceptAllBits(Bits const& b, HLTGlobalStatus const& tr) const;
87 
88  bool containsExceptions(HLTGlobalStatus const& tr) const;
89 
90  bool selectionDecision(HLTGlobalStatus const& tr) const;
91 
92  static std::vector<Strings::const_iterator> matching_triggers(
93  Strings const& trigs,
94  std::string const& s);
95 
96  static bool identical(std::vector<bool> const& a,
97  std::vector<bool> const& b);
98  static bool identical(EventSelector const& a,
99  EventSelector const& b,
100  unsigned int N);
101  static std::vector<bool> expandDecisionList(Bits const& b,
102  bool PassOrFail,
103  unsigned int n);
104  static bool overlapping(std::vector<bool> const& a,
105  std::vector<bool> const& b);
106  static bool subset(std::vector<bool> const& a, std::vector<bool> const& b);
107  static std::vector<bool> combine(std::vector<bool> const& a,
108  std::vector<bool> const& b);
109  }; // EventSelector
110 
111 } // art
112 
113  // ======================================================================
114 
115 #endif /* art_Framework_Core_EventSelector_h */
116 
117 // Local Variables:
118 // mode: c++
119 // End:
Float_t s
Definition: plot.C:23
std::vector< BitInfo > Bits
Definition: EventSelector.h:65
HLTState
status of a trigger path
Definition: HLTenums.h:14
std::vector< std::string > Strings
Definition: EventSelector.h:36
not [yet] run
Definition: HLTenums.h:15
BitInfo(unsigned const pos, bool const state)
Definition: EventSelector.h:58
HLT enums.
Char_t n[5]
bool wantAll() const
Definition: EventSelector.h:45