The Gaudi Framework  v30r3 (a5ef0a68)
EventIDBase Class Reference

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

#include <GaudiKernel/EventIDBase.h>

Public Types

typedef unsigned int number_type
 
typedef uint64_t event_number_t
 

Public Member Functions

number_type run_number () const
 run number - 32 bit unsigned More...
 
event_number_t event_number () const
 event number - 64 bit unsigned More...
 
number_type time_stamp () const
 time stamp - posix time in seconds from 1970, 32 bit unsigned More...
 
number_type time_stamp_ns_offset () const
 time stamp ns - ns time offset for time_stamp, 32 bit unsigned More...
 
number_type lumi_block () const
 luminosity block identifier, 32 bit unsigned More...
 
number_type bunch_crossing_id () const
 bunch crossing ID, 32 bit unsigned More...
 
void set_run_number (number_type runNumber)
 set run number More...
 
void set_event_number (event_number_t eventNumber)
 set event number More...
 
void set_time_stamp (number_type timeStamp)
 set time stamp More...
 
void set_time_stamp_ns_offset (number_type timeStampNs)
 set time stamp in ns More...
 
void set_lumi_block (number_type lumiBlock)
 set luminosity block identifier More...
 
void set_bunch_crossing_id (number_type bcid)
 set bunch crossing ID More...
 
bool isRunEvent () const
 
bool isTimeStamp () const
 
bool isLumiEvent () const
 
bool isRunLumi () const
 
bool isValid () const
 
structors
 EventIDBase ()
 
 EventIDBase (number_type run_number, event_number_t event_number, number_type time_stamp=UNDEFNUM, number_type time_stamp_ns_offset=0, number_type lumi_block=UNDEFNUM, number_type bunch_crossing_id=0)
 
virtual ~EventIDBase ()=default
 

Static Public Member Functions

static auto SortByTimeStamp ()
 
static auto SortByRunEvent ()
 
static auto SortByLumiEvent ()
 
static auto SortByRunLumi ()
 

Static Public Attributes

static const number_type UNDEFNUM = std::numeric_limits<EventIDBase::number_type>::max()
 
static const event_number_t UNDEFEVT = std::numeric_limits<EventIDBase::event_number_t>::max()
 

Private Types

enum  Type {
  Invalid = 0, RunEvent = 1 << 1, TimeStamp = 1 << 2, LumiEvent = 1 << 3,
  RunLumi = 1 << 4
}
 

Private Member Functions

void setRE ()
 
void setTS ()
 
void setLE ()
 
void setRL ()
 

Private Attributes

unsigned m_type {Invalid}
 
number_type m_run_number {UNDEFNUM}
 run number More...
 
event_number_t m_event_number {UNDEFEVT}
 event number More...
 
number_type m_time_stamp {UNDEFNUM}
 posix time in seconds since 1970/01/01 More...
 
number_type m_time_stamp_ns_offset {UNDEFNUM}
 time stamp ns - ns time offset for time_stamp, 32 bit unsigned More...
 
number_type m_lumi_block {UNDEFNUM}
 luminosity block number: the number which uniquely tags a luminosity block within a run More...
 
number_type m_bunch_crossing_id {UNDEFNUM}
 bunch crossing ID, 32 bit unsigned More...
 

Friends

bool operator== (const EventIDBase &lhs, const EventIDBase &rhs)
 Comparison operators. More...
 
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)
 Extraction operators. More...
 

Detailed Description

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

Definition at line 60 of file EventIDBase.h.

Member Typedef Documentation

Definition at line 64 of file EventIDBase.h.

typedef unsigned int EventIDBase::number_type

Definition at line 63 of file EventIDBase.h.

Member Enumeration Documentation

enum EventIDBase::Type
private
Enumerator
Invalid 
RunEvent 
TimeStamp 
LumiEvent 
RunLumi 

Definition at line 177 of file EventIDBase.h.

Constructor & Destructor Documentation

EventIDBase::EventIDBase ( )
inline

Definition at line 72 of file EventIDBase.h.

72 {};
EventIDBase::EventIDBase ( number_type  run_number,
event_number_t  event_number,
number_type  time_stamp = UNDEFNUM,
number_type  time_stamp_ns_offset = 0,
number_type  lumi_block = UNDEFNUM,
number_type  bunch_crossing_id = 0 
)

Definition at line 17 of file EventIDBase.cpp.

25 {
27 
28  if ( m_time_stamp != UNDEFNUM ) {
29  setTS();
31  }
32 
34 
36 }
static const number_type UNDEFNUM
Definition: EventIDBase.h:66
void setLE()
Definition: EventIDBase.h:183
number_type bunch_crossing_id() const
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:96
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:196
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:203
void setRE()
Definition: EventIDBase.h:181
number_type lumi_block() const
luminosity block identifier, 32 bit unsigned
Definition: EventIDBase.h:93
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
number_type time_stamp() const
time stamp - posix time in seconds from 1970, 32 bit unsigned
Definition: EventIDBase.h:87
void setRL()
Definition: EventIDBase.h:184
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
number_type run_number() const
run number - 32 bit unsigned
Definition: EventIDBase.h:81
number_type time_stamp_ns_offset() const
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:90
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:67
void setTS()
Definition: EventIDBase.h:182
event_number_t event_number() const
event number - 64 bit unsigned
Definition: EventIDBase.h:84
virtual EventIDBase::~EventIDBase ( )
virtualdefault

Member Function Documentation

number_type EventIDBase::bunch_crossing_id ( ) const
inline

bunch crossing ID, 32 bit unsigned

Definition at line 96 of file EventIDBase.h.

96 { return m_bunch_crossing_id; }
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:203
event_number_t EventIDBase::event_number ( ) const
inline

event number - 64 bit unsigned

Definition at line 84 of file EventIDBase.h.

84 { return m_event_number; }
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
bool EventIDBase::isLumiEvent ( ) const
inline

Definition at line 145 of file EventIDBase.h.

145 { return m_type & LumiEvent; }
unsigned m_type
Definition: EventIDBase.h:179
bool EventIDBase::isRunEvent ( ) const
inline

Definition at line 143 of file EventIDBase.h.

143 { return m_type & RunEvent; }
unsigned m_type
Definition: EventIDBase.h:179
bool EventIDBase::isRunLumi ( ) const
inline

Definition at line 146 of file EventIDBase.h.

146 { return m_type & RunLumi; }
unsigned m_type
Definition: EventIDBase.h:179
bool EventIDBase::isTimeStamp ( ) const
inline

Definition at line 144 of file EventIDBase.h.

144 { return m_type & TimeStamp; }
unsigned m_type
Definition: EventIDBase.h:179
bool EventIDBase::isValid ( ) const
inline

Definition at line 147 of file EventIDBase.h.

147 { return m_type != Invalid; }
unsigned m_type
Definition: EventIDBase.h:179
number_type EventIDBase::lumi_block ( ) const
inline

luminosity block identifier, 32 bit unsigned

Definition at line 93 of file EventIDBase.h.

93 { return 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:200
number_type EventIDBase::run_number ( ) const
inline

run number - 32 bit unsigned

Definition at line 81 of file EventIDBase.h.

81 { return m_run_number; }
number_type m_run_number
run number
Definition: EventIDBase.h:187
void EventIDBase::set_bunch_crossing_id ( number_type  bcid)
inline

set bunch crossing ID

Definition at line 133 of file EventIDBase.h.

133 { m_bunch_crossing_id = bcid; }
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:203
void EventIDBase::set_event_number ( event_number_t  eventNumber)
inline

set event number

Definition at line 107 of file EventIDBase.h.

108  {
109  m_event_number = eventNumber;
110  if ( m_run_number != UNDEFNUM ) setRE();
111  if ( m_lumi_block != UNDEFNUM ) setLE();
112  }
static const number_type UNDEFNUM
Definition: EventIDBase.h:66
void setLE()
Definition: EventIDBase.h:183
void setRE()
Definition: EventIDBase.h:181
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
void EventIDBase::set_lumi_block ( number_type  lumiBlock)
inline

set luminosity block identifier

Definition at line 125 of file EventIDBase.h.

126  {
127  m_lumi_block = lumiBlock;
128  if ( m_run_number != UNDEFNUM ) setRL();
129  if ( m_event_number != UNDEFEVT ) setLE();
130  }
static const number_type UNDEFNUM
Definition: EventIDBase.h:66
void setLE()
Definition: EventIDBase.h:183
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
void setRL()
Definition: EventIDBase.h:184
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
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:67
void EventIDBase::set_run_number ( number_type  runNumber)
inline

set run number

Definition at line 99 of file EventIDBase.h.

100  {
101  m_run_number = runNumber;
102  if ( m_event_number != UNDEFEVT ) setRE();
103  if ( m_lumi_block != UNDEFNUM ) setRL();
104  }
static const number_type UNDEFNUM
Definition: EventIDBase.h:66
void setRE()
Definition: EventIDBase.h:181
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
void setRL()
Definition: EventIDBase.h:184
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
static const event_number_t UNDEFEVT
Definition: EventIDBase.h:67
void EventIDBase::set_time_stamp ( number_type  timeStamp)
inline

set time stamp

Definition at line 115 of file EventIDBase.h.

116  {
117  m_time_stamp = timeStamp;
118  setTS();
119  }
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:193
void setTS()
Definition: EventIDBase.h:182
void EventIDBase::set_time_stamp_ns_offset ( number_type  timeStampNs)
inline

set time stamp in ns

Definition at line 122 of file EventIDBase.h.

122 { m_time_stamp_ns_offset = timeStampNs; }
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:196
void EventIDBase::setLE ( )
inlineprivate

Definition at line 183 of file EventIDBase.h.

void EventIDBase::setRE ( )
inlineprivate

Definition at line 181 of file EventIDBase.h.

void EventIDBase::setRL ( )
inlineprivate

Definition at line 184 of file EventIDBase.h.

void EventIDBase::setTS ( )
inlineprivate

Definition at line 182 of file EventIDBase.h.

static auto EventIDBase::SortByLumiEvent ( )
inlinestatic

Definition at line 164 of file EventIDBase.h.

165  {
166  return details::add_deref(
167  details::make_cmp( []( const EventIDBase& e ) { return std::tie( e.m_lumi_block, e.m_event_number ); } ) );
168  };
T tie(T...args)
auto add_deref(Fun f)
Definition: EventIDBase.h:38
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
auto make_cmp(Proj p, Cmp cmp={})
Definition: EventIDBase.h:44
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:60
static auto EventIDBase::SortByRunEvent ( )
inlinestatic

Definition at line 158 of file EventIDBase.h.

159  {
160  return details::add_deref(
161  details::make_cmp( []( const EventIDBase& e ) { return std::tie( e.m_run_number, e.m_event_number ); } ) );
162  };
T tie(T...args)
auto add_deref(Fun f)
Definition: EventIDBase.h:38
event_number_t m_event_number
event number
Definition: EventIDBase.h:190
number_type m_run_number
run number
Definition: EventIDBase.h:187
auto make_cmp(Proj p, Cmp cmp={})
Definition: EventIDBase.h:44
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:60
static auto EventIDBase::SortByRunLumi ( )
inlinestatic

Definition at line 170 of file EventIDBase.h.

171  {
172  return details::add_deref(
173  details::make_cmp( []( const EventIDBase& e ) { return std::tie( e.m_run_number, e.m_lumi_block ); } ) );
174  };
T tie(T...args)
auto add_deref(Fun f)
Definition: EventIDBase.h:38
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
auto make_cmp(Proj p, Cmp cmp={})
Definition: EventIDBase.h:44
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:60
static auto EventIDBase::SortByTimeStamp ( )
inlinestatic

Definition at line 152 of file EventIDBase.h.

153  {
155  []( const EventIDBase& e ) { return std::tie( e.m_time_stamp, e.m_time_stamp_ns_offset ); } ) );
156  };
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:196
auto add_deref(Fun f)
Definition: EventIDBase.h:38
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:193
auto make_cmp(Proj p, Cmp cmp={})
Definition: EventIDBase.h:44
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventIDBase.h:60
number_type EventIDBase::time_stamp ( ) const
inline

time stamp - posix time in seconds from 1970, 32 bit unsigned

Definition at line 87 of file EventIDBase.h.

87 { return m_time_stamp; }
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:193
number_type EventIDBase::time_stamp_ns_offset ( ) const
inline

time stamp ns - ns time offset for time_stamp, 32 bit unsigned

Definition at line 90 of file EventIDBase.h.

90 { return 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:196

Friends And Related Function Documentation

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

Definition at line 139 of file EventIDBase.h.

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

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

Extraction operators.

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

Definition at line 140 of file EventIDBase.h.

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

Comparison operators.

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
bool operator> ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 138 of file EventIDBase.h.

138 { return rhs < lhs; }
bool operator>= ( const EventIDBase lhs,
const EventIDBase rhs 
)
friend

Definition at line 141 of file EventIDBase.h.

141 { return !( lhs < rhs ); }

Member Data Documentation

number_type EventIDBase::m_bunch_crossing_id {UNDEFNUM}
private

bunch crossing ID, 32 bit unsigned

Definition at line 203 of file EventIDBase.h.

event_number_t EventIDBase::m_event_number {UNDEFEVT}
private

event number

Definition at line 190 of file EventIDBase.h.

number_type EventIDBase::m_lumi_block {UNDEFNUM}
private

luminosity block number: the number which uniquely tags a luminosity block within a run

Definition at line 200 of file EventIDBase.h.

number_type EventIDBase::m_run_number {UNDEFNUM}
private

run number

Definition at line 187 of file EventIDBase.h.

number_type EventIDBase::m_time_stamp {UNDEFNUM}
private

posix time in seconds since 1970/01/01

Definition at line 193 of file EventIDBase.h.

number_type EventIDBase::m_time_stamp_ns_offset {UNDEFNUM}
private

time stamp ns - ns time offset for time_stamp, 32 bit unsigned

Definition at line 196 of file EventIDBase.h.

unsigned EventIDBase::m_type {Invalid}
private

Definition at line 179 of file EventIDBase.h.

const EventIDBase::event_number_t EventIDBase::UNDEFEVT = std::numeric_limits<EventIDBase::event_number_t>::max()
static

Definition at line 67 of file EventIDBase.h.

const EventIDBase::number_type EventIDBase::UNDEFNUM = std::numeric_limits<EventIDBase::number_type>::max()
static

Definition at line 66 of file EventIDBase.h.


The documentation for this class was generated from the following files: