ProcessAndEventSelectors.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
9 
10 #include <algorithm>
11 #include <cassert>
12 #include <map>
13 #include <string>
14 #include <utility>
15 #include <vector>
16 
17 using namespace cet;
18 using namespace std;
19 using namespace string_literals;
20 
21 namespace art::detail {
22 
23  ProcessAndEventSelector::ProcessAndEventSelector(string const& nm,
24  EventSelector const& es)
25  : processNameSelector_{nm}, eventSelector_{es}
26  {}
27 
30  {
33  return h;
34  }
35 
36  bool
38  {
39  auto h = triggerResults(e);
40  return eventSelector_.acceptEvent(id, *h);
41  }
42 
44  vector<pair<string, string>> const& path_specs,
45  string const& process_name)
46  {
47  // Turn the passed path specs into a map of process name to
48  // a vector of trigger names.
49  map<string, vector<string>> paths_for_process;
50  for (auto const& [proc_name, path_names] : path_specs) {
51  auto const& pname = proc_name.empty() ? process_name : proc_name;
52  paths_for_process[pname].push_back(path_names);
53  }
54  // Now go through all the process names found, and create an event
55  // selector for each one.
56  for (auto const& [pname, paths] : paths_for_process) {
57  sel_.emplace_back(pname, EventSelector{paths});
58  }
59  }
60 
61  bool
63  Event const& e) const
64  {
65  assert(not empty(sel_));
66  return std::any_of(
67  begin(sel_), end(sel_), [id, &e](auto& val) { return val.match(id, e); });
68  }
69 
72  {
73  for (auto& val : sel_) {
74  if (auto h = val.triggerResults(ev); h.isValid()) {
75  return h;
76  }
77  }
78  return Handle<TriggerResults>{};
79  }
80 
81 } // namespace art::detail
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
struct vector vector
bool get(SelectorBase const &, Handle< PROD > &result) const
Definition: DataViewImpl.h:606
STL namespace.
ProcessAndEventSelectors(std::vector< std::pair< std::string, std::string >> const &path_specs, std::string const &process_name)
const double e
bool acceptEvent(ScheduleID id, TriggerResults const &tr) const
art::Handle< art::TriggerResults > triggerResults(Event const &e) const
bool matchEvent(ScheduleID const id, Event const &e) const
std::vector< art::PathSpec > path_specs(std::vector< ModuleSpec > const &selection_override_entries, std::string const &path_selection_override)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
bool match(ScheduleID const id, Event const &e) const