| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

EventIDBase.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_EVENTIDBASE_H
2 #define GAUDIKERNEL_EVENTIDBASE_H 1
3
15 //<<<<<< INCLUDES >>>>>>
16
17 #include <iostream>
18 #include <stdint.h>
19
28 class EventIDBase {
29 public:
30
31 typedef unsigned int number_type;
32
34
35 EventIDBase() {};
36 EventIDBase(number_type run_number,
37 uint64_t event_number,
38 number_type time_stamp=0,
39 number_type time_stamp_ns_offset=0,
40 number_type lumi_block=0,
41 number_type bunch_crossing_id=0);
42 // Use default copy constructor.
43 virtual ~EventIDBase();
45
47 number_type run_number () const { return m_run_number; }
48
50 uint64_t event_number () const { return m_event_number; }
51
53 number_type time_stamp () const { return m_time_stamp; }
54
56 number_type time_stamp_ns_offset () const { return m_time_stamp_ns_offset; }
57
59 number_type lumi_block () const { return m_lumiBlock; }
60
62 number_type bunch_crossing_id () const { return m_bunch_crossing_id; }
63
65 void set_run_number (number_type runNumber) { m_run_number = runNumber; }
66
68 void set_event_number (uint64_t eventNumber) { m_event_number = eventNumber; }
69
71 void set_time_stamp (number_type timeStamp) { m_time_stamp = timeStamp; }
72
74 void set_time_stamp_ns_offset (number_type timeStampNs) {
75 m_time_stamp_ns_offset = timeStampNs;
76 }
77
79 void set_lumi_block (number_type lumiBlock) { m_lumiBlock = lumiBlock; }
80
82 void set_bunch_crossing_id (number_type bcid) { m_bunch_crossing_id = bcid; }
83
85 friend bool operator<(const EventIDBase& lhs, const EventIDBase& rhs);
86 friend bool operator>(const EventIDBase& lhs, const EventIDBase& rhs);
87 friend bool operator==(const EventIDBase& lhs, const EventIDBase& rhs);
88 friend bool operator!=(const EventIDBase& lhs, const EventIDBase& rhs);
89 friend bool operator<=(const EventIDBase& lhs, const EventIDBase& rhs);
90 friend bool operator>=(const EventIDBase& lhs, const EventIDBase& rhs);
91
93 friend std::ostream& operator<<(std::ostream& os, const EventIDBase& rhs);
94
95 private:
96
98 number_type m_run_number {0};
99
101 uint64_t m_event_number {0};
102
104 number_type m_time_stamp {0};
105
107 number_type m_time_stamp_ns_offset {0};
108
111 number_type m_lumiBlock {0};
112
114 number_type m_bunch_crossing_id {0};
115
116 };
117
118
119 inline bool operator<(const EventIDBase& lhs, const EventIDBase& rhs) {
120 // We are assuming that ALL events will have run and event numbers,
121 // and never just a time stamp.
122 // FIXME: any use for also ordering by lumi-block ?
123 return lhs.m_run_number<rhs.m_run_number ||
124 ( lhs.m_run_number==rhs.m_run_number &&
125 lhs.m_event_number<rhs.m_event_number) ;
126 }
127
128 inline bool operator==(const EventIDBase& lhs, const EventIDBase& rhs) {
129 // We assume that equality via run/event numbers is sufficient
130 return lhs.m_run_number == rhs.m_run_number &&
131 lhs.m_event_number == rhs.m_event_number;
132 }
133 inline bool operator>(const EventIDBase& lhs, const EventIDBase& rhs) {
134 return !( (lhs < rhs) || (lhs == rhs));
135 }
136 inline bool operator!=(const EventIDBase& lhs, const EventIDBase& rhs) {
137 return !(lhs == rhs);
138 }
139 inline bool operator<=(const EventIDBase& lhs, const EventIDBase& rhs) {
140 return !(lhs > rhs);
141 }
142 inline bool operator>=(const EventIDBase& lhs, const EventIDBase& rhs) {
143 return !(lhs < rhs);
144 }
145
146 inline std::ostream& operator<<(std::ostream& os, const EventIDBase& rhs) {
147 os << "["
148 << rhs.m_run_number
149 << "," << rhs.m_event_number;
150
151 if ( rhs.m_time_stamp != 0 ) {
152 os << "," << rhs.m_time_stamp << ":" << rhs.m_time_stamp_ns_offset;
153 }
154
155 if ( rhs.m_lumiBlock != 0) {
156 os << ",l:" << rhs.m_lumiBlock;
157 }
158
159 if ( rhs.m_bunch_crossing_id != 0) {
160 os << ",b:" << rhs.m_bunch_crossing_id;
161 }
162 os << "]";
163 return os;
164 }
165
166
167 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>>
168
169 #endif // EVENTINFO_EVENTID_H
170
171
172
173
174
175
EventIDBase::set_time_stamp
void set_time_stamp(number_type timeStamp)
set time stamp
Definition: EventIDBase.h:71
operator<<
std::ostream & operator<<(std::ostream &os, const EventIDBase &rhs)
Definition: EventIDBase.h:146
EventIDBase::set_time_stamp_ns_offset
void set_time_stamp_ns_offset(number_type timeStampNs)
set time stamp in ns
Definition: EventIDBase.h:74
EventIDBase::set_lumi_block
void set_lumi_block(number_type lumiBlock)
set luminosity block identifier
Definition: EventIDBase.h:79
EventIDBase::m_event_number
uint64_t m_event_number
event number
Definition: EventIDBase.h:101
EventIDBase::set_run_number
void set_run_number(number_type runNumber)
set run number
Definition: EventIDBase.h:65
EventIDBase::bunch_crossing_id
number_type bunch_crossing_id() const
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:62
EventIDBase::m_lumiBlock
number_type m_lumiBlock
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:111
EventIDBase::operator==
friend bool operator==(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:128
EventIDBase::operator<<
friend std::ostream & operator<<(std::ostream &os, const EventIDBase &rhs)
Extraction operators.
Definition: EventIDBase.h:146
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:107
EventIDBase::operator<=
friend bool operator<=(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:139
EventIDBase::set_bunch_crossing_id
void set_bunch_crossing_id(number_type bcid)
set bunch crossing ID
Definition: EventIDBase.h:82
uint64_t
unsigned long long uint64_t
Definition: instrset.h:144
EventIDBase::m_bunch_crossing_id
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:114
EventIDBase::lumi_block
number_type lumi_block() const
luminosity block identifier, 32 bit unsigned
Definition: EventIDBase.h:59
EventIDBase::EventIDBase
EventIDBase()
Definition: EventIDBase.h:35
EventIDBase::time_stamp
number_type time_stamp() const
time stamp - posix time in seconds from 1970, 32 bit unsigned
Definition: EventIDBase.h:53
operator>
bool operator>(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:133
EventIDBase::m_time_stamp
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:104
EventIDBase::event_number
uint64_t event_number() const
event number - 64 bit unsigned
Definition: EventIDBase.h:50
EventIDBase::set_event_number
void set_event_number(uint64_t eventNumber)
set event number
Definition: EventIDBase.h:68
EventIDBase::operator!=
friend bool operator!=(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:136
EventIDBase::m_run_number
number_type m_run_number
run number
Definition: EventIDBase.h:98
EventIDBase::run_number
number_type run_number() const
run number - 32 bit unsigned
Definition: EventIDBase.h:47
operator==
bool operator==(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:128
EventIDBase::operator>
friend bool operator>(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:133
EventIDBase::time_stamp_ns_offset
number_type time_stamp_ns_offset() const
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:56
operator<
bool operator<(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:119
EventIDBase::operator<
friend bool operator<(const EventIDBase &lhs, const EventIDBase &rhs)
Comparison operators.
Definition: EventIDBase.h:119
EventIDBase
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:28
operator!=
bool operator!=(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:136
operator>=
bool operator>=(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:142
EventIDBase::number_type
unsigned int number_type
Definition: EventIDBase.h:31
EventIDBase::operator>=
friend bool operator>=(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:142
EventIDBase::~EventIDBase
virtual ~EventIDBase()
Definition: EventIDBase.cpp:27
std::ostream
STL class.
operator<=
bool operator<=(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:139