Get Integral


I have a question concerning the read out of a histogram.
I want to know the content of a certain bin-region:

I have defined a histogram with 100 bins in a range from 0 to 100.
If I want to know the content I am using
double d=((TH1*)_file0->Get(“regions/region1/h_tau_pt”))->Integral(0,100);

The problem is that I get a slightly different result when looking in the histogram directly.
Because of normalization the content of each bin is normally not an Integer.

Do you have any idea?
Is there a better method to obtain these values?

Many thanks!


I think I found the problem…

I have to make
double d=((TH1*)_file0->Get(“regions/region1/h_tau_pt”))->Integral(1,101);

instead of
double d=((TH1*)_file0->Get(“regions/region1/h_tau_pt”))->Integral(0,100);



h1->Integral(0,Nbin) will compute the integral including the underflow bin, while h1->Integral(1,Nbin+1) will compute it using the overflow bin. You should do h1->Integral(1,Nbin) or if you don;t have any range set in the axis, just h1->Integral()

Best Regards