diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index b4dc2e03..dd0d0d9d 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-10-10T13:21:10","documenter_version":"1.1.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-10-10T13:23:07","documenter_version":"1.1.0"}} \ No newline at end of file diff --git a/dev/advanced/custom_branch/index.html b/dev/advanced/custom_branch/index.html index 686f69cf..5df46c84 100644 --- a/dev/advanced/custom_branch/index.html +++ b/dev/advanced/custom_branch/index.html @@ -27,4 +27,4 @@ julia> UnROOT.splitup(data, offsets, UnROOT._KM3NETDAQHit) 4-element Vector{Vector{UnROOT._KM3NETDAQHit}}: - [UnROOT._KM3NETDAQHit(1073742790, 0x00, 9, 0x60)...... + [UnROOT._KM3NETDAQHit(1073742790, 0x00, 9, 0x60)...... diff --git a/dev/advanced/reduce_latency/index.html b/dev/advanced/reduce_latency/index.html index 6b5aea23..44f2596a 100644 --- a/dev/advanced/reduce_latency/index.html +++ b/dev/advanced/reduce_latency/index.html @@ -23,4 +23,4 @@ ________________________________________________________ Executed in 619.20 millis fish external usr time 902.29 millis 0.00 millis 902.29 millis - sys time 658.59 millis 1.05 millis 657.54 millis + sys time 658.59 millis 1.05 millis 657.54 millis diff --git a/dev/devdocs/index.html b/dev/devdocs/index.html index d108d4f2..3887dbe9 100644 --- a/dev/devdocs/index.html +++ b/dev/devdocs/index.html @@ -1,2 +1,2 @@ -For Contributors · UnROOT.jl

While the ROOT documentation does not contain a detailed description of the binary structure, the format can be triangulated by other packages like

Here's a detailed from-scratch walk through on reading a jagged branch from a ROOT file, recommended for first time contributors or those who just want to learn about ROOT file format.

Three's also a discussion reagarding the ROOT binary format documentation on uproot's issue page.

+For Contributors · UnROOT.jl

While the ROOT documentation does not contain a detailed description of the binary structure, the format can be triangulated by other packages like

Here's a detailed from-scratch walk through on reading a jagged branch from a ROOT file, recommended for first time contributors or those who just want to learn about ROOT file format.

Three's also a discussion reagarding the ROOT binary format documentation on uproot's issue page.

diff --git a/dev/exampleusage/index.html b/dev/exampleusage/index.html index 5a8ecea6..fcba38cd 100644 --- a/dev/exampleusage/index.html +++ b/dev/exampleusage/index.html @@ -29,4 +29,4 @@ 6 │ 6 0.00916447384387542 7 │ 7 0.5636229077934333 8 │ 8 0.32617388561103156 - ⋮ │ ⋮ ⋮

Write out a histogram

A histogram is just a tuple of (bincontent, binedges), see FHist.jl docs for details.

+ ⋮ │ ⋮ ⋮

Write out a histogram

A histogram is just a tuple of (bincontent, binedges), see FHist.jl docs for details.

diff --git a/dev/index.html b/dev/index.html index e92329aa..06a0cde8 100644 --- a/dev/index.html +++ b/dev/index.html @@ -84,4 +84,4 @@ "pos_y" "dir_y" "dir_x" - "pos_x" + "pos_x" diff --git a/dev/internalapis/index.html b/dev/internalapis/index.html index 5a4a9de0..3cadbb40 100644 --- a/dev/internalapis/index.html +++ b/dev/internalapis/index.html @@ -14,7 +14,7 @@ julia> ab[begin:end] 0 1 -...source
UnROOT.LazyTreeMethod
LazyTree(f::ROOTFile, s::AbstractString, branche::Union{AbstractString, Regex})
+...
source
UnROOT.LazyTreeMethod
LazyTree(f::ROOTFile, s::AbstractString, branche::Union{AbstractString, Regex})
 LazyTree(f::ROOTFile, s::AbstractString, branches::Vector{Union{AbstractString, Regex}})

Constructor for LazyTree, which is close to an DataFrame (interface wise), and a lazy Table (speed wise). Looping over a LazyTree is fast and type stable. Internally, LazyTree contains a typed table whose branch are LazyBranch. This means that at any given time only N baskets are cached, where N is the number of branches.

Note

Accessing with [start:stop] will return a LazyTree with concrete internal table.

Warning

Split branches are re-named, and the exact renaming may change. See Issue 156 for context.

Example

julia> mytree = LazyTree(f, "Events", ["Electron_dxy", "nMuon", r"Muon_(pt|eta)$"])
  Row │ Electron_dxy     nMuon   Muon_eta         Muon_pt
      │ Vector{Float32}  UInt32  Vector{Float32}  Vector{Float32}
@@ -23,11 +23,11 @@
  2   │ [-0.00982]       2       [0.53, 0.229]    [19.9, 15.3]
  3   │ []               0       []               []
  4   │ [-0.00157]       0       []               []
- ⋮   │     ⋮            ⋮             ⋮                ⋮
source
UnROOT.LazyTreeMethod
function LazyTree(f::ROOTFile, tree::TTree, treepath, branches)

Creates a lazy tree object of the selected branches only. branches is vector of String, Regex or Pair{Regex, SubstitutionString}, where the first item is the regex selector and the second item the rename pattern.

source

More Internal

UnROOT.CursorType

The Cursor type is embeded into Branches of a TTree such that when we need to read the content of a Branch, we don't need to go through the Directory and find the TKey and then seek to where the Branch is.

Note

The io inside a Cursor is in fact only a buffer, it is NOT a io that refers to the whole file's stream.

source
UnROOT.LeafFieldType
struct LeafField{T}
+ ⋮   │     ⋮            ⋮             ⋮                ⋮
source
UnROOT.LazyTreeMethod
function LazyTree(f::ROOTFile, tree::TTree, treepath, branches)

Creates a lazy tree object of the selected branches only. branches is vector of String, Regex or Pair{Regex, SubstitutionString}, where the first item is the regex selector and the second item the rename pattern.

source

More Internal

UnROOT.CursorType

The Cursor type is embeded into Branches of a TTree such that when we need to read the content of a Branch, we don't need to go through the Directory and find the TKey and then seek to where the Branch is.

Note

The io inside a Cursor is in fact only a buffer, it is NOT a io that refers to the whole file's stream.

source
UnROOT.LeafFieldType
struct LeafField{T}
     content_col_idx::Int
     type::Int
     nbits::Int
-end

Base case of field nesting, this links to a column in the RNTuple by 0-based index. T is the eltype of this field which mostly uses Julia native types except for Switch.

The type field is the RNTuple spec type number, used to record split encoding.

source
UnROOT.OffsetBufferType
OffsetBuffer

Works with seek, position of the original file. Think of it as a view of IOStream that can be indexed with original positions.

source
UnROOT.PreambleMethod

Reads the preamble of an object.

The cursor will be put into the right place depending on the data.

source
UnROOT.RNTupleType
RNTuple

This is the struct for holding all metadata (schema) needed to completely describe and RNTuple from ROOT, just like TTree, to obtain a table-like data object, you need to use LazyTree explicitly:

Example

julia> f = ROOTFile("./test/samples/RNTuple/test_ntuple_stl_containers.root");
+end

Base case of field nesting, this links to a column in the RNTuple by 0-based index. T is the eltype of this field which mostly uses Julia native types except for Switch.

The type field is the RNTuple spec type number, used to record split encoding.

source
UnROOT.OffsetBufferType
OffsetBuffer

Works with seek, position of the original file. Think of it as a view of IOStream that can be indexed with original positions.

source
UnROOT.PreambleMethod

Reads the preamble of an object.

The cursor will be put into the right place depending on the data.

source
UnROOT.RNTupleType
RNTuple

This is the struct for holding all metadata (schema) needed to completely describe and RNTuple from ROOT, just like TTree, to obtain a table-like data object, you need to use LazyTree explicitly:

Example

julia> f = ROOTFile("./test/samples/RNTuple/test_ntuple_stl_containers.root");
 
 julia> f["ntuple"]
 UnROOT.RNTuple:
@@ -54,10 +54,10 @@
  3   │ three   [1, 2, 3]        [3.0, 3.0, 3.0]  Vector{Int32}[Int3  ["one", "two", "th  [["one"], ["two"],  three            Union{Int64, Strin  ⋯
  4   │ four    [1, 2, 3, 4]     [4.0, 4.0, 4.0]  Vector{Int32}[Int3  ["one", "two", "th  [["one"], ["two"],  4                Union{Int64, Strin  ⋯
  5   │ five    [1, 2, 3, 4, 5]  [5.0, 5.0, 5.0]  Vector{Int32}[Int3  ["one", "two", "th  [["one"], ["two"],  5                Union{Int64, Strin  ⋯
-                                                                                                                                  5 columns omitted
source
UnROOT.RNTupleCardinalityType
struct RNTupleCardinality{T}
+                                                                                                                                  5 columns omitted
source
UnROOT.RNTupleCardinalityType
struct RNTupleCardinality{T}
     content_col_idx::Int
     nbits::Int
-end

Special field. The cardinality is basically a counter, but the data column is a leaf column of Index32 or Index64. To get a number from Cardinality, one needs to compute ary[i] - ary[i-1].

source
UnROOT.RNTupleFieldType
mutable struct RNTupleField{R, F, O, E} <: AbstractVector{E}

Not a counterpart of RNTuple field in ROOT. This is a user-facing Julia-only construct like LazyBranch that is meant to act like a lazy AbstractVector backed with file IO source and a schema field from RNTuple.schema.

  • R is the type of parent RNTuple
  • F is the type of the field in the schema
  • 'O' is the type of output when you read a cluster-worth of data
  • 'E' is the element type of O (i.e. what you get for each event (row) in iteration)
source
UnROOT.RNTupleSchemaType
struct RNTupleSchema

A wrapper struct for print_tree implementation of the schema display.

Example

julia> f = ROOTFile("./test/samples/RNTuple/test_ntuple_stl_containers.root");
+end

Special field. The cardinality is basically a counter, but the data column is a leaf column of Index32 or Index64. To get a number from Cardinality, one needs to compute ary[i] - ary[i-1].

source
UnROOT.RNTupleFieldType
mutable struct RNTupleField{R, F, O, E} <: AbstractVector{E}

Not a counterpart of RNTuple field in ROOT. This is a user-facing Julia-only construct like LazyBranch that is meant to act like a lazy AbstractVector backed with file IO source and a schema field from RNTuple.schema.

  • R is the type of parent RNTuple
  • F is the type of the field in the schema
  • 'O' is the type of output when you read a cluster-worth of data
  • 'E' is the element type of O (i.e. what you get for each event (row) in iteration)
source
UnROOT.RNTupleSchemaType
struct RNTupleSchema

A wrapper struct for print_tree implementation of the schema display.

Example

julia> f = ROOTFile("./test/samples/RNTuple/test_ntuple_stl_containers.root");
 
 julia> f["ntuple"].schema
 RNTupleSchema with 13 top fields
@@ -83,7 +83,7 @@
 │                                 └─ :content ⇒ Leaf{Char}(col=14)
 ...
 ..
-.
source
UnROOT.ROOTFileMethod
ROOTFile(filename::AbstractString; customstructs = Dict("TLorentzVector" => LorentzVector{Float64}))

ROOTFile's constructor from a file. The customstructs dictionary can be used to pass user-defined struct as value and its corresponding fClassName (in Branch) as key such that UnROOT will know to intepret them, see interped_data.

See also: LazyTree, LazyBranch

Example

julia> f = ROOTFile("test/samples/NanoAODv5_sample.root")
+.
source
UnROOT.ROOTFileMethod
ROOTFile(filename::AbstractString; customstructs = Dict("TLorentzVector" => LorentzVector{Float64}))

ROOTFile's constructor from a file. The customstructs dictionary can be used to pass user-defined struct as value and its corresponding fClassName (in Branch) as key such that UnROOT will know to intepret them, see interped_data.

See also: LazyTree, LazyBranch

Example

julia> f = ROOTFile("test/samples/NanoAODv5_sample.root")
 ROOTFile with 2 entries and 21 streamers.
 test/samples/NanoAODv5_sample.root
 └─ Events
@@ -92,11 +92,11 @@
    ├─ "event"
    ├─ "HTXS_Higgs_pt"
    ├─ "HTXS_Higgs_y"
-   └─ "⋮"
source
UnROOT.StdArrayFieldType
StdArrayField<N, T>

Special base-case field for a leaf field representing std::array<T, N>. This is because RNTuple would serialize it as a leaf field but with flags == 0x0001 in the field description. In total, there are two field descriptions associlated with array<>, one for meta-data (the N), the other one for the actual data.

source
UnROOT.StreamersMethod
function Streamers(io)

Reads all the streamers from the ROOT source.

source
UnROOT.StringFieldType
StringField

Special base-case field for String leaf field. This is because RNTuple splits a leaf String field into two columns (instead of split in field records). So we need an offset column and a content column (that contains Chars).

source
UnROOT.THMethod
TH(io, tkey::TKey, refs)

Internal function used to form a fields = Dict{Symbol, Any}() that represents the fields of a TH (histogram) in C++ ROOT.

source
UnROOT._field_output_typeMethod
_field_output_type(::Type{F}) where F

This is function is used in two ways:

  • provide a output type prediction for each "field" in RNTuple so we can

achieve type stability

  • it's also used to enforce the type stability in read_field:
    # this is basically a type assertion for `res`
-    return res::_field_output_type(field)
source
UnROOT._rntuple_clusterrangeMethod

The event number range a given cluster covers, in Julia's index

source
UnROOT.arrayMethod
array(f::ROOTFile, path; raw=false)

Reads an array from a branch. Set raw=true to return raw data and correct offsets.

source
UnROOT.arraysMethod
arrays(f::ROOTFile, treename)

Reads all branches from a tree.

source
UnROOT.auto_T_JaggTMethod
auto_T_JaggT(f::ROOTFile, branch; customstructs::Dict{String, Type})

Given a file and branch, automatically return (eltype, Jaggtype). This function is aware of custom structs that are carried with the parent ROOTFile.

This is also where you may want to "redirect" classname -> Julia struct name, for example "TLorentzVector" => LorentzVector here and you can focus on LorentzVectors.LorentzVector methods from here on.

See also: ROOTFile, interped_data

source
UnROOT.basketarrayMethod
basketarray(f::ROOTFile, path::AbstractString, ith)
+   └─ "⋮"
source
UnROOT.StdArrayFieldType
StdArrayField<N, T>

Special base-case field for a leaf field representing std::array<T, N>. This is because RNTuple would serialize it as a leaf field but with flags == 0x0001 in the field description. In total, there are two field descriptions associlated with array<>, one for meta-data (the N), the other one for the actual data.

source
UnROOT.StreamersMethod
function Streamers(io)

Reads all the streamers from the ROOT source.

source
UnROOT.StringFieldType
StringField

Special base-case field for String leaf field. This is because RNTuple splits a leaf String field into two columns (instead of split in field records). So we need an offset column and a content column (that contains Chars).

source
UnROOT.THMethod
TH(io, tkey::TKey, refs)

Internal function used to form a fields = Dict{Symbol, Any}() that represents the fields of a TH (histogram) in C++ ROOT.

source
UnROOT._field_output_typeMethod
_field_output_type(::Type{F}) where F

This is function is used in two ways:

  • provide a output type prediction for each "field" in RNTuple so we can

achieve type stability

  • it's also used to enforce the type stability in read_field:
    # this is basically a type assertion for `res`
+    return res::_field_output_type(field)
source
UnROOT._rntuple_clusterrangeMethod

The event number range a given cluster covers, in Julia's index

source
UnROOT.arrayMethod
array(f::ROOTFile, path; raw=false)

Reads an array from a branch. Set raw=true to return raw data and correct offsets.

source
UnROOT.arraysMethod
arrays(f::ROOTFile, treename)

Reads all branches from a tree.

source
UnROOT.auto_T_JaggTMethod
auto_T_JaggT(f::ROOTFile, branch; customstructs::Dict{String, Type})

Given a file and branch, automatically return (eltype, Jaggtype). This function is aware of custom structs that are carried with the parent ROOTFile.

This is also where you may want to "redirect" classname -> Julia struct name, for example "TLorentzVector" => LorentzVector here and you can focus on LorentzVectors.LorentzVector methods from here on.

See also: ROOTFile, interped_data

source
UnROOT.basketarrayMethod
basketarray(f::ROOTFile, path::AbstractString, ith)
 basketarray(f::ROOTFile, branch::Union{TBranch, TBranchElement}, ith)
-basketarray(lb::LazyBranch, ith)

Reads actual data from ith basket of a branch. This function first calls readbasket to obtain raw bytes and offsets of a basket, then calls auto_T_JaggT followed by interped_data to translate raw bytes into actual data.

source
UnROOT.basketarray_iterMethod
basketarray_iter(f::ROOTFile, branch::Union{TBranch, TBranchElement})
-basketarray_iter(lb::LazyBranch)

Returns a Base.Generator yielding the output of basketarray() for all baskets.

source
UnROOT.chaintreesMethod
chaintrees(ts)

Chain a collection of LazyTrees together to form a larger tree, every tree should have identical branch names and types, we're not trying to re-implement SQL here.

Example

julia> typeof(tree)
+basketarray(lb::LazyBranch, ith)

Reads actual data from ith basket of a branch. This function first calls readbasket to obtain raw bytes and offsets of a basket, then calls auto_T_JaggT followed by interped_data to translate raw bytes into actual data.

source
UnROOT.basketarray_iterMethod
basketarray_iter(f::ROOTFile, branch::Union{TBranch, TBranchElement})
+basketarray_iter(lb::LazyBranch)

Returns a Base.Generator yielding the output of basketarray() for all baskets.

source
UnROOT.chaintreesMethod
chaintrees(ts)

Chain a collection of LazyTrees together to form a larger tree, every tree should have identical branch names and types, we're not trying to re-implement SQL here.

Example

julia> typeof(tree)
 LazyTree with 1 branches:
 a
 
@@ -115,12 +115,12 @@
 UnROOT.LazyEvent{NamedTuple{(:a,), Tuple{LazyBranch{Int32, UnROOT.Nojagg, Vector{Int32}}}}}
 
 julia> eltype(tree2)
-UnROOT.LazyEvent{NamedTuple{(:a,), Tuple{SentinelArrays.ChainedVector{Int32, LazyBranch{Int32, UnROOT.Nojagg, Vector{Int32}}}}}}
source
UnROOT.compressed_datastreamMethod
compressed_datastream(io, tkey)

Extract all [compressionheader][rawbytes] from a TKey. This is an isolated function because we want to compartmentalize disk I/O as much as possible.

See also: decompress_datastreambytes

source
UnROOT.decompress_datastreambytesMethod
decompress_datastreambytes(compbytes, tkey)

Process the compressed bytes compbytes which was read out by compressed_datastream and pointed to from tkey. This function simply return uncompressed bytes according to the compression algorithm detected (or the lack of).

source
UnROOT.endcheckMethod
function endcheck(io, preamble::Preamble)

Checks if everything went well after parsing a TOBject. Used in conjuction with Preamble.

source
UnROOT.interped_dataMethod
interped_data(rawdata, rawoffsets, ::Type{T}, ::Type{J}) where {T, J<:JaggType}

The function thats interpret raw bytes (from a basket) into corresponding Julia data, based on type T and jagg type J.

In order to retrieve data from custom branches, user should defined more speialized method of this function with specific T and J. See TLorentzVector example.

source
UnROOT.interped_dataMethod
interped_data(rawdata, rawoffsets, ::Type{Vector{LorentzVector{Float64}}}, ::Type{Offsetjagg})

The interped_data method specialized for LorentzVector. This method will get called by basketarray instead of the default method for TLorentzVector branch.

source
UnROOT.parseTHMethod
parseTH(th::Dict{Symbol, Any})

Parse the output of TH into a tuple of counts, edges, and sumw2. A StatsBase.Histogram can then be constructed with Histogram(edges, counts). TH1 and TH2 inputs are supported.

source
UnROOT.parsetobjectMethod

Direct parsing of streamed objects which are not sitting on branches. This function needs to be rewritten, so that it can create proper types of TObject inherited data (like TVectorT<*>).

source
UnROOT.read_fieldMethod
read_field(io, field::F, page_list) where F

Read a field from the io stream. The page_list is a list of PageLinks for the current cluster group. The type stability is achieved by type asserting based on type F via _field_output_type function.

source
UnROOT.read_fieldMethod
read_field(io, field::StructField{N, T}, page_list) where {N, T}

Since each field of the struct is stored in a separate field of the RNTuple, this function returns a StructArray to maximize efficiency.

source
UnROOT.read_pagedescMethod
read_pagedesc(io, pagedesc::Vector{PageDescription}, nbits::Integer)

Read the decompressed raw bytes given a Page Description. The nbits need to be provided according to the element type of the column since pagedesc only contains num_elements information.

Note

Boolean values are always stored as bit in RNTuple, so nbits = 1.

source
UnROOT.readbasketMethod
readbasket(f::ROOTFile, branch, ith)
-readbasketseek(f::ROOTFile, branch::Union{TBranch, TBranchElement}, seek_pos::Int, nbytes)

The fundamental building block of reading read data from a .root file. Read read one basket's raw bytes and offsets at a time. These raw bytes and offsets then (potentially) get processed by interped_data.

See also: auto_T_JaggT, basketarray

source
UnROOT.readobjany!Method
function readobjany!(io, tkey::TKey, refs)

The main entrypoint where streamers are parsed and cached for later use. The refs dictionary holds the streamers or parsed data which are reused when already available.

source
UnROOT.skiptobjMethod
function skiptobj(io)

Skips a TOBject.

source
UnROOT.splitupMethod
splitup(data::Vector{UInt8}, offsets, T::Type; skipbytes=0)

Given the offsets and data return by array(...; raw = true), reconstructed the actual array (with custome struct, can be jagged as well).

source
UnROOT.topological_sortMethod
function topological_sort(streamer_infos)

Sort the streamers with respect to their dependencies and keep only those which are not defined already.

The implementation is based on https://stackoverflow.com/a/11564769/1623645

source
UnROOT.unpackMethod
unpack(x::CompressionHeader)

Return the following information:

  • Name of compression algorithm
  • Level of the compression
  • compressedbytes and uncompressedbytes according to uproot3
source
UnROOT.@SimpleStructMacro
macro SimpleStruct

Define reading method on the fly for _rntuple_read

Example

julia> @SimpleStruct struct Locator
+UnROOT.LazyEvent{NamedTuple{(:a,), Tuple{SentinelArrays.ChainedVector{Int32, LazyBranch{Int32, UnROOT.Nojagg, Vector{Int32}}}}}}
source
UnROOT.compressed_datastreamMethod
compressed_datastream(io, tkey)

Extract all [compressionheader][rawbytes] from a TKey. This is an isolated function because we want to compartmentalize disk I/O as much as possible.

See also: decompress_datastreambytes

source
UnROOT.decompress_datastreambytesMethod
decompress_datastreambytes(compbytes, tkey)

Process the compressed bytes compbytes which was read out by compressed_datastream and pointed to from tkey. This function simply return uncompressed bytes according to the compression algorithm detected (or the lack of).

source
UnROOT.endcheckMethod
function endcheck(io, preamble::Preamble)

Checks if everything went well after parsing a TOBject. Used in conjuction with Preamble.

source
UnROOT.interped_dataMethod
interped_data(rawdata, rawoffsets, ::Type{T}, ::Type{J}) where {T, J<:JaggType}

The function thats interpret raw bytes (from a basket) into corresponding Julia data, based on type T and jagg type J.

In order to retrieve data from custom branches, user should defined more speialized method of this function with specific T and J. See TLorentzVector example.

source
UnROOT.interped_dataMethod
interped_data(rawdata, rawoffsets, ::Type{Vector{LorentzVector{Float64}}}, ::Type{Offsetjagg})

The interped_data method specialized for LorentzVector. This method will get called by basketarray instead of the default method for TLorentzVector branch.

source
UnROOT.parseTHMethod
parseTH(th::Dict{Symbol, Any})

Parse the output of TH into a tuple of counts, edges, and sumw2. A StatsBase.Histogram can then be constructed with Histogram(edges, counts). TH1 and TH2 inputs are supported.

source
UnROOT.parsetobjectMethod

Direct parsing of streamed objects which are not sitting on branches. This function needs to be rewritten, so that it can create proper types of TObject inherited data (like TVectorT<*>).

source
UnROOT.read_fieldMethod
read_field(io, field::F, page_list) where F

Read a field from the io stream. The page_list is a list of PageLinks for the current cluster group. The type stability is achieved by type asserting based on type F via _field_output_type function.

source
UnROOT.read_fieldMethod
read_field(io, field::StructField{N, T}, page_list) where {N, T}

Since each field of the struct is stored in a separate field of the RNTuple, this function returns a StructArray to maximize efficiency.

source
UnROOT.read_pagedescMethod
read_pagedesc(io, pagedesc::Vector{PageDescription}, nbits::Integer)

Read the decompressed raw bytes given a Page Description. The nbits need to be provided according to the element type of the column since pagedesc only contains num_elements information.

Note

Boolean values are always stored as bit in RNTuple, so nbits = 1.

source
UnROOT.readbasketMethod
readbasket(f::ROOTFile, branch, ith)
+readbasketseek(f::ROOTFile, branch::Union{TBranch, TBranchElement}, seek_pos::Int, nbytes)

The fundamental building block of reading read data from a .root file. Read read one basket's raw bytes and offsets at a time. These raw bytes and offsets then (potentially) get processed by interped_data.

See also: auto_T_JaggT, basketarray

source
UnROOT.readobjany!Method
function readobjany!(io, tkey::TKey, refs)

The main entrypoint where streamers are parsed and cached for later use. The refs dictionary holds the streamers or parsed data which are reused when already available.

source
UnROOT.skiptobjMethod
function skiptobj(io)

Skips a TOBject.

source
UnROOT.splitupMethod
splitup(data::Vector{UInt8}, offsets, T::Type; skipbytes=0)

Given the offsets and data return by array(...; raw = true), reconstructed the actual array (with custome struct, can be jagged as well).

source
UnROOT.topological_sortMethod
function topological_sort(streamer_infos)

Sort the streamers with respect to their dependencies and keep only those which are not defined already.

The implementation is based on https://stackoverflow.com/a/11564769/1623645

source
UnROOT.unpackMethod
unpack(x::CompressionHeader)

Return the following information:

  • Name of compression algorithm
  • Level of the compression
  • compressedbytes and uncompressedbytes according to uproot3
source
UnROOT.@SimpleStructMacro
macro SimpleStruct

Define reading method on the fly for _rntuple_read

Example

julia> @SimpleStruct struct Locator
            num_bytes::Int32
            offset::UInt64
        end

would automatically define the following reading method:

function _rntuple_read(io, ::Type{Locator})
     num_bytes = _rntuple_read(io, Int32)
     offset = _rntuple_read(io, UInt64)
     Locator(num_bytes, offset)
-end

Notice _rntuple_read falls back to read for all types that are not defined by us.

source
UnROOT.@stackMacro
macro stack(into, structs...)

Stack the fields of multiple structs and create a new one. The first argument is the name of the new struct followed by the ones to be stacked. Parametric types are not supported and the fieldnames needs to be unique.

Example:

@stack Baz Foo Bar

Creates Baz with the concatenated fields of Foo and Bar

source
+end

Notice _rntuple_read falls back to read for all types that are not defined by us.

source
UnROOT.@stackMacro
macro stack(into, structs...)

Stack the fields of multiple structs and create a new one. The first argument is the name of the new struct followed by the ones to be stacked. Parametric types are not supported and the fieldnames needs to be unique.

Example:

@stack Baz Foo Bar

Creates Baz with the concatenated fields of Foo and Bar

source
diff --git a/dev/performancetips/index.html b/dev/performancetips/index.html index cdaced13..4c82f3bc 100644 --- a/dev/performancetips/index.html +++ b/dev/performancetips/index.html @@ -6,4 +6,4 @@ nmu = evt.nMuon nmu !=4 && continue calculation(nmu) -end +end