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 <iostream>
#include <tuple>
#include <stdint.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

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
 

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 211 of file EventIDBase.h.

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

Definition at line 185 of file EventIDBase.h.

185  {
186  // first try ordering by timestamp if both are non-zero
187  // then try ordering by lumi/event if both have non-zero lumi
188  // then order by run/event
189 
190  if (lhs.isTimeStamp() && rhs.isTimeStamp()) {
191  return (lhs.m_time_stamp < rhs.m_time_stamp);
192  } else {
193  if (lhs.isLumiEvent() && rhs.isLumiEvent()) {
194  return (std::tie(lhs.m_lumiBlock, lhs.m_event_number) <
195  std::tie(rhs.m_lumiBlock, rhs.m_event_number) );
196  } else {
197  return (std::tie(lhs.m_run_number, lhs.m_event_number) <
199  }
200  }
201 }
number_type m_lumiBlock
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:178
T tie(T...args)
event_number_t m_event_number
event number
Definition: EventIDBase.h:168
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:171
number_type m_run_number
run number
Definition: EventIDBase.h:165
bool isTimeStamp() const
Definition: EventIDBase.cpp:59
bool isLumiEvent() const
Definition: EventIDBase.cpp:64
std::ostream& operator<< ( std::ostream os,
const EventIDBase rhs 
)
inline

Definition at line 221 of file EventIDBase.h.

221  {
222  if (rhs.m_type == EventIDBase::Invalid) {
223  os << "[INVALID]";
224  return os;
225  }
226 
227  os << "["
228  << rhs.m_run_number
229  << "," << rhs.m_event_number;
230 
231  if ( rhs.isTimeStamp() != 0 ) {
232  os << "," << rhs.m_time_stamp << ":" << rhs.m_time_stamp_ns_offset;
233  }
234 
235  if ( rhs.isLumiEvent() != 0) {
236  os << ",l:" << rhs.m_lumiBlock;
237  }
238 
239  if ( rhs.m_bunch_crossing_id != 0) {
240  os << ",b:" << rhs.m_bunch_crossing_id;
241  }
242  os << "]";
243  return os;
244 }
unsigned m_type
Definition: EventIDBase.h:158
number_type m_lumiBlock
luminosity block number: the number which uniquely tags a luminosity block within a run ...
Definition: EventIDBase.h:178
number_type m_time_stamp_ns_offset
time stamp ns - ns time offset for time_stamp, 32 bit unsigned
Definition: EventIDBase.h:174
number_type m_bunch_crossing_id
bunch crossing ID, 32 bit unsigned
Definition: EventIDBase.h:181
event_number_t m_event_number
event number
Definition: EventIDBase.h:168
number_type m_time_stamp
posix time in seconds since 1970/01/01
Definition: EventIDBase.h:171
number_type m_run_number
run number
Definition: EventIDBase.h:165
bool isTimeStamp() const
Definition: EventIDBase.cpp:59
bool isLumiEvent() const
Definition: EventIDBase.cpp:64
bool operator<= ( const EventIDBase lhs,
const EventIDBase rhs 
)
inline

Definition at line 214 of file EventIDBase.h.

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

Definition at line 203 of file EventIDBase.h.

203  {
204  // We assume that equality via run/event numbers is sufficient
205  return ( lhs.m_run_number == rhs.m_run_number &&
206  lhs.m_event_number == rhs.m_event_number );
207 }
event_number_t m_event_number
event number
Definition: EventIDBase.h:168
number_type m_run_number
run number
Definition: EventIDBase.h:165
bool operator> ( const EventIDBase lhs,
const EventIDBase rhs 
)
inline

Definition at line 208 of file EventIDBase.h.

208  {
209  return !( (lhs < rhs) || (lhs == rhs));
210 }
bool operator>= ( const EventIDBase lhs,
const EventIDBase rhs 
)
inline

Definition at line 217 of file EventIDBase.h.

217  {
218  return !(lhs < rhs);
219 }