CMS 3D CMS Logo

EventID.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Provenance_EventID_h
00002 #define DataFormats_Provenance_EventID_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     DataFormats/Provenance
00006 // Class  :     EventID
00007 // 
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Mon Aug  8 15:13:14 EDT 2005
00019 // $Id: EventID.h,v 1.4 2007/06/21 16:52:40 wmtan Exp $
00020 //
00021 
00022 // system include files
00023 #include <iosfwd>
00024 
00025 // user include files
00026 #include "DataFormats/Provenance/interface/RunID.h"
00027 
00028 // forward declarations
00029 namespace edm {
00030 
00031    typedef unsigned int EventNumber_t;
00032 
00033    
00034 class EventID {
00035 
00036    public:
00037    
00038    
00039       EventID() : run_(0), event_(0) {}
00040       EventID(RunNumber_t iRun, EventNumber_t iEvent) :
00041         run_(iRun), event_(iEvent) {}
00042       
00043       // ---------- const member functions ---------------------
00044       RunNumber_t run() const { return run_; }
00045       EventNumber_t event() const { return event_; }
00046    
00047       //moving from one EventID to another one
00048       EventID next() const {
00049          if(event_ != maxEventNumber()) {
00050             return EventID(run_, event_+1);
00051          }
00052          return EventID(run_+1, 1);
00053       }
00054       EventID nextRun() const {
00055          return EventID(run_+1, 0);
00056       }
00057       EventID nextRunFirstEvent() const {
00058          return EventID(run_+1, 1);
00059       }
00060       EventID previousRunLastEvent() const {
00061          if(run_ > 1) {
00062             return EventID(run_-1, maxEventNumber());
00063          }
00064          return EventID(0,0);
00065       }
00066    
00067       EventID previous() const {
00068          if(event_ > 1) {
00069             return EventID(run_, event_-1);
00070          }
00071          if(run_ != 0) {
00072             return EventID(run_ -1, maxEventNumber());
00073          }
00074          return EventID(0,0);
00075       }
00076       
00077       bool operator<(EventID const& iRHS) const {
00078          return (run_ == iRHS.run_ ? event_ < iRHS.event_ : run_ < iRHS.run_);
00079       }
00080 
00081       bool operator>=(EventID const& iRHS) const {
00082          return !(*this < iRHS);
00083       }
00084 
00085       bool operator==(EventID const& iRHS) const {
00086          return !(*this < iRHS || iRHS < *this);
00087       }
00088 
00089       bool operator!=(EventID const& iRHS) const {
00090          return !(*this == iRHS);
00091       }
00092 
00093       bool operator<=(EventID const& iRHS) const {
00094          return (*this < iRHS || *this == iRHS);
00095       }
00096 
00097       bool operator>(EventID const& iRHS) const {
00098          return !(*this <= iRHS);
00099       }
00100 
00101       // ---------- static functions ---------------------------
00102 
00103       static EventNumber_t maxEventNumber() {
00104          return 0xFFFFFFFFU;
00105       }
00106    
00107       static EventID firstValidEvent() {
00108          return EventID(1, 1);
00109       }
00110       // ---------- member functions ---------------------------
00111    
00112    private:
00113       //EventID(EventID const&); // stop default
00114 
00115       //EventID const& operator=(EventID const&); // stop default
00116 
00117       // ---------- member data --------------------------------
00118       RunNumber_t run_;
00119       EventNumber_t event_;
00120 };
00121 
00122 std::ostream& operator<<(std::ostream& oStream, EventID const& iID);
00123 
00124 }
00125 #endif

Generated on Tue Jun 9 17:31:33 2009 for CMSSW by  doxygen 1.5.4