LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
RangeSetInfo.cc
Go to the documentation of this file.
3 
5  std::vector<EventRange>&& ers)
6  : run{r}, ranges{std::move(ers)}
7 {}
8 
9 bool
11 {
13 }
14 
15 void
17 {
18  if (run != rsi.run) {
20  << "Cannot merge two ranges-of-validity with different run numbers: "
21  << run << " vs. " << rsi.run << '\n'
22  << "Please contact artists@fnal.gov.";
23  }
24 
25  // If full range-set information is to be retained (the
26  // default), then append the accumulated ranges into the
27  // already-existing container. Bail out early.
28  if (!compact) {
29  std::move(rsi.ranges.begin(), rsi.ranges.end(), std::back_inserter(ranges));
30  return;
31  }
32 
33  // For compact ranges
34  for (auto&& range : rsi.ranges) {
35  auto const subRunN = range.subRun();
36  // If compact option is chosen, there will be *at most*
37  // one entry in the 'ranges' container that corresponds to
38  // this subrun.
39  auto found =
40  std::find_if(begin(ranges), end(ranges), [subRunN](auto const& er) {
41  return er.subRun() == subRunN;
42  });
43  if (found == end(ranges)) {
44  ranges.push_back(std::move(range));
45  continue;
46  }
47 
48  throw_if_not_disjoint(run, *found, range);
49  auto const ebegin = std::min(found->begin(), range.begin());
50  auto const eend = std::max(found->end(), range.end());
51  *found = EventRange{subRunN, ebegin, eend};
52  }
53 }
std::vector< EventRange > ranges
Definition: RangeSetInfo.h:35
void throw_if_not_disjoint(RunNumber_t const rn, EventRange const &left, EventRange const &right) noexcept(false)
Definition: RangeSet.cc:333
Int_t max
Definition: plot.C:27
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
void update(RangeSetInfo &&rsi, bool compact)
Definition: RangeSetInfo.cc:16
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Int_t min
Definition: plot.C:26
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:119