Integral with a defined bin range

Hi guys,

maybe it’s a stupid question but I think I didn’t get really the meaning of the TH1::Integral() method with a defined bin range.

If I have a histo defined as h(“title”,“title”,23,1,24)

and I take h->Integral(2,24)

what is the integration range I’m considering?


Please read tips for efficient and successful posting and posting code

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


h->GetXaxis()->GetBinLowEdge(2)h->GetXaxis()->GetBinUpEdge(24)

Note that bin 24 is the “overflow bin” in your case, so when filling it will “collect” everything from h->GetXaxis()->GetBinLowEdge(24) to “infinity”.

h(“title”,“title”,23,1,24)

means your histogram has 23 bins, where the lower bin border is 1.0 and the upper is 24.0. So the bin number 1 goes from 1.0 to 2.0, bin number 2 from 2.0 to 3.0 etc.

Integral(2,24) gets the sum of the bin content for bins 2 to 24. Now - that bin 24 is special, it’s the bin that contains everything “to the right” of the histogram, i.e. all Fill() with values > 24.

Makes sense?

Thank you guys

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.