23 using namespace fhicl;
29 constexpr
auto invalid_entry = numeric_limits<size_t>::max();
33 return [id](
art::PathSpec const& spec) {
return spec.path_id == id; };
36 for_(
string const& name)
38 return [&name](
art::PathSpec const& spec) {
return spec.name == name; };
42 lookup_exception(
string const& process_name)
46 "An error occurred while retrieving the trigger paths for process '" +
47 process_name +
"'.\n"};
54 auto const spec_strs =
55 trigger_paths_pset.
get<vector<string>>(
"trigger_paths");
58 vector<string> trigger_path_names;
59 vector<vector<string>> module_names;
60 for (
auto const& spec_str : specs) {
61 trigger_path_names.push_back(spec_str.name);
62 module_names.push_back(physics_pset.
get<vector<string>>(spec_str.name));
65 std::move(specs), std::move(trigger_path_names), std::move(module_names)};
71 TriggerNamesService::TriggerNamesService(
75 dataPerProcess_.try_emplace(
76 getProcessName(), data_for_process(trigger_paths_pset, physics_pset));
80 TriggerNamesService::currentData_()
const 82 return dataPerProcess_.at(getProcessName());
88 TriggerNamesService::triggerResults(
Event const&
e,
89 string const& process_name)
const 95 throw lookup_exception(process_name) << *h.whyFailed();
98 map<string, HLTPathStatus>
99 TriggerNamesService::pathResults(
Event const&
e,
100 string const& process_name)
const 102 auto const& tr = triggerResults(e, process_name);
104 process_name ==
"current_process" ? getProcessName() : process_name;
106 auto it = dataPerProcess_.find(process_name);
107 if (it ==
cend(dataPerProcess_)) {
110 throw lookup_exception(pname)
111 <<
"Could not locate process configuration for the process '" << pname
113 <<
"This can happen if the ParameterSets were dropped on input.\n" 114 <<
"Please contact artists@fnal.gov for guidance.\n";
120 data_for_process(trigger_pset, pset.get<
ParameterSet>(
"physics"));
121 it = dataPerProcess_.try_emplace(process_name, std::move(data)).first;
124 auto const& names = it->second.triggerPathNames;
125 assert(
size(names) == tr.size());
127 map<string, HLTPathStatus> result;
128 for (
size_t i = 0,
n = tr.size(); i !=
n; ++i) {
129 result.try_emplace(names[i], tr.at(i));
137 TriggerNamesService::getProcessName()
const 142 vector<string>
const&
143 TriggerNamesService::getTrigPaths()
const 145 return currentData_().triggerPathNames;
149 TriggerNamesService::getTrigPath(
PathID const id)
const 151 auto const i = index_for(
id);
152 if (i == invalid_entry) {
154 <<
"A path name could not be found corresponding to path ID " 157 return currentData_().triggerPathSpecs[i].name;
160 vector<string>
const&
161 TriggerNamesService::getTrigPathModules(
string const& name)
const 163 auto const& modules = currentData_().moduleNames;
164 return modules.at(index_(for_(name)));
167 vector<string>
const&
168 TriggerNamesService::getTrigPathModules(
PathID const id)
const 170 auto const& modules = currentData_().moduleNames;
171 return modules.at(index_for(
id));
175 TriggerNamesService::index_for(
PathID const id)
const 177 return index_(for_(
id));
183 auto const&
path_specs = currentData_().triggerPathSpecs;
187 auto it = find_if(b,
e, matched_entry);
189 return invalid_entry;
191 return distance(b, it);
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
static collection_type const & get() noexcept
const std::string instance
ProcessHistory const & processHistory() const
std::string to_string(Protection p)
std::function< bool(PathSpec const &)> entry_selector_t
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::vector< PathSpec > path_specs(std::vector< std::string > const &path_spec_strs)
T get(std::string const &key) const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::optional< ProcessConfiguration > getConfigurationForProcess(std::string const &name) const
Handle< PROD > getHandle(SelectorBase const &) const
art::TriggerNamesService::DataPerProcess DataPerProcess
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.