CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/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     // This is the ID of the full process history (not the reduced process history).
00058     // In cases where LuminosityBlock's are merged, the ID of the first process history encountered
00059     // is stored here.
00060     ProcessHistoryID processHistoryID_;
00061     // LuminosityBlock ID
00062     LuminosityBlockID id_;
00063     // Times from DAQ
00064     Timestamp beginTime_;
00065     Timestamp endTime_;
00066   };
00067 
00068   inline
00069   std::ostream&
00070   operator<<(std::ostream& os, const LuminosityBlockAuxiliary& p) {
00071     p.write(os);
00072     return os;
00073   }
00074 
00075 }
00076 #endif