CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LuminosityBlockID.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_LuminosityBlockID_h
2 #define DataFormats_Provenance_LuminosityBlockID_h
3 // -*- C++ -*-
4 //
5 // Package: DataFormats/Provenance
6 // Class : LuminosityBlockID
7 //
16 //
17 //
18 
19 // system include files
20 #include <functional>
21 #include <iosfwd>
22 
23 // user include files
26 #include <cstdint>
27 
28 // forward declarations
29 namespace edm {
30 
32  public:
34  explicit LuminosityBlockID(uint64_t id);
36  : run_(iRun), luminosityBlock_(iLuminosityBlock) {}
37 
38  //virtual ~LuminosityBlockID();
39 
40  // ---------- const member functions ---------------------
41  RunNumber_t run() const { return run_; }
43 
44  uint64_t value() const;
45 
46  //moving from one LuminosityBlockID to another one
50  }
51  return LuminosityBlockID(run_ + 1, 1);
52  }
53  LuminosityBlockID nextRun() const { return LuminosityBlockID(run_ + 1, 0); }
56  if (run_ > 1) {
58  }
59  return LuminosityBlockID(0, 0);
60  }
61 
63  if (luminosityBlock_ > 1) {
65  }
66  if (run_ != 0) {
68  }
69  return LuminosityBlockID(0, 0);
70  }
71 
72  bool operator==(LuminosityBlockID const& iRHS) const {
73  return iRHS.run_ == run_ && iRHS.luminosityBlock_ == luminosityBlock_;
74  }
75  bool operator!=(LuminosityBlockID const& iRHS) const { return !(*this == iRHS); }
76 
77  bool operator<(LuminosityBlockID const& iRHS) const { return doOp<std::less>(iRHS); }
78  bool operator<=(LuminosityBlockID const& iRHS) const { return doOp<std::less_equal>(iRHS); }
79  bool operator>(LuminosityBlockID const& iRHS) const { return doOp<std::greater>(iRHS); }
80  bool operator>=(LuminosityBlockID const& iRHS) const { return doOp<std::greater_equal>(iRHS); }
81 
82  // ---------- static functions ---------------------------
83 
84  static LuminosityBlockNumber_t maxLuminosityBlockNumber() { return 0xFFFFFFFFU; }
85 
87  // ---------- member functions ---------------------------
88 
89  private:
90  template <template <typename> class Op>
91  bool doOp(LuminosityBlockID const& iRHS) const {
92  //Run takes presidence for comparisions
93  if (run_ == iRHS.run_) {
94  Op<LuminosityBlockNumber_t> op_e;
95  return op_e(luminosityBlock_, iRHS.luminosityBlock_);
96  }
97  Op<RunNumber_t> op;
98  return op(run_, iRHS.run_);
99  }
100  //LuminosityBlockID(LuminosityBlockID const&); // stop default
101 
102  //LuminosityBlockID const& operator=(LuminosityBlockID const&); // stop default
103 
104  // ---------- member data --------------------------------
107  };
108 
109  std::ostream& operator<<(std::ostream& oStream, LuminosityBlockID const& iID);
110 
111  inline LuminosityBlockID const& min(LuminosityBlockID const& lh, LuminosityBlockID const& rh) {
112  return (rh < lh ? rh : lh);
113  }
114 
115  inline LuminosityBlockID const& max(LuminosityBlockID const& lh, LuminosityBlockID const& rh) {
116  return (rh < lh ? lh : rh);
117  }
118 
119 } // namespace edm
120 #endif
LuminosityBlockID previous() const
static LuminosityBlockID firstValidLuminosityBlock()
LuminosityBlockID next() const
bool operator>=(LuminosityBlockID const &iRHS) const
LuminosityBlockNumber_t luminosityBlock_
RunNumber_t const invalidRunNumber
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
bool operator>(LuminosityBlockID const &iRHS) const
bool int lh
Definition: SIMDVec.h:20
unsigned int LuminosityBlockNumber_t
bool operator!=(LuminosityBlockID const &iRHS) const
bool operator<=(LuminosityBlockID const &iRHS) const
bool doOp(LuminosityBlockID const &iRHS) const
RunNumber_t run() const
uint64_t value() const
EventID const & min(EventID const &lh, EventID const &rh)
Definition: EventID.h:116
LuminosityBlockID nextRunFirstLuminosityBlock() const
LuminosityBlockNumber_t const invalidLuminosityBlockNumber
bool operator<(LuminosityBlockID const &iRHS) const
LuminosityBlockID nextRun() const
unsigned long long uint64_t
Definition: Time.h:13
LuminosityBlockID(RunNumber_t iRun, LuminosityBlockNumber_t iLuminosityBlock)
LuminosityBlockNumber_t luminosityBlock() const
bool operator==(LuminosityBlockID const &iRHS) const
LuminosityBlockID previousRunLastLuminosityBlock() const
unsigned int RunNumber_t
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:118