Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EventIDRange.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_EVENTIDRANGE_H
2 #define GAUDIKERNEL_EVENTIDRANGE_H 1
3 
14 #include <iostream>
15 #include <sstream>
16 #include <string>
17 
23 class EventIDRange {
24 public:
25  EventIDRange();
26  EventIDRange( const EventIDBase& start, const EventIDBase& stop );
27  EventIDRange( const EventIDRange& r ) : m_start( r.m_start ), m_stop( r.m_stop ){};
28  EventIDRange& operator=( const EventIDRange& r );
29 
30  EventIDBase start() const { return m_start; }
31  EventIDBase stop() const { return m_stop; }
32 
33  bool isInRange( const EventIDBase& t ) const { // return ( t >= m_start && t < m_stop ); }
34  return ( std::tie( t.m_run_number, t.m_lumi_block, t.m_event_number ) >=
42  }
43 
44  static EventIDRange intersect( const EventIDRange& it ) { return it; }
45  template <typename... T>
46  static EventIDRange intersect( const EventIDRange& first, const T&... rest ) {
47  EventIDRange r = intersect( rest... );
48 
49  EventIDBase i1 = max( first.start(), r.start() );
50  EventIDBase i2 = min( first.stop(), r.stop() );
51 
52  return EventIDRange( i1, i2 );
53  }
54 
55  friend bool operator==( const EventIDRange& lhs, const EventIDRange& rhs );
56  friend bool operator!=( const EventIDRange& lhs, const EventIDRange& rhs );
57 
58  friend std::ostream& operator<<( std::ostream& os, const EventIDRange& rhs );
59 
60  operator std::string() const;
61 
62 private:
65 };
66 
67 inline bool operator==( const EventIDRange& lhs, const EventIDRange& rhs ) {
68  return lhs.m_start == rhs.m_start && lhs.m_stop == rhs.m_stop;
69 }
70 
71 inline bool operator!=( const EventIDRange& lhs, const EventIDRange& rhs ) { return !( lhs == rhs ); }
72 
73 inline EventIDRange::operator std::string() const {
75  os << "{" << m_start << " - " << m_stop << "}";
76  return os.str();
77 }
78 
79 #endif
T tie(T...args)
static EventIDRange intersect(const EventIDRange &first, const T &...rest)
Definition: EventIDRange.h:46
friend std::ostream & operator<<(std::ostream &os, const EventIDRange &rhs)
friend bool operator==(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:67
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:192
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:202
EventIDRange(const EventIDRange &r)
Definition: EventIDRange.h:27
EventIDBase m_stop
Definition: EventIDRange.h:64
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:215
STL class.
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:196
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Event ID Range object.
Definition: EventIDRange.h:23
EventIDRange & operator=(const EventIDRange &r)
friend bool operator!=(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:71
number_type m_run_number
run number
Definition: EventIDBase.h:183
static EventIDRange intersect(const EventIDRange &it)
Definition: EventIDRange.h:44
EventIDBase stop() const
Definition: EventIDRange.h:31
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:56
EventIDBase m_start
Definition: EventIDRange.h:63
EventIDBase start() const
Definition: EventIDRange.h:30
bool isInRange(const EventIDBase &t) const
Definition: EventIDRange.h:33
STL class.