The Gaudi Framework  v30r3 (a5ef0a68)
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 <cstdint>
#include <iomanip>
#include <iostream>
#include <tuple>
#include "GaudiKernel/compose.h"
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

struct  details::arg_helper< lambda >
 
struct  details::arg_helper< Ret(T::*)(Arg) const >
 
class  EventIDBase
 This class provides a unique identification for each event, in terms of run/event number and/or a time stamp. More...
 

Namespaces

 details
 

Typedefs

template<typename lambda >
using details::argument_t = typename arg_helper< lambda >::type
 

Functions

template<typename Fun >
auto details::add_deref (Fun f)
 
template<typename Proj , typename Cmp = std::greater<>>
auto details::make_cmp (Proj p, Cmp cmp={})
 
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 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.h:144
std::ostream& operator<< ( std::ostream os,
const EventIDBase rhs 
)
inline

Definition at line 227 of file EventIDBase.h.

228 {
229  if ( rhs.m_type == EventIDBase::Invalid ) return os << "[INVALID]";
230 
231  const char* separator = "";
232  os << "[";
233  if ( rhs.m_run_number != EventIDBase::UNDEFNUM ) {
234  os << rhs.m_run_number;
235  separator = ",";
236  }
237 
238  if ( rhs.m_event_number != EventIDBase::UNDEFEVT ) {
239  os << separator << rhs.m_event_number;
240  separator = ",";
241  }
242 
243  if ( rhs.isTimeStamp() ) {
244  os << separator << "t:" << rhs.m_time_stamp;
245  if ( rhs.m_time_stamp_ns_offset != 0 ) {
246  os << "." << std::setfill( '0' ) << std::setw( 9 ) << rhs.m_time_stamp_ns_offset;
247  }
248  separator = ",";
249  }
250 
251  if ( rhs.isLumiEvent() || rhs.isRunLumi() ) {
252  os << separator << "l:" << rhs.m_lumi_block;
253  separator = ",";
254  }
255 
256  if ( rhs.m_bunch_crossing_id != 0 ) {
257  os << separator << "b:" << rhs.m_bunch_crossing_id;
258  }
259  os << "]";
260  return os;
261 }
static const number_type UNDEFNUM
Definition: EventIDBase.h:66
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.h:146
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
T setw(T...args)
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
T setfill(T...args)
number_type m_run_number
run number
Definition: EventIDBase.h:187
bool isTimeStamp() const
Definition: EventIDBase.h:144
bool isLumiEvent() const
Definition: EventIDBase.h:145
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:67
bool operator== ( const EventIDBase lhs,
const EventIDBase rhs 
)
inline

Definition at line 220 of file EventIDBase.h.

221 {
222  // We assume that equality via run/event/lumi numbers is sufficient
223  return ( lhs.m_run_number == rhs.m_run_number && lhs.m_event_number == rhs.m_event_number &&
224  lhs.m_lumi_block == rhs.m_lumi_block );
225 }
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