Re: [ROOT] TH1, TF1 and integrals

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Mar 26 2004 - 15:43:52 MET


Hi Julien,

Sorry for the long delay to answer your mail

Julien Bolmont wrote:
>Hi,

>>Sorry if this question has already been asked or seems stupid but I 
>really don't know what happen...

>I really don't know how ROOT does to integrate TF1 and TH1...
>For example, I send you a macro. If you run it, you will see (I hope 
>because it's what I see) that the integral of a product of a constant c 
>with a function f is not equal to the product of the constant c with 
>the integral of f.
>The other problem is that the integral of the corresponding histogram 
>(TH1) is wrong too...

I do not see any difference between the two methods. I Get the following output
8.34299e-06 OK
8.34299e-06 NOK !!  (but it is OK)
histo integral with "width" = 7.79905e-06

There is a difference between TF1::Integral and TH1::Integral.
TF1::Integral is more precise. TH1::Integral can only assume a uniform
distribution inside one bin.

Rene Brun

>I think I probably miss something important ! But what ?

>Could you explain to me why these two cases leads to wrong results ?
>Why the result with a TF1 is so different from the result obtained with 
>a TH1, even with a big number of bins ?

>Thanks a lot for your answer !

>Julien.



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET