Skip to content

Commit 135f49d

Browse files
authored
improved custom class names (#431)
1 parent 94e77b8 commit 135f49d

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/root.jl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,18 @@ function auto_T_JaggT(f::ROOTFile, branch; customstructs::Dict{String, Type})
487487
parentname = branch.fParentName
488488

489489
# Custom struct lookup.
490-
# When classname == parentname the branch is a field of its own class, so we
491-
# use "ClassName.fieldTitle" as the identifier (KM3NeT-style dot notation).
492-
identifier = classname == parentname ? join([classname, branch.fTitle], '.') : classname
493-
if haskey(customstructs, identifier)
494-
return customstructs[identifier], Nojagg
490+
# First try the specific "ClassName.fieldTitle" identifier.
491+
# This also resolves split sub-branches of a derived class, where
492+
# the branch carries a base class name that differs from the parent (and would
493+
# otherwise collapse to a non-unique bare class name shared by sibling
494+
# branches). Fall back to the bare class name when the branch is not a field
495+
# of its own class, preserving the previous behaviour.
496+
specific_identifier = join([classname, branch.fTitle], '.')
497+
if haskey(customstructs, specific_identifier)
498+
return customstructs[specific_identifier], Nojagg
499+
end
500+
if classname != parentname && haskey(customstructs, classname)
501+
return customstructs[classname], Nojagg
495502
end
496503

497504
# Streamer-based resolution: use fTypeName from the TStreamerElement.

0 commit comments

Comments
 (0)