3 #include "cetlib/crc32.h" 10 checksum(std::string
const& compact_string)
12 return cet::crc32{compact_string}.digest();
22 disjoint(std::vector<EventRange>
const& ranges)
24 if (ranges.size() < 2ull)
27 auto it = ranges.cbegin();
28 auto const end = ranges.cend();
29 for (
auto next = std::next(it); next !=
end; ++it, ++next) {
30 if (!it->is_disjoint(*next))
66 std::vector<EventRange>
const& eventRanges)
87 <<
"A range set must be sorted before it is collapsed.\n";
92 result.push_back(
ranges_.front());
95 auto&
back = result.back();
96 if (
back.is_adjacent(r)) {
126 if (
back.subRun() ==
id.subRun() &&
back.end() ==
id.event()) {
142 std::vector<EventRange> merged;
147 std::back_inserter(merged));
148 std::unique(merged.begin(), merged.end());
155 std::pair<RangeSet::const_iterator, bool>
159 bool did_split{
false};
170 if (foundRange !=
ranges_.cend() && foundRange->is_valid() &&
171 foundRange->size() > 1ull) {
172 auto const begin = foundRange->begin();
173 auto const end = foundRange->end();
175 result = std::next(leftIt);
177 std::swap(*result,
right);
180 return std::make_pair(result, did_split);
200 return tmp.has_disjoint_ranges();
206 for (
auto const& range :
ranges_) {
221 for (
auto const& range :
ranges_) {
222 if (range.contains(s, e))
238 for (
auto const& range :
ranges_) {
239 if (!range.is_valid())
248 return ranges_.size() == 1ull &&
255 return ranges_.size() == 1ull &&
ranges_.front().is_full_subRun();
271 for (
auto const& r :
ranges_) {
285 if (!both_valid(l, r))
299 if (!both_valid(l, r))
320 auto const& rranges = rtmp.collapse().ranges();
322 std::vector<EventRange> merged;
323 std::merge(lranges.begin(),
327 std::back_inserter(merged));
329 return disjoint(merged);
340 <<
"Attempt to merge event ranges that both contain one or more of the " 342 <<
" Run: " << rn <<
'\n' 343 <<
" " <<
left <<
" vs.\n" 350 if (!both_valid(l, r))
358 os <<
" Run: " << rs.
run();
363 for (
auto const& er : rs.
ranges()) {
std::ostream & operator<<(std::ostream &os, EDAnalyzer::Table< T > const &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
std::vector< EventRange > ranges_
void assign_ranges(const_iterator b, const_iterator e)
EventRange full_run_event_range()
void throw_if_not_disjoint(RunNumber_t const rn, EventRange const &left, EventRange const &right) noexcept(false)
RangeSet & merge(RangeSet const &other)
std::vector< EventRange > const & ranges() const
bool has_disjoint_ranges() const
static EventRange forSubRun(SubRunNumber_t s)
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
IDNumber_t< Level::SubRun > SubRunNumber_t
static RangeSet forRun(RunID)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
bool is_full_subRun() const
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()
static RangeSet forSubRun(SubRunID)
void update(EventID const &)
bool contains(RunNumber_t, SubRunNumber_t, EventNumber_t) const
std::string to_compact_string() const
std::enable_if_t< detail::are_handles< T, U >::value, bool > overlapping_ranges(T const &a, U const &b)
static RangeSet invalid()
std::enable_if_t< detail::are_handles< T, U >::value, bool > same_ranges(T const &a, U const &b)
IDNumber_t< Level::Event > EventNumber_t
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
SubRunNumber_t subRun() const
std::string to_string(ModuleType mt)
bool operator==(Provenance const &a, Provenance const &b)
unsigned checksum() const
Event finding and building.
std::pair< const_iterator, bool > split_range(SubRunNumber_t, EventNumber_t)
IDNumber_t< Level::Run > RunNumber_t