File indexing completed on 2024-04-06 12:18:24
0001 #ifndef HLTrigger_HLTcore_HLTConfigData_h
0002 #define HLTrigger_HLTcore_HLTConfigData_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "DataFormats/HLTReco/interface/HLTPrescaleTable.h"
0016 #include "HLTrigger/HLTcore/interface/FractionalPrescale.h"
0017
0018 #include <map>
0019 #include <string>
0020 #include <vector>
0021 #include <type_traits>
0022
0023
0024
0025
0026
0027 class HLTConfigData {
0028 public:
0029 HLTConfigData();
0030 HLTConfigData(const edm::ParameterSet* iID);
0031
0032 private:
0033
0034 void extract();
0035
0036 public:
0037
0038 void dump(const std::string& what) const;
0039
0040
0041
0042
0043 const std::string& processName() const;
0044
0045
0046 const std::string& globalTag() const;
0047
0048
0049 const std::string& tableName() const;
0050
0051
0052 unsigned int size() const;
0053
0054 unsigned int size(unsigned int trigger) const;
0055 unsigned int size(const std::string& trigger) const;
0056
0057
0058 const std::vector<std::string>& triggerNames() const;
0059 const std::string& triggerName(unsigned int triggerIndex) const;
0060
0061
0062 unsigned int triggerIndex(const std::string& triggerName) const;
0063
0064
0065 const std::vector<std::string>& moduleLabels(unsigned int trigger) const;
0066 const std::vector<std::string>& moduleLabels(const std::string& trigger) const;
0067 const std::vector<std::string>& saveTagsModules(unsigned int trigger) const;
0068 const std::vector<std::string>& saveTagsModules(const std::string& trigger) const;
0069 const std::string& moduleLabel(unsigned int trigger, unsigned int module) const;
0070 const std::string& moduleLabel(const std::string& trigger, unsigned int module) const;
0071
0072
0073 unsigned int moduleIndex(unsigned int trigger, const std::string& module) const;
0074 unsigned int moduleIndex(const std::string& trigger, const std::string& module) const;
0075
0076
0077 const std::string moduleType(const std::string& module) const;
0078
0079
0080 const std::string moduleEDMType(const std::string& module) const;
0081
0082
0083 const edm::ParameterSet& processPSet() const;
0084
0085
0086 const edm::ParameterSet& modulePSet(const std::string& module) const;
0087
0088
0089 bool saveTags(const std::string& module) const;
0090
0091
0092 unsigned int l1tType() const;
0093
0094
0095
0096 const std::vector<std::vector<std::pair<bool, std::string>>>& hltL1GTSeeds() const;
0097
0098 const std::vector<std::pair<bool, std::string>>& hltL1GTSeeds(const std::string& trigger) const;
0099
0100 const std::vector<std::pair<bool, std::string>>& hltL1GTSeeds(unsigned int trigger) const;
0101
0102
0103
0104 const std::vector<std::vector<std::string>>& hltL1TSeeds() const;
0105
0106 const std::vector<std::string>& hltL1TSeeds(const std::string& trigger) const;
0107
0108 const std::vector<std::string>& hltL1TSeeds(unsigned int trigger) const;
0109
0110
0111
0112 const std::vector<std::string>& streamNames() const;
0113
0114 const std::string& streamName(unsigned int stream) const;
0115
0116 unsigned int streamIndex(const std::string& stream) const;
0117
0118 const std::vector<std::vector<std::string>>& streamContents() const;
0119
0120 const std::vector<std::string>& streamContent(unsigned int stream) const;
0121
0122 const std::vector<std::string>& streamContent(const std::string& stream) const;
0123
0124
0125
0126 const std::vector<std::string>& datasetNames() const;
0127
0128 const std::string& datasetName(unsigned int dataset) const;
0129
0130 unsigned int datasetIndex(const std::string& dataset) const;
0131
0132 const std::vector<std::vector<std::string>>& datasetContents() const;
0133
0134 const std::vector<std::string>& datasetContent(unsigned int dataset) const;
0135
0136 const std::vector<std::string>& datasetContent(const std::string& dataset) const;
0137
0138
0139
0140 unsigned int prescaleSize() const;
0141
0142 template <typename T = unsigned int>
0143 T prescaleValue(unsigned int set, const std::string& trigger) const;
0144
0145 const std::vector<std::string>& prescaleLabels() const;
0146
0147 template <typename T = unsigned int>
0148 std::map<std::string, std::vector<T>> const& prescaleTable() const;
0149
0150
0151 edm::ParameterSetID id() const;
0152
0153 private:
0154 const edm::ParameterSet* processPSet_;
0155
0156 std::string processName_;
0157 std::string globalTag_;
0158 std::string tableName_;
0159 std::vector<std::string> triggerNames_;
0160 std::vector<std::vector<std::string>> moduleLabels_;
0161 std::vector<std::vector<std::string>> saveTagsModules_;
0162
0163 std::map<std::string, unsigned int> triggerIndex_;
0164 std::vector<std::map<std::string, unsigned int>> moduleIndex_;
0165
0166 unsigned int l1tType_;
0167 std::vector<std::vector<std::pair<bool, std::string>>> hltL1GTSeeds_;
0168 std::vector<std::vector<std::string>> hltL1TSeeds_;
0169
0170 std::vector<std::string> streamNames_;
0171 std::map<std::string, unsigned int> streamIndex_;
0172 std::vector<std::vector<std::string>> streamContents_;
0173
0174 std::vector<std::string> datasetNames_;
0175 std::map<std::string, unsigned int> datasetIndex_;
0176 std::vector<std::vector<std::string>> datasetContents_;
0177
0178 trigger::HLTPrescaleTable hltPrescaleTable_;
0179 std::map<std::string, std::vector<double>> hltPrescaleTableValuesDouble_;
0180 std::map<std::string, std::vector<FractionalPrescale>> hltPrescaleTableValuesFractional_;
0181 };
0182
0183 template <typename T>
0184 T HLTConfigData::prescaleValue(unsigned int set, const std::string& trigger) const {
0185 static_assert(std::is_same_v<T, double> or std::is_same_v<T, FractionalPrescale>,
0186 "\n\tPlease use prescaleValue<double> or prescaleValue<FractionalPrescale>"
0187 "\n\t(other types for HLT prescales are not supported anymore by HLTConfigData)");
0188 return hltPrescaleTable_.prescale(set, trigger);
0189 }
0190
0191 template <typename T>
0192 std::map<std::string, std::vector<T>> const& HLTConfigData::prescaleTable() const {
0193 static_assert(std::is_same_v<T, double> or std::is_same_v<T, FractionalPrescale>,
0194 "\n\tPlease use prescaleTable<double> or prescaleTable<FractionalPrescale>"
0195 "\n\t(other types for HLT prescales are not supported anymore by HLTConfigData)");
0196 return hltPrescaleTable_.table();
0197 }
0198
0199 template <>
0200 std::map<std::string, std::vector<double>> const& HLTConfigData::prescaleTable() const;
0201
0202 template <>
0203 std::map<std::string, std::vector<FractionalPrescale>> const& HLTConfigData::prescaleTable() const;
0204
0205 #endif