Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading a tuple<unsigned int, string, bool, unsigned int> from a TTree #363

Open
peremato opened this issue Nov 7, 2024 · 1 comment
Open

Comments

@peremato
Copy link
Member

peremato commented Nov 7, 2024

I have a problem reading the linked file. There is a TTree called polio_metadata with a branch called events___CollectionTypeInfo of type tuple<unsigned int, string, bool, unsigned int>. I am interested to get the element 1 of the tuple, which is string. But I get an error:

LazyTree(tfile,"podio_metadata",["events___CollectionTypeInfo/events___CollectionTypeInfo._1"])
ERROR: TypeError: in GenericMemory, in element type, expected Type, got a value of type Nothing
Stacktrace:
  [1] GenericMemory
    @ ./boot.jl:516 [inlined]
  [2] Vector{nothing}(::UndefInitializer, m::Int64)
    @ Core ./boot.jl:578
  [3] Vector{nothing}()
    @ Core ./boot.jl:601
  [4] LazyBranch(f::ROOTFile, b::UnROOT.TBranchElement_10)
    @ UnROOT ~/.julia/packages/UnROOT/4c5To/src/iteration.jl:123
  [5] LazyBranch(f::ROOTFile, s::String)
    @ UnROOT ~/.julia/packages/UnROOT/4c5To/src/iteration.jl:134
  [6] LazyTree(f::ROOTFile, tree::UnROOT.TTree, treepath::String, branches::Vector{String}; sink::Type{LazyTree})
    @ UnROOT ~/.julia/packages/UnROOT/4c5To/src/iteration.jl:449
  [7] LazyTree
    @ ~/.julia/packages/UnROOT/4c5To/src/iteration.jl:431 [inlined]
  [8] LazyTree(f::ROOTFile, s::String, branches::Vector{String}; kwargs::@Kwargs{})
    @ UnROOT ~/.julia/packages/UnROOT/4c5To/src/iteration.jl:392
  [9] LazyTree(f::ROOTFile, s::String, branches::Vector{String})
    @ UnROOT ~/.julia/packages/UnROOT/4c5To/src/iteration.jl:389
 [10] top-level scope
    @ REPL[25]:1

I can get element 0 without problems:

LazyTree(tfile,"podio_metadata",["events___CollectionTypeInfo/events___CollectionTypeInfo._0"])
 Row │ events___Collec                                                                                                                                         ⋯
     │ SubArray{UInt32                                                                                                                                         ⋯
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 1   │ [3470328915, 140414123, 2135478584, 1822974285, 1427737228, 1424292776, 3616779153, 3455758480, 1122056138, 4183352422, 1753703688, 1293498717, 3617521 ⋯
  

Do you know a way out?

@Moelf
Copy link
Member

Moelf commented Nov 7, 2024

I don't think we ever read tuples in TTree actually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants