Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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={})
 
EventIDBase min (const EventIDBase &lhs, const EventIDBase &rhs)
 
EventIDBase max (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

EventIDBase max ( const EventIDBase lhs,
const EventIDBase rhs 
)
inline

Definition at line 215 of file EventIDBase.h.

215  {
216 
217  //"max" is much trickier because we need to handle invalid number explicilty by
218  // checking if a EventIDBase is TS or Run/Lumi
219 
222 
223  if ( lhs.isTimeStamp() && rhs.isTimeStamp() ) { // both time-stamp, compare them
224  time_stamp = std::max( std::tie( lhs.m_time_stamp, lhs.m_time_stamp_ns_offset ),
226  } else if ( lhs.isTimeStamp() ) { // only lhs time-stamp: Use it
227  time_stamp = std::tie( lhs.m_time_stamp, lhs.m_time_stamp_ns_offset );
228  } else { // otherwise use rhs time-stamp which might be UNDEFNUM (in case both input values are Run-Lumi only)
229  time_stamp = std::tie( rhs.m_time_stamp, rhs.m_time_stamp_ns_offset );
230  }
231 
232  if ( lhs.isRunLumi() && rhs.isRunLumi() ) { // both run-lumi, compare them
233  run_lumi_ev = std::max( std::tie( lhs.m_run_number, lhs.m_lumi_block, lhs.m_event_number ),
235 
236  } else if ( lhs.isRunLumi() ) { // only lhs run-lumi: Use it
237  run_lumi_ev = std::tie( lhs.m_run_number, lhs.m_lumi_block, lhs.m_event_number );
238  } else { // otherwise use rhs run-lumi which might be UNDEFNUM (in case both input values are TS-only)
239  run_lumi_ev = std::tie( rhs.m_run_number, rhs.m_lumi_block, rhs.m_event_number );
240  }
241 
242  return EventIDBase( run_lumi_ev, time_stamp, lhs.bunch_crossing_id() );
243 }
number_type bunch_crossing_id() const
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:97
T tie(T...args)
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:192
bool isRunLumi() const
Definition: EventIDBase.h:146
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:196
number_type m_run_number
run number
Definition: EventIDBase.h:183
T max(T...args)
bool isTimeStamp() const
Definition: EventIDBase.h:144
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:56
EventIDBase min ( const EventIDBase lhs,
const EventIDBase rhs 
)
inline

Definition at line 202 of file EventIDBase.h.

202  {
203 
204  //"min" is easy b/c the numbers denoting invalidty for TS or Run/Event/LB are the
205  // largest possible numbers, so naturally larger than any valid number
206 
211  lhs.bunch_crossing_id() // bcid doesn't really matter here
212  );
213 }
number_type bunch_crossing_id() const
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:97
T tie(T...args)
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:192
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
T min(T...args)
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:196
number_type m_run_number
run number
Definition: EventIDBase.h:183
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:56
bool operator< ( const EventIDBase lhs,
const EventIDBase rhs 
)
inline

Definition at line 245 of file EventIDBase.h.

245  {
246  // first try ordering by timestamp if both are non-zero
247  // then try ordering by run/lumi/event
248  // this assumes that both EventIDBase have the same set of values defined.
249 
250  if ( lhs.isTimeStamp() && rhs.isTimeStamp() ) {
251  return lhs.m_time_stamp < rhs.m_time_stamp;
252  } else {
253  return std::tie( lhs.m_run_number, lhs.m_lumi_block, lhs.m_event_number ) <
255  }
256 }
T tie(T...args)
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:196
number_type m_run_number
run number
Definition: EventIDBase.h:183
bool isTimeStamp() const
Definition: EventIDBase.h:144
std::ostream& operator<< ( std::ostream os,
const EventIDBase rhs 
)
inline

Definition at line 264 of file EventIDBase.h.

264  {
265  if ( rhs.m_type == EventIDBase::Invalid ) return os << "[INVALID]";
266 
267  const char* separator = "";
268  os << "[";
269  if ( rhs.m_run_number != EventIDBase::UNDEFNUM ) {
270  os << rhs.m_run_number;
271  separator = ",";
272  }
273 
274  if ( rhs.m_event_number != EventIDBase::UNDEFEVT ) {
275  os << separator << rhs.m_event_number;
276  separator = ",";
277  }
278 
279  if ( rhs.isTimeStamp() ) {
280  os << separator << "t:" << rhs.m_time_stamp;
281  if ( rhs.m_time_stamp_ns_offset != 0 ) {
282  os << "." << std::setfill( '0' ) << std::setw( 9 ) << rhs.m_time_stamp_ns_offset;
283  }
284  separator = ",";
285  }
286 
287  if ( rhs.isLumiEvent() || rhs.isRunLumi() ) {
288  os << separator << "l:" << rhs.m_lumi_block;
289  separator = ",";
290  }
291 
292  if ( rhs.m_bunch_crossing_id != 0 ) { os << separator << "b:" << rhs.m_bunch_crossing_id; }
293  os << "]";
294  return os;
295 }
static const number_type UNDEFNUM
Definition: EventIDBase.h:61
unsigned m_type
Definition: EventIDBase.h:175
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:192
bool isRunLumi() const
Definition: EventIDBase.h:146
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:199
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
T setw(T...args)
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:196
T setfill(T...args)
number_type m_run_number
run number
Definition: EventIDBase.h:183
bool isTimeStamp() const
Definition: EventIDBase.h:144
bool isLumiEvent() const
Definition: EventIDBase.h:145
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:62
bool operator== ( const EventIDBase lhs,
const EventIDBase rhs 
)
inline

Definition at line 258 of file EventIDBase.h.

258  {
259  // We assume that equality via run/event/lumi numbers is sufficient
260  return ( lhs.m_run_number == rhs.m_run_number && lhs.m_event_number == rhs.m_event_number &&
261  lhs.m_lumi_block == rhs.m_lumi_block );
262 }
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
number_type m_lumi_block
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:196
number_type m_run_number
run number
Definition: EventIDBase.h:183