Illegal world coordinates for histogram TH2D

Hello,
when I try to draw the histo defined as

TH2D *angledist = new TH2D(“angledist”,“angledist”,nevent,0.,nevent,sizevectors,0.,sizevectors);

where nevent is 35 and sizevectors is 687

I see from angledist->GetBinContent(j1+1,j2+1)
that the histogram is well filled but as I try to draw it with the "COLZ"
I always get

Error in TCanvas::Range: illegal world coordinates range: x1=0.000000, y1=0.000000, x2=0.000000, y2=0.000000
Error in TCanvas::RangeAxis: illegal axis coordinates range: xmin=0.000000, ymin=0.000000, xmax=0.000000, ymax=0.000000

I use root5.14 but i also tried root17.08
Please tell me how can I solve this problem!!!

Could you post your histogram in a ROOT file?

Rene

Sure, This is part of the root file I wrote

TH2D *angledist = new TH2D(“angledist”,“angledist”,nevent,0.,nevent,sizevectors,0.,sizevectors);

for (i1=0; i1< nevent; i1++)
{

 for(i2=0; i2<sizevectors; i2++)
   {
     	     angulardist =acos(sin(declev[i1])*sin(declvec[i2])+cos(declev[i1])*cos(declvec[i2])*cos((arev[i1]-arvec[i2])));

 angledist->SetBinContent(i1+1,i2+1,angulardist/cf);	     
	     

     if((angulardist/cf) <= 3.15){
      extlist<<i1<<"\t"<<evnumd[i1]<<"\t"<<evenergy[i1]<<"\t"<<arev[i1]/cf<<"\t"<<declev[i1]/cf<< "\t"<<i2<<"\t"<<indexcat[i2]<<"\t"<<arvec[i2]/cf<<"\t"<<declvec[i2]/cf<<"\t"<<zed[i2]<<"\t"<<angulardist/cf<<endl;	    
       agnwithinbin++;   
 
     }

    
     indexagn[i2]=i2;
     
     
     if(angulardist/cf <= max[i1]) 
       {
	 max[i1]=angulardist/cf;
	 
	 index[i1]=i2;
	 		 
       }
 
   }

 
   }
 
 extlist.close();
   list.close();

angledist->Draw(“COLZ”);
angledist->Write();

Hope this is sufficient …
Many thanks!

If you cannot post a file containing the histogram, post the shortest possible (but running) piece of code that I can use to reproduce your problem.

Rene

Hello,
sorry but I didn’t reach to send you the ROOT file, can I send it to you by email?

Could you post your file in some afs public read area? if not send it to me by mail.

Rene