LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::detail::RangeSetInfo Struct Reference

#include "RangeSetInfo.h"

Public Member Functions

 RangeSetInfo (RunNumber_t const r, std::vector< EventRange > &&ers)
 
bool is_invalid () const
 
void update (RangeSetInfo &&rsi, bool compact)
 

Static Public Member Functions

static RangeSetInfo invalid ()
 

Public Attributes

RunNumber_t run {IDNumber<Level::Run>::invalid()}
 
std::vector< EventRangeranges {}
 

Private Member Functions

 RangeSetInfo ()=default
 

Detailed Description

Definition at line 22 of file RangeSetInfo.h.

Constructor & Destructor Documentation

art::detail::RangeSetInfo::RangeSetInfo ( RunNumber_t const  r,
std::vector< EventRange > &&  ers 
)
explicit

Definition at line 4 of file RangeSetInfo.cc.

References ranges.

6  : run{r}, ranges{std::move(ers)}
7 {}
std::vector< EventRange > ranges
Definition: RangeSetInfo.h:35
art::detail::RangeSetInfo::RangeSetInfo ( )
privatedefault

Member Function Documentation

static RangeSetInfo art::detail::RangeSetInfo::invalid ( )
inlinestatic

Definition at line 28 of file RangeSetInfo.h.

References update().

29  {
30  return RangeSetInfo{};
31  }
bool art::detail::RangeSetInfo::is_invalid ( ) const

Definition at line 10 of file RangeSetInfo.cc.

References run.

Referenced by art::detail::resolveRangeSet().

11 {
13 }
static constexpr type invalid()
Definition: IDNumber.h:81
void art::detail::RangeSetInfo::update ( RangeSetInfo &&  rsi,
bool  compact 
)

Definition at line 16 of file RangeSetInfo.cc.

References evd::details::begin(), evd::details::end(), art::errors::LogicError, max, min, ranges, run, and art::throw_if_not_disjoint().

Referenced by invalid().

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)
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)

Member Data Documentation

std::vector<EventRange> art::detail::RangeSetInfo::ranges {}

Definition at line 35 of file RangeSetInfo.h.

Referenced by RangeSetInfo(), art::detail::resolveRangeSet(), and update().

RunNumber_t art::detail::RangeSetInfo::run {IDNumber<Level::Run>::invalid()}

Definition at line 34 of file RangeSetInfo.h.

Referenced by is_invalid(), art::detail::resolveRangeSet(), and update().


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