The Gaudi Framework  v29r0 (ff2e7097)
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  SortByRunLumi
 
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 isRunLumi () 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 = std::numeric_limits<EventIDBase::number_type>::max()
 
static const event_number_t UNDEFEVT = std::numeric_limits<EventIDBase::event_number_t>::max()
 

Private Types

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

Private Member Functions

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

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_lumi_block {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 28 of file EventIDBase.h.

Member Typedef Documentation

Definition at line 32 of file EventIDBase.h.

typedef unsigned int EventIDBase::number_type

Definition at line 31 of file EventIDBase.h.

Member Enumeration Documentation

enum EventIDBase::Type
private
Enumerator
Invalid 
RunEvent 
TimeStamp 
LumiEvent 
RunLumi 

Definition at line 177 of file EventIDBase.h.

Constructor & Destructor Documentation

EventIDBase::EventIDBase ( )
inline

Definition at line 40 of file EventIDBase.h.

40 {};
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 17 of file EventIDBase.cpp.

25 {
27  setRE();
28  }
29 
30  if ( m_time_stamp != UNDEFNUM ) {
31  setTS();
34  }
35  }
36 
38  setLE();
39  }
40 
41  if ( m_run_number != UNDEFNUM && m_lumi_block != UNDEFNUM ) {
42  setRL();
43  }
44 }
static const number_type UNDEFNUM
Definition: EventIDBase.h:34
void setLE()
Definition: EventIDBase.h:183
number_type bunch_crossing_id() const
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:64
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:196
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:203
void setRE()
Definition: EventIDBase.h:181
number_type lumi_block() const
luminosity block identifier, 32 bit unsigned
Definition: EventIDBase.h:61
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
number_type time_stamp() const
time stamp - posix time in seconds from 1970, 32 bit unsigned
Definition: EventIDBase.h:55
void setRL()
Definition: EventIDBase.h:184
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:193
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:200
number_type m_run_number
run number
Definition: EventIDBase.h:187
number_type run_number() const
run number - 32 bit unsigned
Definition: EventIDBase.h:49
number_type time_stamp_ns_offset() const
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:58
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:35
void setTS()
Definition: EventIDBase.h:182
event_number_t event_number() const
event number - 64 bit unsigned
Definition: EventIDBase.h:52
EventIDBase::~EventIDBase ( )
virtual

Definition at line 46 of file EventIDBase.cpp.

46 {}

Member Function Documentation

number_type EventIDBase::bunch_crossing_id ( ) const
inline

bunch crossing ID, 32 bit unsigned

Definition at line 64 of file EventIDBase.h.

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

event number - 64 bit unsigned

Definition at line 52 of file EventIDBase.h.

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

Definition at line 52 of file EventIDBase.cpp.

52 { return ( m_type & LumiEvent ); }
unsigned m_type
Definition: EventIDBase.h:179
bool EventIDBase::isRunEvent ( ) const

Definition at line 48 of file EventIDBase.cpp.

48 { return ( m_type & RunEvent ); }
unsigned m_type
Definition: EventIDBase.h:179
bool EventIDBase::isRunLumi ( ) const

Definition at line 54 of file EventIDBase.cpp.

54 { return ( m_type & RunLumi ); }
unsigned m_type
Definition: EventIDBase.h:179
bool EventIDBase::isTimeStamp ( ) const

Definition at line 50 of file EventIDBase.cpp.

50 { return ( m_type & TimeStamp ); }
unsigned m_type
Definition: EventIDBase.h:179
bool EventIDBase::isValid ( ) const

Definition at line 56 of file EventIDBase.cpp.

56 { return ( m_type != Invalid ); }
unsigned m_type
Definition: EventIDBase.h:179
number_type EventIDBase::lumi_block ( ) const
inline

luminosity block identifier, 32 bit unsigned

Definition at line 61 of file EventIDBase.h.

61 { return 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:200
number_type EventIDBase::run_number ( ) const
inline

run number - 32 bit unsigned

Definition at line 49 of file EventIDBase.h.

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

set bunch crossing ID

Definition at line 101 of file EventIDBase.h.

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

set event number

Definition at line 75 of file EventIDBase.h.

76  {
77  m_event_number = eventNumber;
78  if ( m_run_number != UNDEFNUM ) setRE();
79  if ( m_lumi_block != UNDEFNUM ) setLE();
80  }
static const number_type UNDEFNUM
Definition: EventIDBase.h:34
void setLE()
Definition: EventIDBase.h:183
void setRE()
Definition: EventIDBase.h:181
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:200
number_type m_run_number
run number
Definition: EventIDBase.h:187
void EventIDBase::set_lumi_block ( number_type  lumiBlock)
inline

set luminosity block identifier

Definition at line 93 of file EventIDBase.h.

94  {
95  m_lumi_block = lumiBlock;
96  if ( m_run_number != UNDEFNUM ) setRL();
97  if ( m_event_number != UNDEFEVT ) setLE();
98  }
static const number_type UNDEFNUM
Definition: EventIDBase.h:34
void setLE()
Definition: EventIDBase.h:183
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
void setRL()
Definition: EventIDBase.h:184
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:200
number_type m_run_number
run number
Definition: EventIDBase.h:187
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:35
void EventIDBase::set_run_number ( number_type  runNumber)
inline

set run number

Definition at line 67 of file EventIDBase.h.

68  {
69  m_run_number = runNumber;
70  if ( m_event_number != UNDEFEVT ) setRE();
71  if ( m_lumi_block != UNDEFNUM ) setRL();
72  }
static const number_type UNDEFNUM
Definition: EventIDBase.h:34
void setRE()
Definition: EventIDBase.h:181
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
void setRL()
Definition: EventIDBase.h:184
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:200
number_type m_run_number
run number
Definition: EventIDBase.h:187
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:35
void EventIDBase::set_time_stamp ( number_type  timeStamp)
inline

set time stamp

Definition at line 83 of file EventIDBase.h.

84  {
85  m_time_stamp = timeStamp;
86  setTS();
87  }
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:193
void setTS()
Definition: EventIDBase.h:182
void EventIDBase::set_time_stamp_ns_offset ( number_type  timeStampNs)
inline

set time stamp in ns

Definition at line 90 of file EventIDBase.h.

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

Definition at line 183 of file EventIDBase.h.

void EventIDBase::setRE ( )
inlineprivate

Definition at line 181 of file EventIDBase.h.

void EventIDBase::setRL ( )
inlineprivate

Definition at line 184 of file EventIDBase.h.

void EventIDBase::setTS ( )
inlineprivate

Definition at line 182 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 55 of file EventIDBase.h.

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

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

Definition at line 58 of file EventIDBase.h.

58 { 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:196

Friends And Related Function Documentation

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

Definition at line 240 of file EventIDBase.h.

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

Comparison operators.

Definition at line 206 of file EventIDBase.h.

207 {
208  // first try ordering by timestamp if both are non-zero
209  // then try ordering by run/lumi/event
210  // this assumes that both EventIDBase have the same set of values defined.
211 
212  if ( lhs.isTimeStamp() && rhs.isTimeStamp() ) {
213  return ( lhs.m_time_stamp < rhs.m_time_stamp );
214  } else {
215  return ( std::tie( lhs.m_run_number, lhs.m_lumi_block, lhs.m_event_number ) <
217  }
218 }
T tie(T...args)
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:193
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:200
number_type m_run_number
run number
Definition: EventIDBase.h:187
bool isTimeStamp() const
Definition: EventIDBase.cpp:50
std::ostream& operator<< ( std::ostream os,
const EventIDBase rhs 
)
friend

Extraction operators.

Definition at line 244 of file EventIDBase.h.

245 {
246  if ( rhs.m_type == EventIDBase::Invalid ) {
247  os << "[INVALID]";
248  return os;
249  }
250 
251  os << "[" << rhs.m_run_number << "," << rhs.m_event_number;
252 
253  if ( rhs.isTimeStamp() ) {
254  os << "," << rhs.m_time_stamp << ":" << rhs.m_time_stamp_ns_offset;
255  }
256 
257  if ( rhs.isLumiEvent() || rhs.isRunLumi() ) {
258  os << ",l:" << rhs.m_lumi_block;
259  }
260 
261  if ( rhs.m_bunch_crossing_id != 0 ) {
262  os << ",b:" << rhs.m_bunch_crossing_id;
263  }
264  os << "]";
265  return os;
266 }
unsigned m_type
Definition: EventIDBase.h:179
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:196
bool isRunLumi() const
Definition: EventIDBase.cpp:54
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:203
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:193
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:200
number_type m_run_number
run number
Definition: EventIDBase.h:187
bool isTimeStamp() const
Definition: EventIDBase.cpp:50
bool isLumiEvent() const
Definition: EventIDBase.cpp:52
bool operator<= ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 241 of file EventIDBase.h.

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

Definition at line 234 of file EventIDBase.h.

235 {
236  // We assume that equality via run/event/lumi numbers is sufficient
237  return ( lhs.m_run_number == rhs.m_run_number && lhs.m_event_number == rhs.m_event_number &&
238  lhs.m_lumi_block == rhs.m_lumi_block );
239 }
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:200
number_type m_run_number
run number
Definition: EventIDBase.h:187
bool operator> ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 220 of file EventIDBase.h.

221 {
222  // first try ordering by timestamp if both are non-zero
223  // then try ordering by run/lumi/event
224  // this assumes that both EventIDBase have the same set of values defined.
225 
226  if ( lhs.isTimeStamp() && rhs.isTimeStamp() ) {
227  return ( lhs.m_time_stamp > rhs.m_time_stamp );
228  } else {
229  return ( std::tie( lhs.m_run_number, lhs.m_lumi_block, lhs.m_event_number ) >
231  }
232 }
T tie(T...args)
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:193
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:200
number_type m_run_number
run number
Definition: EventIDBase.h:187
bool isTimeStamp() const
Definition: EventIDBase.cpp:50
bool operator>= ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 242 of file EventIDBase.h.

242 { return !( lhs < rhs ); }

Member Data Documentation

number_type EventIDBase::m_bunch_crossing_id {UNDEFNUM}
private

bunch crossing ID, 32 bit unsigned

Definition at line 203 of file EventIDBase.h.

event_number_t EventIDBase::m_event_number {UNDEFEVT}
private

event number

Definition at line 190 of file EventIDBase.h.

number_type EventIDBase::m_lumi_block {UNDEFNUM}
private

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

Definition at line 200 of file EventIDBase.h.

number_type EventIDBase::m_run_number {UNDEFNUM}
private

run number

Definition at line 187 of file EventIDBase.h.

number_type EventIDBase::m_time_stamp {UNDEFNUM}
private

posix time in seconds since 1970/01/01

Definition at line 193 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 196 of file EventIDBase.h.

unsigned EventIDBase::m_type {Invalid}
private

Definition at line 179 of file EventIDBase.h.

const EventIDBase::event_number_t EventIDBase::UNDEFEVT = std::numeric_limits<EventIDBase::event_number_t>::max()
static

Definition at line 35 of file EventIDBase.h.

const EventIDBase::number_type EventIDBase::UNDEFNUM = std::numeric_limits<EventIDBase::number_type>::max()
static

Definition at line 34 of file EventIDBase.h.


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