Skip to content

Support for custom branches that contain std vectors of custom structs? #197

@oschulz

Description

@oschulz

I have a root file with a custom-type branch whose elements contain structs that contain vectors of custom structs, e.g.

struct Foo
{
  long a;
  std::vector<short> b;
};

struct Bar
{
  long c;
  std::vector<Foo> d;
};

The file uses standard ROOT autogenerated streamers. I'm trying to read it using

struct Foo
    a::Clong
    b::Vector{Cshort}
end

struct Bar
    d::Clong
    e::Vector{Foo}
end

f = ROOTFile("myfile.root", customstructs = Dict("Foo" => Foo, "Bar" => Bar))
tree = LazyTree(f, "TreeOnFire", ["bar_branch"]);
tree[1].bar_branch; # fails

but I get

julia> tree[1].bar_branch;
ERROR: MethodError: no method matching -(::Nothing, ::Int64)
[...]
Stacktrace:
 [1] _localindex_newbasket!(ba::LazyBranch{Plane, UnROOT.Nojagg, Vector{Plane}}, idx::Int64, tid::Int64)
[...]

Should this work or can't we handle custom structs like that automatically yet?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions