TTree Optimization

Hi,

I have a user who is concerned with the output size of TTrees that he is generating. I have found references to some optimization that can be done, but no concrete examples or explanations of the preferred methods. Also, there seems to be no clear delimitation between optimizations for reading as compared to writing,

I’d appreciate some pointers on how to decrease file size. Do I need to change the default values for AutoFlush or AutoSave? Should I invoke OptimizeBackets, and if so when?

Also, any pointers on how to increase speed in writing and reading would be appreciated. I understand there must be some balance between speed and size, are the default values reasonable optimizations?

Thanks!

Hi,

the default settings of ROOT already produce rather optimised output on disk for the general case.
On the other hand, these might depend on the format of the output data.
What kind of dataformats is the user interested in?

Cheers,
Danilo

It is mostly just Double_t and UShort_t.

Ok: the standard optimisations of ROOT in this case should be already enough.
What I may suggest is to:
o Persist floats instead of doubles if no precision issues can arise. Additionally you could look into the opaque typedef Double32: see this tutorial root.cern.ch/root/html/tutorials … e32.C.html
o You could enable the lzma compression, trading some cpu and memory at runtime to gain some space on disk. For example, before creating your tree:

TFile f(filename, option, title, ROOT::CompressionSettings(ROOT::kLZMA, 5));

Cheers,
Danilo