Slim Trees¶
A quick and dirty script for reducing the file size of a ROOT file by removing unwanted branches from a TTree.
Examples
The following examples assume the branches you want included in the slimmed tree
are listed in slimbranches.txt
.
Slim the tree tree
in data.root
and save to data.slim.root
:
$ slim-trees tree -i data.root
Slim the tree tree
in data.root
and save to newdata.root
:
$ slim-trees tree -i data.root -o newdata.root
Slim the tree tree
in data.root
, save to data.slim.root
, and only
keep the first 100 events:
$ slim-trees tree -i data.root -t 100
Note
A standard ROOT installation provides a program called rootslimtree
which
attempts to do much the same that this script does, but is more feature-rich.
The source code is available in the main ROOT git repository.
There are some quirks about rootslimtree
that I don’t understand, for
example I’ve seen it increase the file size of ROOT file after stripping away
unwanted branches. This is obviously not ideal.