diff --git a/README.md b/README.md index 2fcdba16..4b32be80 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,14 @@ [![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors-) -[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tamasgal.github.io/UnROOT.jl/dev) -[![Build Status](https://github.com/tamasgal/UnROOT.jl/workflows/CI/badge.svg)](https://github.com/tamasgal/UnROOT.jl/actions) -[![Codecov](https://codecov.io/gh/tamasgal/UnROOT.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/tamasgal/UnROOT.jl) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliahep.github.io/UnROOT.jl/dev) +[![Build Status](https://github.com/JuliaHEP/UnROOT.jl/workflows/CI/badge.svg)](https://github.com/JuliaHEP/UnROOT.jl/actions) +[![Codecov](https://codecov.io/gh/JuliaHEP/UnROOT.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaHEP/UnROOT.jl) UnROOT.jl is a reader for the [CERN ROOT](https://root.cern) file format written entirely in Julia, without any dependence on ROOT or Python. -## Quick Start (see [docs](https://tamasgal.github.io/UnROOT.jl/dev/) for more) +## Quick Start (see [docs](https://JuliaHEP.github.io/UnROOT.jl/dev/) for more) ```julia julia> using UnROOT @@ -69,7 +69,7 @@ ROOTFile with 1 entry and 19 streamers. ## Branch of custom struct We provide an experimental interface for hooking up UnROOT with your custom types -that only takes 2 steps, as explained [in the docs](https://tamasgal.github.io/UnROOT.jl/dev/advanced/custom_branch/). +that only takes 2 steps, as explained [in the docs](https://JuliaHEP.github.io/UnROOT.jl/dev/advanced/custom_branch/). As a show case for this functionality, the `TLorentzVector` support in UnROOT is implemented with the said plug-in system. @@ -202,10 +202,10 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - - + + + + diff --git a/docs/make.jl b/docs/make.jl index 03fc2f89..bb4837a7 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -17,7 +17,7 @@ makedocs(; "For Contributors" => "devdocs.md", "APIs" => "internalapis.md", ], - repo="https://github.com/tamasgal/UnROOT.jl/blob/{commit}{path}#L{line}", + repo="https://github.com/JuliaHEP/UnROOT.jl/blob/{commit}{path}#L{line}", sitename="UnROOT.jl", authors="Tamas Gal and contributors", ) diff --git a/docs/src/advanced/custom_branch.md b/docs/src/advanced/custom_branch.md index 5f71367c..bcc1f003 100644 --- a/docs/src/advanced/custom_branch.md +++ b/docs/src/advanced/custom_branch.md @@ -3,17 +3,17 @@ It is possible to parse Branches with custom structure as long as you know how t As an example, the `TLorentzVector` is added using this mechanism and we will walk through the steps needed: ### 1. Provide a map between `fClassName` of your struct (as seen in .root) to a Julia type. -Pass a `Dict{String, Type}` to `ROOTFile(filepath; customstructs)`. The `TLorentzVector` is shipped [by default](https://github.com/tamasgal/UnROOT.jl/blob/06b692523bbff3f467f6b7fe3544e411a719bc9e/src/root.jl#L21): +Pass a `Dict{String, Type}` to `ROOTFile(filepath; customstructs)`. The `TLorentzVector` is shipped [by default](https://github.com/JuliaHEP/UnROOT.jl/blob/06b692523bbff3f467f6b7fe3544e411a719bc9e/src/root.jl#L21): ```julia ROOTFile(filepath; customstructs = Dict("TLorentzVector" => LorentzVector{Float64})) ``` -This `Dict` will subsequently be used by the `auto_T_JaggT` function [at here](https://github.com/tamasgal/UnROOT.jl/blob/06b692523bbff3f467f6b7fe3544e411a719bc9e/src/root.jl#L213-L222) such that when we encounter a branch with this `fClassName`, we will return your `Type` as the detected element type of this branch. +This `Dict` will subsequently be used by the `auto_T_JaggT` function [at here](https://github.com/JuliaHEP/UnROOT.jl/blob/06b692523bbff3f467f6b7fe3544e411a719bc9e/src/root.jl#L213-L222) such that when we encounter a branch with this `fClassName`, we will return your `Type` as the detected element type of this branch. ### 2. Extend the raw bytes interpreting function `UnROOT.interped_data` -By default, given a branch element type and a "jaggness" type, a general function [is defined](https://github.com/tamasgal/UnROOT.jl/blob/06b692523bbff3f467f6b7fe3544e411a719bc9e/src/root.jl#L149) which will try to parse the raw bytes into Julia data structure. The `::Type{T}` will match what you have provided in the `Dict` in the previous step. +By default, given a branch element type and a "jaggness" type, a general function [is defined](https://github.com/JuliaHEP/UnROOT.jl/blob/06b692523bbff3f467f6b7fe3544e411a719bc9e/src/root.jl#L149) which will try to parse the raw bytes into Julia data structure. The `::Type{T}` will match what you have provided in the `Dict` in the previous step. -Thus, to "teach" UnROOT how to interpret bytes for your type `T`, you would want to defined a more specific `UnROOT.interped_data` than the default one. Taking the `TLorentzVector` [as example](https://github.com/tamasgal/UnROOT.jl/blob/06b692523bbff3f467f6b7fe3544e411a719bc9e/src/custom.jl#L23) again, we define a function: +Thus, to "teach" UnROOT how to interpret bytes for your type `T`, you would want to defined a more specific `UnROOT.interped_data` than the default one. Taking the `TLorentzVector` [as example](https://github.com/JuliaHEP/UnROOT.jl/blob/06b692523bbff3f467f6b7fe3544e411a719bc9e/src/custom.jl#L23) again, we define a function: ```julia using LorentzVector const LVF64 = LorentzVector{Float64} @@ -32,7 +32,7 @@ function Base.reinterpret(::Type{LVF64}, v::AbstractVector{UInt8}) where T end ``` -The `Base.reinterpret` function is just a helper function, you could instead write everything inside `UnROOT.interped_data`. We then builds on these, to interpret Jagged TLV branch: https://github.com/tamasgal/UnROOT.jl/blob/4747f6f5fd97ed1a872765485b4eb9e99ec5a650/src/custom.jl#L47 +The `Base.reinterpret` function is just a helper function, you could instead write everything inside `UnROOT.interped_data`. We then builds on these, to interpret Jagged TLV branch: https://github.com/JuliaHEP/UnROOT.jl/blob/4747f6f5fd97ed1a872765485b4eb9e99ec5a650/src/custom.jl#L47 ### More details To expand a bit what we're doing here, the `rawdata` for a single `TLV` is always `64 bytes` long and the first `32 bytes` are TObject header which we don't care (which is why we don't care about `rawoffsets` here). The last `32 bytes` make up 4 `Float64` and we simply parse them and return a collection of (julia) `LorentzVector{Float64}`. diff --git a/test/samples/issue61.py b/test/samples/issue61.py index a19d5147..e26d4ca7 100644 --- a/test/samples/issue61.py +++ b/test/samples/issue61.py @@ -1,6 +1,6 @@ import ROOT as r -# https://github.com/tamasgal/UnROOT.jl/issues/61 +# https://github.com/JuliaHEP/UnROOT.jl/issues/61 # needs to be run in a specific environment to trigger the issue # in the first place

Tamas Gal

๐Ÿ’ป ๐Ÿ“– ๐Ÿš‡ ๐Ÿ”ฃ โš ๏ธ

Jerry Ling

๐Ÿ’ป โš ๏ธ ๐Ÿ”ฃ ๐Ÿ“–

Johannes Schumann

๐Ÿ’ป โš ๏ธ ๐Ÿ”ฃ

Nick Amin

๐Ÿ’ป โš ๏ธ ๐Ÿ”ฃ

Tamas Gal

๐Ÿ’ป ๐Ÿ“– ๐Ÿš‡ ๐Ÿ”ฃ โš ๏ธ

Jerry Ling

๐Ÿ’ป โš ๏ธ ๐Ÿ”ฃ ๐Ÿ“–

Johannes Schumann

๐Ÿ’ป โš ๏ธ ๐Ÿ”ฃ

Nick Amin

๐Ÿ’ป โš ๏ธ ๐Ÿ”ฃ

Mosรจ Giordano

๐Ÿš‡

Oliver Schulz

๐Ÿค”

Misha Mikhasenko

๐Ÿ”ฃ