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