The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
EventIDRange.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
21
23#include <iostream>
24#include <sstream>
25#include <string>
26
31
33public:
38
39 const EventIDBase& start() const { return m_start; }
40 const EventIDBase& stop() const { return m_stop; }
41
42 bool isInRange( const EventIDBase& t ) const { // return ( t >= m_start && t < m_stop ); }
43 return ( std::tie( t.m_run_number, t.m_lumi_block, t.m_event_number ) >= // run/lumi larger than run/lumi of start
44 std::tie( m_start.m_run_number, m_start.m_lumi_block, m_start.m_event_number ) &&
45
46 std::tie( t.m_run_number, t.m_lumi_block, t.m_event_number ) < // run/lumi smaller than run/lumi of stop
47 std::tie( m_stop.m_run_number, m_stop.m_lumi_block, m_stop.m_event_number ) &&
48
49 std::tie( t.m_time_stamp, t.m_time_stamp_ns_offset ) >= // time-stamp larger than time-stamp of start
50 std::tie( m_start.m_time_stamp, m_start.m_time_stamp_ns_offset ) &&
51
52 std::tie( t.m_time_stamp, t.m_time_stamp_ns_offset ) < // time-stap smaller than time-tamp of stop
53 std::tie( m_stop.m_time_stamp, m_stop.m_time_stamp_ns_offset ) );
54 }
55
56 static EventIDRange intersect( const EventIDRange& it ) { return it; }
57 template <typename... T>
58 static EventIDRange intersect( const EventIDRange& first, const T&... rest ) {
59 EventIDRange r = intersect( rest... );
60
61 EventIDBase i1 = max( first.start(), r.start() );
62 EventIDBase i2 = min( first.stop(), r.stop() );
63
64 return EventIDRange( i1, i2 );
65 }
66
67 friend bool operator==( const EventIDRange& lhs, const EventIDRange& rhs );
68 friend bool operator!=( const EventIDRange& lhs, const EventIDRange& rhs );
69
70 friend std::ostream& operator<<( std::ostream& os, const EventIDRange& rhs );
71
72 operator std::string() const;
73
74private:
77};
78
79inline bool operator==( const EventIDRange& lhs, const EventIDRange& rhs ) {
80 return lhs.m_start == rhs.m_start && lhs.m_stop == rhs.m_stop;
81}
82
83inline bool operator!=( const EventIDRange& lhs, const EventIDRange& rhs ) { return !( lhs == rhs ); }
84
85inline EventIDRange::operator std::string() const {
86 std::ostringstream os;
87 os << "{" << m_start << " - " << m_stop << "}";
88 return os.str();
89}
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
bool operator==(const EventIDRange &lhs, const EventIDRange &rhs)
bool operator!=(const EventIDRange &lhs, const EventIDRange &rhs)
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition EventIDBase.h:65
Event ID Range object.
const EventIDBase & start() const
bool isInRange(const EventIDBase &t) const
static EventIDRange intersect(const EventIDRange &first, const T &... rest)
EventIDBase m_stop
EventIDRange & operator=(const EventIDRange &r)
const EventIDBase & stop() const
friend bool operator==(const EventIDRange &lhs, const EventIDRange &rhs)
EventIDBase m_start
friend std::ostream & operator<<(std::ostream &os, const EventIDRange &rhs)
static EventIDRange intersect(const EventIDRange &it)
friend bool operator!=(const EventIDRange &lhs, const EventIDRange &rhs)
EventIDRange(const EventIDRange &r)