Pipe TTree::Draw() into a histogram

Hi,
I use the following code to pipe the result of a ntuple to histogram and get the entries of the histogram

TCanvas* c1 = new TCanvas(“c1”,“ntuple draw”);
c1->Divide(2,3);

c1->cd(1);
ntuple->Draw(“result>>h1”,“tt==1&&type==1”);
TH1F h1=(TH1F) gDirectory->Get(“h1”);
TH1F h1=(TH1F) gPad->GetPrimitive(“h1”);
n0=h1->GetEntries();

if there is no entries for this histogram, then the root prints error like this

Error in TPad::Range: illegal world coordinates range: x1=0.000000, y1=-1.375625, x2=0.000000, y2=1.380625
Error in TPad::RangeAxis: illegal axis coordinates range: xmin=0.000000, ymin=-1.100000, xmax=0.000000, ymax=1.105000

could you tell me how to avoid this error? the root version I use is 4.00/04.

Thanks in advance
Yu

This typically means that your selection is such that the output histogram has no entries.

Rene