Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:26

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/thread_safety_macros.h"
0014 #include "FWCore/Utilities/interface/transform.h"
0015 
0016 #include <iostream>
0017 
0018 //Using this function with the 'const static within s_dummyPSet'
0019 // guarantees that even if multiple threads call s_dummyPSet at the
0020 // same time, only the 'first' one registers the dummy PSet.
0021 static const edm::ParameterSet initializeDummyPSet() {
0022   edm::ParameterSet dummy;
0023   dummy.registerIt();
0024   return dummy;
0025 }
0026 
0027 static const edm::ParameterSet* s_dummyPSet() {
0028   static const edm::ParameterSet dummyPSet{initializeDummyPSet()};
0029   return &dummyPSet;
0030 }
0031 
0032 HLTConfigData::HLTConfigData()
0033     : processPSet_(s_dummyPSet()),
0034       processName_(""),
0035       globalTag_(""),
0036       tableName_(),
0037       triggerNames_(),
0038       moduleLabels_(),
0039       saveTagsModules_(),
0040       triggerIndex_(),
0041       moduleIndex_(),
0042       l1tType_(0),
0043       hltL1GTSeeds_(),
0044       hltL1TSeeds_(),
0045       streamNames_(),
0046       streamIndex_(),
0047       streamContents_(),
0048       datasetNames_(),
0049       datasetIndex_(),
0050       datasetContents_(),
0051       hltPrescaleTable_(),
0052       hltPrescaleTableValuesDouble_{},
0053       hltPrescaleTableValuesFractional_{} {
0054   if (processPSet_->id().isValid()) {
0055     extract();
0056   }
0057 }
0058 
0059 HLTConfigData::HLTConfigData(const edm::ParameterSet* iPSet)
0060     : processPSet_(iPSet),
0061       processName_(""),
0062       globalTag_(""),
0063       tableName_(),
0064       triggerNames_(),
0065       moduleLabels_(),
0066       saveTagsModules_(),
0067       triggerIndex_(),
0068       moduleIndex_(),
0069       l1tType_(0),
0070       hltL1GTSeeds_(),
0071       hltL1TSeeds_(),
0072       streamNames_(),
0073       streamIndex_(),
0074       streamContents_(),
0075       datasetNames_(),
0076       datasetIndex_(),
0077       datasetContents_(),
0078       hltPrescaleTable_(),
0079       hltPrescaleTableValuesDouble_{},
0080       hltPrescaleTableValuesFractional_{} {
0081   if (processPSet_->id().isValid()) {
0082     extract();
0083   }
0084 }
0085 
0086 void HLTConfigData::extract() {
0087   using namespace std;
0088   using namespace edm;
0089   using namespace trigger;
0090 
0091   // Extract process name
0092   CMS_SA_ALLOW if (processPSet_->existsAs<string>("@process_name", true)) {
0093     processName_ = processPSet_->getParameter<string>("@process_name");
0094   }
0095 
0096   // Extract globaltag
0097   globalTag_ = "";
0098   const ParameterSet* GlobalTagPSet(nullptr);
0099   CMS_SA_ALLOW if (processPSet_->exists("GlobalTag")) { GlobalTagPSet = &(processPSet_->getParameterSet("GlobalTag")); }
0100   else if (processPSet_->exists("PoolDBESSource@GlobalTag")) {
0101     GlobalTagPSet = &(processPSet_->getParameterSet("PoolDBESSource@GlobalTag"));
0102   }
0103   CMS_SA_ALLOW 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   CMS_SA_ALLOW if (processPSet_->existsAs<ParameterSet>("HLTConfigVersion", true)) {
0109     const ParameterSet& HLTPSet(processPSet_->getParameterSet("HLTConfigVersion"));
0110     CMS_SA_ALLOW if (HLTPSet.existsAs<string>("tableName", true)) {
0111       tableName_ = HLTPSet.getParameter<string>("tableName");
0112     }
0113   }
0114 
0115   // Extract trigger paths (= paths - end_paths)
0116   CMS_SA_ALLOW if (processPSet_->existsAs<ParameterSet>("@trigger_paths", true)) {
0117     const ParameterSet& HLTPSet(processPSet_->getParameterSet("@trigger_paths"));
0118     CMS_SA_ALLOW 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     CMS_SA_ALLOW 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   CMS_SA_ALLOW 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   CMS_SA_ALLOW 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   CMS_SA_ALLOW if (processPSet_->existsAs<ParameterSet>(preS, true)) { prescaleName = preS; }
0240   else if (processPSet_->existsAs<ParameterSet>(preT, true)) {
0241     prescaleName = preT;
0242   }
0243   if (prescaleName.empty()) {
0244     hltPrescaleTable_ = HLTPrescaleTable();
0245   } else {
0246     const ParameterSet& iPS(processPSet_->getParameterSet(prescaleName));
0247     string defaultLabel("default");
0248     CMS_SA_ALLOW if (iPS.existsAs<string>("lvl1DefaultLabel", true)) {
0249       defaultLabel = iPS.getParameter<string>("lvl1DefaultLabel");
0250     }
0251     vector<string> labels;
0252     CMS_SA_ALLOW if (iPS.existsAs<vector<string>>("lvl1Labels", true)) {
0253       labels = iPS.getParameter<vector<string>>("lvl1Labels");
0254     }
0255     unsigned int set(0);
0256     const unsigned int n(labels.size());
0257     for (unsigned int i = 0; i != n; ++i) {
0258       if (labels[i] == defaultLabel)
0259         set = i;
0260     }
0261     map<string, vector<unsigned int>> table;
0262     CMS_SA_ALLOW if (iPS.existsAs<vector<ParameterSet>>("prescaleTable", true)) {
0263       const vector<ParameterSet>& vpTable(iPS.getParameterSetVector("prescaleTable"));
0264       const unsigned int m(vpTable.size());
0265       for (unsigned int i = 0; i != m; ++i) {
0266         table[vpTable[i].getParameter<std::string>("pathName")] =
0267             vpTable[i].getParameter<std::vector<unsigned int>>("prescales");
0268       }
0269     }
0270     if (n > 0) {
0271       hltPrescaleTable_ = HLTPrescaleTable(set, labels, table);
0272     } else {
0273       hltPrescaleTable_ = HLTPrescaleTable();
0274     }
0275   }
0276 
0277   // fill maps to return prescales values with allowed types (double, FractionalPrescale)
0278   for (auto const& [key, psVals] : hltPrescaleTable_.table()) {
0279     hltPrescaleTableValuesDouble_.insert(
0280         {key, edm::vector_transform(psVals, [](auto const ps) -> double { return ps; })});
0281     hltPrescaleTableValuesFractional_.insert(
0282         {key, edm::vector_transform(psVals, [](auto const ps) -> FractionalPrescale { return ps; })});
0283   }
0284 
0285   // Determine L1T Type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
0286   l1tType_ = 0;
0287   unsigned int stage1(0), stage2(0);
0288   CMS_SA_ALLOW if (processPSet_->existsAs<std::vector<std::string>>("@all_modules")) {
0289     const std::vector<std::string>& allModules(processPSet_->getParameter<std::vector<std::string>>("@all_modules"));
0290     for (auto const& allModule : allModules) {
0291       if ((moduleType(allModule) == "HLTLevel1GTSeed") or (moduleType(allModule) == "L1GlobalTrigger")) {
0292         stage1 += 1;
0293       } else if ((moduleType(allModule) == "HLTL1TSeed") or (moduleType(allModule) == "L1TGlobalProducer")) {
0294         stage2 += 1;
0295       }
0296     }
0297   }
0298   if ((stage1 + stage2) == 0) {
0299     l1tType_ = 0;
0300     //     edm::LogError("HLTConfigData") << " Can't identify l1tType: Process '" << processName_ << "' does not contain any identifying instances!";
0301   } else if ((stage1 * stage2) != 0) {
0302     l1tType_ = 0;
0303     //     edm::LogError("HLTConfigData") << " Can't identify l1tType: Process '" << processName_ << "' contains both legacy/stage-1/stage-2 instances!";
0304   } else if (stage1 > 0) {
0305     l1tType_ = 1;
0306     //     edm::LogError("HLTConfigData") << " Identified Process '" << processName_ << "' as legacy/stage-1 L1T!";
0307   } else {
0308     l1tType_ = 2;
0309     //     edm::LogError("HLTConfigData") << " Identified Process '" << processName_ << "' as stage-2 L1T!";
0310   }
0311 
0312   LogVerbatim("HLTConfigData") << "HLTConfigData: ProcessPSet with name/GT/table/l1tType: '" << processName_ << "' '"
0313                                << globalTag_ << "' '" << tableName_ << "' " << l1tType_;
0314 
0315   return;
0316 }
0317 
0318 void HLTConfigData::dump(const std::string& what) const {
0319   using namespace std;
0320   using namespace edm;
0321 
0322   if (what == "ProcessPSet") {
0323     cout << "HLTConfigData::dump: ProcessPSet = " << endl << *processPSet_ << endl;
0324   } else if (what == "ProcessName") {
0325     cout << "HLTConfigData::dump: ProcessName = " << processName_ << endl;
0326   } else if (what == "GlobalTag") {
0327     cout << "HLTConfigData::dump: GlobalTag = " << globalTag_ << endl;
0328   } else if (what == "TableName") {
0329     cout << "HLTConfigData::dump: TableName = " << tableName_ << endl;
0330   } else if (what == "Triggers") {
0331     const unsigned int n(size());
0332     cout << "HLTConfigData::dump: Triggers: " << n << endl;
0333     for (unsigned int i = 0; i != n; ++i) {
0334       cout << "  " << i << " " << triggerNames_[i] << endl;
0335     }
0336   } else if (what == "TriggerSeeds") {
0337     const unsigned int n(size());
0338     cout << "HLTConfigData::dump: TriggerSeeds: " << n << endl;
0339     for (unsigned int i = 0; i != n; ++i) {
0340       const unsigned int m1(hltL1GTSeeds_[i].size());
0341       const unsigned int m2(hltL1TSeeds_[i].size());
0342       cout << "  " << i << " " << triggerNames_[i] << " " << m1 << "/" << m2 << endl;
0343       if (m1 > 0) {
0344         for (unsigned int j1 = 0; j1 != m1; ++j1) {
0345           cout << "    HLTLevel1GTSeed: " << j1 << " " << hltL1GTSeeds_[i][j1].first << "/"
0346                << hltL1GTSeeds_[i][j1].second;
0347         }
0348         cout << endl;
0349       }
0350       if (m2 > 0) {
0351         for (unsigned int j2 = 0; j2 != m2; ++j2) {
0352           cout << "    HLTL1TSeed: " << j2 << " " << hltL1TSeeds_[i][j2];
0353         }
0354         cout << endl;
0355       }
0356     }
0357   } else if (what == "Modules") {
0358     const unsigned int n(size());
0359     cout << "HLTConfigData::dump Triggers and Modules: " << n << endl;
0360     for (unsigned int i = 0; i != n; ++i) {
0361       const unsigned int m(size(i));
0362       cout << i << " " << triggerNames_[i] << " " << m << endl;
0363       cout << " - Modules: ";
0364       unsigned int nHLTPrescalers(0);
0365       unsigned int nHLTLevel1GTSeed(0);
0366       unsigned int nHLTL1TSeed(0);
0367       for (unsigned int j = 0; j != m; ++j) {
0368         const string& label(moduleLabels_[i][j]);
0369         const string type(moduleType(label));
0370         const string edmtype(moduleEDMType(label));
0371         const bool tags(saveTags(label));
0372         cout << " " << j << ":" << label << "/" << type << "/" << edmtype << "/" << tags;
0373         if (type == "HLTPrescaler")
0374           nHLTPrescalers++;
0375         if (type == "HLTLevel1GTSeed")
0376           nHLTLevel1GTSeed++;
0377         if (type == "HLTL1TSeed")
0378           nHLTL1TSeed++;
0379       }
0380       cout << endl;
0381       cout << " - Number of HLTPrescaler/HLTLevel1GTSeed/HLTL1TSeed modules: " << nHLTPrescalers << "/"
0382            << nHLTLevel1GTSeed << "/" << nHLTL1TSeed << endl;
0383     }
0384   } else if (what == "StreamNames") {
0385     const unsigned int n(streamNames_.size());
0386     cout << "HLTConfigData::dump: StreamNames: " << n << endl;
0387     for (unsigned int i = 0; i != n; ++i) {
0388       cout << "  " << i << " " << streamNames_[i] << endl;
0389     }
0390   } else if (what == "Streams") {
0391     const unsigned int n(streamNames_.size());
0392     cout << "HLTConfigData::dump: Streams: " << n << endl;
0393     for (unsigned int i = 0; i != n; ++i) {
0394       const unsigned int m(streamContents_[i].size());
0395       cout << "  " << i << " " << streamNames_[i] << " " << m << endl;
0396       for (unsigned int j = 0; j != m; ++j) {
0397         cout << "    " << j << " " << streamContents_[i][j] << endl;
0398       }
0399     }
0400   } else if (what == "DatasetNames") {
0401     const unsigned int n(datasetNames_.size());
0402     cout << "HLTConfigData::dump: DatasetNames: " << n << endl;
0403     for (unsigned int i = 0; i != n; ++i) {
0404       cout << "  " << i << " " << datasetNames_[i] << endl;
0405     }
0406   } else if (what == "Datasets") {
0407     const unsigned int n(datasetNames_.size());
0408     cout << "HLTConfigData::dump: Datasets: " << n << endl;
0409     for (unsigned int i = 0; i != n; ++i) {
0410       const unsigned int m(datasetContents_[i].size());
0411       cout << "  " << i << " " << datasetNames_[i] << " " << m << endl;
0412       for (unsigned int j = 0; j != m; ++j) {
0413         cout << "    " << j << " " << datasetContents_[i][j] << endl;
0414       }
0415     }
0416   } else if (what == "PrescaleTable") {
0417     const unsigned int n(hltPrescaleTable_.size());
0418     cout << "HLTConfigData::dump: PrescaleTable: # of sets : " << n << endl;
0419     const vector<string>& labels(hltPrescaleTable_.labels());
0420     for (unsigned int i = 0; i != n; ++i) {
0421       cout << " " << i << "/'" << labels.at(i) << "'";
0422     }
0423     if (n > 0)
0424       cout << endl;
0425     auto const& table = hltPrescaleTable_.table();
0426     cout << "HLTConfigData::dump: PrescaleTable: # of paths: " << table.size() << endl;
0427     for (auto const& [key, val] : table) {
0428       for (unsigned int i = 0; i != n; ++i) {
0429         cout << " " << val.at(i);
0430       }
0431       cout << " " << key << endl;
0432     }
0433   } else {
0434     cout << "HLTConfigData::dump: Unkown dump request: " << what << endl;
0435   }
0436   return;
0437 }
0438 
0439 const std::string& HLTConfigData::processName() const { return processName_; }
0440 
0441 const std::string& HLTConfigData::globalTag() const { return globalTag_; }
0442 
0443 unsigned int HLTConfigData::size() const { return triggerNames_.size(); }
0444 unsigned int HLTConfigData::size(unsigned int trigger) const { return moduleLabels_.at(trigger).size(); }
0445 unsigned int HLTConfigData::size(const std::string& trigger) const { return size(triggerIndex(trigger)); }
0446 
0447 const std::string& HLTConfigData::tableName() const { return tableName_; }
0448 const std::vector<std::string>& HLTConfigData::triggerNames() const { return triggerNames_; }
0449 const std::string& HLTConfigData::triggerName(unsigned int trigger) const { return triggerNames_.at(trigger); }
0450 unsigned int HLTConfigData::triggerIndex(const std::string& trigger) const {
0451   const std::map<std::string, unsigned int>::const_iterator index(triggerIndex_.find(trigger));
0452   if (index == triggerIndex_.end()) {
0453     return size();
0454   } else {
0455     return index->second;
0456   }
0457 }
0458 
0459 const std::vector<std::string>& HLTConfigData::moduleLabels(unsigned int trigger) const {
0460   return moduleLabels_.at(trigger);
0461 }
0462 const std::vector<std::string>& HLTConfigData::moduleLabels(const std::string& trigger) const {
0463   return moduleLabels_.at(triggerIndex(trigger));
0464 }
0465 
0466 const std::vector<std::string>& HLTConfigData::saveTagsModules(unsigned int trigger) const {
0467   return saveTagsModules_.at(trigger);
0468 }
0469 const std::vector<std::string>& HLTConfigData::saveTagsModules(const std::string& trigger) const {
0470   return saveTagsModules_.at(triggerIndex(trigger));
0471 }
0472 
0473 const std::string& HLTConfigData::moduleLabel(unsigned int trigger, unsigned int module) const {
0474   return moduleLabels_.at(trigger).at(module);
0475 }
0476 const std::string& HLTConfigData::moduleLabel(const std::string& trigger, unsigned int module) const {
0477   return moduleLabels_.at(triggerIndex(trigger)).at(module);
0478 }
0479 
0480 unsigned int HLTConfigData::moduleIndex(unsigned int trigger, const std::string& module) const {
0481   const std::map<std::string, unsigned int>::const_iterator index(moduleIndex_.at(trigger).find(module));
0482   if (index == moduleIndex_.at(trigger).end()) {
0483     return size(trigger);
0484   } else {
0485     return index->second;
0486   }
0487 }
0488 unsigned int HLTConfigData::moduleIndex(const std::string& trigger, const std::string& module) const {
0489   return moduleIndex(triggerIndex(trigger), module);
0490 }
0491 
0492 const std::string HLTConfigData::moduleType(const std::string& module) const {
0493   const edm::ParameterSet& pset(modulePSet(module));
0494   CMS_SA_ALLOW if (pset.existsAs<std::string>("@module_type", true)) {
0495     return pset.getParameter<std::string>("@module_type");
0496   }
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   CMS_SA_ALLOW if (pset.existsAs<std::string>("@module_edm_type", true)) {
0505     return pset.getParameter<std::string>("@module_edm_type");
0506   }
0507   else {
0508     return "";
0509   }
0510 }
0511 
0512 const edm::ParameterSet& HLTConfigData::processPSet() const { return *processPSet_; }
0513 
0514 const edm::ParameterSet& HLTConfigData::modulePSet(const std::string& module) const {
0515   //HLTConfigProvider sees ignored modules as "-modname"
0516   //but in the PSet, the module is named "modname"
0517   //so if it starts with "-", you need to remove the "-" from the
0518   //module name to be able to retreive it from the PSet
0519   CMS_SA_ALLOW if (processPSet_->exists(module.front() != '-' ? module : module.substr(1))) {
0520     return processPSet_->getParameterSet(module.front() != '-' ? module : module.substr(1));
0521   }
0522   else {
0523     return *s_dummyPSet();
0524   }
0525 }
0526 
0527 bool HLTConfigData::saveTags(const std::string& module) const {
0528   const edm::ParameterSet& pset(modulePSet(module));
0529   CMS_SA_ALLOW if (pset.existsAs<bool>("saveTags", true)) { return pset.getParameter<bool>("saveTags"); }
0530   else {
0531     return false;
0532   }
0533 }
0534 
0535 unsigned int HLTConfigData::l1tType() const { return l1tType_; }
0536 
0537 const std::vector<std::vector<std::pair<bool, std::string>>>& HLTConfigData::hltL1GTSeeds() const {
0538   return hltL1GTSeeds_;
0539 }
0540 
0541 const std::vector<std::pair<bool, std::string>>& HLTConfigData::hltL1GTSeeds(const std::string& trigger) const {
0542   return hltL1GTSeeds(triggerIndex(trigger));
0543 }
0544 
0545 const std::vector<std::pair<bool, std::string>>& HLTConfigData::hltL1GTSeeds(unsigned int trigger) const {
0546   return hltL1GTSeeds_.at(trigger);
0547 }
0548 
0549 const std::vector<std::vector<std::string>>& HLTConfigData::hltL1TSeeds() const { return hltL1TSeeds_; }
0550 
0551 const std::vector<std::string>& HLTConfigData::hltL1TSeeds(const std::string& trigger) const {
0552   return hltL1TSeeds(triggerIndex(trigger));
0553 }
0554 
0555 const std::vector<std::string>& HLTConfigData::hltL1TSeeds(unsigned int trigger) const {
0556   return hltL1TSeeds_.at(trigger);
0557 }
0558 
0559 /// Streams
0560 const std::vector<std::string>& HLTConfigData::streamNames() const { return streamNames_; }
0561 
0562 const std::string& HLTConfigData::streamName(unsigned int stream) const { return streamNames_.at(stream); }
0563 
0564 unsigned int HLTConfigData::streamIndex(const std::string& stream) const {
0565   const std::map<std::string, unsigned int>::const_iterator index(streamIndex_.find(stream));
0566   if (index == streamIndex_.end()) {
0567     return streamNames_.size();
0568   } else {
0569     return index->second;
0570   }
0571 }
0572 
0573 const std::vector<std::vector<std::string>>& HLTConfigData::streamContents() const { return streamContents_; }
0574 
0575 const std::vector<std::string>& HLTConfigData::streamContent(unsigned int stream) const {
0576   return streamContents_.at(stream);
0577 }
0578 
0579 const std::vector<std::string>& HLTConfigData::streamContent(const std::string& stream) const {
0580   return streamContent(streamIndex(stream));
0581 }
0582 
0583 /// Datasets
0584 const std::vector<std::string>& HLTConfigData::datasetNames() const { return datasetNames_; }
0585 
0586 const std::string& HLTConfigData::datasetName(unsigned int dataset) const { return datasetNames_.at(dataset); }
0587 
0588 unsigned int HLTConfigData::datasetIndex(const std::string& dataset) const {
0589   const std::map<std::string, unsigned int>::const_iterator index(datasetIndex_.find(dataset));
0590   if (index == datasetIndex_.end()) {
0591     return datasetNames_.size();
0592   } else {
0593     return index->second;
0594   }
0595 }
0596 
0597 const std::vector<std::vector<std::string>>& HLTConfigData::datasetContents() const { return datasetContents_; }
0598 
0599 const std::vector<std::string>& HLTConfigData::datasetContent(unsigned int dataset) const {
0600   return datasetContents_.at(dataset);
0601 }
0602 
0603 const std::vector<std::string>& HLTConfigData::datasetContent(const std::string& dataset) const {
0604   return datasetContent(datasetIndex(dataset));
0605 }
0606 
0607 unsigned int HLTConfigData::prescaleSize() const { return hltPrescaleTable_.size(); }
0608 
0609 template <>
0610 std::map<std::string, std::vector<double>> const& HLTConfigData::prescaleTable() const {
0611   return hltPrescaleTableValuesDouble_;
0612 }
0613 
0614 template <>
0615 std::map<std::string, std::vector<FractionalPrescale>> const& HLTConfigData::prescaleTable() const {
0616   return hltPrescaleTableValuesFractional_;
0617 }
0618 
0619 const std::vector<std::string>& HLTConfigData::prescaleLabels() const { return hltPrescaleTable_.labels(); }
0620 
0621 edm::ParameterSetID HLTConfigData::id() const { return processPSet_->id(); }