Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:54

0001 #ifndef DataFormats_Common_TriggerResults_h
0002 #define DataFormats_Common_TriggerResults_h
0003 
0004 /** \class edm::TriggerResults
0005  *
0006  *  Original Authors: Jim Kowalkowski 13-01-06
0007  *                    Martin Grunewald
0008  *
0009  *  The trigger path results are maintained here as a sequence of
0010  *  entries, one per trigger path.  They are assigned in the order
0011  *  they appeared in the process-level pset.  (They are actually
0012  *  stored in the base class HLTGlobalStatus)
0013  *
0014  *  The ParameterSetID can be used to get a ParameterSet from
0015  *  the registry of parameter sets.  This ParameterSet contains
0016  *  a vector<string> named "trigger_paths" that contains the
0017  *  trigger path names in the same order as the trigger path
0018  *  results stored here.
0019  *
0020  *  The vector<string> contained in this class is empty and
0021  *  no longer used.  It is kept for backward compatibility reasons.
0022  *  In early versions of the code, the trigger results paths names
0023  *  were stored there.
0024  *
0025  */
0026 
0027 #include "DataFormats/Common/interface/HLTGlobalStatus.h"
0028 #include "DataFormats/Common/interface/traits.h"
0029 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0030 
0031 #include <string>
0032 #include <vector>
0033 
0034 namespace edm {
0035   class TriggerResults : public HLTGlobalStatus, public DoNotRecordParents {
0036     typedef std::vector<std::string> Strings;
0037 
0038   private:
0039     /// Parameter set id
0040     edm::ParameterSetID psetid_;
0041 
0042     /// Not used anymore
0043     Strings names_;
0044 
0045   public:
0046     /// Trivial contructor
0047     TriggerResults() : HLTGlobalStatus(), psetid_(), names_() {}
0048 
0049     /// Standard contructor
0050     TriggerResults(const HLTGlobalStatus& hlt, const edm::ParameterSetID& psetid)
0051         : HLTGlobalStatus(hlt), psetid_(psetid), names_() {}
0052 
0053     /// Not used anymore
0054     TriggerResults(const HLTGlobalStatus& hlt, const Strings& names) : HLTGlobalStatus(hlt), psetid_(), names_(names) {}
0055 
0056     /// Get stored parameter set id
0057     const ParameterSetID& parameterSetID() const { return psetid_; }
0058 
0059     /// swap function
0060     void swap(TriggerResults& other) {
0061       this->HLTGlobalStatus::swap(other);
0062       psetid_.swap(other.psetid_);
0063       // next line not used any more
0064       names_.swap(other.names_);
0065     }
0066 
0067     // The next three functions are OBSOLETE and should only be used for backward
0068     // compatibility to older data.  The names_ vector is always empty in new data.
0069 
0070     /// Obsolete
0071     const std::vector<std::string>& getTriggerNames() const { return names_; }
0072 
0073     /// Obsolete
0074     const std::string& name(unsigned int i) const { return names_.at(i); }
0075 
0076     /// Obsolete
0077     unsigned int find(const std::string& name) const {
0078       const unsigned int n(size());
0079       for (unsigned int i = 0; i != n; ++i)
0080         if (names_[i] == name)
0081           return i;
0082       return n;
0083     }
0084   };
0085 
0086   // Free swap function
0087   inline void swap(TriggerResults& lhs, TriggerResults& rhs) { lhs.swap(rhs); }
0088 }  // namespace edm
0089 
0090 #endif