Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

also trying TDirectory #107

Merged
merged 4 commits into from
Sep 16, 2021
Merged

also trying TDirectory #107

merged 4 commits into from
Sep 16, 2021

Conversation

aminnj
Copy link
Member

@aminnj aminnj commented Sep 16, 2021

attempt to support TDirectories a la #67

julia> using UnROOT

julia> f = UnROOT.samplefile("tdir_complicated.root")
ROOTFile with 3 entries and 23 streamers.
/Users/namin/.julia/dev/UnROOT/test/samples/tdir_complicated.root
├─ a (TH1F)
├─ b (TH1F)
└─ mydir
   ├─ Events (TTree)
   │  └─ "Jet_pt"
   ├─ c (TH1F)
   ├─ d (TH1F)
   └─ mysubdir
      ├─ e (TH1F)
      └─ f (TH1F)

julia> f["mydir/mysubdir/e"][:fName]
"e"

julia> f["mydir"]["mysubdir"]["e"][:fName]
"e"

julia> length.(LazyTree(f, "mydir/Events").Jet_pt) |> println
Float32[0.0, 73.067154, 0.0, 20.33066, 0.0, 0.0]
julia> sum(UnROOT.samplefile("issue11_tdirectory.root")["Data/mytree/Particle0_E"])
1012.0000000000031

@codecov
Copy link

codecov bot commented Sep 16, 2021

Codecov Report

Merging #107 (68df67c) into master (b32d2cb) will increase coverage by 0.09%.
The diff coverage is 96.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #107      +/-   ##
==========================================
+ Coverage   89.84%   89.94%   +0.09%     
==========================================
  Files          11       11              
  Lines        1319     1342      +23     
==========================================
+ Hits         1185     1207      +22     
- Misses        134      135       +1     
Impacted Files Coverage Δ
src/root.jl 90.90% <90.00%> (-0.09%) ⬇️
src/bootstrap.jl 84.02% <100.00%> (+0.45%) ⬆️
src/displays.jl 98.11% <100.00%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b32d2cb...68df67c. Read the comment docs.

@aminnj aminnj changed the title [WIP] also trying TDirectory also trying TDirectory Sep 16, 2021
@tamasgal
Copy link
Member

I think this looks good, great :D

Regarding the reference propagation: we may refactor that at some point, but currently it is OK like this. We should focus on mandatory features first and at some point start to work on the internal API, whenever it gets too hacky ;)

@tamasgal tamasgal merged commit 9f80260 into JuliaHEP:master Sep 16, 2021
This was referenced Sep 16, 2021
Moelf pushed a commit to aminnj/UnROOT.jl that referenced this pull request Jun 23, 2022
* try1

* recursive and unit tests

* add files

* actually add tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants