CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/DataFormats/Common/interface/TriggerResults.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Common_TriggerResults_h
00002 #define DataFormats_Common_TriggerResults_h
00003 
00028 #include "DataFormats/Common/interface/HLTGlobalStatus.h"
00029 #include "DataFormats/Common/interface/traits.h"
00030 #include "DataFormats/Provenance/interface/ParameterSetID.h"
00031 
00032 
00033 #include <string>
00034 #include <vector>
00035 
00036 namespace edm
00037 {
00038   class TriggerResults : public HLTGlobalStatus, public DoNotRecordParents  {
00039 
00040     typedef std::vector<std::string> Strings;
00041 
00042   private:
00044     edm::ParameterSetID psetid_;
00045 
00047     Strings             names_;
00048 
00049   public:
00050 
00052     TriggerResults() : HLTGlobalStatus(), psetid_(), names_() { }
00053 
00055     TriggerResults(const HLTGlobalStatus& hlt, const edm::ParameterSetID& psetid)
00056       : HLTGlobalStatus(hlt), psetid_(psetid), names_() { }
00057 
00059     TriggerResults(const HLTGlobalStatus& hlt, const Strings& names)
00060       : HLTGlobalStatus(hlt), psetid_(), names_(names) { }
00061 
00063     const ParameterSetID& parameterSetID() const { return psetid_; }
00064 
00066     void swap(TriggerResults& other) {
00067       this->HLTGlobalStatus::swap(other);
00068       psetid_.swap(other.psetid_);
00069       // next line not used any more
00070       names_.swap(other.names_);
00071     }
00072 
00074     TriggerResults& operator=(TriggerResults const& rhs) {
00075       TriggerResults temp(rhs);
00076       this->swap(temp);
00077       return *this;
00078     }
00079 
00080     // The next three functions are OBSOLETE and should only be used for backward
00081     // compatibility to older data.  The names_ vector is always empty in new data.
00082 
00084     const std::vector<std::string>& getTriggerNames() const { return names_; }
00085 
00087     const std::string& name(unsigned int i) const {return names_.at(i);}
00088 
00090     unsigned int find (const std::string& name) const {
00091       const unsigned int n(size());
00092       for (unsigned int i = 0; i != n; ++i) if (names_[i] == name) return i;
00093       return n;
00094     }
00095   };
00096 
00097   // Free swap function
00098   inline
00099   void
00100   swap(TriggerResults& lhs, TriggerResults& rhs) {
00101     lhs.swap(rhs);
00102   }
00103 }
00104 
00105 #endif