thart
February 2, 2010, 2:00pm
1
Hi,
I want to integrate bins in a subrange of a TH2D histogram but I fail with the syntax of Integral()
For example, how would I integrate a a rectangular subrange in (x_min,y_min) & (x_max,y_max)?
Following the Integral() definitions
I thought that it would work with
But ROOT computes the integral value for my test histogram as 0 although the histogram is definitely not empty…
Maybe somebody could help me with the correct syntax?
Cheers & Thanks,
Thomas
brun
February 2, 2010, 2:07pm
2
using
Double_t Integral(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Option_t* option = "")
with
binx1 = myhist->GetXaxis()->FindBin(xmin);
binx2 = myhist->GetXaxis()->FindBin(xmax);
biny1 = myhist->GetYaxis()->FindBin(ymin);
biny2 = myhist->GetYaxis()->FindBin(ymax);
The TH1::FindBin function returns a global bin number (see doc)
Rene
thart
February 2, 2010, 2:13pm
3
Hi Rene,
many thanks – I have not considered that I have to ask the particular axis. But now it seems quite obvious
Thanks,
Thomas