How to get entries from a scatter plot (TH2F)

Hi, all

I have a question of scatter plot like y vs x

I hope to know the entries within the range (0<x<4) and (0<y<8), does anyone know how to do that ?

Thanks a lot


Double_t TH2::Integral(Int_t firstxbin, Int_t lastxbin, Int_t firstybin, Int_t lastybin, Option_t *option) const { //Return integral of bin contents in range [firstxbin,lastxbin],[firstybin,lastybin] // for a 2-D histogram // By default the integral is computed as the sum of bin contents in the range. // if option "width" is specified, the integral is the sum of // the bin contents multiplied by the bin width in x and in y.

you can compute the bin number correspinding to a x, y value with eg

firstybin = h->GetYaxis()->FindBin(ymin)