diff --git a/src/RNTuple/highlevel.jl b/src/RNTuple/highlevel.jl index 93a3b507..49157d26 100644 --- a/src/RNTuple/highlevel.jl +++ b/src/RNTuple/highlevel.jl @@ -35,13 +35,15 @@ Base.IndexStyle(::RNTupleField) = IndexLinear() The event number range a given cluster covers, in Julia's index """ function _rntuple_clusterrange(cs) - first_entry = cs.num_first_entry - n_entries = cs.num_entries - return first_entry+1:(first_entry+n_entries) + first_entry = cs.first_entry_number + n_entries = cs.number_of_entries + return first_entry+1:(first_entry+n_entries) end function _clusterranges(lbs::AbstractVector{<:RNTupleField}) - ranges = map(_rntuple_clusterrange, first(lbs).rn.footer.cluster_summaries) + rn = first(lbs).rn + cluster_summaries = _read_page_list(rn, 1).cluster_summaries + ranges = map(_rntuple_clusterrange, cluster_summaries) return ranges end @@ -110,9 +112,8 @@ function _read_page_list(rn, nth=1) end function _localindex_newcluster!(rf::RNTupleField, idx::Int, tid::Int) - (; header_checksum, - cluster_summaries, - nested_page_locations) = _read_page_list(rf.rn, 1) + page_list =_read_page_list(rf.rn, 1) + cluster_summaries, nested_page_locations = page_list.cluster_summaries, page_list.nested_page_locations for (cluster_idx, cluster) in enumerate(cluster_summaries) first_entry = cluster.first_entry_number @@ -185,10 +186,11 @@ struct RNTuple{O, S} end function _length(rn::RNTuple)::Int - last = lastindex(rn.footer.cluster_group_records) - page_list = _read_page_list(rn, last) - last_cluster = page_list.cluster_summaries[end] - return last_cluster.first_entry_number + last_cluster.number_of_entries + last_record_idx = lastindex(rn.footer.cluster_group_records) + page_list = _read_page_list(rn, last_record_idx) + last_cs = page_list.cluster_summaries[end] + range = _rntuple_clusterrange(last_cs) + return last(range) end function Base.keys(rn::RNTuple) diff --git a/test/Project.toml b/test/Project.toml index 9506b155..b4093af2 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -7,6 +7,7 @@ LorentzVectors = "3f54b04b-17fc-5cd4-9758-90c048d965e3" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" +TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat]