The Gaudi Framework  v30r0 (c919700c)
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 <iomanip>
#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 241 of file EventIDBase.h.

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

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

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

Definition at line 242 of file EventIDBase.h.

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

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

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

Definition at line 243 of file EventIDBase.h.

243 { return !( lhs < rhs ); }