EventIDBase Class Reference

This class provides a unique identification for each event, in terms of run/event number and/or a time stamp. More...

#include <GaudiKernel/EventIDBase.h>

Classes

class  SortByLumiEvent
 
class  SortByRunEvent
 
class  SortByTimeStamp
 

Public Types

typedef unsigned int number_type
 
typedef uint64_t event_number_t
 

Public Member Functions

number_type run_number () const
 run number - 32 bit unsigned More...
 
event_number_t event_number () const
 event number - 64 bit unsigned More...
 
number_type time_stamp () const
 time stamp - posix time in seconds from 1970, 32 bit unsigned More...
 
number_type time_stamp_ns_offset () const
 time stamp ns - ns time offset for time_stamp, 32 bit unsigned More...
 
number_type lumi_block () const
 luminosity block identifier, 32 bit unsigned More...
 
number_type bunch_crossing_id () const
 bunch crossing ID, 32 bit unsigned More...
 
void set_run_number (number_type runNumber)
 set run number More...
 
void set_event_number (event_number_t eventNumber)
 set event number More...
 
void set_time_stamp (number_type timeStamp)
 set time stamp More...
 
void set_time_stamp_ns_offset (number_type timeStampNs)
 set time stamp in ns More...
 
void set_lumi_block (number_type lumiBlock)
 set luminosity block identifier More...
 
void set_bunch_crossing_id (number_type bcid)
 set bunch crossing ID More...
 
bool isRunEvent () const
 
bool isTimeStamp () const
 
bool isLumiEvent () const
 
bool isValid () const
 
structors
 EventIDBase ()
 
 EventIDBase (number_type run_number, event_number_t event_number, number_type time_stamp=UNDEFNUM, number_type time_stamp_ns_offset=0, number_type lumi_block=UNDEFNUM, number_type bunch_crossing_id=0)
 
virtual ~EventIDBase ()
 

Static Public Attributes

static const number_type UNDEFNUM
 
static const event_number_t UNDEFEVT
 

Private Types

enum  Type { Invalid = 0, RunEvent = 1 << 1, TimeStamp = 1 << 2, LumiEvent = 1 << 3 }
 

Private Member Functions

void setRE ()
 
void setTS ()
 
void setLE ()
 

Private Attributes

unsigned m_type {Invalid}
 
number_type m_run_number {UNDEFNUM}
 run number More...
 
event_number_t m_event_number {UNDEFEVT}
 event number More...
 
number_type m_time_stamp {UNDEFNUM}
 posix time in seconds since 1970/01/01 More...
 
number_type m_time_stamp_ns_offset {UNDEFNUM}
 time stamp ns - ns time offset for time_stamp, 32 bit unsigned More...
 
number_type m_lumiBlock {UNDEFNUM}
 luminosity block number: the number which uniquely tags a luminosity block within a run More...
 
number_type m_bunch_crossing_id {UNDEFNUM}
 bunch crossing ID, 32 bit unsigned More...
 

Friends

bool operator< (const EventIDBase &lhs, const EventIDBase &rhs)
 Comparison operators. More...
 
bool operator> (const EventIDBase &lhs, const EventIDBase &rhs)
 
bool operator== (const EventIDBase &lhs, const EventIDBase &rhs)
 
bool operator!= (const EventIDBase &lhs, const EventIDBase &rhs)
 
bool operator<= (const EventIDBase &lhs, const EventIDBase &rhs)
 
bool operator>= (const EventIDBase &lhs, const EventIDBase &rhs)
 
std::ostreamoperator<< (std::ostream &os, const EventIDBase &rhs)
 Extraction operators. More...
 

Detailed Description

This class provides a unique identification for each event, in terms of run/event number and/or a time stamp.

Definition at line 29 of file EventIDBase.h.

Member Typedef Documentation

Definition at line 33 of file EventIDBase.h.

typedef unsigned int EventIDBase::number_type

Definition at line 32 of file EventIDBase.h.

Member Enumeration Documentation

enum EventIDBase::Type
private
Enumerator
Invalid 
RunEvent 
TimeStamp 
LumiEvent 

Definition at line 151 of file EventIDBase.h.

151  {
152  Invalid = 0,
153  RunEvent = 1 << 1,
154  TimeStamp = 1 << 2,
155  LumiEvent = 1 << 3
156  };

Constructor & Destructor Documentation

EventIDBase::EventIDBase ( )
inline

Definition at line 42 of file EventIDBase.h.

42 {};
EventIDBase::EventIDBase ( number_type  run_number,
event_number_t  event_number,
number_type  time_stamp = UNDEFNUM,
number_type  time_stamp_ns_offset = 0,
number_type  lumi_block = UNDEFNUM,
number_type  bunch_crossing_id = 0 
)

Definition at line 19 of file EventIDBase.cpp.

25  :
32 {
34  setRE();
35  }
36 
37  if (m_time_stamp != UNDEFNUM) {
38  setTS();
41  }
42  }
43 
45  setLE();
46  }
47 
48 }
static const number_type UNDEFNUM
Definition: EventIDBase.h:35
void setLE()
Definition: EventIDBase.h:162
number_type bunch_crossing_id() const
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:69
number_type m_lumiBlock
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:178
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:174
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:181
void setRE()
Definition: EventIDBase.h:160
number_type lumi_block() const
luminosity block identifier, 32 bit unsigned
Definition: EventIDBase.h:66
event_number_t m_event_number
event number
Definition: EventIDBase.h:168
number_type time_stamp() const
time stamp - posix time in seconds from 1970, 32 bit unsigned
Definition: EventIDBase.h:60
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:171
number_type m_run_number
run number
Definition: EventIDBase.h:165
number_type run_number() const
run number - 32 bit unsigned
Definition: EventIDBase.h:54
number_type time_stamp_ns_offset() const
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:63
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:36
void setTS()
Definition: EventIDBase.h:161
event_number_t event_number() const
event number - 64 bit unsigned
Definition: EventIDBase.h:57
EventIDBase::~EventIDBase ( )
virtual

Definition at line 50 of file EventIDBase.cpp.

51 {}

Member Function Documentation

number_type EventIDBase::bunch_crossing_id ( ) const
inline

bunch crossing ID, 32 bit unsigned

Definition at line 69 of file EventIDBase.h.

69 { return m_bunch_crossing_id; }
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:181
event_number_t EventIDBase::event_number ( ) const
inline

event number - 64 bit unsigned

Definition at line 57 of file EventIDBase.h.

57 { return m_event_number; }
event_number_t m_event_number
event number
Definition: EventIDBase.h:168
bool EventIDBase::isLumiEvent ( ) const

Definition at line 64 of file EventIDBase.cpp.

64  {
65  return ( m_type & LumiEvent );
66 }
unsigned m_type
Definition: EventIDBase.h:158
bool EventIDBase::isRunEvent ( ) const

Definition at line 54 of file EventIDBase.cpp.

54  {
55  return ( m_type & RunEvent );
56 }
unsigned m_type
Definition: EventIDBase.h:158
bool EventIDBase::isTimeStamp ( ) const

Definition at line 59 of file EventIDBase.cpp.

59  {
60  return ( m_type & TimeStamp );
61 }
unsigned m_type
Definition: EventIDBase.h:158
bool EventIDBase::isValid ( ) const

Definition at line 69 of file EventIDBase.cpp.

69  {
70  return ( m_type != Invalid );
71 }
unsigned m_type
Definition: EventIDBase.h:158
number_type EventIDBase::lumi_block ( ) const
inline

luminosity block identifier, 32 bit unsigned

Definition at line 66 of file EventIDBase.h.

66 { return m_lumiBlock; }
number_type m_lumiBlock
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:178
number_type EventIDBase::run_number ( ) const
inline

run number - 32 bit unsigned

Definition at line 54 of file EventIDBase.h.

54 { return m_run_number; }
number_type m_run_number
run number
Definition: EventIDBase.h:165
void EventIDBase::set_bunch_crossing_id ( number_type  bcid)
inline

set bunch crossing ID

Definition at line 89 of file EventIDBase.h.

89 { m_bunch_crossing_id = bcid; }
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:181
void EventIDBase::set_event_number ( event_number_t  eventNumber)
inline

set event number

Definition at line 75 of file EventIDBase.h.

75 { m_event_number = eventNumber; }
event_number_t m_event_number
event number
Definition: EventIDBase.h:168
void EventIDBase::set_lumi_block ( number_type  lumiBlock)
inline

set luminosity block identifier

Definition at line 86 of file EventIDBase.h.

86 { m_lumiBlock = lumiBlock; setLE(); }
void setLE()
Definition: EventIDBase.h:162
number_type m_lumiBlock
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:178
void EventIDBase::set_run_number ( number_type  runNumber)
inline

set run number

Definition at line 72 of file EventIDBase.h.

72 { m_run_number = runNumber; setRE();}
void setRE()
Definition: EventIDBase.h:160
number_type m_run_number
run number
Definition: EventIDBase.h:165
void EventIDBase::set_time_stamp ( number_type  timeStamp)
inline

set time stamp

Definition at line 78 of file EventIDBase.h.

78 { m_time_stamp = timeStamp; setTS();}
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:171
void setTS()
Definition: EventIDBase.h:161
void EventIDBase::set_time_stamp_ns_offset ( number_type  timeStampNs)
inline

set time stamp in ns

Definition at line 81 of file EventIDBase.h.

81  {
82  m_time_stamp_ns_offset = timeStampNs;
83  }
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:174
void EventIDBase::setLE ( )
inlineprivate

Definition at line 162 of file EventIDBase.h.

void EventIDBase::setRE ( )
inlineprivate

Definition at line 160 of file EventIDBase.h.

void EventIDBase::setTS ( )
inlineprivate

Definition at line 161 of file EventIDBase.h.

number_type EventIDBase::time_stamp ( ) const
inline

time stamp - posix time in seconds from 1970, 32 bit unsigned

Definition at line 60 of file EventIDBase.h.

60 { return m_time_stamp; }
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:171
number_type EventIDBase::time_stamp_ns_offset ( ) const
inline

time stamp ns - ns time offset for time_stamp, 32 bit unsigned

Definition at line 63 of file EventIDBase.h.

63 { return 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:174

Friends And Related Function Documentation

bool operator!= ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 211 of file EventIDBase.h.

211  {
212  return !(lhs == rhs);
213 }
bool operator< ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Comparison operators.

Definition at line 185 of file EventIDBase.h.

185  {
186  // first try ordering by timestamp if both are non-zero
187  // then try ordering by lumi/event if both have non-zero lumi
188  // then order by run/event
189 
190  if (lhs.isTimeStamp() && rhs.isTimeStamp()) {
191  return (lhs.m_time_stamp < rhs.m_time_stamp);
192  } else {
193  if (lhs.isLumiEvent() && rhs.isLumiEvent()) {
194  return (std::tie(lhs.m_lumiBlock, lhs.m_event_number) <
195  std::tie(rhs.m_lumiBlock, rhs.m_event_number) );
196  } else {
197  return (std::tie(lhs.m_run_number, lhs.m_event_number) <
199  }
200  }
201 }
number_type m_lumiBlock
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:178
T tie(T...args)
event_number_t m_event_number
event number
Definition: EventIDBase.h:168
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:171
number_type m_run_number
run number
Definition: EventIDBase.h:165
bool isTimeStamp() const
Definition: EventIDBase.cpp:59
bool isLumiEvent() const
Definition: EventIDBase.cpp:64
std::ostream& operator<< ( std::ostream os,
const EventIDBase rhs 
)
friend

Extraction operators.

Definition at line 221 of file EventIDBase.h.

221  {
222  if (rhs.m_type == EventIDBase::Invalid) {
223  os << "[INVALID]";
224  return os;
225  }
226 
227  os << "["
228  << rhs.m_run_number
229  << "," << rhs.m_event_number;
230 
231  if ( rhs.isTimeStamp() != 0 ) {
232  os << "," << rhs.m_time_stamp << ":" << rhs.m_time_stamp_ns_offset;
233  }
234 
235  if ( rhs.isLumiEvent() != 0) {
236  os << ",l:" << rhs.m_lumiBlock;
237  }
238 
239  if ( rhs.m_bunch_crossing_id != 0) {
240  os << ",b:" << rhs.m_bunch_crossing_id;
241  }
242  os << "]";
243  return os;
244 }
unsigned m_type
Definition: EventIDBase.h:158
number_type m_lumiBlock
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:178
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:174
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:181
event_number_t m_event_number
event number
Definition: EventIDBase.h:168
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:171
number_type m_run_number
run number
Definition: EventIDBase.h:165
bool isTimeStamp() const
Definition: EventIDBase.cpp:59
bool isLumiEvent() const
Definition: EventIDBase.cpp:64
bool operator<= ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 214 of file EventIDBase.h.

214  {
215  return !(lhs > rhs);
216 }
bool operator== ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 203 of file EventIDBase.h.

203  {
204  // We assume that equality via run/event numbers is sufficient
205  return ( lhs.m_run_number == rhs.m_run_number &&
206  lhs.m_event_number == rhs.m_event_number );
207 }
event_number_t m_event_number
event number
Definition: EventIDBase.h:168
number_type m_run_number
run number
Definition: EventIDBase.h:165
bool operator> ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 208 of file EventIDBase.h.

208  {
209  return !( (lhs < rhs) || (lhs == rhs));
210 }
bool operator>= ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 217 of file EventIDBase.h.

217  {
218  return !(lhs < rhs);
219 }

Member Data Documentation

number_type EventIDBase::m_bunch_crossing_id {UNDEFNUM}
private

bunch crossing ID, 32 bit unsigned

Definition at line 181 of file EventIDBase.h.

event_number_t EventIDBase::m_event_number {UNDEFEVT}
private

event number

Definition at line 168 of file EventIDBase.h.

number_type EventIDBase::m_lumiBlock {UNDEFNUM}
private

luminosity block number: the number which uniquely tags a luminosity block within a run

Definition at line 178 of file EventIDBase.h.

number_type EventIDBase::m_run_number {UNDEFNUM}
private

run number

Definition at line 165 of file EventIDBase.h.

number_type EventIDBase::m_time_stamp {UNDEFNUM}
private

posix time in seconds since 1970/01/01

Definition at line 171 of file EventIDBase.h.

number_type EventIDBase::m_time_stamp_ns_offset {UNDEFNUM}
private

time stamp ns - ns time offset for time_stamp, 32 bit unsigned

Definition at line 174 of file EventIDBase.h.

unsigned EventIDBase::m_type {Invalid}
private

Definition at line 158 of file EventIDBase.h.

const EventIDBase::event_number_t EventIDBase::UNDEFEVT
static
Initial value:

Definition at line 36 of file EventIDBase.h.

const EventIDBase::number_type EventIDBase::UNDEFNUM
static
Initial value:

Definition at line 35 of file EventIDBase.h.


The documentation for this class was generated from the following files: