CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/FWCore/Common/interface/TriggerResultsByName.h

Go to the documentation of this file.
00001 #ifndef FWCore_Common_TriggerResultsByName_h
00002 #define FWCore_Common_TriggerResultsByName_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     FWCore/Common
00006 // Class  :     TriggerResultsByName
00007 // 
00031 //
00032 // Original Author:  W. David Dagenhart
00033 //         Created:  11 December 2009
00034 //
00035 
00036 #include "DataFormats/Provenance/interface/ParameterSetID.h"
00037 #include "DataFormats/Common/interface/HLTenums.h"
00038 
00039 #include <string>
00040 #include <vector>
00041 
00042 namespace edm {
00043 
00044   class TriggerResults;
00045   class TriggerNames;
00046   class HLTPathStatus;
00047 
00048   class TriggerResultsByName {
00049 
00050   public:
00051 
00052     TriggerResultsByName(TriggerResults const* triggerResults,
00053                          TriggerNames const* triggerNames);
00054 
00055     bool isValid() const;
00056 
00057     ParameterSetID const& parameterSetID() const;
00058 
00059     // Was at least one path run?
00060     bool wasrun() const;
00061 
00062     // Has at least one path accepted the event?
00063     bool accept() const;
00064 
00065     // Has any path encountered an error (exception)
00066     bool  error() const;
00067 
00068     HLTPathStatus const& at(std::string const& pathName) const;
00069     HLTPathStatus const& at(unsigned i) const;
00070 
00071     HLTPathStatus const& operator[](std::string const& pathName) const;
00072     HLTPathStatus const& operator[](unsigned i) const;
00073 
00074     // Was ith path run?
00075     bool wasrun(std::string const& pathName) const;
00076     bool wasrun(unsigned i) const;
00077 
00078     // Has ith path accepted the event
00079     bool accept(std::string const& pathName) const;
00080     bool accept(unsigned i) const;
00081 
00082     // Has ith path encountered an error (exception)?
00083     bool error(std::string const& pathName) const;
00084     bool error(unsigned i) const;
00085 
00086     // Get status of ith path
00087     hlt::HLTState state(std::string const& pathName) const;
00088     hlt::HLTState state(unsigned i) const;
00089 
00090     // Get index (slot position) of module giving the decision of the ith path
00091     unsigned index(std::string const& pathName) const;
00092     unsigned index(unsigned i) const;
00093 
00094     std::vector<std::string> const& triggerNames() const;
00095 
00096     // Throws if the number is out of range.
00097     std::string const& triggerName(unsigned i) const;
00098 
00099     // If the input name is not known, this returns a value
00100     // equal to the size.
00101     unsigned triggerIndex(std::string const& pathName) const;
00102 
00103     // The number of trigger names.
00104     std::vector<std::string>::size_type size() const;
00105 
00106   private:
00107 
00108     unsigned getAndCheckIndex(std::string const& pathName) const;
00109 
00110     void throwTriggerResultsMissing() const;
00111     void throwTriggerNamesMissing() const;
00112 
00113     TriggerResults const* triggerResults_;
00114     TriggerNames const* triggerNames_;
00115   };
00116 }
00117 #endif