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

Better browsing #199

Merged
merged 12 commits into from
Feb 8, 2023
Merged

Better browsing #199

merged 12 commits into from
Feb 8, 2023

Conversation

tamasgal
Copy link
Member

@tamasgal tamasgal commented Dec 23, 2022

This will break a few things since f["what/ever"] will now always return the object which sits at that "position" but the navigation is much easier.

Before this PR, UnROOT choked on branches which could not be interpreted so that the user's only option to explore the structure was to use .fBranches etc. and dig into ROOT internals.

Now, if a TTree or TBranchElement is returned by getindex(), the branches are listed:

julia> using UnROOT
[ Info: Precompiling UnROOT [3cd96dde-e98d-4713-81e9-a4a1b0235ce9]

julia> f = ROOTFile("mcv7.2.gsg_muon-CC_1-100GeV.km3sim.jterbr00011156.jorcarec.aanet.2591.root")
ROOTFile with 4 entries and 32 streamers.
mcv7.2.gsg_muon-CC_1-100GeV.km3sim.jterbr00011156.jorcarec.aanet.2591.root
├─ E (TTree)
│  └─ "Evt"
├─ KM3NET_SUMMARYSLICE (TTree)
│  └─ "KM3NET_SUMMARYSLICE"
├─ Head (Head)
└─ META (TDirectory)
   ├─ JMeta (TNamed)
   ├─ JMeta (TNamed)
   ├─ JMeta (TNamed)
   ├─ JMeta (TNamed)
   ├─ JMeta (TNamed)
   ├─ JMeta (TNamed)
   ├─ JMeta (TNamed)
   ├─ JMeta (TNamed)
   ├─ JConvertEvt (TNamed)
   ├─ JMuonEnergy (TNamed)
   ├─ JMuonStart (TNamed)
   ├─ JMuonStart (TNamed)
   ├─ JMuonGandalf (TNamed)
   ├─ JMuonSimplex (TNamed)
   ├─ JMuonPrefit (TNamed)
   └─ JTriggerEfficiency (TNamed)


julia> f["E"]
E (TTree)
└─ "Evt"


julia> f["E/Evt"]
Evt
├─ AAObject
│  ├─ TObject
│  │  ├─ fUniqueID
│  │  └─ fBits
│  ├─ usr
│  ├─ usr_names
│  └─ any
├─ id
├─ det_id
├─ mc_id
├─ run_id
├─ mc_run_id
├─ frame_index
├─ trigger_mask
├─ trigger_counter
├─ overlays
├─ t
│  ├─ t.fSec
│  └─ t.fNanoSec
├─ hits
│  ├─ hits.fUniqueID

@tamasgal
Copy link
Member Author

I had to adjust quite a few tests since

b = rootfile["some/path"]

now needs an explicit call to

b = LazyBranch(rootfile, "some/path")

(btw. TAB-completion would be awesome 😆 )

@tamasgal tamasgal marked this pull request as ready for review December 23, 2022 01:03
@tamasgal tamasgal requested a review from Moelf December 23, 2022 01:03
@codecov
Copy link

codecov bot commented Dec 23, 2022

Codecov Report

Base: 90.33% // Head: 90.00% // Decreases project coverage by -0.34% ⚠️

Coverage data is based on head (e2be84c) compared to base (7bf7918).
Patch coverage: 50.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #199      +/-   ##
==========================================
- Coverage   90.33%   90.00%   -0.34%     
==========================================
  Files          18       18              
  Lines        2091     2100       +9     
==========================================
+ Hits         1889     1890       +1     
- Misses        202      210       +8     
Impacted Files Coverage Δ
src/displays.jl 83.50% <0.00%> (-5.51%) ⬇️
src/streamers.jl 89.33% <50.00%> (-0.54%) ⬇️
src/iteration.jl 87.21% <100.00%> (+0.05%) ⬆️
src/root.jl 94.20% <100.00%> (-0.07%) ⬇️
src/types.jl 98.86% <100.00%> (+0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

src/root.jl Show resolved Hide resolved
src/root.jl Show resolved Hide resolved
@Moelf
Copy link
Member

Moelf commented Dec 23, 2022

@tamasgal yeah I think it's fine.

So:

  1. set version to 0.9 since it's technically breaking
  2. add CHANGELOG or NEWS somewhere?

thanks for this!

src/root.jl Outdated Show resolved Hide resolved
@tamasgal
Copy link
Member Author

tamasgal commented Feb 8, 2023

Alright @Moelf from my side it's done. Can you have a look? I put a notice in the README, I think we can leave it there for a while, at least until v1.0 😉

@Moelf Moelf merged commit 1a239fd into master Feb 8, 2023
@tamasgal tamasgal deleted the browsing-rootfiles branch February 8, 2023 13:44
@tamasgal
Copy link
Member Author

tamasgal commented Feb 8, 2023

Thanks! I'll go ahead with the release then

@tamasgal tamasgal mentioned this pull request Feb 12, 2023
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