| The Gaudi Framework v32r1 (f65d50dc)

EventIDRange.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_EVENTIDRANGE_H
2 #define GAUDIKERNEL_EVENTIDRANGE_H 1
3
13 #include "GaudiKernel/EventIDBase.h"
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 ) >= // run/lumi larger than run/lumi of start
35 std::tie( m_start.m_run_number, m_start.m_lumi_block, m_start.m_event_number ) &&
36
37 std::tie( t.m_run_number, t.m_lumi_block, t.m_event_number ) < // run/lumi smaller than run/lumi of stop
38 std::tie( m_stop.m_run_number, m_stop.m_lumi_block, m_stop.m_event_number ) &&
39
40 std::tie( t.m_time_stamp, t.m_time_stamp_ns_offset ) >= // time-stamp larger than time-stamp of start
41 std::tie( m_start.m_time_stamp, m_start.m_time_stamp_ns_offset ) &&
42
43 std::tie( t.m_time_stamp, t.m_time_stamp_ns_offset ) < // time-stap smaller than time-tamp of stop
44 std::tie( m_stop.m_time_stamp, m_stop.m_time_stamp_ns_offset ) );
45 }
46
47 static EventIDRange intersect( const EventIDRange& it ) { return it; }
48 template <typename... T>
49 static EventIDRange intersect( const EventIDRange& first, const T&... rest ) {
50 EventIDRange r = intersect( rest... );
51
52 EventIDBase i1 = max( first.start(), r.start() );
53 EventIDBase i2 = min( first.stop(), r.stop() );
54
55 return EventIDRange( i1, i2 );
56 }
57
58 friend bool operator==( const EventIDRange& lhs, const EventIDRange& rhs );
59 friend bool operator!=( const EventIDRange& lhs, const EventIDRange& rhs );
60
61 friend std::ostream& operator<<( std::ostream& os, const EventIDRange& rhs );
62
63 operator std::string() const;
64
65 private:
66 EventIDBase m_start{};
67 EventIDBase m_stop{};
68 };
69
70 inline bool operator==( const EventIDRange& lhs, const EventIDRange& rhs ) {
71 return lhs.m_start == rhs.m_start && lhs.m_stop == rhs.m_stop;
72 }
73
74 inline bool operator!=( const EventIDRange& lhs, const EventIDRange& rhs ) { return !( lhs == rhs ); }
75
76 inline EventIDRange::operator std::string() const {
77 std::ostringstream os;
78 os << "{" << m_start << " - " << m_stop << "}";
79 return os.str();
80 }
81
82 #endif
std::tie
T tie(T... args)
EventIDRange::operator<<
friend std::ostream & operator<<(std::ostream &os, const EventIDRange &rhs)
Definition: EventIDRange.cpp:42
EventIDRange::operator==
friend bool operator==(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:70
EventIDBase::m_time_stamp_ns_offset
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:192
min
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:202
EventIDRange::EventIDRange
EventIDRange(const EventIDRange &r)
Definition: EventIDRange.h:27
EventIDRange::m_stop
EventIDBase m_stop
Definition: EventIDRange.h:67
EventIDBase::m_event_number
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
max
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:215
std::string
STL class.
EventIDBase::m_time_stamp
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
EventIDBase::m_lumi_block
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run
Definition: EventIDBase.h:196
EventIDBase.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
EventIDRange
Event ID Range object.
Definition: EventIDRange.h:23
std::ostringstream
STL class.
EventIDRange::operator=
EventIDRange & operator=(const EventIDRange &r)
Definition: EventIDRange.cpp:34
EventIDRange::operator!=
friend bool operator!=(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:74
std::ostringstream::str
T str(T... args)
EventIDBase::m_run_number
number_type m_run_number
run number
Definition: EventIDBase.h:183
EventIDRange::EventIDRange
EventIDRange()
Definition: EventIDRange.cpp:13
EventIDRange::intersect
static EventIDRange intersect(const EventIDRange &it)
Definition: EventIDRange.h:47
EventIDRange::stop
EventIDBase stop() const
Definition: EventIDRange.h:31
EventIDBase
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:56
EventIDRange::m_start
EventIDBase m_start
Definition: EventIDRange.h:66
EventIDRange::start
EventIDBase start() const
Definition: EventIDRange.h:30
EventIDRange::intersect
static EventIDRange intersect(const EventIDRange &first, const T &... rest)
Definition: EventIDRange.h:49
EventIDRange::isInRange
bool isInRange(const EventIDBase &t) const
Definition: EventIDRange.h:33
std::ostream
STL class.
operator==
bool operator==(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:70
operator!=
bool operator!=(const EventIDRange &lhs, const EventIDRange &rhs)
Definition: EventIDRange.h:74