LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ClosedRangeSetHandler.cc
Go to the documentation of this file.
7 
8 #include <algorithm>
9 
10 namespace {
11  constexpr auto invalid_eid[[gnu::unused]] =
13 }
14 
15 namespace art {
16 
18  {}
19 
20  RangeSet
22  {
24  tmp.assign_ranges(begin(), rsIter_);
25  return tmp;
26  }
27 
28  void
29  ClosedRangeSetHandler::do_update(EventID const& id, bool const lastInSubRun)
30  {
31  eventInfo_.set(id, lastInSubRun);
32 
33  if (lastInSubRun) {
35  return;
36  }
37 
38  while (rsIter_ != end() && !rsIter_->contains(id.subRun(), id.event())) {
39  ++rsIter_;
40  }
41  }
42 
43  void
45  {
46  rsIter_ = end();
47  }
48 
49  void
51  {
52  if (!eventInfo_.lastInSubRun && rsIter_ != end()) {
53  auto split_range = ranges_.split_range(eventInfo_.id.subRun(),
54  eventInfo_.id.next().event());
55  if (split_range.second)
56  rsIter_ = split_range.first;
57  }
58  }
59 
60  void
62  {
63  std::vector<EventRange> rebasedRanges(rsIter_, end());
64  RangeSet tmpRS{ranges_.run(), rebasedRanges};
66  std::swap(*this, tmp);
67  }
68 
71  {
72  if (rsIter_ == end())
73  return end();
74 
75  auto const sr = rsIter_->subRun();
76  auto pos = std::find_if(
77  rsIter_, end(), [sr](auto const& range) { return range.subRun() != sr; });
78  return pos;
79  }
80 }
void set(EventID const &eid, bool const last)
EventID next() const
Definition: EventID.h:135
RangeSet::const_iterator rsIter_
std::vector< EventRange >::const_iterator const_iterator
Definition: RangeSet.h:33
Float_t tmp
Definition: plot.C:37
ClosedRangeSetHandler(RangeSet const &inputRangeSet)
RunNumber_t run() const
Definition: RangeSet.h:36
RangeSet do_getSeenRanges() const override
RangeSet::const_iterator next_subrun_or_end() const
void do_update(EventID const &, bool lastInSubRun) override
HLT enums.
EventNumber_t event() const
Definition: EventID.h:117
SubRunNumber_t subRun() const
Definition: EventID.h:111
std::pair< const_iterator, bool > split_range(SubRunNumber_t, EventNumber_t)
Definition: RangeSet.cc:156