RDataFrame: TH1DModel tricks to use less memory

Hello,
I use RDataFrame in my analysis and I have a large number of systematic uncertainties (O(1500)). I implemented them via the Vary Method.

code:
model= ROOT.RDF.TH1DModel(‘hname’,‘Title’, len(ptbins[0])-1, ptbins[0])
d.Vary(ptvar, method, variationTags=vtags, variationName=“pt” ).Histo1D(model,ptvar,‘weight’))

This works great !
Unfortunately now my memory blows up and I can not run the code. Are there some tricks to use less memory. For the good old TH1D for example one can switch to TH1F or remove the sumw2 option which reduces already a lot…
Thank you for your help.
Tancredi

Hello @tancredi ,

the simplest thing to do is use coarser binning. You can also split your 1500 histograms in 2 separate loops, which halves the memory usage. Or reduce the number of thread (the number passed to EnableImplicitMT(n) which will also scale down memory usage accordingly.

I hope this helps,
Enrico