Greetings,
I collect points for a TGraph2D from a tree as follows:
TGraph2D *grexp = new TGraph2D();
TFile *f = new TFile(fnames[i]);
TTree *t = (TTree *) f->Get("limit");
Float_t deltaNLL, par1, par2;
Int_t nexp=0;
t->SetBranchAddress("deltaNLL", &deltaNLL);
t->SetBranchAddress(par1name, &par1);
t->SetBranchAddress(par2name, &par2);
for (size_t j = 0, n = t->GetEntries(); j < n; ++j) {
t->GetEntry(j);
grexp->SetPoint(nexp++,par1,par2,2*deltaNLL);
}
Immediately after reading the tree in I print the contents of the graph out:
double *x = grexp->GetX();
double *y = grexp->GetY();
double *z = grexp->GetZ();
for(int i=0; i<grexp->GetN(); i++)
printf ("%d\t%f\t%f\t%f\n",i,x[i],y[i],z[i]);
Immediately after this I draw the graph:
TCanvas *canv = new TCanvas("tester","tester",500,500);
grexp->Draw("TRI");
The result is attached. It gives me exactly what I expect.
BUT: If I then click on the canvas and change the draw option to “SURF3”, I get the second result posted, which seems to indicate there are points on the x=y line with the z value equal to zero (I verified this in log scale). However, the printed contents of the graph show NO SUCH points exist in the graph.
Why is the TGraph drawing routine adding these spurious points? I need to make contour plots of the surface shown, and that draw option also exhibits the same spurious zeroes.
Thanks for any help with this,
-P. Dudero