TriggerNamesService.h
Go to the documentation of this file.
1 #ifndef art_Framework_Services_System_TriggerNamesService_h
2 #define art_Framework_Services_System_TriggerNamesService_h
3 // vim: set sw=2 expandtab :
4 
5 //
6 // TriggerNamesService
7 //
8 // This service makes the trigger names available. They are provided in
9 // the same order that the pass/fail status of these triggers is recorded
10 // in the TriggerResults object. These trigger names are the names of
11 // the paths that appear in the configuration (excluding end paths). The
12 // order is the same as in the configuration.
13 //
14 // There are also accessors for the end path names.
15 //
16 // There are other accessors for other trigger related information from
17 // the job configuration: the process name, whether a report on trigger
18 // results was requested and the parameter set containing the list of
19 // trigger paths.
20 //
21 // Almost all the functions return information related to the current
22 // process only. The second getTrigPaths function is an exception.
23 // It will return the trigger path names from previous processes.
24 //
25 
28 #include "fhiclcpp/ParameterSet.h"
29 
30 #include <cstddef>
31 #include <map>
32 #include <string>
33 #include <vector>
34 
35 namespace art {
36 
37  class TriggerResults;
38 
40 
41  // Special Member Functions
42  public:
43  TriggerNamesService(std::vector<std::string> const& triggerPathNames,
44  std::string const& processName,
45  fhicl::ParameterSet const& triggerPSet,
46  fhicl::ParameterSet const& physicsPSet);
47  // API
48  public:
49  // Returns jobPS.process_name
50  std::string const& getProcessName() const;
51  // Parameter set containing the trigger paths, the key
52  // is "trigger_paths", and the value is getTrigPaths().
53  fhicl::ParameterSet const& getTriggerPSet() const;
54  // Returns trigger path names passed to the ctor.
55  std::vector<std::string> const& getTrigPaths() const;
56  // Returns count of trigger path names.
57  std::size_t size() const;
58  // Returns the trigger path name at index i.
59  std::string const& getTrigPath(std::size_t const i) const;
60  // Returns the trigger bit position of trigger path name,
61  // or size() on failure.
62  std::size_t findTrigPath(std::string const& name) const;
63  // Returns the module names on the named trigger path.
64  std::vector<std::string> const& getTrigPathModules(
65  std::string const& name) const;
66  // Returns the modules names on the trigger path at bit position i.
67  std::vector<std::string> const& getTrigPathModules(
68  std::size_t const i) const;
69  // Returns the module name on the named trigger path at index j.
70  std::string const& getTrigPathModule(std::string const& name,
71  std::size_t const j) const;
72  // Returns the module name on the trigger path at bit position i with module
73  // index j.
74  std::string const& getTrigPathModule(std::size_t const i,
75  std::size_t const j) const;
76  // Implementation details.
77  private:
78  std::size_t find(std::map<std::string, std::size_t> const& posmap,
79  std::string const& name) const;
80  // Data members
81  private:
82  // Trigger path names, passed to ctor.
83  std::vector<std::string> const triggerPathNames_;
84  // The art process_name from the top pset.
86  // Parameter set of trigger paths (used by
87  // TriggerResults objects), the key is
88  // "trigger_paths", and the value is
89  // triggerPathNames_, const after ctor.
91  // Maps trigger path name to trigger bit position, const after ctor.
92  std::map<std::string, std::size_t> trigPathNameToTrigBitPos_{};
93  // Labels of modules on trigger paths, const after ctor.
94  std::vector<std::vector<std::string>> moduleNames_{};
95  };
96 
97 } // namespace art
98 
100 
101 #endif /* art_Framework_Services_System_TriggerNamesService_h */
102 
103 // Local Variables:
104 // mode: c++
105 // End:
std::map< std::string, std::size_t > trigPathNameToTrigBitPos_
const XML_Char * name
Definition: expat.h:151
#define DECLARE_ART_SYSTEM_SERVICE(svc, scope)
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
TriggerNamesService(std::vector< std::string > const &triggerPathNames, std::string const &processName, fhicl::ParameterSet const &triggerPSet, fhicl::ParameterSet const &physicsPSet)
enum BeamMode string