LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::TriggerNamesService Class Reference

#include "TriggerNamesService.h"

Public Types

using Strings = std::vector< std::string >
 
using PosMap = std::map< std::string, unsigned int >
 
using size_type = PosMap::size_type
 

Public Member Functions

 TriggerNamesService (fhicl::ParameterSet const &procPS, std::vector< std::string > const &triggerPathNames)
 
size_type size () const
 
Strings const & getTrigPaths () const
 
std::string const & getTrigPath (size_type const i) const
 
size_type findTrigPath (std::string const &name) const
 
bool getTrigPaths (TriggerResults const &triggerResults, Strings &trigPaths) const
 
auto getTrigPathModules (std::string const &name) const -> Strings const &
 
auto getTrigPathModules (size_type const i) const -> Strings const &
 
std::string const & getTrigPathModule (std::string const &name, size_type const j) const
 
std::string const & getTrigPathModule (size_type const i, size_type const j) const
 
size_type find (PosMap const &posmap, std::string const &name) const
 
std::string const & getProcessName () const
 
bool wantSummary () const
 
fhicl::ParameterSet const & getTriggerPSet () const
 

Private Attributes

Strings trignames_
 
PosMap trigpos_ {}
 
Strings end_names_ {}
 
PosMap end_pos_ {}
 
fhicl::ParameterSet trigger_pset_ {}
 
std::vector< Stringsmodulenames_ {}
 
std::string process_name_
 
bool wantSummary_
 

Detailed Description

Definition at line 41 of file TriggerNamesService.h.

Member Typedef Documentation

using art::TriggerNamesService::PosMap = std::map<std::string, unsigned int>

Definition at line 44 of file TriggerNamesService.h.

using art::TriggerNamesService::size_type = PosMap::size_type

Definition at line 45 of file TriggerNamesService.h.

using art::TriggerNamesService::Strings = std::vector<std::string>

Definition at line 43 of file TriggerNamesService.h.

Constructor & Destructor Documentation

TriggerNamesService::TriggerNamesService ( fhicl::ParameterSet const &  procPS,
std::vector< std::string > const &  triggerPathNames 
)

Definition at line 22 of file TriggerNamesService_service.cc.

References end_names_, end_pos_, modulenames_, process_name_, fhicl::ParameterSet::put(), trigger_pset_, trignames_, trigpos_, and wantSummary_.

24  : trignames_{trigger_path_names}
25  , process_name_{procPS.get<string>("process_name")}
26  , wantSummary_{procPS.get<bool>("services.scheduler.wantSummary", false)}
27 {
28  // Make and hold onto a parameter set for posterity.
29  trigger_pset_.put("trigger_paths", trignames_);
30  ParameterSetRegistry::put(trigger_pset_);
31 
32  auto const& physics = procPS.get<ParameterSet>("physics", {});
33  end_names_ = physics.get<Strings>("end_paths", {});
34 
35  auto assign_position = [](auto& posmap, size_type const i, auto const& name) {
36  posmap[name] = i;
37  };
38 
39  using namespace std::placeholders;
40  cet::for_all_with_index(
41  trignames_, std::bind(assign_position, std::ref(trigpos_), _1, _2));
42  cet::for_all_with_index(
43  end_names_, std::bind(assign_position, std::ref(end_pos_), _1, _2));
44 
45  cet::transform_all(
46  trignames_,
47  std::back_inserter(modulenames_),
48  [&physics](std::string const& par) { return physics.get<Strings>(par); });
49 } // c'tor
fhicl::ParameterSet trigger_pset_
std::vector< Strings > modulenames_
std::vector< std::string > Strings
void put(std::string const &key)

Member Function Documentation

size_type art::TriggerNamesService::find ( PosMap const &  posmap,
std::string const &  name 
) const
inline

Definition at line 91 of file TriggerNamesService.h.

Referenced by findTrigPath(), getTrigPathModule(), and getTrigPathModules().

92  {
93  auto const pos = posmap.find(name);
94  if (pos == posmap.cend()) {
95  return posmap.size();
96  } else {
97  return pos->second;
98  }
99  }
size_type art::TriggerNamesService::findTrigPath ( std::string const &  name) const
inline

Definition at line 67 of file TriggerNamesService.h.

References find(), getTrigPathModule(), getTrigPathModules(), getTrigPaths(), and trigpos_.

68  {
69  return find(trigpos_, name);
70  }
size_type find(PosMap const &posmap, std::string const &name) const
std::string const& art::TriggerNamesService::getProcessName ( ) const
inline

Definition at line 102 of file TriggerNamesService.h.

References process_name_.

103  {
104  return process_name_;
105  }
fhicl::ParameterSet const& art::TriggerNamesService::getTriggerPSet ( ) const
inline

Definition at line 114 of file TriggerNamesService.h.

References trigger_pset_.

115  {
116  return trigger_pset_;
117  }
fhicl::ParameterSet trigger_pset_
std::string const& art::TriggerNamesService::getTrigPath ( size_type const  i) const
inline

Definition at line 62 of file TriggerNamesService.h.

References trignames_.

63  {
64  return trignames_.at(i);
65  }
std::string const & art::TriggerNamesService::getTrigPathModule ( std::string const &  name,
size_type const  j 
) const
inline

Definition at line 151 of file TriggerNamesService.h.

References find(), modulenames_, and trigpos_.

Referenced by findTrigPath().

153 {
154  return modulenames_.at(find(trigpos_, name)).at(j);
155 }
size_type find(PosMap const &posmap, std::string const &name) const
std::vector< Strings > modulenames_
std::string const & art::TriggerNamesService::getTrigPathModule ( size_type const  i,
size_type const  j 
) const
inline

Definition at line 158 of file TriggerNamesService.h.

References DECLARE_ART_SYSTEM_SERVICE, art::LEGACY, and modulenames_.

160 {
161  return modulenames_.at(i).at(j);
162 }
std::vector< Strings > modulenames_
auto art::TriggerNamesService::getTrigPathModules ( std::string const &  name) const -> Strings const&
inline

Definition at line 137 of file TriggerNamesService.h.

References find(), modulenames_, and trigpos_.

Referenced by findTrigPath().

139 {
140  return modulenames_.at(find(trigpos_, name));
141 }
size_type find(PosMap const &posmap, std::string const &name) const
std::vector< Strings > modulenames_
auto art::TriggerNamesService::getTrigPathModules ( size_type const  i) const -> Strings const&
inline

Definition at line 144 of file TriggerNamesService.h.

References modulenames_.

146 {
147  return modulenames_.at(i);
148 }
std::vector< Strings > modulenames_
Strings const& art::TriggerNamesService::getTrigPaths ( ) const
inline

Definition at line 57 of file TriggerNamesService.h.

References trignames_.

Referenced by findTrigPath().

58  {
59  return trignames_;
60  }
bool TriggerNamesService::getTrigPaths ( TriggerResults const &  triggerResults,
Strings trigPaths 
) const

Definition at line 54 of file TriggerNamesService_service.cc.

References fhicl::ParameterSet::get(), art::TriggerResults::parameterSetID(), art::HLTGlobalStatus::size(), std::swap(), and art::errors::Unknown.

56 {
57  ParameterSet pset;
58  if (!ParameterSetRegistry::get(triggerResults.parameterSetID(), pset)) {
59  return false;
60  }
61  auto tmpPaths = pset.get<Strings>("trigger_paths", {});
62  if (tmpPaths.size() != triggerResults.size()) {
64  << "TriggerNamesService::getTrigPaths, Trigger names vector and\n"
65  "TriggerResults are different sizes. This should be impossible,\n"
66  "please send information to reproduce this problem to\n"
67  "the ART developers.\n";
68  }
69  std::swap(tmpPaths, trigPaths);
70  return true;
71 }
std::vector< std::string > Strings
T get(std::string const &key) const
Definition: ParameterSet.h:231
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
size_type art::TriggerNamesService::size ( void  ) const
inline

Definition at line 52 of file TriggerNamesService.h.

References trignames_.

53  {
54  return trignames_.size();
55  }
bool art::TriggerNamesService::wantSummary ( ) const
inline

Definition at line 107 of file TriggerNamesService.h.

References wantSummary_.

108  {
109  return wantSummary_;
110  }

Member Data Documentation

Strings art::TriggerNamesService::end_names_ {}
private

Definition at line 122 of file TriggerNamesService.h.

Referenced by TriggerNamesService().

PosMap art::TriggerNamesService::end_pos_ {}
private

Definition at line 123 of file TriggerNamesService.h.

Referenced by TriggerNamesService().

std::vector<Strings> art::TriggerNamesService::modulenames_ {}
private
std::string art::TriggerNamesService::process_name_
private

Definition at line 130 of file TriggerNamesService.h.

Referenced by getProcessName(), and TriggerNamesService().

fhicl::ParameterSet art::TriggerNamesService::trigger_pset_ {}
private

Definition at line 125 of file TriggerNamesService.h.

Referenced by getTriggerPSet(), and TriggerNamesService().

Strings art::TriggerNamesService::trignames_
private

Definition at line 120 of file TriggerNamesService.h.

Referenced by getTrigPath(), getTrigPaths(), size(), and TriggerNamesService().

PosMap art::TriggerNamesService::trigpos_ {}
private
bool art::TriggerNamesService::wantSummary_
private

Definition at line 131 of file TriggerNamesService.h.

Referenced by TriggerNamesService(), and wantSummary().


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