Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-19 01:11:42

0001 #ifndef DataFormats_Provenance_RunAuxiliary_h
0002 #define DataFormats_Provenance_RunAuxiliary_h
0003 
0004 #include <iosfwd>
0005 #include <set>
0006 
0007 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
0008 #include "DataFormats/Provenance/interface/RunID.h"
0009 #include "DataFormats/Provenance/interface/Timestamp.h"
0010 
0011 // Auxiliary run data that is persistent
0012 
0013 namespace edm {
0014   class RunAux;
0015   class RunAuxiliary {
0016   public:
0017     friend void conversion(RunAux const&, RunAuxiliary&);
0018     RunAuxiliary() : processHistoryID_(), id_(), beginTime_(), endTime_() {}
0019     RunAuxiliary(RunID const& theId, Timestamp const& theTime, Timestamp const& theEndTime)
0020         : processHistoryID_(), id_(theId), beginTime_(theTime), endTime_(theEndTime) {}
0021     RunAuxiliary(RunNumber_t const& run, Timestamp const& theTime, Timestamp const& theEndTime)
0022         : processHistoryID_(), id_(run), beginTime_(theTime), endTime_(theEndTime) {}
0023     void write(std::ostream& os) const;
0024     ProcessHistoryID const& processHistoryID() const { return processHistoryID_; }
0025     void setProcessHistoryID(ProcessHistoryID const& phid) { processHistoryID_ = phid; }
0026     RunID const& id() const { return id_; }
0027     RunID& id() { return id_; }
0028     Timestamp const& beginTime() const { return beginTime_; }
0029     Timestamp const& endTime() const { return endTime_; }
0030     RunNumber_t run() const { return id_.run(); }
0031     void setBeginTime(Timestamp const& time) {
0032       if (beginTime_ == Timestamp::invalidTimestamp())
0033         beginTime_ = time;
0034     }
0035     void setEndTime(Timestamp const& time) {
0036       if (endTime_ == Timestamp::invalidTimestamp())
0037         endTime_ = time;
0038     }
0039     void mergeAuxiliary(RunAuxiliary const& aux);
0040 
0041   private:
0042     // This is the ID of the full process history (not the reduced process history).
0043     // In cases where Run's are merged, the ID of the first process history encountered
0044     // is stored here.
0045     ProcessHistoryID processHistoryID_;
0046 
0047     RunID id_;
0048     // Times from DAQ
0049     Timestamp beginTime_;
0050     Timestamp endTime_;
0051 
0052   private:
0053     void mergeNewTimestampsIntoThis_(RunAuxiliary const& newAux);
0054   };
0055 
0056   inline std::ostream& operator<<(std::ostream& os, const RunAuxiliary& p) {
0057     p.write(os);
0058     return os;
0059   }
0060 
0061 }  // namespace edm
0062 
0063 #endif