TriggerNamesService_service.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
7 #include "cetlib_except/exception.h"
9 
10 #include <cstddef>
11 #include <map>
12 #include <string>
13 #include <vector>
14 
15 using namespace std;
16 using namespace cet;
17 using namespace fhicl;
18 using namespace hep::concurrency;
19 
20 namespace art {
21 
22  TriggerNamesService::TriggerNamesService(
23  vector<string> const& triggerPathNames,
24  string const& processName,
25  ParameterSet const& triggerPSet,
26  ParameterSet const& physicsPSet)
27  : triggerPathNames_{triggerPathNames}
28  , processName_{processName}
29  , triggerPSet_{triggerPSet}
30  {
31  size_t i{0};
32  for (auto const& pathname : triggerPathNames_) {
33  trigPathNameToTrigBitPos_[pathname] = i++;
34  moduleNames_.push_back(physicsPSet.get<vector<string>>(pathname));
35  }
36  }
37 
38  string const&
40  {
41  return processName_;
42  }
43 
44  ParameterSet const&
46  {
47  return triggerPSet_;
48  }
49 
50  vector<string> const&
52  {
53  return triggerPathNames_;
54  }
55 
56  size_t
58  {
59  return triggerPathNames_.size();
60  }
61 
62  string const&
63  TriggerNamesService::getTrigPath(size_t const i) const
64  {
65  return triggerPathNames_.at(i);
66  }
67 
68  size_t
69  TriggerNamesService::find(map<string, size_t> const& posmap,
70  string const& name) const
71  {
72  auto const I = posmap.find(name);
73  if (I == posmap.cend()) {
74  return posmap.size();
75  }
76  return I->second;
77  }
78 
79  size_t
81  {
82  return find(trigPathNameToTrigBitPos_, name);
83  }
84 
85  vector<string> const&
87  {
89  }
90 
91  vector<string> const&
92  TriggerNamesService::getTrigPathModules(size_t const i) const
93  {
94  return moduleNames_.at(i);
95  }
96 
97  string const&
98  TriggerNamesService::getTrigPathModule(string const& name,
99  size_t const j) const
100  {
101  return moduleNames_.at(find(trigPathNameToTrigBitPos_, name)).at(j);
102  }
103 
104  string const&
105  TriggerNamesService::getTrigPathModule(size_t const i, size_t const j) const
106  {
107  return moduleNames_.at(i).at(j);
108  }
109 
110 } // namespace art
std::map< std::string, std::size_t > trigPathNameToTrigBitPos_
const XML_Char * name
Definition: expat.h:151
std::string const processName_
std::vector< std::string > const & getTrigPathModules(std::string const &name) const
fhicl::ParameterSet triggerPSet_
std::vector< std::string > const triggerPathNames_
std::string const & getProcessName() const
std::string const & getTrigPath(std::size_t const i) const
std::vector< std::string > const & getTrigPaths() const
std::size_t find(std::map< std::string, std::size_t > const &posmap, std::string const &name) const
std::string const & getTrigPathModule(std::string const &name, std::size_t const j) const
const double j
Definition: BetheBloch.cxx:29
std::size_t findTrigPath(std::string const &name) const
std::vector< std::vector< std::string > > moduleNames_
fhicl::ParameterSet const & getTriggerPSet() const
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8