CMS 3D CMS Logo

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 //
14 #include <functional>
15 #include <iosfwd>
16 
19 #include <cstdint>
20 
21 namespace edm {
22 
24  public:
26  explicit LuminosityBlockID(uint64_t id);
28  : run_(iRun), luminosityBlock_(iLuminosityBlock) {}
29 
30  // ---------- const member functions ---------------------
31  RunNumber_t run() const { return run_; }
33 
34  uint64_t value() const;
35 
36  //moving from one LuminosityBlockID to another one
40  }
41  return LuminosityBlockID(run_ + 1, 1);
42  }
43  LuminosityBlockID nextRun() const { return LuminosityBlockID(run_ + 1, 0); }
46  if (run_ > 1) {
48  }
49  return LuminosityBlockID(0, 0);
50  }
51 
53  if (luminosityBlock_ > 1) {
55  }
56  if (run_ != 0) {
58  }
59  return LuminosityBlockID(0, 0);
60  }
61 
62  bool operator==(LuminosityBlockID const& iRHS) const {
63  return iRHS.run_ == run_ && iRHS.luminosityBlock_ == luminosityBlock_;
64  }
65  bool operator!=(LuminosityBlockID const& iRHS) const { return !(*this == iRHS); }
66 
67  bool operator<(LuminosityBlockID const& iRHS) const { return doOp<std::less>(iRHS); }
68  bool operator<=(LuminosityBlockID const& iRHS) const { return doOp<std::less_equal>(iRHS); }
69  bool operator>(LuminosityBlockID const& iRHS) const { return doOp<std::greater>(iRHS); }
70  bool operator>=(LuminosityBlockID const& iRHS) const { return doOp<std::greater_equal>(iRHS); }
71 
72  // ---------- static functions ---------------------------
73 
74  static LuminosityBlockNumber_t maxLuminosityBlockNumber() { return 0xFFFFFFFFU; }
75 
77 
78  private:
79  template <template <typename> class Op>
80  bool doOp(LuminosityBlockID const& iRHS) const {
81  //Run takes presidence for comparisions
82  if (run_ == iRHS.run_) {
83  Op<LuminosityBlockNumber_t> op_e;
84  return op_e(luminosityBlock_, iRHS.luminosityBlock_);
85  }
86  Op<RunNumber_t> op;
87  return op(run_, iRHS.run_);
88  }
89 
90  // ---------- member data --------------------------------
93  };
94 
95  std::ostream& operator<<(std::ostream& oStream, LuminosityBlockID const& iID);
96 
97  inline LuminosityBlockID const& min(LuminosityBlockID const& lh, LuminosityBlockID const& rh) {
98  return (rh < lh ? rh : lh);
99  }
100 
101  inline LuminosityBlockID const& max(LuminosityBlockID const& lh, LuminosityBlockID const& rh) {
102  return (rh < lh ? lh : rh);
103  }
104 
105 } // namespace edm
106 #endif
LuminosityBlockNumber_t luminosityBlock() const
static LuminosityBlockID firstValidLuminosityBlock()
LuminosityBlockID previousRunLastLuminosityBlock() 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
LuminosityBlockID nextRun() const
bool operator==(LuminosityBlockID const &iRHS) const
bool operator>(LuminosityBlockID const &iRHS) const
EventID const & min(EventID const &lh, EventID const &rh)
Definition: EventID.h:116
bool operator>=(LuminosityBlockID const &iRHS) const
LuminosityBlockNumber_t const invalidLuminosityBlockNumber
RunNumber_t run() const
unsigned long long uint64_t
Definition: Time.h:13
LuminosityBlockID(RunNumber_t iRun, LuminosityBlockNumber_t iLuminosityBlock)
LuminosityBlockID previous() const
LuminosityBlockID nextRunFirstLuminosityBlock() const
bool operator<=(LuminosityBlockID const &iRHS) const
HLT enums.
bool operator!=(LuminosityBlockID const &iRHS) const
LuminosityBlockID next() const
unsigned int RunNumber_t
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
bool doOp(LuminosityBlockID const &iRHS) const
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:118