CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DataFormats/Provenance/interface/LuminosityBlockAuxiliary.h

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