Hello,
I’m using Geant4 to simulate some decays and I’m saving the result in a root file which I then read with UnROOT.jl. I have the following code:
using DrWatson
quickactivate(@__DIR__)
using UnROOT
f = UnROOT.ROOTFile(datadir("sims/root/ss", "ss_U238_p=10bar_Rmin=292mm_Rmax=300mm.root"))
with structure
I can successfully access branches except those containing Strings, such as the one called “Particle”, shown in the picture above. When I do:
UnROOT.LazyBranch(f, "G4Sim/Particle")
I’m getting the following error:
Failed to show value:
TaskFailedException
nested task error: DimensionMismatch: expected input array of length 16, got length 12
Stacktrace:
[1] dimension_mismatch_fail(::Type{StaticArraysCore.SVector{16, UInt8}}, a::SubArray{UInt8, 1, Vector{UInt8}, Tuple{UnitRange{Int64}}, true})
@ StaticArrays ~/.julia/packages/StaticArrays/85pEu/src/convert.jl:196
[2] convert
@ ~/.julia/packages/StaticArrays/85pEu/src/convert.jl:201 [inlined]
[3] StaticArray
@ ~/.julia/packages/StaticArrays/85pEu/src/convert.jl:174 [inlined]
[4] reinterpret(::Type{UnROOT.FixLenVector{16, UInt8}}, v::SubArray{UInt8, 1, Vector{UInt8}, Tuple{UnitRange{Int64}}, true})
@ UnROOT ~/.julia/packages/UnROOT/xaBnN/src/custom.jl:86
[5] #235
@ ./none:0 [inlined]
[6] iterate
@ ./generator.jl:47 [inlined]
[7] collect_to!(dest::Vector{UnROOT.FixLenVector{16, UInt8}}, itr::Base.Generator{Base.Iterators.PartitionIterator{Vector{UInt8}}, UnROOT.var"#235#236"{UnROOT.FixLenVector{16, UInt8}}}, offs::Int64, st::Int64)
@ Base ./array.jl:892
[8] collect_to_with_first!
@ ./array.jl:870 [inlined]
[9] collect(itr::Base.Generator{Base.Iterators.PartitionIterator{Vector{UInt8}}, UnROOT.var"#235#236"{UnROOT.FixLenVector{16, UInt8}}})
@ Base ./array.jl:844
[10] interped_data(rawdata::Vector{UInt8}, rawoffsets::Vector{Int32}, ::Type{UnROOT.FixLenVector{16, UInt8}}, ::Type{UnROOT.Nojagg})
@ UnROOT ~/.julia/packages/UnROOT/xaBnN/src/custom.jl:90
[11] basketarray(f::UnROOT.ROOTFile, branch::UnROOT.TBranch_13, ithbasket::Int64)
@ UnROOT ~/.julia/packages/UnROOT/xaBnN/src/iteration.jl:64
[12] basketarray(lb::UnROOT.LazyBranch{UnROOT.FixLenVector{16, UInt8}, UnROOT.Nojagg, Vector{UnROOT.FixLenVector{16, UInt8}}}, ithbasket::Int64)
@ UnROOT ~/.julia/packages/UnROOT/xaBnN/src/iteration.jl:135
[13] #214
@ ~/.julia/packages/UnROOT/xaBnN/src/iteration.jl:486 [inlined]
[14] iterate
@ ./generator.jl:47 [inlined]
[15] _collect(c::UnitRange{Int64}, itr::Base.Generator{UnitRange{Int64}, UnROOT.var"#214#217"{UnROOT.LazyBranch{UnROOT.FixLenVector{16, UInt8}, UnROOT.Nojagg, Vector{UnROOT.FixLenVector{16, UInt8}}}}}, ::Base.EltypeUnknown, isz::Base.HasShape{1})
@ Base ./array.jl:854
[16] collect_similar
@ ./array.jl:763 [inlined]
[17] map
@ ./abstractarray.jl:3285 [inlined]
[18] getindex(ba::UnROOT.LazyBranch{UnROOT.FixLenVector{16, UInt8}, UnROOT.Nojagg, Vector{UnROOT.FixLenVector{16, UInt8}}}, range::UnitRange{Int64})
@ UnROOT ~/.julia/packages/UnROOT/xaBnN/src/iteration.jl:486
[19] (::UnROOT.var"#244#246"{UnROOT.LazyBranch{UnROOT.FixLenVector{16, UInt8}, UnROOT.Nojagg, Vector{UnROOT.FixLenVector{16, UInt8}}}})()
@ UnROOT ~/.julia/packages/UnROOT/xaBnN/src/displays.jl:95
Stack trace
Here is what happened, the most recent locations are first:
1. <mark>**wait**</mark> @ *task.jl:352*
2. <mark>**show**(io::IOContext{IOBuffer}, ::MIME{Symbol("text/plain")}, br::UnROOT.LazyBranch{UnROOT.FixLenVector{16, UInt8}, UnROOT.Nojagg, Vector{UnROOT.FixLenVector{16, UInt8}}})</mark> @ *displays.jl:97*
I’m on Julia 1.10.2 working on Pluto and I’m using the v0.10.31 version of UnROOT.