Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/iteration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Reads all branches from a tree.
"""
function arrays(f::ROOTFile, treename)
names = keys(f[treename])
names = getbranchnamesrecursive(f[treename])
res = Vector{Vector}(undef, length(names))
Threads.@threads for i in eachindex(names)
res[i] = array(f, "$treename/$(names[i])")
Expand Down Expand Up @@ -455,8 +455,16 @@ function LazyTree(f::ROOTFile, tree::TTree, treepath, branches; sink = LazyTree)
elseif b isa Pair{Regex, SubstitutionString{String}}
[_b => replace(_b, first(b) => last(b)) for _b ∈ filter(_m(first.(b)), all_bnames)]
elseif b isa String
expand = any(n->startswith(n, "$b/$b"), all_bnames)
expand ? [_b => normalize_branchname(_b) for _b ∈ filter(n->startswith(n, "$b/$b"), all_bnames)] : [b => normalize_branchname(b)]
if any(n->startswith(n, "$b/$b"), all_bnames)
# Double-prefix split class (e.g. "Electron/Electron.pt")
[_b => normalize_branchname(_b) for _b ∈ filter(n->startswith(n, "$b/$b"), all_bnames)]
elseif b ∉ all_bnames && any(n->startswith(n, "$b/"), all_bnames)
# Container branch (split class without repeated prefix, e.g. "ODEvent/member")
# Strip the container prefix so column names are just "memberName"
[_b => normalize_branchname(chop(_b, head=length(b)+1, tail=0)) for _b ∈ filter(n->startswith(n, "$b/"), all_bnames)]
else
[b => normalize_branchname(b)]
end
else
error("branch selection must be string or regex")
end
Expand Down
4 changes: 4 additions & 0 deletions src/root.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ function streamerfor(f::ROOTFile, branch::TBranchElement)
# TODO: For now, we force it to be 0 in this case, until someone complains.
if fID == -1
fID = 0
elseif fID < 0
# fID == -2 (and other negative values) indicates the branch stores the
# whole object (e.g. a nested STL collection); fall back to classname-based detection.
return missing
end
next_streamer = streamerfor(f, branch.fClassName)
if ismissing(next_streamer)
Expand Down
Loading