# Draw the 1-D and 2-D histograms

I use the hsimple.root file in the tutorials folder, there is a 1-D and a 2-D histogram, I want to draw the part of the histogram and get the entries of the part. For example, I want to draw the histogram that x>1 .and. y>1 and get the entries of it. How can I do that?

``````   hpxpy->Draw("BOX");
hpxpy->GetXaxis()->SetRangeUser(1.,4.);
hpxpy->GetYaxis()->SetRangeUser(1.,4.);
Int_t bx1 = hpxpy->GetXaxis()->FindBin(1.);
Int_t bx2 = hpxpy->GetXaxis()->FindBin(4.);
Int_t by1 = hpxpy->GetYaxis()->FindBin(1.);
Int_t by2 = hpxpy->GetYaxis()->FindBin(4.);
printf("%g\n", hpxpy->Integral(bx1,bx2,by1,by2));``````

Thank you! I have been successfully get the right answer use the code that you told me! But now I have a problem: how can I get the entries of x^2+y^2<=1 in the 2-D histogram?
Another problem is : if the file have a TFolder and a subTFolder and the 2-D histogram in the subTFolder how can I find the 2-D histogram and get the entries in the region?

[quote=“ertaoLee”]Thank you! I have been successfully get the right answer use the code that you told me! But now I have a problem: how can I get the entries of x^2+y^2<=1 in the 2-D histogram?
Another problem is : if the file have a TFolder and a subTFolder and the 2-D histogram in the subTFolder how can I find the 2-D histogram and get the entries in the region?[/quote]

I’m trying to get the histogram and am having issues, is there a special support page for newbies that I am missing?