CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/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     // most recent process that affected this run
00052     // is the last on the list, this defines what "latest" is
00053     ProcessHistoryID processHistoryID_;
00054 
00055     // Run ID
00056     RunID id_;
00057     // Times from DAQ
00058     Timestamp beginTime_;
00059     Timestamp endTime_;
00060 
00061   private:
00062     void mergeNewTimestampsIntoThis_(RunAuxiliary const& newAux);    
00063   };
00064 
00065   inline
00066   std::ostream&
00067   operator<<(std::ostream& os, const RunAuxiliary& p) {
00068     p.write(os);
00069     return os;
00070   }
00071 
00072 }
00073 
00074 #endif