UnROOT.jl icon indicating copy to clipboard operation
UnROOT.jl copied to clipboard

Dangling TBasket not handled properly (offset index type wrong)

Open Moelf opened this issue 2 years ago • 2 comments

@tamasgal this is your turf, no rush, and thanks @gojakuch for spotting it.

You can find the test file from this PR:

  • https://github.com/scikit-hep/scikit-hep-testdata/pull/107

it's tiny (<500 KB), but it triggers a weird code path:

julia> a = LazyTree("/home/akako/Downloads/nanoAOD_2015_CMS_Open_Data_ttbar.root", "Events");

julia> typeof(a.Electron_pt)
LazyBranch{SubArray{Float32, 1, Vector{Float32}, Tuple{UnitRange{Int64}}, true}, UnROOT.Nooffsetjagg, ArraysOfArrays.VectorOfVectors{Float32, Vector{Float32}, Vector{Int32}, Vector{Tuple{}}}}

julia> eltype(a.Electron_pt)
SubArray{Float32, 1, Vector{Float32}, Tuple{UnitRange{Int64}}, true}

julia> a.Electron_pt[1]
ERROR: MethodError: Cannot `convert` an object of type
  ArraysOfArrays.VectorOfArrays{Float32{},1,0,Array{Float32{},1},Array{UInt32,1},Array{Tuple{},1}} to an object of type
  ArraysOfArrays.VectorOfArrays{Float32{},1,0,Array{Float32{},1},Array{Int32,1},Array{Tuple{},1}}

Closest candidates are:
  convert(::Type{T}, ::LinearAlgebra.Factorization) where T<:AbstractArray
   @ LinearAlgebra ~/Documents/github/dotFiles/homedir/.julia/juliaup/julia-1.9.1+0.x64.linux.gnu/share/julia/stdlib/v1.9/LinearAlgebra/src/factorization.jl:59
  convert(::Type{T}, ::T) where T<:AbstractArray
   @ Base abstractarray.jl:16
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:64

Stacktrace:
 [1] setindex!(A::Vector{ArraysOfArrays.VectorOfVectors{Float32, Vector{Float32}, Vector{Int32}, Vector{Tuple{}}}}, x::ArraysOfArrays.VectorOfVectors{Float32, Vector{Float32}, Vector{UInt32}, Vector{Tuple{}}}, i1::Int64)
   @ Base ./array.jl:969
 [2] _get_buffer_range(ba::LazyBranch{SubArray{Float32, 1, Vector{Float32}, Tuple{UnitRange{Int64}}, true}, UnROOT.Nooffsetjagg, ArraysOfArrays.VectorOfVectors{Float32, Vector{Float32}, Vector{Int32}, Vector{Tuple{}}}}, tid::Int64, #unused#::Nothing)
   @ UnROOT ~/Documents/github/dotFiles/homedir/.julia/dev/UnROOT/src/iteration.jl:202
 [3] _localindex_newbasket!(ba::LazyBranch{SubArray{Float32, 1, Vector{Float32}, Tuple{UnitRange{Int64}}, true}, UnROOT.Nooffsetjagg, ArraysOfArrays.VectorOfVectors{Float32, Vector{Float32}, Vector{Int32}, Vector{Tuple{}}}}, idx::Int64, tid::Int64)
   @ UnROOT ~/Documents/github/dotFiles/homedir/.julia/dev/UnROOT/src/iteration.jl:190

Basically somehow we predicted the type wrong, even though we got the data right, (you can manually show inside _get_buffer_range

Moelf avatar Jun 27 '23 18:06 Moelf

hitting this again :crying_cat_face:

Moelf avatar Jul 31 '23 17:07 Moelf

I need more clones...

tamasgal avatar Aug 08 '23 09:08 tamasgal