Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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