TriggerResults

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
#ifndef DataFormats_Common_TriggerResults_h
#define DataFormats_Common_TriggerResults_h

/** \class edm::TriggerResults
 *
 *  Original Authors: Jim Kowalkowski 13-01-06
 *                    Martin Grunewald
 *
 *  The trigger path results are maintained here as a sequence of
 *  entries, one per trigger path.  They are assigned in the order
 *  they appeared in the process-level pset.  (They are actually
 *  stored in the base class HLTGlobalStatus)
 *
 *  The ParameterSetID can be used to get a ParameterSet from
 *  the registry of parameter sets.  This ParameterSet contains
 *  a vector<string> named "trigger_paths" that contains the
 *  trigger path names in the same order as the trigger path
 *  results stored here.
 *
 *  The vector<string> contained in this class is empty and
 *  no longer used.  It is kept for backward compatibility reasons.
 *  In early versions of the code, the trigger results paths names
 *  were stored there.
 *
 */

#include "DataFormats/Common/interface/HLTGlobalStatus.h"
#include "DataFormats/Common/interface/traits.h"
#include "DataFormats/Provenance/interface/ParameterSetID.h"

#include <string>
#include <vector>

namespace edm {
  class TriggerResults : public HLTGlobalStatus, public DoNotRecordParents {
    typedef std::vector<std::string> Strings;

  private:
    /// Parameter set id
    edm::ParameterSetID psetid_;

    /// Not used anymore
    Strings names_;

  public:
    /// Trivial contructor
    TriggerResults() : HLTGlobalStatus(), psetid_(), names_() {}

    /// Standard contructor
    TriggerResults(const HLTGlobalStatus& hlt, const edm::ParameterSetID& psetid)
        : HLTGlobalStatus(hlt), psetid_(psetid), names_() {}

    /// Not used anymore
    TriggerResults(const HLTGlobalStatus& hlt, const Strings& names) : HLTGlobalStatus(hlt), psetid_(), names_(names) {}

    /// Get stored parameter set id
    const ParameterSetID& parameterSetID() const { return psetid_; }

    /// swap function
    void swap(TriggerResults& other) {
      this->HLTGlobalStatus::swap(other);
      psetid_.swap(other.psetid_);
      // next line not used any more
      names_.swap(other.names_);
    }

    // The next three functions are OBSOLETE and should only be used for backward
    // compatibility to older data.  The names_ vector is always empty in new data.

    /// Obsolete
    const std::vector<std::string>& getTriggerNames() const { return names_; }

    /// Obsolete
    const std::string& name(unsigned int i) const { return names_.at(i); }

    /// Obsolete
    unsigned int find(const std::string& name) const {
      const unsigned int n(size());
      for (unsigned int i = 0; i != n; ++i)
        if (names_[i] == name)
          return i;
      return n;
    }
  };

  // Free swap function
  inline void swap(TriggerResults& lhs, TriggerResults& rhs) { lhs.swap(rhs); }
}  // namespace edm

#endif