Strange behavior of TGraph2D

I try to draw a function Prob=f(Phim,Phic) by using TGraph2D,

#define PI 3.141592654
{
  Double_t Phim,Phic,Prob,Y;
  Double_t Thetam=0.168052,Thetac=1.50985;

  TGraph2D* grpr=new TGraph2D();
  TGraph* grprm=new TGraph();
  TGraph* grprc=new TGraph();

  TRandom *r = new TRandom();

  for(Int_t i=0;i<1000>Rndm(i);
      Phic=PI*r->Rndm(i);
      Y=cos(Phim)*cos(Phic)-sin(Phim)*sin(Phic)*cos(2*Thetam-2*Thetac);
      Prob=(2*Y*sin(Phim)*sin(2*Thetam)+sin(Phic)*sin(2*Thetac))*(2*Y*sin(Phim)*sin(2*Thetam)+sin(Phic)*sin(2*Thetac));
      grpr->SetPoint(i,Phim,Phic,Prob);
      grprm->SetPoint(i,Phim,Prob);
      grprc->SetPoint(i,Phic,Prob);
    }

  TCanvas *c2= new TCanvas("c2"," ",600,600);
  c2->Divide(2);c2->cd(1);
  grpr->Draw("surf1");
  c2_2->Divide(1,2);
  c2_2->cd(1);
  grprm->Draw("AF");
  c2_2->cd(2);
  grprc->Draw("AF");
}

Prob goes to 0 when both Phim and Phic are 0.
But with the ‘surf’ option, of 90% chances, a peak(single point?) will emerge at the bin of least Phim and Phic…
If project the sampled points to 2D plots of Prob vs. Phim and Prob vs. Phic, such a peak does not appear. So it is a bug of TGraph2D?
Run the code, should get a plot as in the attatchment.


The code that you posted does not compile. Post your script as an attachment.
In case you use a version older than 5.12 move to 5.12

Rene

I moved to 5.12 and seems to have got rid of the single point.
Thanks!