Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::TriggerNamesService Class Reference

#include <TriggerNamesService.h>

Classes

struct  DataPerProcess
 

Public Member Functions

 TriggerNamesService (fhicl::ParameterSet const &trigger_paths_pset, fhicl::ParameterSet const &physics_pset)
 
TriggerResults const & triggerResults (Event const &e, std::string const &process_name="current_process") const
 
std::map< std::string, HLTPathStatuspathResults (Event const &e, std::string const &process_name="current_process") const
 
std::string const & getProcessName () const
 
std::vector< std::string > const & getTrigPaths () const
 
std::string const & getTrigPath (PathID const id) const
 
PathID findTrigPath (std::string const &name) const
 
std::vector< std::string > const & getTrigPathModules (std::string const &name) const
 
std::vector< std::string > const & getTrigPathModules (PathID id) const
 
size_t index_for (PathID id) const
 

Private Member Functions

size_t index_ (detail::entry_selector_t selector) const
 
DataPerProcess const & currentData_ () const
 

Private Attributes

std::map< std::string, DataPerProcessdataPerProcess_
 

Detailed Description

Definition at line 44 of file TriggerNamesService.h.

Constructor & Destructor Documentation

art::TriggerNamesService::TriggerNamesService ( fhicl::ParameterSet const &  trigger_paths_pset,
fhicl::ParameterSet const &  physics_pset 
)

Definition at line 70 of file TriggerNamesService_service.cc.

73  {
74  dataPerProcess_.try_emplace(
75  getProcessName(), data_for_process(trigger_paths_pset, physics_pset));
76  }
std::string const & getProcessName() const
std::map< std::string, DataPerProcess > dataPerProcess_

Member Function Documentation

DataPerProcess const & art::TriggerNamesService::currentData_ ( ) const
private

Definition at line 79 of file TriggerNamesService_service.cc.

80  {
81  return dataPerProcess_.at(getProcessName());
82  }
std::string const & getProcessName() const
std::map< std::string, DataPerProcess > dataPerProcess_
PathID art::TriggerNamesService::findTrigPath ( std::string const &  name) const
string const & art::TriggerNamesService::getProcessName ( ) const

Definition at line 136 of file TriggerNamesService_service.cc.

137  {
139  }
std::string const & processName() const
Definition: Globals.cc:48
static Globals * instance()
Definition: Globals.cc:17
string const & art::TriggerNamesService::getTrigPath ( PathID const  id) const

Definition at line 148 of file TriggerNamesService_service.cc.

149  {
150  auto const i = index_for(id);
151  if (i == invalid_entry) {
153  << "A path name could not be found corresponding to path ID "
154  << to_string(id) << '\n';
155  }
156  return currentData_().triggerPathSpecs[i].name;
157  }
size_t index_for(PathID id) const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
DataPerProcess const & currentData_() const
vector< string > const & art::TriggerNamesService::getTrigPathModules ( std::string const &  name) const

Definition at line 160 of file TriggerNamesService_service.cc.

161  {
162  auto const& modules = currentData_().moduleNames;
163  return modules.at(index_(for_(name)));
164  }
static QCString name
Definition: declinfo.cpp:673
size_t index_(detail::entry_selector_t selector) const
std::vector< std::vector< std::string > > moduleNames
DataPerProcess const & currentData_() const
vector< string > const & art::TriggerNamesService::getTrigPathModules ( PathID  id) const

Definition at line 167 of file TriggerNamesService_service.cc.

168  {
169  auto const& modules = currentData_().moduleNames;
170  return modules.at(index_for(id));
171  }
size_t index_for(PathID id) const
std::vector< std::vector< std::string > > moduleNames
DataPerProcess const & currentData_() const
vector< string > const & art::TriggerNamesService::getTrigPaths ( ) const

Definition at line 142 of file TriggerNamesService_service.cc.

143  {
145  }
std::vector< std::string > triggerPathNames
DataPerProcess const & currentData_() const
size_t art::TriggerNamesService::index_ ( detail::entry_selector_t  selector) const
private

Definition at line 180 of file TriggerNamesService_service.cc.

181  {
182  auto const& path_specs = currentData_().triggerPathSpecs;
183 
184  auto const b = begin(path_specs);
185  auto const e = end(path_specs);
186  auto it = std::find_if(b, e, matched_entry);
187  if (it == e) {
188  return invalid_entry;
189  }
190  return std::distance(b, it);
191  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
const double e
std::vector< PathSpec > path_specs(std::vector< std::string > const &path_spec_strs)
Definition: PathSpec.cc:34
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
static bool * b
Definition: config.cpp:1043
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
DataPerProcess const & currentData_() const
size_t art::TriggerNamesService::index_for ( PathID  id) const

Definition at line 174 of file TriggerNamesService_service.cc.

175  {
176  return index_(for_(id));
177  }
size_t index_(detail::entry_selector_t selector) const
std::map< std::string, HLTPathStatus > art::TriggerNamesService::pathResults ( Event const &  e,
std::string const &  process_name = "current_process" 
) const

Definition at line 98 of file TriggerNamesService_service.cc.

100  {
101  auto const& tr = triggerResults(e, process_name);
102  auto const& pname =
103  process_name == "current_process" ? getProcessName() : process_name;
104 
105  auto it = dataPerProcess_.find(process_name);
106  if (it == cend(dataPerProcess_)) {
107  auto config = e.processHistory().getConfigurationForProcess(pname);
108  if (not config) {
109  throw lookup_exception(pname)
110  << "Could not locate process configuration for the process '" << pname
111  << "'\n"
112  << "This can happen if the ParameterSets were dropped on input.\n"
113  << "Please contact artists@fnal.gov for guidance.\n";
114  }
115 
116  auto const& trigger_pset = ParameterSetRegistry::get(tr.parameterSetID());
117  auto const& pset = ParameterSetRegistry::get(config->parameterSetID());
118  auto data = data_for_process(trigger_pset,
119  pset.get<fhicl::ParameterSet>("physics"));
120  it = dataPerProcess_.try_emplace(process_name, std::move(data)).first;
121  }
122 
123  auto const& names = it->second.triggerPathNames;
124  assert(size(names) == tr.size());
125 
126  std::map<std::string, HLTPathStatus> result;
127  for (size_t i = 0, n = tr.size(); i != n; ++i) {
128  result.try_emplace(names[i], tr.at(i));
129  }
130  return result;
131  }
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:87
static QCString result
std::string const & getProcessName() const
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
const double e
static Config * config
Definition: config.cpp:1054
std::void_t< T > n
def move(depos, offset)
Definition: depos.py:107
TriggerResults const & triggerResults(Event const &e, std::string const &process_name="current_process") const
static std::vector< std::string > const names
Definition: FragmentType.hh:8
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
std::map< std::string, DataPerProcess > dataPerProcess_
TriggerResults const & art::TriggerNamesService::triggerResults ( Event const &  e,
std::string const &  process_name = "current_process" 
) const

Definition at line 87 of file TriggerNamesService_service.cc.

89  {
90  Handle<art::TriggerResults> h;
91  if (not e.getByLabel("TriggerResults", "", process_name, h)) {
92  throw lookup_exception(process_name) << *h.whyFailed();
93  }
94  return *h;
95  }
const double e

Member Data Documentation

std::map<std::string, DataPerProcess> art::TriggerNamesService::dataPerProcess_
mutableprivate

Definition at line 80 of file TriggerNamesService.h.


The documentation for this class was generated from the following files: