Opened 3 years ago
Last modified 3 years ago
#1517 new How to
How to set the splitlevel for branches in the output root file
Reported by: | kratsg | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Delphes code | Version: | Delphes 3 |
Keywords: | splitlevel, ttree, tbranch, root | Cc: |
Description
Hi,
I'd like to use uproot (and columnar analysis) to analyze Delphes outputs. Right now, all the branches (e.g. Jet.Mass) seem to be set at splitlevel=0 ("unsplit") which means it takes some time to deserialize the branch before one can load it up.
Is there a way we can configure the splitlevel when Delphes writes these branches out? (This is Snowmass2021-related).
Thanks,
Giordon
Change History (4)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
Hi Pavel, thanks for the quick response. I noted in the documentation that the default splitlevel in all the ROOT::TTree::Branch() functions are 99 (fully split) so I'm wondering how the Delphes output seems to indicate a splitlevel of 0. Maybe I'm misreading things or looking at the branches incorrectly:
root [1] TBranch* branch = Delphes->GetBranch("Jet.Mass") (TBranch *) 0x5bd3980 root [2] branch->GetSplitLevel() (int) 0
I'll play around with the parameter and see how things work. Perhaps we can close the issue at this point and if I find that a configurable one improves uproot, I can open up another ticket and reference this one.
comment:3 by , 3 years ago
As far as I know (from a ROOT user point of view) Jet.Mass
is a leaf not a branch. Only Jet
is a branch.
The splitlevel of the Jet
branch is indeed 99:
root [1] TBranch* branch = Delphes->GetBranch("Jet") (TBranch *) 0x55b92a912a10 root [2] branch->GetSplitLevel() (int) 99
So, when Delphes creates the Jet
branch the splitlevel of the Jet
branch is the default 99 value (fully split). Jet.Mass
is a result of the splitting (a leaf or a subbranch).
Have you tried to point uproot to the Jet
branch instead of the Jet.Mass
leaf/subbranch?
comment:4 by , 3 years ago
Indeed, you're right, the splitlevel seems ok -- and so this is probably not the issue I'm seeing. I'll explore further. Thanks!
Delphes uses the default splitlevel value. According to the ROOT documentation at this link, the default value is 1.
All the branches are created by the code on line 41 in external/ExRootAnalysis/ExRootTreeBranch.cc:
https://github.com/delphes/delphes/blob/master/external/ExRootAnalysis/ExRootTreeBranch.cc#L41
The splitlevel parameter is not currently configurable. So please set it in the code and let me know if it solves the problem. If setting splitlevel to a different value solves the problem with uproot, I can make splitlevel configurable or just set it to the value that works with uproot.