CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventID.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_EventID_h
2 #define DataFormats_Provenance_EventID_h
3 // -*- C++ -*-
4 //
5 // Package: DataFormats/Provenance
6 // Class : EventID
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Mon Aug 8 15:13:14 EDT 2005
19 //
20 
21 // system include files
22 #include <iosfwd>
23 
24 // user include files
26 
27 // forward declarations
28 namespace edm {
29 
30  typedef unsigned int EventNumber_t;
31  typedef unsigned int LuminosityBlockNumber_t;
32 
33 
34  class EventID {
35 
36  public:
37  EventID() : run_(0), luminosityBlock_(0), event_(0) {}
39  run_(iRun), luminosityBlock_(iLumi), event_(iEvent) {}
40 
41  // ---------- const member functions ---------------------
42  RunNumber_t run() const { return run_; }
44  EventNumber_t event() const { return event_; }
45 
46  //moving from one EventID to another one
48  if(event_ != maxEventNumber()) {
49  return EventID(run_, lumi, event_ + 1);
50  }
51  return EventID(run_ + 1, lumi, 1);
52  }
54  return EventID(run_ + 1, lumi, 0);
55  }
57  return EventID(run_ + 1, lumi, 1);
58  }
60  if(run_ > 1) {
61  return EventID(run_ - 1, lumi, maxEventNumber());
62  }
63  return EventID();
64  }
65 
67  if(event_ > 1) {
68  return EventID(run_, lumi, event_-1);
69  }
70  if(run_ != 0) {
71  return EventID(run_ - 1, lumi, maxEventNumber());
72  }
73  return EventID();
74  }
75 
76  bool operator<(EventID const& iRHS) const {
77  if (run_ < iRHS.run_) return true;
78  if (run_ > iRHS.run_) return false;
79  if (luminosityBlock_ < iRHS.luminosityBlock_) return true;
80  if (luminosityBlock_ > iRHS.luminosityBlock_) return false;
81  return (event_ < iRHS.event_);
82  }
83 
84  bool operator>=(EventID const& iRHS) const {
85  return !(*this < iRHS);
86  }
87 
88  bool operator==(EventID const& iRHS) const {
89  return !(*this < iRHS || iRHS < *this);
90  }
91 
92  bool operator!=(EventID const& iRHS) const {
93  return !(*this == iRHS);
94  }
95 
96  bool operator<=(EventID const& iRHS) const {
97  return (*this < iRHS || *this == iRHS);
98  }
99 
100  bool operator>(EventID const& iRHS) const {
101  return !(*this <= iRHS);
102  }
103 
104  // ---------- static functions ---------------------------
105 
107  return 0xFFFFFFFFU;
108  }
109 
111  return EventID(1, 1, 1);
112  }
113  // ---------- member functions ---------------------------
114 
116  luminosityBlock_ = lb;
117  }
118  private:
119  //EventID(EventID const&); // stop default
120 
121  //EventID const& operator=(EventID const&); // stop default
122 
123  // ---------- member data --------------------------------
127  };
128 
129  std::ostream& operator<<(std::ostream& oStream, EventID const& iID);
130 
131  inline
132  EventID const& min(EventID const& lh, EventID const& rh) {
133  return (rh < lh ? rh : lh);
134  }
135 
136  inline
137  EventID const& max(EventID const& lh, EventID const& rh) {
138  return (rh < lh ? lh : rh);
139  }
140 }
141 #endif
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
EventNumber_t event_
Definition: EventID.h:126
bool operator!=(EventID const &iRHS) const
Definition: EventID.h:92
bool operator==(EventID const &iRHS) const
Definition: EventID.h:88
unsigned int EventNumber_t
Definition: EventID.h:30
tuple lumi
Definition: fjr2json.py:35
bool operator<(EventID const &iRHS) const
Definition: EventID.h:76
LuminosityBlockNumber_t luminosityBlock_
Definition: EventID.h:125
bool int lh
Definition: SSEVec.h:55
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
EventID previous(LuminosityBlockNumber_t const &lumi) const
Definition: EventID.h:66
EventID next(LuminosityBlockNumber_t const &lumi) const
Definition: EventID.h:47
int iEvent
Definition: GenABIO.cc:243
RunNumber_t run_
Definition: EventID.h:124
void setLuminosityBlockNumber(LuminosityBlockNumber_t const &lb)
Definition: EventID.h:115
EventID const & min(EventID const &lh, EventID const &rh)
Definition: EventID.h:132
EventID nextRun(LuminosityBlockNumber_t const &lumi) const
Definition: EventID.h:53
bool operator<=(EventID const &iRHS) const
Definition: EventID.h:96
static EventID firstValidEvent()
Definition: EventID.h:110
static EventNumber_t maxEventNumber()
Definition: EventID.h:106
EventID nextRunFirstEvent(LuminosityBlockNumber_t const &lumi) const
Definition: EventID.h:56
unsigned int RunNumber_t
Definition: EventRange.h:32
EventID(RunNumber_t iRun, LuminosityBlockNumber_t iLumi, EventNumber_t iEvent)
Definition: EventID.h:38
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
EventID previousRunLastEvent(LuminosityBlockNumber_t const &lumi) const
Definition: EventID.h:59
bool operator>=(EventID const &iRHS) const
Definition: EventID.h:84
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:137
bool operator>(EventID const &iRHS) const
Definition: EventID.h:100