The Gaudi Framework  v29r0 (ff2e7097)
EventIDBase.h File Reference

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

#include <iostream>
#include <stdint.h>
#include <tuple>
Include dependency graph for EventIDBase.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  EventIDBase
 This class provides a unique identification for each event, in terms of run/event number and/or a time stamp. More...
 
class  EventIDBase::SortByTimeStamp
 
class  EventIDBase::SortByRunEvent
 
class  EventIDBase::SortByLumiEvent
 
class  EventIDBase::SortByRunLumi
 

Functions

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)
 
bool operator>= (const EventIDBase &lhs, const EventIDBase &rhs)
 
std::ostreamoperator<< (std::ostream &os, const EventIDBase &rhs)
 

Detailed Description

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

Author
RD Schaffer R.D.S.nosp@m.chaf.nosp@m.fer@c.nosp@m.ern..nosp@m.ch
Paolo Calafiura pcala.nosp@m.fiur.nosp@m.a@lbl.nosp@m..gov
Charles Leggett

Definition in file EventIDBase.h.

Function Documentation

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

Definition at line 240 of file EventIDBase.h.

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

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 
)
inline

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 
)
inline

Definition at line 241 of file EventIDBase.h.

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

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 
)
inline

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 
)
inline

Definition at line 242 of file EventIDBase.h.

242 { return !( lhs < rhs ); }