10 #include "cetlib/container_algorithms.h" 11 #include "cetlib/crc32.h" 27 disjoint(vector<EventRange>
const&
ranges)
29 if (ranges.size() < 2ull) {
32 auto it = ranges.cbegin();
33 auto const end = ranges.cend();
34 for (
auto nxt = next(it); nxt !=
end; ++it, ++nxt) {
35 if (!it->is_disjoint(*nxt)) {
51 RangeSet::forRun(
RunID const rid)
64 RangeSet::~RangeSet() =
default;
65 RangeSet::RangeSet() =
default;
66 RangeSet::RangeSet(
RangeSet const& rhs) =
default;
67 RangeSet::RangeSet(
RangeSet&& rhs) =
default;
94 vector<EventRange>
const&
108 for (
auto const& range :
ranges_) {
109 if (range.contains(s, e)) {
125 return ranges_.size() == 1ull &&
132 return (
ranges_.size() == 1ull) &&
ranges_.front().is_full_subRun();
175 return tmp.has_disjoint_ranges();
181 for (
auto const& range :
ranges_) {
225 auto const sr =
ranges_.at(b).subRun();
227 find_if(
ranges_.cbegin() + b,
ranges_.cend(), [sr](
auto const& range) {
228 return range.subRun() != sr;
230 return static_cast<size_t>(pos -
ranges_.cbegin());
254 vector<EventRange> result;
256 copy(
ranges_.cbegin() + b,
ranges_.cbegin() +
e, back_inserter(result));
273 <<
"A range set must be sorted before it is collapsed.\n";
277 result.reserve(
ranges_.size());
278 result.push_back(
ranges_.front());
281 auto&
back = result.back();
303 vector<EventRange> merged;
308 back_inserter(merged));
309 unique(merged.begin(), merged.end());
320 if (!rs.
ranges_.empty() && (e >= 1) && (e <= rs.
ranges_.size())) {
344 pair<std::size_t, bool>
348 bool did_split =
false;
352 return r.contains(s, e);
358 if ((foundRange !=
ranges_.cend()) && foundRange->is_valid() &&
359 (foundRange->size() > 1ull)) {
360 auto const begin = foundRange->begin();
361 auto const end = foundRange->end();
363 result = next(leftIt);
368 return make_pair(static_cast<size_t>(result -
ranges_.cbegin()), did_split);
394 <<
"\nA RangeSet created using RangeSet::forRun cannot be modified.\n";
440 auto const& rranges = rtmp.collapse().ranges();
442 std::vector<EventRange> merged;
443 std::merge(lranges.begin(),
447 back_inserter(merged));
449 return disjoint(merged);
460 <<
"Attempt to merge event ranges that both contain one or more of the " 462 <<
" Run: " << rn <<
'\n' 463 <<
" " <<
left <<
" vs.\n" 464 <<
" " <<
right <<
'\n';
479 os <<
" Run: " << rs.
run();
484 for (
auto const& er : rs.
ranges()) {
bool operator==(Provenance const &a, Provenance const &b) noexcept
void set_end(EventNumber_t const e)
std::pair< std::size_t, bool > split_range(SubRunNumber_t, EventNumber_t)
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
std::vector< EventRange >::const_iterator const_iterator
bool has_disjoint_ranges() const
std::vector< EventRange > const & ranges() const
std::enable_if_t< detail::are_handles_v< T, U >, bool > overlapping_ranges(T const &a, U const &b)
std::vector< EventRange > ranges_
void set_run(RunNumber_t const r)
EventRange full_run_event_range()
void assign_ranges(RangeSet const &rs, std::size_t const b, std::size_t const e)
EventNumber_t end() const noexcept
void throw_if_not_disjoint(RunNumber_t const rn, EventRange const &left, EventRange const &right) noexcept(false)
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
std::ostream & operator<<(std::ostream &os, const GroupSelector &gs)
std::enable_if_t< detail::are_handles_v< T, U >, bool > disjoint_ranges(T const &a, U const &b)
std::size_t end_idx() const
IDNumber_t< Level::SubRun > SubRunNumber_t
const_iterator end() const
std::vector< EventRange > extract_ranges(std::size_t const b, std::size_t const e)
bool contains(RunNumber_t, SubRunNumber_t, EventNumber_t) const
std::string to_compact_string() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
void require_not_full_run()
std::enable_if_t< detail::are_handles_v< T, U >, bool > same_ranges(T const &a, U const &b)
void update(EventID const &)
const_iterator begin() const
SubRunNumber_t subRun() const noexcept
IDNumber_t< Level::Event > EventNumber_t
void swap(lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &a, lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &b)
RangeSet & merge(RangeSet const &other)
bool is_full_subRun() const
bool merge(EventRange const &other)
SubRunNumber_t subRun() const
std::size_t next_subrun_or_end(std::size_t const b) const
bool is_adjacent(EventRange const &other) const noexcept
EventRange & at(std::size_t)
std::string to_string(ModuleType const mt)
unsigned checksum() const
bool is_collapsed() const
Event finding and building.
std::size_t begin_idx() const
IDNumber_t< Level::Run > RunNumber_t