Skip to content

Reading TH2I histograms  #364

@MarcoRiggirello

Description

@MarcoRiggirello

Hi, noob here.
I'm trying to read TH2I histograms. With standard UnROOT, I get this error:

julia> f["OpticalGroup_0/Hybrid_0/SCurve_OpticalGroup0_Hybrid0_MPA0"]
ERROR: UndefVarError: `TH2I` not defined in `UnROOT`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
 [1] getindex(d::UnROOT.ROOTDirectory, s::String)
   @ UnROOT ~/.julia/packages/UnROOT/4c5To/src/root.jl:194
 [2] getindex(d::UnROOT.ROOTDirectory, s::String)
   @ UnROOT ~/.julia/packages/UnROOT/4c5To/src/root.jl:191
 [3] _getindex(f::ROOTFile, s::String)
   @ UnROOT ~/.julia/packages/UnROOT/4c5To/src/root.jl:171
 [4] #150
   @ ~/.julia/packages/UnROOT/4c5To/src/root.jl:163 [inlined]
 [5] get!(default::UnROOT.var"#150#151"{ROOTFile, String}, h::Dict{Any, Any}, key::String)
   @ Base ./dict.jl:458
 [6] getindex(f::ROOTFile, s::String)
   @ UnROOT ~/.julia/packages/UnROOT/4c5To/src/root.jl:162
 [7] top-level scope
   @ REPL[3]:1

I tried then to add the TH1I function to bootstrap.jl but this resulted in another kind of error

julia> f["OpticalGroup_0/Hybrid_0/SCurve_OpticalGroup0_Hybrid0_MPA0"]
ERROR: EOFError: read end of file
Stacktrace:
  [1] peek
    @ ./iobuffer.jl:201 [inlined]
  [2] read
    @ ./iobuffer.jl:211 [inlined]
  [3] readtype
    @ ~/.julia/packages/UnROOT/qhPjK/src/io.jl:23 [inlined]
  [4] readtype
    @ ~/.julia/packages/UnROOT/qhPjK/src/streamers.jl:643 [inlined]
  [5] TH(io::UnROOT.MmapStream, tkey::UnROOT.TKey32, refs::Dict{Int32, Any})
    @ UnROOT ~/.julia/packages/UnROOT/qhPjK/src/bootstrap.jl:1030
  [6] TH2I(io::UnROOT.MmapStream, tkey::UnROOT.TKey32, refs::Dict{Int32, Any})
    @ UnROOT ~/.julia/packages/UnROOT/qhPjK/src/bootstrap.jl:954
  [7] getindex(d::UnROOT.ROOTDirectory, s::String)
    @ UnROOT ~/.julia/packages/UnROOT/qhPjK/src/root.jl:195
  [8] getindex(d::UnROOT.ROOTDirectory, s::String)
    @ UnROOT ~/.julia/packages/UnROOT/qhPjK/src/root.jl:191
  [9] _getindex(f::ROOTFile, s::String)
    @ UnROOT ~/.julia/packages/UnROOT/qhPjK/src/root.jl:171
 [10] #150
    @ ~/.julia/packages/UnROOT/qhPjK/src/root.jl:163 [inlined]
 [11] get!(default::UnROOT.var"#150#151"{ROOTFile, String}, h::Dict{Any, Any}, key::String)
    @ Base ./dict.jl:458
 [12] getindex(f::ROOTFile, s::String)
    @ UnROOT ~/.julia/packages/UnROOT/qhPjK/src/root.jl:162
 [13] top-level scope
    @ REPL[3]:1

Am I doing things wrong? What is different with respect to float TArray based TH classes that makes this trivial solution not working?
Thanks for the help
MR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions