The Gaudi Framework  v29r3 (fa547fc2)
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 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 
RunLumi 

Definition at line 178 of file EventIDBase.h.

Constructor & Destructor Documentation

EventIDBase::EventIDBase ( )
inline

Definition at line 41 of file EventIDBase.h.

41 {};
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:35
void setLE()
Definition: EventIDBase.h:184
number_type bunch_crossing_id() const
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:65
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:197
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:204
void setRE()
Definition: EventIDBase.h:182
number_type lumi_block() const
luminosity block identifier, 32 bit unsigned
Definition: EventIDBase.h:62
event_number_t m_event_number
event number
Definition: EventIDBase.h:191
number_type time_stamp() const
time stamp - posix time in seconds from 1970, 32 bit unsigned
Definition: EventIDBase.h:56
void setRL()
Definition: EventIDBase.h:185
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:194
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:201
number_type m_run_number
run number
Definition: EventIDBase.h:188
number_type run_number() const
run number - 32 bit unsigned
Definition: EventIDBase.h:50
number_type time_stamp_ns_offset() const
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:59
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:36
void setTS()
Definition: EventIDBase.h:183
event_number_t event_number() const
event number - 64 bit unsigned
Definition: EventIDBase.h:53
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 65 of file EventIDBase.h.

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

event number - 64 bit unsigned

Definition at line 53 of file EventIDBase.h.

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

Definition at line 52 of file EventIDBase.cpp.

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

Definition at line 48 of file EventIDBase.cpp.

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

Definition at line 54 of file EventIDBase.cpp.

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

Definition at line 50 of file EventIDBase.cpp.

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

Definition at line 56 of file EventIDBase.cpp.

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

luminosity block identifier, 32 bit unsigned

Definition at line 62 of file EventIDBase.h.

62 { 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:201
number_type EventIDBase::run_number ( ) const
inline

run number - 32 bit unsigned

Definition at line 50 of file EventIDBase.h.

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

set bunch crossing ID

Definition at line 102 of file EventIDBase.h.

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

set event number

Definition at line 76 of file EventIDBase.h.

77  {
78  m_event_number = eventNumber;
79  if ( m_run_number != UNDEFNUM ) setRE();
80  if ( m_lumi_block != UNDEFNUM ) setLE();
81  }
static const number_type UNDEFNUM
Definition: EventIDBase.h:35
void setLE()
Definition: EventIDBase.h:184
void setRE()
Definition: EventIDBase.h:182
event_number_t m_event_number
event number
Definition: EventIDBase.h:191
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:201
number_type m_run_number
run number
Definition: EventIDBase.h:188
void EventIDBase::set_lumi_block ( number_type  lumiBlock)
inline

set luminosity block identifier

Definition at line 94 of file EventIDBase.h.

95  {
96  m_lumi_block = lumiBlock;
97  if ( m_run_number != UNDEFNUM ) setRL();
98  if ( m_event_number != UNDEFEVT ) setLE();
99  }
static const number_type UNDEFNUM
Definition: EventIDBase.h:35
void setLE()
Definition: EventIDBase.h:184
event_number_t m_event_number
event number
Definition: EventIDBase.h:191
void setRL()
Definition: EventIDBase.h:185
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:201
number_type m_run_number
run number
Definition: EventIDBase.h:188
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:36
void EventIDBase::set_run_number ( number_type  runNumber)
inline

set run number

Definition at line 68 of file EventIDBase.h.

69  {
70  m_run_number = runNumber;
71  if ( m_event_number != UNDEFEVT ) setRE();
72  if ( m_lumi_block != UNDEFNUM ) setRL();
73  }
static const number_type UNDEFNUM
Definition: EventIDBase.h:35
void setRE()
Definition: EventIDBase.h:182
event_number_t m_event_number
event number
Definition: EventIDBase.h:191
void setRL()
Definition: EventIDBase.h:185
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:201
number_type m_run_number
run number
Definition: EventIDBase.h:188
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:36
void EventIDBase::set_time_stamp ( number_type  timeStamp)
inline

set time stamp

Definition at line 84 of file EventIDBase.h.

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

set time stamp in ns

Definition at line 91 of file EventIDBase.h.

91 { 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:197
void EventIDBase::setLE ( )
inlineprivate

Definition at line 184 of file EventIDBase.h.

void EventIDBase::setRE ( )
inlineprivate

Definition at line 182 of file EventIDBase.h.

void EventIDBase::setRL ( )
inlineprivate

Definition at line 185 of file EventIDBase.h.

void EventIDBase::setTS ( )
inlineprivate

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

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

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

Definition at line 59 of file EventIDBase.h.

59 { 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:197

Friends And Related Function Documentation

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

Comparison operators.

Definition at line 207 of file EventIDBase.h.

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

Extraction operators.

Definition at line 245 of file EventIDBase.h.

246 {
247  if ( rhs.m_type == EventIDBase::Invalid ) {
248  os << "[INVALID]";
249  return os;
250  }
251 
252  os << "[" << rhs.m_run_number;
253 
254  if ( rhs.m_event_number != EventIDBase::UNDEFEVT ) {
255  os << "," << rhs.m_event_number;
256  }
257 
258  if ( rhs.isTimeStamp() ) {
259  os << ",t:" << rhs.m_time_stamp;
260  if ( rhs.m_time_stamp_ns_offset != 0 ) {
261  os << "." << std::setfill( '0' ) << std::setw( 9 ) << rhs.m_time_stamp_ns_offset;
262  }
263  }
264 
265  if ( rhs.isLumiEvent() || rhs.isRunLumi() ) {
266  os << ",l:" << rhs.m_lumi_block;
267  }
268 
269  if ( rhs.m_bunch_crossing_id != 0 ) {
270  os << ",b:" << rhs.m_bunch_crossing_id;
271  }
272  os << "]";
273  return os;
274 }
unsigned m_type
Definition: EventIDBase.h:180
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:197
bool isRunLumi() const
Definition: EventIDBase.cpp:54
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:204
event_number_t m_event_number
event number
Definition: EventIDBase.h:191
T setw(T...args)
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:194
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:201
T setfill(T...args)
number_type m_run_number
run number
Definition: EventIDBase.h:188
bool isTimeStamp() const
Definition: EventIDBase.cpp:50
bool isLumiEvent() const
Definition: EventIDBase.cpp:52
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:36
bool operator<= ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 242 of file EventIDBase.h.

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

Definition at line 235 of file EventIDBase.h.

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

Definition at line 221 of file EventIDBase.h.

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

Definition at line 243 of file EventIDBase.h.

243 { return !( lhs < rhs ); }

Member Data Documentation

number_type EventIDBase::m_bunch_crossing_id {UNDEFNUM}
private

bunch crossing ID, 32 bit unsigned

Definition at line 204 of file EventIDBase.h.

event_number_t EventIDBase::m_event_number {UNDEFEVT}
private

event number

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

number_type EventIDBase::m_run_number {UNDEFNUM}
private

run number

Definition at line 188 of file EventIDBase.h.

number_type EventIDBase::m_time_stamp {UNDEFNUM}
private

posix time in seconds since 1970/01/01

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

unsigned EventIDBase::m_type {Invalid}
private

Definition at line 180 of file EventIDBase.h.

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

Definition at line 36 of file EventIDBase.h.

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

Definition at line 35 of file EventIDBase.h.


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