The integral option in TH1::Add

In TH1 class, there is such a function.

It add a TF1 function to TH1.

The behaviour of this function with option “I” is very weird to me. I would thought this function should integrate the function h1 over the bin and then divided by the bin width. However, in really, the function multiply by the bin width instead.
In the line 816 of the source code

I also don’t understand what is the point of 815 line

Is there any reason for this? Or is it a bug?



I agree this function is weird and certainly not correct the way it is implemented.
One should just compute the integral and dived by the bin width.

I see the code has been like this for more than 10 years. This means nobody has used this functionality. For curiosity what is your use case to use TH1::Add with a function and for using it with the integral option ?

Best Regards


Hi Lorenzo,

Thank you for the response.
I want to smooth a function to a certain resolution which corresponding to the bin width of the histogram created. I believe the integral option will automatically do this for me, if it works appropriately.



The bug us fixed now in the ROOT master and 6.08 version