LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::EventRange Class Reference

#include "EventRange.h"

Public Member Functions

 EventRange ()=default
 
 EventRange (SubRunNumber_t s, EventNumber_t begin, EventNumber_t end)
 
bool operator< (EventRange const &other) const
 
bool operator== (EventRange const &other) const
 
bool operator!= (EventRange const &other) const
 
auto subRun () const
 
bool empty () const
 
auto begin () const
 
auto end () const
 
auto size () const
 
bool is_valid () const
 
bool is_full_subRun () const
 
bool contains (SubRunNumber_t s, EventNumber_t e) const
 
bool is_same (EventRange const &other) const
 
bool is_adjacent (EventRange const &other) const
 
bool is_disjoint (EventRange const &other) const
 
bool is_subset (EventRange const &other) const
 
bool is_superset (EventRange const &other) const
 
bool is_overlapping (EventRange const &other) const
 
bool merge (EventRange const &other)
 
void set_end (EventNumber_t const e)
 

Static Public Member Functions

static EventRange invalid ()
 
static EventRange forSubRun (SubRunNumber_t s)
 
static bool are_valid (EventRange const &l, EventRange const &r)
 

Private Member Functions

void require_not_full_SubRun ()
 

Private Attributes

SubRunNumber_t subRun_ {IDNumber<Level::SubRun>::invalid()}
 
EventNumber_t begin_ {IDNumber<Level::Event>::invalid()}
 
EventNumber_t end_ {IDNumber<Level::Event>::invalid()}
 

Detailed Description

Definition at line 16 of file EventRange.h.

Constructor & Destructor Documentation

art::EventRange::EventRange ( )
explicitdefault
EventRange::EventRange ( SubRunNumber_t  s,
EventNumber_t  begin,
EventNumber_t  end 
)
explicit

Definition at line 30 of file EventRange.cc.

References begin_, e, and end_.

33  : subRun_{s}, begin_{b}, end_{e}
34 {
35  require_ordering(begin_, end_);
36 }
Float_t s
Definition: plot.C:23
SubRunNumber_t subRun_
Definition: EventRange.h:86
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
Float_t e
Definition: plot.C:34

Member Function Documentation

bool EventRange::are_valid ( EventRange const &  l,
EventRange const &  r 
)
static

Definition at line 93 of file EventRange.cc.

References is_valid().

Referenced by is_adjacent(), is_disjoint(), is_overlapping(), is_same(), is_subset(), is_superset(), merge(), and size().

94 {
95  return l.is_valid() && r.is_valid();
96 }
auto art::EventRange::begin ( ) const
inline

Definition at line 42 of file EventRange.h.

References begin_.

Referenced by art::operator<<().

43  {
44  return begin_;
45  }
EventNumber_t begin_
Definition: EventRange.h:87
bool EventRange::contains ( SubRunNumber_t  s,
EventNumber_t  e 
) const

Definition at line 87 of file EventRange.cc.

References begin_, end_, and subRun_.

Referenced by size().

88 {
89  return subRun_ == s && e >= begin_ && e < end_;
90 }
Float_t s
Definition: plot.C:23
SubRunNumber_t subRun_
Definition: EventRange.h:86
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
Float_t e
Definition: plot.C:34
bool art::EventRange::empty ( void  ) const
inline

Definition at line 37 of file EventRange.h.

References begin_, and end_.

38  {
39  return begin_ == end_;
40  }
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
auto art::EventRange::end ( void  ) const
inline

Definition at line 47 of file EventRange.h.

References end_.

Referenced by art::operator<<().

48  {
49  return end_;
50  }
EventNumber_t end_
Definition: EventRange.h:88
EventRange EventRange::forSubRun ( SubRunNumber_t  s)
static

Definition at line 25 of file EventRange.cc.

References s.

Referenced by art::RangeSet::forSubRun().

26 {
28 }
Float_t s
Definition: plot.C:23
static constexpr type invalid()
Definition: IDNumber.h:16
EventRange EventRange::invalid ( )
static

Definition at line 19 of file EventRange.cc.

20 {
21  return EventRange{};
22 }
bool EventRange::is_adjacent ( EventRange const &  other) const

Definition at line 112 of file EventRange.cc.

References are_valid(), begin_, end_, and subRun_.

Referenced by merge(), and size().

113 {
114  if (!are_valid(*this, other))
115  return false;
116  return subRun_ == other.subRun_ && end_ == other.begin_;
117 }
SubRunNumber_t subRun_
Definition: EventRange.h:86
static bool are_valid(EventRange const &l, EventRange const &r)
Definition: EventRange.cc:93
EventNumber_t end_
Definition: EventRange.h:88
bool EventRange::is_disjoint ( EventRange const &  other) const

Definition at line 120 of file EventRange.cc.

References are_valid(), begin_, end_, and subRun_.

Referenced by is_overlapping(), and size().

121 {
122  if (!are_valid(*this, other))
123  return false;
124  return (subRun_ == other.subRun_) ? end_ <= other.begin_ : true;
125 }
SubRunNumber_t subRun_
Definition: EventRange.h:86
static bool are_valid(EventRange const &l, EventRange const &r)
Definition: EventRange.cc:93
EventNumber_t end_
Definition: EventRange.h:88
bool EventRange::is_full_subRun ( ) const

Definition at line 105 of file EventRange.cc.

References begin_, end_, art::is_valid(), and subRun_.

Referenced by art::operator<<(), require_not_full_SubRun(), and size().

106 {
107  return art::is_valid(subRun_) && begin_ == 0 &&
109 }
static constexpr type invalid()
Definition: IDNumber.h:16
constexpr bool is_valid(IDNumber_t< L > const id)
Definition: IDNumber.h:112
SubRunNumber_t subRun_
Definition: EventRange.h:86
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
bool EventRange::is_overlapping ( EventRange const &  other) const

Definition at line 154 of file EventRange.cc.

References are_valid(), is_disjoint(), is_subset(), and is_superset().

Referenced by size().

155 {
156  if (!are_valid(*this, other))
157  return false;
158  return !is_disjoint(other) && !is_subset(other) && !is_superset(other);
159 }
bool is_superset(EventRange const &other) const
Definition: EventRange.cc:145
static bool are_valid(EventRange const &l, EventRange const &r)
Definition: EventRange.cc:93
bool is_subset(EventRange const &other) const
Definition: EventRange.cc:136
bool is_disjoint(EventRange const &other) const
Definition: EventRange.cc:120
bool EventRange::is_same ( EventRange const &  other) const

Definition at line 128 of file EventRange.cc.

References are_valid(), and operator==().

Referenced by size().

129 {
130  if (!are_valid(*this, other))
131  return false;
132  return operator==(other);
133 }
bool operator==(EventRange const &other) const
Definition: EventRange.cc:66
static bool are_valid(EventRange const &l, EventRange const &r)
Definition: EventRange.cc:93
bool EventRange::is_subset ( EventRange const &  other) const

Definition at line 136 of file EventRange.cc.

References are_valid(), begin_, end_, and subRun_.

Referenced by is_overlapping(), and size().

137 {
138  if (!are_valid(*this, other))
139  return false;
140  return subRun_ == other.subRun_ && begin_ >= other.begin_ &&
141  end_ <= other.end_;
142 }
SubRunNumber_t subRun_
Definition: EventRange.h:86
static bool are_valid(EventRange const &l, EventRange const &r)
Definition: EventRange.cc:93
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
bool EventRange::is_superset ( EventRange const &  other) const

Definition at line 145 of file EventRange.cc.

References are_valid(), begin_, end_, and subRun_.

Referenced by is_overlapping(), and size().

146 {
147  if (!are_valid(*this, other))
148  return false;
149  return subRun_ == other.subRun_ && begin_ <= other.begin_ &&
150  end_ >= other.end_;
151 }
SubRunNumber_t subRun_
Definition: EventRange.h:86
static bool are_valid(EventRange const &l, EventRange const &r)
Definition: EventRange.cc:93
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
bool EventRange::is_valid ( ) const

Definition at line 99 of file EventRange.cc.

References art::is_valid(), and subRun_.

Referenced by are_valid(), and size().

100 {
101  return art::is_valid(subRun_);
102 }
constexpr bool is_valid(IDNumber_t< L > const id)
Definition: IDNumber.h:112
SubRunNumber_t subRun_
Definition: EventRange.h:86
bool EventRange::merge ( EventRange const &  other)

Definition at line 39 of file EventRange.cc.

References are_valid(), end_, is_adjacent(), and require_not_full_SubRun().

Referenced by size().

40 {
42  if (!are_valid(*this, other))
43  return false;
44 
45  bool const mergeable = is_adjacent(other);
46  if (mergeable)
47  end_ = other.end_;
48  return mergeable;
49 }
bool is_adjacent(EventRange const &other) const
Definition: EventRange.cc:112
static bool are_valid(EventRange const &l, EventRange const &r)
Definition: EventRange.cc:93
EventNumber_t end_
Definition: EventRange.h:88
void require_not_full_SubRun()
Definition: EventRange.h:78
bool EventRange::operator!= ( EventRange const &  other) const

Definition at line 73 of file EventRange.cc.

References operator==().

74 {
75  return !operator==(other);
76 }
bool operator==(EventRange const &other) const
Definition: EventRange.cc:66
bool EventRange::operator< ( EventRange const &  other) const

Definition at line 52 of file EventRange.cc.

References begin_, end_, and subRun_.

53 {
54  if (subRun_ == other.subRun_) {
55  if (begin_ == other.begin_) {
56  return end_ < other.end_;
57  } else {
58  return begin_ < other.begin_;
59  }
60  } else {
61  return subRun_ < other.subRun_;
62  }
63 }
SubRunNumber_t subRun_
Definition: EventRange.h:86
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
bool EventRange::operator== ( EventRange const &  other) const

Definition at line 66 of file EventRange.cc.

References begin_, end_, and subRun_.

Referenced by is_same(), and operator!=().

67 {
68  return subRun_ == other.subRun_ && begin_ == other.begin_ &&
69  end_ == other.end_;
70 }
SubRunNumber_t subRun_
Definition: EventRange.h:86
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
void art::EventRange::require_not_full_SubRun ( )
inlineprivate

Definition at line 78 of file EventRange.h.

References is_full_subRun(), and art::errors::LogicError.

Referenced by merge(), and set_end().

79  {
80  if (is_full_subRun())
82  << "\nAn EventRange created using EventRange::forSubRun cannot be "
83  "modified.\n";
84  }
bool is_full_subRun() const
Definition: EventRange.cc:105
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void EventRange::set_end ( EventNumber_t const  e)

Definition at line 79 of file EventRange.cc.

References begin_, e, end_, and require_not_full_SubRun().

Referenced by size().

80 {
82  require_ordering(begin_, e);
83  end_ = e;
84 }
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
void require_not_full_SubRun()
Definition: EventRange.h:78
Float_t e
Definition: plot.C:34
auto art::EventRange::size ( void  ) const
inline

Definition at line 52 of file EventRange.h.

References are_valid(), begin_, contains(), e, end_, is_adjacent(), is_disjoint(), is_full_subRun(), is_overlapping(), is_same(), is_subset(), is_superset(), is_valid(), merge(), and set_end().

53  {
54  return is_valid() ? end_ - begin_ : -1ull;
55  }
EventNumber_t end_
Definition: EventRange.h:88
EventNumber_t begin_
Definition: EventRange.h:87
bool is_valid() const
Definition: EventRange.cc:99
auto art::EventRange::subRun ( ) const
inline

Definition at line 32 of file EventRange.h.

References subRun_.

Referenced by art::operator<<().

33  {
34  return subRun_;
35  }
SubRunNumber_t subRun_
Definition: EventRange.h:86

Member Data Documentation


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