Go to the documentation of this file.00001 #ifndef FWCore_Framework_TriggerNamesService_h
00002 #define FWCore_Framework_TriggerNamesService_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033
00034 #include <string>
00035 #include <map>
00036 #include <vector>
00037
00038 namespace edm {
00039
00040 class TriggerResults;
00041
00042 namespace service {
00043 class TriggerNamesService
00044 {
00045 public:
00046
00047 typedef std::vector<std::string> Strings;
00048 typedef std::map<std::string, unsigned int> PosMap;
00049 typedef PosMap::size_type size_type;
00050
00051 explicit TriggerNamesService(ParameterSet const& proc_pset);
00052
00053
00054
00055
00056
00057 size_type size() const { return trignames_.size(); }
00058 Strings const& getTrigPaths() const { return trignames_; }
00059 std::string const& getTrigPath(size_type const i) const { return trignames_.at(i);}
00060 size_type findTrigPath(std::string const& name) const { return find(trigpos_,name);}
00061
00062
00063
00064
00065
00066
00067
00068
00069 bool getTrigPaths(TriggerResults const& triggerResults,
00070 Strings& trigPaths);
00071
00072
00073
00074
00075
00076 bool getTrigPaths(TriggerResults const& triggerResults,
00077 Strings& trigPaths,
00078 bool& fromPSetRegistry);
00079
00080 Strings const& getEndPaths() const { return end_names_; }
00081 std::string const& getEndPath(size_type const i) const { return end_names_.at(i);}
00082 size_type findEndPath(std::string const& name) const { return find(end_pos_,name);}
00083
00084 Strings const& getTrigPathModules(std::string const& name) const {
00085 return modulenames_.at(find(trigpos_,name));
00086 }
00087 Strings const& getTrigPathModules(size_type const i) const {
00088 return modulenames_.at(i);
00089 }
00090 std::string const& getTrigPathModule (std::string const& name, size_type const j) const {
00091 return (modulenames_.at(find(trigpos_,name))).at(j);
00092 }
00093 std::string const& getTrigPathModule (size_type const i, size_type const j) const {
00094 return (modulenames_.at(i)).at(j);
00095 }
00096
00097 Strings const& getEndPathModules(std::string const& name) const {
00098 return end_modulenames_.at(find(end_pos_,name));
00099 }
00100 Strings const& getEndPathModules(size_type const i) const {
00101 return end_modulenames_.at(i);
00102 }
00103 std::string const& getEndPathModule (std::string const& name, size_type const j) const {
00104 return (end_modulenames_.at(find(end_pos_,name))).at(j);
00105 }
00106 std::string const& getEndPathModule (size_type const i, size_type const j) const {
00107 return (end_modulenames_.at(i)).at(j);
00108 }
00109
00110 size_type find (PosMap const& posmap, std::string const& name) const {
00111 PosMap::const_iterator const pos(posmap.find(name));
00112 if (pos == posmap.end()) {
00113 return posmap.size();
00114 } else {
00115 return pos->second;
00116 }
00117 }
00118
00119 void loadPosMap(PosMap& posmap, Strings const& names) {
00120 size_type const n(names.size());
00121 for (size_type i = 0; i != n; ++i) {
00122 posmap[names[i]] = i;
00123 }
00124 }
00125
00126 std::string const& getProcessName() const { return process_name_; }
00127 bool wantSummary() const { return wantSummary_; }
00128
00129
00130 edm::ParameterSet const& getTriggerPSet() const { return trigger_pset_; }
00131
00132 private:
00133
00134 edm::ParameterSet trigger_pset_;
00135
00136 Strings trignames_;
00137 PosMap trigpos_;
00138 Strings end_names_;
00139 PosMap end_pos_;
00140
00141 std::vector<Strings> modulenames_;
00142 std::vector<Strings> end_modulenames_;
00143
00144 std::string process_name_;
00145 bool wantSummary_;
00146 };
00147 }
00148 }
00149
00150 #endif