CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/FWCore/Common/src/TriggerNames.cc

Go to the documentation of this file.
00001 
00002 #include "FWCore/Common/interface/TriggerNames.h"
00003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00004 
00005 namespace edm {
00006 
00007   TriggerNames::TriggerNames() { }
00008 
00009   TriggerNames::TriggerNames(edm::ParameterSet const& pset) {
00010 
00011     triggerNames_ = pset.getParameter<Strings>("@trigger_paths");
00012 
00013     unsigned int index = 0;
00014     for (Strings::const_iterator iName = triggerNames_.begin(),
00015          iEnd = triggerNames_.end();
00016          iName != iEnd;
00017          ++iName, ++index) {
00018       indexMap_[*iName] = index;
00019     }
00020     psetID_ = pset.id();
00021   }
00022 
00023   TriggerNames::Strings const&
00024   TriggerNames::triggerNames() const { return triggerNames_; }
00025 
00026   std::string const&
00027   TriggerNames::triggerName(unsigned int index) const {
00028     return triggerNames_.at(index);
00029   }
00030 
00031   unsigned int
00032   TriggerNames::triggerIndex(const std::string& name) const {
00033     IndexMap::const_iterator const pos = indexMap_.find(name);
00034     if (pos == indexMap_.end()) return indexMap_.size();
00035     return pos->second;
00036   }
00037 
00038   TriggerNames::Strings::size_type
00039   TriggerNames::size() const { return triggerNames_.size(); }
00040 
00041   ParameterSetID const&
00042   TriggerNames::parameterSetID() const { return psetID_; }
00043 }