Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:03

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     /// Copy assignment using swap.
0068     TriggerResults& operator=(TriggerResults const& rhs) {
0069       TriggerResults temp(rhs);
0070       this->swap(temp);
0071       return *this;
0072     }
0073 
0074     // The next three functions are OBSOLETE and should only be used for backward
0075     // compatibility to older data.  The names_ vector is always empty in new data.
0076 
0077     /// Obsolete
0078     const std::vector<std::string>& getTriggerNames() const { return names_; }
0079 
0080     /// Obsolete
0081     const std::string& name(unsigned int i) const { return names_.at(i); }
0082 
0083     /// Obsolete
0084     unsigned int find(const std::string& name) const {
0085       const unsigned int n(size());
0086       for (unsigned int i = 0; i != n; ++i)
0087         if (names_[i] == name)
0088           return i;
0089       return n;
0090     }
0091   };
0092 
0093   // Free swap function
0094   inline void swap(TriggerResults& lhs, TriggerResults& rhs) { lhs.swap(rhs); }
0095 }  // namespace edm
0096 
0097 #endif