| The Gaudi Framework v32r1 (f65d50dc)

Classes | Namespaces | Typedefs | Functions
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::ostream & | operator<< (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

## ◆ max()

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
220 std::tuple<EventIDBase::number_type, EventIDBase::number_type, EventIDBase::event_number_t> run_lumi_ev;
221 std::tuple<EventIDBase::number_type, EventIDBase::number_type> time_stamp;
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 ),
225 std::tie( rhs.m_time_stamp, rhs.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 ),
234 std::tie( rhs.m_run_number, rhs.m_lumi_block, rhs.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 }
EventIDBase::isRunLumi
bool isRunLumi() const
Definition: EventIDBase.h:146
std::tie
T tie(T... args)
EventIDBase::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:192
EventIDBase::m_event_number
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
EventIDBase::m_time_stamp
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
EventIDBase::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:196
EventIDBase::m_run_number
number_type m_run_number
run number
Definition: EventIDBase.h:183
std::max
T max(T... args)
std::tuple
EventIDBase
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:56
EventIDBase::bunch_crossing_id
number_type bunch_crossing_id() const
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:97
EventIDBase::isTimeStamp
bool isTimeStamp() const
Definition: EventIDBase.h:144

## ◆ min()

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
207 return EventIDBase( std::min( std::tie( lhs.m_run_number, lhs.m_lumi_block, lhs.m_event_number ),
208 std::tie( rhs.m_run_number, rhs.m_lumi_block, rhs.m_event_number ) ),
209 std::min( std::tie( lhs.m_time_stamp, lhs.m_time_stamp_ns_offset ),
210 std::tie( rhs.m_time_stamp, rhs.m_time_stamp_ns_offset ) ),
211 lhs.bunch_crossing_id() // bcid doesn't really matter here
212 );
213 }
std::tie
T tie(T... args)
EventIDBase::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:192
EventIDBase::m_event_number
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
EventIDBase::m_time_stamp
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
std::min
T min(T... args)
EventIDBase::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:196
EventIDBase::m_run_number
number_type m_run_number
run number
Definition: EventIDBase.h:183
EventIDBase
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:56
EventIDBase::bunch_crossing_id
number_type bunch_crossing_id() const
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:97

## ◆ operator<()

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 ) <
254 std::tie( rhs.m_run_number, rhs.m_lumi_block, rhs.m_event_number );
255 }
256 }
std::tie
T tie(T... args)
EventIDBase::m_event_number
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
EventIDBase::m_time_stamp
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
EventIDBase::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:196
EventIDBase::m_run_number
number_type m_run_number
run number
Definition: EventIDBase.h:183
EventIDBase::isTimeStamp
bool isTimeStamp() const
Definition: EventIDBase.h:144

## ◆ operator<<()

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 }
EventIDBase::UNDEFNUM
static const number_type UNDEFNUM
Definition: EventIDBase.h:61
EventIDBase::m_type
unsigned m_type
Definition: EventIDBase.h:175
EventIDBase::isRunLumi
bool isRunLumi() const
Definition: EventIDBase.h:146
EventIDBase::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:192
EventIDBase::m_bunch_crossing_id
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:199
EventIDBase::m_event_number
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
std::setw
T setw(T... args)
EventIDBase::m_time_stamp
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:189
EventIDBase::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:196
EventIDBase::Invalid
Definition: EventIDBase.h:173
std::setfill
T setfill(T... args)
EventIDBase::m_run_number
number_type m_run_number
run number
Definition: EventIDBase.h:183
EventIDBase::isLumiEvent
bool isLumiEvent() const
Definition: EventIDBase.h:145
EventIDBase::UNDEFEVT
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:62
EventIDBase::isTimeStamp
bool isTimeStamp() const
Definition: EventIDBase.h:144

## ◆ operator==()

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 }
EventIDBase::m_event_number
event_number_t m_event_number
event number
Definition: EventIDBase.h:186
EventIDBase::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:196
EventIDBase::m_run_number
number_type m_run_number
run number
Definition: EventIDBase.h:183