TProfile memory usage

I am using root to process raw data from a detector and currently trying to find ways to increase precision along with memory usage as well as lower (or at least keep) used disk space.

Previously, I have tried simply filling an array of TH2C, leading to an output file of about 8MB. Since most of the data is supposed to be centered around the y=0 bin, I tried to improve this by using a combination of a narrow TH2C hist around zero with the same bin width, and a two-dimensional THnSparseC for catching outliers. This did decrease the filesize to about 6.6MB.

Then I realized I needed to keep precise track of mean value and its error for y values in each bin on x regardless of the THnSparseC y-binning, so I considered adding in a separately filled TH2C::ProfileX() for each hist in the array. Suddenly, the data volume of my output file is at 19MB, nearly triple the previous value without the TProfiles.

Is this to be expected? Is there a better way of keeping track of the mean and error of y-values for each xbin? I think the main problem is that ProfileX() takes floats instead of chars, but I was hoping to get an answer from someone more experienced.

ROOT Version: 6.26
Platform: Linux
Compiler: Not Provided

The TProfile stores double values for the sum of the content and the sum square in order to compute mean and its error. If you 2D histogram is not having many bins in y but a lots of bins in x, it could be possible that storing a Profile is less efficient than storing a TH2C.


1 Like