Skip to content
Snippets Groups Projects
Verified Commit 236f1131 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Use `nothing` for the missing online/offline trees

parent a046ce42
No related branches found
No related tags found
No related merge requests found
struct ROOTFile
_fobj::UnROOT.ROOTFile
online::Union{OnlineTree, Missing}
offline::Union{OfflineTree, Missing}
online::Union{OnlineTree, Nothing}
offline::Union{OfflineTree, Nothing}
function ROOTFile(filename::AbstractString)
customstructs = Dict(
......@@ -13,17 +13,17 @@ struct ROOTFile
)
fobj = UnROOT.ROOTFile(filename, customstructs=customstructs)
tpath_offline = ROOT.TTREE_OFFLINE_EVENT
offline = tpath_offline keys(fobj) ? OfflineTree(fobj) : missing
offline = tpath_offline keys(fobj) ? OfflineTree(fobj) : nothing
tpath_online = ROOT.TTREE_ONLINE_EVENT
online = tpath_online keys(fobj) ? OnlineTree(fobj) : missing
online = tpath_online keys(fobj) ? OnlineTree(fobj) : nothing
new(fobj, online, offline)
end
end
Base.close(f::ROOTFile) = close(f._fobj)
function Base.show(io::IO, f::ROOTFile)
s = String[]
!ismissing(f.online) && push!(s, "$(f.online)")
!ismissing(f.offline) && push!(s, "$(f.offline)")
!isnothing(f.online) && push!(s, "$(f.online)")
!isnothing(f.offline) && push!(s, "$(f.offline)")
info = join(s, ", ")
print(io, "ROOTFile{$info}")
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment