Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-09-21 02:12:37

0001 /** \class HLTConfigData
0002  *
0003  * See header file for documentation
0004  *
0005  *
0006  *  \author Martin Grunewald
0007  *
0008  */
0009 
0010 #include "HLTrigger/HLTcore/interface/HLTConfigData.h"
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "FWCore/Utilities/interface/path_configuration.h"
0013 #include "FWCore/Utilities/interface/transform.h"
0014 
0015 #include <iostream>
0016 
0017 //Using this function with the 'const static within s_dummyPSet'
0018 // guarantees that even if multiple threads call s_dummyPSet at the
0019 // same time, only the 'first' one registers the dummy PSet.
0020 static const edm::ParameterSet initializeDummyPSet() {
0021   edm::ParameterSet dummy;
0022   dummy.registerIt();
0023   return dummy;
0024 }
0025 
0026 static const edm::ParameterSet* s_dummyPSet() {
0027   static const edm::ParameterSet dummyPSet{initializeDummyPSet()};
0028   return &dummyPSet;
0029 }
0030 
0031 HLTConfigData::HLTConfigData()
0032     : processPSet_(s_dummyPSet()),
0033       processName_(""),
0034       globalTag_(""),
0035       tableName_(),
0036       triggerNames_(),
0037       moduleLabels_(),
0038       saveTagsModules_(),
0039       triggerIndex_(),
0040       moduleIndex_(),
0041       l1tType_(0),
0042       hltL1GTSeeds_(),
0043       hltL1TSeeds_(),
0044       streamNames_(),
0045       streamIndex_(),
0046       streamContents_(),
0047       datasetNames_(),
0048       datasetIndex_(),
0049       datasetContents_(),
0050       hltPrescaleTable_(),
0051       hltPrescaleTableValuesDouble_{},
0052       hltPrescaleTableValuesFractional_{} {
0053   if (processPSet_->id().isValid()) {
0054     extract();
0055   }
0056 }
0057 
0058 HLTConfigData::HLTConfigData(const edm::ParameterSet* iPSet)
0059     : processPSet_(iPSet),
0060       processName_(""),
0061       globalTag_(""),
0062       tableName_(),
0063       triggerNames_(),
0064       moduleLabels_(),
0065       saveTagsModules_(),
0066       triggerIndex_(),
0067       moduleIndex_(),
0068       l1tType_(0),
0069       hltL1GTSeeds_(),
0070       hltL1TSeeds_(),
0071       streamNames_(),
0072       streamIndex_(),
0073       streamContents_(),
0074       datasetNames_(),
0075       datasetIndex_(),
0076       datasetContents_(),
0077       hltPrescaleTable_(),
0078       hltPrescaleTableValuesDouble_{},
0079       hltPrescaleTableValuesFractional_{} {
0080   if (processPSet_->id().isValid()) {
0081     extract();
0082   }
0083 }
0084 
0085 void HLTConfigData::extract() {
0086   using namespace std;
0087   using namespace edm;
0088   using namespace trigger;
0089 
0090   // Extract process name
0091   if (processPSet_->existsAs<string>("@process_name", true)) {
0092     processName_ = processPSet_->getParameter<string>("@process_name");
0093   }
0094 
0095   // Extract globaltag
0096   globalTag_ = "";
0097   const ParameterSet* GlobalTagPSet(nullptr);
0098   if (processPSet_->exists("GlobalTag")) {
0099     GlobalTagPSet = &(processPSet_->getParameterSet("GlobalTag"));
0100   } else if (processPSet_->exists("PoolDBESSource@GlobalTag")) {
0101     GlobalTagPSet = &(processPSet_->getParameterSet("PoolDBESSource@GlobalTag"));
0102   }
0103   if (GlobalTagPSet && GlobalTagPSet->existsAs<std::string>("globaltag", true)) {
0104     globalTag_ = GlobalTagPSet->getParameter<std::string>("globaltag");
0105   }
0106 
0107   // Obtain PSet containing table name (available only in 2_1_10++ files)
0108   if (processPSet_->existsAs<ParameterSet>("HLTConfigVersion", true)) {
0109     const ParameterSet& HLTPSet(processPSet_->getParameterSet("HLTConfigVersion"));
0110     if (HLTPSet.existsAs<string>("tableName", true)) {
0111       tableName_ = HLTPSet.getParameter<string>("tableName");
0112     }
0113   }
0114 
0115   // Extract trigger paths (= paths - end_paths)
0116   if (processPSet_->existsAs<ParameterSet>("@trigger_paths", true)) {
0117     const ParameterSet& HLTPSet(processPSet_->getParameterSet("@trigger_paths"));
0118     if (HLTPSet.existsAs<vector<string>>("@trigger_paths", true)) {
0119       triggerNames_ = HLTPSet.getParameter<vector<string>>("@trigger_paths");
0120     }
0121   }
0122 
0123   // Obtain module labels of all modules on all trigger paths
0124   const unsigned int n(size());
0125   moduleLabels_.reserve(n);
0126   for (unsigned int i = 0; i != n; ++i) {
0127     if (processPSet_->existsAs<vector<string>>(triggerNames_[i], true)) {
0128       moduleLabels_.push_back(path_configuration::configurationToModuleBitPosition(
0129           processPSet_->getParameter<vector<string>>(triggerNames_[i])));
0130     }
0131   }
0132   saveTagsModules_.reserve(n);
0133   vector<string> labels;
0134   for (unsigned int i = 0; i != n; ++i) {
0135     labels.clear();
0136     const vector<string>& modules(moduleLabels(i));
0137     const unsigned int m(modules.size());
0138     labels.reserve(m);
0139     for (unsigned int j = 0; j != m; ++j) {
0140       const string& label(modules[j]);
0141       if (saveTags(label))
0142         labels.push_back(label);
0143     }
0144     saveTagsModules_.push_back(labels);
0145   }
0146 
0147   // Fill index maps for fast lookup
0148   moduleIndex_.resize(n);
0149   for (unsigned int i = 0; i != n; ++i) {
0150     triggerIndex_[triggerNames_[i]] = i;
0151     moduleIndex_[i].clear();
0152     const unsigned int m(size(i));
0153     for (unsigned int j = 0; j != m; ++j) {
0154       moduleIndex_[i][moduleLabels_[i][j]] = j;
0155     }
0156   }
0157 
0158   // Extract and fill HLTLevel1GTSeed information for each trigger path
0159   hltL1GTSeeds_.resize(n);
0160   for (unsigned int i = 0; i != n; ++i) {
0161     hltL1GTSeeds_[i].clear();
0162     const unsigned int m(size(i));
0163     for (unsigned int j = 0; j != m; ++j) {
0164       const string& label(moduleLabels_[i][j]);
0165       //HLTConfigProvider sees ignored modules as "-modname"
0166       //if the HLTLevel1GTSeed is ignored in the config, it shouldnt
0167       //count to the number of active HLTLevel1GTSeeds so we now check
0168       //for the module being ignored
0169       if (label.front() != '-' && moduleType(label) == "HLTLevel1GTSeed") {
0170         const ParameterSet& pset(modulePSet(label));
0171         if (pset != ParameterSet()) {
0172           const bool l1Tech(pset.getParameter<bool>("L1TechTriggerSeeding"));
0173           const string l1Seed(pset.getParameter<string>("L1SeedsLogicalExpression"));
0174           hltL1GTSeeds_[i].push_back(pair<bool, string>(l1Tech, l1Seed));
0175         }
0176       }
0177     }
0178   }
0179 
0180   // Extract and fill HLTL1TSeed information for each trigger path
0181   hltL1TSeeds_.resize(n);
0182   for (unsigned int i = 0; i != n; ++i) {
0183     hltL1TSeeds_[i].clear();
0184     const unsigned int m(size(i));
0185     for (unsigned int j = 0; j != m; ++j) {
0186       const string& label(moduleLabels_[i][j]);
0187       //HLTConfigProvider sees ignored modules as "-modname"
0188       //if the HLTL1TSeed is ignored in the config, it shouldnt
0189       //count to the number of active HLTL1TSeeds so we now check
0190       //for the module being ignored
0191       if (label.front() != '-' && moduleType(label) == "HLTL1TSeed") {
0192         const ParameterSet& pset(modulePSet(label));
0193         if (pset != ParameterSet()) {
0194           const string l1Gtag(pset.getParameter<edm::InputTag>("L1GlobalInputTag").label());
0195           // Emulator output is used to ignore L1T prescales
0196           if (l1Gtag != "hltGtStage2ObjectMap") {
0197             const string l1Seed(pset.getParameter<string>("L1SeedsLogicalExpression"));
0198             hltL1TSeeds_[i].push_back(l1Seed);
0199           }
0200         }
0201       }
0202     }
0203   }
0204 
0205   // Extract and fill streams information
0206   if (processPSet_->existsAs<ParameterSet>("streams", true)) {
0207     const ParameterSet& streams(processPSet_->getParameterSet("streams"));
0208     streamNames_ = streams.getParameterNamesForType<vector<string>>();
0209     sort(streamNames_.begin(), streamNames_.end());
0210     const unsigned int n(streamNames_.size());
0211     streamContents_.resize(n);
0212     for (unsigned int i = 0; i != n; ++i) {
0213       streamIndex_[streamNames_[i]] = i;
0214       streamContents_[i] = streams.getParameter<vector<string>>(streamNames_[i]);
0215       sort(streamContents_[i].begin(), streamContents_[i].end());
0216     }
0217   }
0218 
0219   // Extract and fill datasets information
0220   if (processPSet_->existsAs<ParameterSet>("datasets", true)) {
0221     const ParameterSet& datasets(processPSet_->getParameterSet("datasets"));
0222     datasetNames_ = datasets.getParameterNamesForType<vector<string>>();
0223     sort(datasetNames_.begin(), datasetNames_.end());
0224     const unsigned int n(datasetNames_.size());
0225     datasetContents_.resize(n);
0226     for (unsigned int i = 0; i != n; ++i) {
0227       datasetIndex_[datasetNames_[i]] = i;
0228       datasetContents_[i] = datasets.getParameter<vector<string>>(datasetNames_[i]);
0229       sort(datasetContents_[i].begin(), datasetContents_[i].end());
0230     }
0231   }
0232 
0233   // Extract and fill Prescale information
0234 
0235   // Check various possibilities to get the HLT prescale sets:
0236   string prescaleName("");
0237   const string preS("PrescaleService");
0238   const string preT("PrescaleTable");
0239   if (processPSet_->existsAs<ParameterSet>(preS, true)) {
0240     prescaleName = preS;
0241   } else if (processPSet_->existsAs<ParameterSet>(preT, true)) {
0242     prescaleName = preT;
0243   }
0244   if (prescaleName.empty()) {
0245     hltPrescaleTable_ = HLTPrescaleTable();
0246   } else {
0247     const ParameterSet& iPS(processPSet_->getParameterSet(prescaleName));
0248     string defaultLabel("default");
0249     if (iPS.existsAs<string>("lvl1DefaultLabel", true)) {
0250       defaultLabel = iPS.getParameter<string>("lvl1DefaultLabel");
0251     }
0252     vector<string> labels;
0253     if (iPS.existsAs<vector<string>>("lvl1Labels", true)) {
0254       labels = iPS.getParameter<vector<string>>("lvl1Labels");
0255     }
0256     unsigned int set(0);
0257     const unsigned int n(labels.size());
0258     for (unsigned int i = 0; i != n; ++i) {
0259       if (labels[i] == defaultLabel)
0260         set = i;
0261     }
0262     map<string, vector<unsigned int>> table;
0263     if (iPS.existsAs<vector<ParameterSet>>("prescaleTable", true)) {
0264       const vector<ParameterSet>& vpTable(iPS.getParameterSetVector("prescaleTable"));
0265       const unsigned int m(vpTable.size());
0266       for (unsigned int i = 0; i != m; ++i) {
0267         table[vpTable[i].getParameter<std::string>("pathName")] =
0268             vpTable[i].getParameter<std::vector<unsigned int>>("prescales");
0269       }
0270     }
0271     if (n > 0) {
0272       hltPrescaleTable_ = HLTPrescaleTable(set, labels, table);
0273     } else {
0274       hltPrescaleTable_ = HLTPrescaleTable();
0275     }
0276   }
0277 
0278   // fill maps to return prescales values with allowed types (double, FractionalPrescale)
0279   for (auto const& [key, psVals] : hltPrescaleTable_.table()) {
0280     hltPrescaleTableValuesDouble_.insert(
0281         {key, edm::vector_transform(psVals, [](auto const ps) -> double { return ps; })});
0282     hltPrescaleTableValuesFractional_.insert(
0283         {key, edm::vector_transform(psVals, [](auto const ps) -> FractionalPrescale { return ps; })});
0284   }
0285 
0286   // Determine L1T Type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
0287   l1tType_ = 0;
0288   unsigned int stage1(0), stage2(0);
0289   if (processPSet_->existsAs<std::vector<std::string>>("@all_modules")) {
0290     const std::vector<std::string>& allModules(processPSet_->getParameter<std::vector<std::string>>("@all_modules"));
0291     for (auto const& allModule : allModules) {
0292       if ((moduleType(allModule) == "HLTLevel1GTSeed") or (moduleType(allModule) == "L1GlobalTrigger")) {
0293         stage1 += 1;
0294       } else if ((moduleType(allModule) == "HLTL1TSeed") or (moduleType(allModule) == "L1TGlobalProducer")) {
0295         stage2 += 1;
0296       }
0297     }
0298   }
0299   if ((stage1 + stage2) == 0) {
0300     l1tType_ = 0;
0301     //     edm::LogError("HLTConfigData") << " Can't identify l1tType: Process '" << processName_ << "' does not contain any identifying instances!";
0302   } else if ((stage1 * stage2) != 0) {
0303     l1tType_ = 0;
0304     //     edm::LogError("HLTConfigData") << " Can't identify l1tType: Process '" << processName_ << "' contains both legacy/stage-1/stage-2 instances!";
0305   } else if (stage1 > 0) {
0306     l1tType_ = 1;
0307     //     edm::LogError("HLTConfigData") << " Identified Process '" << processName_ << "' as legacy/stage-1 L1T!";
0308   } else {
0309     l1tType_ = 2;
0310     //     edm::LogError("HLTConfigData") << " Identified Process '" << processName_ << "' as stage-2 L1T!";
0311   }
0312 
0313   LogVerbatim("HLTConfigData") << "HLTConfigData: ProcessPSet with name/GT/table/l1tType: '" << processName_ << "' '"
0314                                << globalTag_ << "' '" << tableName_ << "' " << l1tType_;
0315 
0316   return;
0317 }
0318 
0319 void HLTConfigData::dump(const std::string& what) const {
0320   using namespace std;
0321   using namespace edm;
0322 
0323   if (what == "ProcessPSet") {
0324     cout << "HLTConfigData::dump: ProcessPSet = " << endl << *processPSet_ << endl;
0325   } else if (what == "ProcessName") {
0326     cout << "HLTConfigData::dump: ProcessName = " << processName_ << endl;
0327   } else if (what == "GlobalTag") {
0328     cout << "HLTConfigData::dump: GlobalTag = " << globalTag_ << endl;
0329   } else if (what == "TableName") {
0330     cout << "HLTConfigData::dump: TableName = " << tableName_ << endl;
0331   } else if (what == "Triggers") {
0332     const unsigned int n(size());
0333     cout << "HLTConfigData::dump: Triggers: " << n << endl;
0334     for (unsigned int i = 0; i != n; ++i) {
0335       cout << "  " << i << " " << triggerNames_[i] << endl;
0336     }
0337   } else if (what == "TriggerSeeds") {
0338     const unsigned int n(size());
0339     cout << "HLTConfigData::dump: TriggerSeeds: " << n << endl;
0340     for (unsigned int i = 0; i != n; ++i) {
0341       const unsigned int m1(hltL1GTSeeds_[i].size());
0342       const unsigned int m2(hltL1TSeeds_[i].size());
0343       cout << "  " << i << " " << triggerNames_[i] << " " << m1 << "/" << m2 << endl;
0344       if (m1 > 0) {
0345         for (unsigned int j1 = 0; j1 != m1; ++j1) {
0346           cout << "    HLTLevel1GTSeed: " << j1 << " " << hltL1GTSeeds_[i][j1].first << "/"
0347                << hltL1GTSeeds_[i][j1].second;
0348         }
0349         cout << endl;
0350       }
0351       if (m2 > 0) {
0352         for (unsigned int j2 = 0; j2 != m2; ++j2) {
0353           cout << "    HLTL1TSeed: " << j2 << " " << hltL1TSeeds_[i][j2];
0354         }
0355         cout << endl;
0356       }
0357     }
0358   } else if (what == "Modules") {
0359     const unsigned int n(size());
0360     cout << "HLTConfigData::dump Triggers and Modules: " << n << endl;
0361     for (unsigned int i = 0; i != n; ++i) {
0362       const unsigned int m(size(i));
0363       cout << i << " " << triggerNames_[i] << " " << m << endl;
0364       cout << " - Modules: ";
0365       unsigned int nHLTPrescalers(0);
0366       unsigned int nHLTLevel1GTSeed(0);
0367       unsigned int nHLTL1TSeed(0);
0368       for (unsigned int j = 0; j != m; ++j) {
0369         const string& label(moduleLabels_[i][j]);
0370         const string type(moduleType(label));
0371         const string edmtype(moduleEDMType(label));
0372         const bool tags(saveTags(label));
0373         cout << " " << j << ":" << label << "/" << type << "/" << edmtype << "/" << tags;
0374         if (type == "HLTPrescaler")
0375           nHLTPrescalers++;
0376         if (type == "HLTLevel1GTSeed")
0377           nHLTLevel1GTSeed++;
0378         if (type == "HLTL1TSeed")
0379           nHLTL1TSeed++;
0380       }
0381       cout << endl;
0382       cout << " - Number of HLTPrescaler/HLTLevel1GTSeed/HLTL1TSeed modules: " << nHLTPrescalers << "/"
0383            << nHLTLevel1GTSeed << "/" << nHLTL1TSeed << endl;
0384     }
0385   } else if (what == "StreamNames") {
0386     const unsigned int n(streamNames_.size());
0387     cout << "HLTConfigData::dump: StreamNames: " << n << endl;
0388     for (unsigned int i = 0; i != n; ++i) {
0389       cout << "  " << i << " " << streamNames_[i] << endl;
0390     }
0391   } else if (what == "Streams") {
0392     const unsigned int n(streamNames_.size());
0393     cout << "HLTConfigData::dump: Streams: " << n << endl;
0394     for (unsigned int i = 0; i != n; ++i) {
0395       const unsigned int m(streamContents_[i].size());
0396       cout << "  " << i << " " << streamNames_[i] << " " << m << endl;
0397       for (unsigned int j = 0; j != m; ++j) {
0398         cout << "    " << j << " " << streamContents_[i][j] << endl;
0399       }
0400     }
0401   } else if (what == "DatasetNames") {
0402     const unsigned int n(datasetNames_.size());
0403     cout << "HLTConfigData::dump: DatasetNames: " << n << endl;
0404     for (unsigned int i = 0; i != n; ++i) {
0405       cout << "  " << i << " " << datasetNames_[i] << endl;
0406     }
0407   } else if (what == "Datasets") {
0408     const unsigned int n(datasetNames_.size());
0409     cout << "HLTConfigData::dump: Datasets: " << n << endl;
0410     for (unsigned int i = 0; i != n; ++i) {
0411       const unsigned int m(datasetContents_[i].size());
0412       cout << "  " << i << " " << datasetNames_[i] << " " << m << endl;
0413       for (unsigned int j = 0; j != m; ++j) {
0414         cout << "    " << j << " " << datasetContents_[i][j] << endl;
0415       }
0416     }
0417   } else if (what == "PrescaleTable") {
0418     const unsigned int n(hltPrescaleTable_.size());
0419     cout << "HLTConfigData::dump: PrescaleTable: # of sets : " << n << endl;
0420     const vector<string>& labels(hltPrescaleTable_.labels());
0421     for (unsigned int i = 0; i != n; ++i) {
0422       cout << " " << i << "/'" << labels.at(i) << "'";
0423     }
0424     if (n > 0)
0425       cout << endl;
0426     auto const& table = hltPrescaleTable_.table();
0427     cout << "HLTConfigData::dump: PrescaleTable: # of paths: " << table.size() << endl;
0428     for (auto const& [key, val] : table) {
0429       for (unsigned int i = 0; i != n; ++i) {
0430         cout << " " << val.at(i);
0431       }
0432       cout << " " << key << endl;
0433     }
0434   } else {
0435     cout << "HLTConfigData::dump: Unkown dump request: " << what << endl;
0436   }
0437   return;
0438 }
0439 
0440 const std::string& HLTConfigData::processName() const { return processName_; }
0441 
0442 const std::string& HLTConfigData::globalTag() const { return globalTag_; }
0443 
0444 unsigned int HLTConfigData::size() const { return triggerNames_.size(); }
0445 unsigned int HLTConfigData::size(unsigned int trigger) const { return moduleLabels_.at(trigger).size(); }
0446 unsigned int HLTConfigData::size(const std::string& trigger) const { return size(triggerIndex(trigger)); }
0447 
0448 const std::string& HLTConfigData::tableName() const { return tableName_; }
0449 const std::vector<std::string>& HLTConfigData::triggerNames() const { return triggerNames_; }
0450 const std::string& HLTConfigData::triggerName(unsigned int trigger) const { return triggerNames_.at(trigger); }
0451 unsigned int HLTConfigData::triggerIndex(const std::string& trigger) const {
0452   const std::map<std::string, unsigned int>::const_iterator index(triggerIndex_.find(trigger));
0453   if (index == triggerIndex_.end()) {
0454     return size();
0455   } else {
0456     return index->second;
0457   }
0458 }
0459 
0460 const std::vector<std::string>& HLTConfigData::moduleLabels(unsigned int trigger) const {
0461   return moduleLabels_.at(trigger);
0462 }
0463 const std::vector<std::string>& HLTConfigData::moduleLabels(const std::string& trigger) const {
0464   return moduleLabels_.at(triggerIndex(trigger));
0465 }
0466 
0467 const std::vector<std::string>& HLTConfigData::saveTagsModules(unsigned int trigger) const {
0468   return saveTagsModules_.at(trigger);
0469 }
0470 const std::vector<std::string>& HLTConfigData::saveTagsModules(const std::string& trigger) const {
0471   return saveTagsModules_.at(triggerIndex(trigger));
0472 }
0473 
0474 const std::string& HLTConfigData::moduleLabel(unsigned int trigger, unsigned int module) const {
0475   return moduleLabels_.at(trigger).at(module);
0476 }
0477 const std::string& HLTConfigData::moduleLabel(const std::string& trigger, unsigned int module) const {
0478   return moduleLabels_.at(triggerIndex(trigger)).at(module);
0479 }
0480 
0481 unsigned int HLTConfigData::moduleIndex(unsigned int trigger, const std::string& module) const {
0482   const std::map<std::string, unsigned int>::const_iterator index(moduleIndex_.at(trigger).find(module));
0483   if (index == moduleIndex_.at(trigger).end()) {
0484     return size(trigger);
0485   } else {
0486     return index->second;
0487   }
0488 }
0489 unsigned int HLTConfigData::moduleIndex(const std::string& trigger, const std::string& module) const {
0490   return moduleIndex(triggerIndex(trigger), module);
0491 }
0492 
0493 const std::string HLTConfigData::moduleType(const std::string& module) const {
0494   const edm::ParameterSet& pset(modulePSet(module));
0495   if (pset.existsAs<std::string>("@module_type", true)) {
0496     return pset.getParameter<std::string>("@module_type");
0497   } else {
0498     return "";
0499   }
0500 }
0501 
0502 const std::string HLTConfigData::moduleEDMType(const std::string& module) const {
0503   const edm::ParameterSet& pset(modulePSet(module));
0504   if (pset.existsAs<std::string>("@module_edm_type", true)) {
0505     return pset.getParameter<std::string>("@module_edm_type");
0506   } else {
0507     return "";
0508   }
0509 }
0510 
0511 const edm::ParameterSet& HLTConfigData::processPSet() const { return *processPSet_; }
0512 
0513 const edm::ParameterSet& HLTConfigData::modulePSet(const std::string& module) const {
0514   //HLTConfigProvider sees ignored modules as "-modname"
0515   //but in the PSet, the module is named "modname"
0516   //so if it starts with "-", you need to remove the "-" from the
0517   //module name to be able to retreive it from the PSet
0518   if (processPSet_->exists(module.front() != '-' ? module : module.substr(1))) {
0519     return processPSet_->getParameterSet(module.front() != '-' ? module : module.substr(1));
0520   } else {
0521     return *s_dummyPSet();
0522   }
0523 }
0524 
0525 bool HLTConfigData::saveTags(const std::string& module) const {
0526   const edm::ParameterSet& pset(modulePSet(module));
0527   if (pset.existsAs<bool>("saveTags", true)) {
0528     return pset.getParameter<bool>("saveTags");
0529   } else {
0530     return false;
0531   }
0532 }
0533 
0534 unsigned int HLTConfigData::l1tType() const { return l1tType_; }
0535 
0536 const std::vector<std::vector<std::pair<bool, std::string>>>& HLTConfigData::hltL1GTSeeds() const {
0537   return hltL1GTSeeds_;
0538 }
0539 
0540 const std::vector<std::pair<bool, std::string>>& HLTConfigData::hltL1GTSeeds(const std::string& trigger) const {
0541   return hltL1GTSeeds(triggerIndex(trigger));
0542 }
0543 
0544 const std::vector<std::pair<bool, std::string>>& HLTConfigData::hltL1GTSeeds(unsigned int trigger) const {
0545   return hltL1GTSeeds_.at(trigger);
0546 }
0547 
0548 const std::vector<std::vector<std::string>>& HLTConfigData::hltL1TSeeds() const { return hltL1TSeeds_; }
0549 
0550 const std::vector<std::string>& HLTConfigData::hltL1TSeeds(const std::string& trigger) const {
0551   return hltL1TSeeds(triggerIndex(trigger));
0552 }
0553 
0554 const std::vector<std::string>& HLTConfigData::hltL1TSeeds(unsigned int trigger) const {
0555   return hltL1TSeeds_.at(trigger);
0556 }
0557 
0558 /// Streams
0559 const std::vector<std::string>& HLTConfigData::streamNames() const { return streamNames_; }
0560 
0561 const std::string& HLTConfigData::streamName(unsigned int stream) const { return streamNames_.at(stream); }
0562 
0563 unsigned int HLTConfigData::streamIndex(const std::string& stream) const {
0564   const std::map<std::string, unsigned int>::const_iterator index(streamIndex_.find(stream));
0565   if (index == streamIndex_.end()) {
0566     return streamNames_.size();
0567   } else {
0568     return index->second;
0569   }
0570 }
0571 
0572 const std::vector<std::vector<std::string>>& HLTConfigData::streamContents() const { return streamContents_; }
0573 
0574 const std::vector<std::string>& HLTConfigData::streamContent(unsigned int stream) const {
0575   return streamContents_.at(stream);
0576 }
0577 
0578 const std::vector<std::string>& HLTConfigData::streamContent(const std::string& stream) const {
0579   return streamContent(streamIndex(stream));
0580 }
0581 
0582 /// Datasets
0583 const std::vector<std::string>& HLTConfigData::datasetNames() const { return datasetNames_; }
0584 
0585 const std::string& HLTConfigData::datasetName(unsigned int dataset) const { return datasetNames_.at(dataset); }
0586 
0587 unsigned int HLTConfigData::datasetIndex(const std::string& dataset) const {
0588   const std::map<std::string, unsigned int>::const_iterator index(datasetIndex_.find(dataset));
0589   if (index == datasetIndex_.end()) {
0590     return datasetNames_.size();
0591   } else {
0592     return index->second;
0593   }
0594 }
0595 
0596 const std::vector<std::vector<std::string>>& HLTConfigData::datasetContents() const { return datasetContents_; }
0597 
0598 const std::vector<std::string>& HLTConfigData::datasetContent(unsigned int dataset) const {
0599   return datasetContents_.at(dataset);
0600 }
0601 
0602 const std::vector<std::string>& HLTConfigData::datasetContent(const std::string& dataset) const {
0603   return datasetContent(datasetIndex(dataset));
0604 }
0605 
0606 unsigned int HLTConfigData::prescaleSize() const { return hltPrescaleTable_.size(); }
0607 
0608 template <>
0609 std::map<std::string, std::vector<double>> const& HLTConfigData::prescaleTable() const {
0610   return hltPrescaleTableValuesDouble_;
0611 }
0612 
0613 template <>
0614 std::map<std::string, std::vector<FractionalPrescale>> const& HLTConfigData::prescaleTable() const {
0615   return hltPrescaleTableValuesFractional_;
0616 }
0617 
0618 const std::vector<std::string>& HLTConfigData::prescaleLabels() const { return hltPrescaleTable_.labels(); }
0619 
0620 edm::ParameterSetID HLTConfigData::id() const { return processPSet_->id(); }