Skip to content

Commit

Permalink
Preparing release
Browse files Browse the repository at this point in the history
  • Loading branch information
peremato committed Feb 12, 2024
1 parent 0470ba1 commit 8ebfbd4
Show file tree
Hide file tree
Showing 6 changed files with 3,959 additions and 10 deletions.
8 changes: 0 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@ version = "0.1.0"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Corpuscles = "e78a0372-c628-4773-9c8d-eb17d149bf93"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
FHist = "68837c9b-b678-4cd5-9925-8a54edc8f695"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
UnROOT = "3cd96dde-e98d-4713-81e9-a4a1b0235ce9"
Expand Down
13 changes: 13 additions & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
EDM4hep = "eb32b910-dde9-4347-8fce-cd6be3498f0c"
FHist = "68837c9b-b678-4cd5-9925-8a54edc8f695"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
LsqFit = "2fda8390-95c7-5789-9bda-21331edee243"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

2,749 changes: 2,749 additions & 0 deletions examples/reco_edm4hep.ipynb

Large diffs are not rendered by default.

1,186 changes: 1,186 additions & 0 deletions examples/reco_eff_edm4hep.ipynb

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/Components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include("../podio/genComponents.jl")

#---Vector3d
Base.convert(::Type{Vector3d}, t::Tuple) = Vector3d(t...)
Base.convert(::SVector{3,Float64}, v::Vector3d) = SVector{3,Float64}(v...)
Base.show(io::IO, v::Vector3d) = print(io, "($(v.x), $(v.y), $(v.z))")
Base.:+(v1::Vector3d, v2::Vector3d) = Vector3d(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z)
Base.:-(v1::Vector3d, v2::Vector3d) = Vector3d(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z)
Expand All @@ -22,6 +23,8 @@ function Base.isapprox(v1::Vector3d, v2::Vector3d; atol::Real=0, rtol::Real=Base
end
Base.iterate(v::Vector3d, i=1) = i > 3 ? nothing : (getproperty(v, propertynames(v)[i]), i+1)
Base.length(v::Vector3d) = 3
θ(v::Vector3d) = atan((v.x^2+v.y^2), v.z)
ϕ(v::Vector3d) = atan(v.y, v.x)

#---Vector3f
Base.convert(::Type{Vector3f}, t::Tuple) = Vector3f(t...)
Expand All @@ -37,6 +40,8 @@ function Base.isapprox(v1::Vector3f, v2::Vector3f; atol::Real=0, rtol::Real=Base
end
Base.iterate(v::Vector3f, i=1) = i > 3 ? nothing : (getproperty(v, propertynames(v)[i]), i+1)
Base.length(v::Vector3f) = 3
θ(v::Vector3f) = atan((v.x^2+v.y^2), v.z)
ϕ(v::Vector3f) = atan(v.y, v.x)

#---Vector2i
Base.convert(::Type{Vector2i}, t::Tuple) = Vector2i(t...)
Expand Down
8 changes: 6 additions & 2 deletions src/RootIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module RootIO
file::ROOTFile
isRNTuple::Bool
collectionIDs::Dict{String, UInt32}
collectionNames::Dict{UInt32, String}
btypes::Dict{String, Type}
layouts::Dict{String, Tuple} # for TTree only
lazytree::LazyTree
Expand All @@ -47,14 +48,17 @@ module RootIO
reader.isRNTuple = true
meta = LazyTree(rtuple, ["events___idTable", "events_collectionNames"])[1]
reader.collectionIDs = Dict(meta.events_collectionNames .=> meta.events___idTable)
reader.collectionNames = Dict(meta.events___idTable .=> meta.events_collectionNames)
else
reader.isRNTuple = false
meta = LazyTree(reader.file, "podio_metadata", [Regex("events___idTable/(.*)") => s"\1"])[1]
reader.collectionIDs = Dict(meta.m_names .=> meta.m_collectionIDs)
reader.collectionNames = Dict(meta.m_collectionIDs .=> meta.m_names)
end
else
@warn "ROOT file $filename does not have a 'podio_metadate' tree. Is it a PODIO file?"
reader.collectionIDs = Dict{UInt32, String}()
reader.collectionNames = Dict{String, UInt32}()
end
# layouts and branch types
reader.btypes = Dict{String, Type}()
Expand Down Expand Up @@ -98,7 +102,7 @@ module RootIO
cid = findfirst(x -> lowercase(x) == lowercase("_$(branch)_$(na)_collectionID"), splitnames)
end
push!(layout, (ft, (id, cid)))
elseif ft <: SVector # fixed arrarys are translated to SVector
elseif ft <: SVector # fixed arrays are translated to SVector
s = size(ft)[1]
id = findfirst(x-> x == n * "[$(s)]", splitnames)
push!(layout, (ft,(id,s)))
Expand Down Expand Up @@ -135,7 +139,7 @@ module RootIO
for l in inds
if l isa Tuple
if l[1] <: SVector # (type,(id, size))
ft, (id, s) = l
ft, (id, s) = l
push!(sa, StructArray{ft}(reshape(evt[id], s, len);dims=1))
else
push!(sa, getStructArrayTTree(evt, l, collid, len))
Expand Down

0 comments on commit 8ebfbd4

Please sign in to comment.