The TProfile histograms inherit from the double precision histograms (like TProfile2D from TH2D).
Does this mean that every bin in the profile histogram uses 64 bits? If yes, is it possible to have profile histograms with only single precision, to limit memory usage? If not presently, could it be considered for a future version?
There are two arrays stored in a TProfile
-sum of weights per bin
-sum of square of weights per bin
the second one must be in double precision, ie assuming a float per bin for the first array, you would gain less than 1/3 of the current volume.
There are use cases where float is enough also for the squares, why not let the user decide if she/he needs it? (I am sorry that I posted in the wrong forum because this turned out to be a feature request).
I made an implementation of a class TProfileF deriving from TH1F instead of TH1D.
I created an instance of this class with 100 bins. The total size of the object is 2272 bytes
to be compared with 3088 bytes for the same object with a TProfile.
A TH1F has its bin contents using a float but its bin errors always using a double.
The TProfileF object size i(2272 bytes) ncludes
640 bytes (sizeof(object) without dynamic structures
408 bytes for the array holding the number of entries per bin
408 bytes for the sum of weights
816 bytes for the sum of squares of weights
You can find the code in attachment. To use it do
[code] root > .L TProfileF.cxx+
TProfileF.cxx (62.6 KB)
TProfileF.h (6.56 KB)