RunAuxiliary

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
#ifndef DataFormats_Provenance_RunAuxiliary_h
#define DataFormats_Provenance_RunAuxiliary_h

#include <iosfwd>
#include <set>

#include "DataFormats/Provenance/interface/ProcessHistoryID.h"
#include "DataFormats/Provenance/interface/RunID.h"
#include "DataFormats/Provenance/interface/Timestamp.h"

// Auxiliary run data that is persistent

namespace edm {
  class RunAux;
  class RunAuxiliary {
  public:
    friend void conversion(RunAux const&, RunAuxiliary&);
    RunAuxiliary() : processHistoryID_(), id_(), beginTime_(), endTime_() {}
    RunAuxiliary(RunID const& theId, Timestamp const& theTime, Timestamp const& theEndTime)
        : processHistoryID_(), id_(theId), beginTime_(theTime), endTime_(theEndTime) {}
    RunAuxiliary(RunNumber_t const& run, Timestamp const& theTime, Timestamp const& theEndTime)
        : processHistoryID_(), id_(run), beginTime_(theTime), endTime_(theEndTime) {}
    void write(std::ostream& os) const;
    ProcessHistoryID const& processHistoryID() const { return processHistoryID_; }
    void setProcessHistoryID(ProcessHistoryID const& phid) { processHistoryID_ = phid; }
    RunID const& id() const { return id_; }
    RunID& id() { return id_; }
    Timestamp const& beginTime() const { return beginTime_; }
    Timestamp const& endTime() const { return endTime_; }
    RunNumber_t run() const { return id_.run(); }
    void setBeginTime(Timestamp const& time) {
      if (beginTime_ == Timestamp::invalidTimestamp())
        beginTime_ = time;
    }
    void setEndTime(Timestamp const& time) {
      if (endTime_ == Timestamp::invalidTimestamp())
        endTime_ = time;
    }
    void mergeAuxiliary(RunAuxiliary const& aux);

  private:
    // This is the ID of the full process history (not the reduced process history).
    // In cases where Run's are merged, the ID of the first process history encountered
    // is stored here.
    ProcessHistoryID processHistoryID_;

    RunID id_;
    // Times from DAQ
    Timestamp beginTime_;
    Timestamp endTime_;

  private:
    void mergeNewTimestampsIntoThis_(RunAuxiliary const& newAux);
  };

  inline std::ostream& operator<<(std::ostream& os, const RunAuxiliary& p) {
    p.write(os);
    return os;
  }

}  // namespace edm

#endif