CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/DataFormats/Provenance/interface/RunAuxiliary.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Provenance_RunAuxiliary_h
00002 #define DataFormats_Provenance_RunAuxiliary_h
00003 
00004 #include <iosfwd>
00005 #include <set>
00006 
00007 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
00008 #include "DataFormats/Provenance/interface/RunID.h"
00009 #include "DataFormats/Provenance/interface/Timestamp.h"
00010 
00011 // Auxiliary run data that is persistent
00012 
00013 namespace edm {
00014   class RunAux;
00015   class RunAuxiliary {
00016   public:
00017     friend void conversion(RunAux const&, RunAuxiliary&);
00018     RunAuxiliary() :
00019         processHistoryID_(),
00020         id_(),
00021         beginTime_(),
00022         endTime_() {}
00023     RunAuxiliary(RunID const& theId, Timestamp const& theTime, Timestamp const& theEndTime) :
00024         processHistoryID_(),
00025         id_(theId),
00026         beginTime_(theTime),
00027         endTime_(theEndTime) {}
00028     RunAuxiliary(RunNumber_t const& run, Timestamp const& theTime, Timestamp const& theEndTime) :
00029         processHistoryID_(),
00030         id_(run),
00031         beginTime_(theTime),
00032         endTime_(theEndTime) {}
00033     ~RunAuxiliary() {}
00034     void write(std::ostream& os) const;
00035     ProcessHistoryID const& processHistoryID() const {return processHistoryID_;}
00036     void setProcessHistoryID(ProcessHistoryID const& phid) {processHistoryID_ = phid;}
00037     RunID const& id() const {return id_;}
00038     RunID& id() {return id_;}
00039     Timestamp const& beginTime() const {return beginTime_;}
00040     Timestamp const& endTime() const {return endTime_;}
00041     RunNumber_t run() const {return id_.run();}
00042     void setBeginTime(Timestamp const& time) {
00043       if (beginTime_ == Timestamp::invalidTimestamp()) beginTime_ = time;
00044     }
00045     void setEndTime(Timestamp const& time) {
00046       if (endTime_ == Timestamp::invalidTimestamp()) endTime_ = time;
00047     }
00048     void mergeAuxiliary(RunAuxiliary const& aux);
00049 
00050   private:
00051     // This is the ID of the full process history (not the reduced process history).
00052     // In cases where Run's are merged, the ID of the first process history encountered
00053     // is stored here.
00054     ProcessHistoryID processHistoryID_;
00055 
00056     // Run ID
00057     RunID id_;
00058     // Times from DAQ
00059     Timestamp beginTime_;
00060     Timestamp endTime_;
00061 
00062   private:
00063     void mergeNewTimestampsIntoThis_(RunAuxiliary const& newAux);    
00064   };
00065 
00066   inline
00067   std::ostream&
00068   operator<<(std::ostream& os, const RunAuxiliary& p) {
00069     p.write(os);
00070     return os;
00071   }
00072 
00073 }
00074 
00075 #endif