9 class next_run_in_file {
18 class next_subrun_in_run {
20 next_subrun_in_run(
RunID const runID) : runID_{runID} {}
32 class next_event_in_subrun {
34 next_event_in_subrun(
SubRunID const subRunID) : subRunID_{subRunID} {}
48 end_of_subrun(
SubRunID const subRunID) : subRunID_{subRunID} {}
61 end_of_run(
RunID const runID) : runID_{runID} {}
76 bool const compactRanges)
79 auto begin = std::cbegin(fileIndex);
80 auto end = std::cend(fileIndex);
83 std::find_if(
begin,
end, next_subrun_in_run{subRunID.
runID()});
84 if (subrun_begin ==
end) {
90 std::find_if(subrun_begin,
end, next_event_in_subrun{subRunID});
91 if (event_it ==
end) {
96 auto const& eid = event_it->eventID_;
98 std::find_if_not(event_it,
end, next_event_in_subrun{subRunID});
101 auto const count = std::distance(event_it, event_end);
108 auto const ebegin = eid.event();
109 auto const eend = (count == 1) ?
111 std::prev(event_end)->eventID_.next().event();
112 rangeSet.emplace_range(
subrun, ebegin, eend);
116 std::for_each(event_it, event_end, [&rangeSet](
auto const& element) {
125 bool const compactRanges)
127 auto const run = runID.
run();
128 auto const begin = std::cbegin(fileIndex);
129 auto const end = std::cend(fileIndex);
134 auto subrun_begin = std::find_if(
begin,
end, next_subrun_in_run{runID});
135 if (subrun_begin ==
end) {
140 auto const run_end = std::find_if(subrun_begin,
end, end_of_run{runID});
141 while (subrun_begin != run_end) {
142 auto const subRunID = subrun_begin->eventID_.subRunID();
147 auto subrun_end = std::find_if(subrun_begin,
end, end_of_subrun{subRunID});
148 subrun_begin = subrun_end;
RunID const & runID() const
SubRunID const & subRunID() const
RangeSet rangeSetFromFileIndex(FileIndex const &fileIndex, RunID runID, bool compactRanges)
RunID const & runID() const
auto begin(Data< Value > const &data)
EntryType getEntryType() const
SubRunNumber_t subRun() const