Integrate histogram


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi dear experts

I need to find the area of my histogram between the range I specified. range is -5.55 to 4.47.

h3->Integral(N_fit1,N_fit2);

N_fit1 is -5.55. N_fit2 is 4.47
I used Integral command for this but the result got me thinking and one of my teacher said result doesn’t look right which is 326. Does anyone have any idea what I am doing wrong.
Thanks for help

Hi,

the arguments of TH1::Integral are not the axis numbers, but bin numbers. So you need to figure out which bins your -5.55 and +4.47 belong to, and to feed these two numbers to the TH1::Integral:

h3->Integral(h3->FindBin(-5.55), h3->FindBin(+4.47));
1 Like