Get coordinates of a point from a TGraph2D

Hi,

I am interested in finding the coordinates of the minimum point (Z-direction) of at TGraph2D. I know how to get the value of z:

gr -> GetZmin();

I’d like to know the x and y coordinates corresponding to that point.

Is that possible without fitting the graph with a function?

Estela.

You can try the following, assuming a TGraph2D* g

```int ix,iy,iz; g->GetHistogram()->GetMinimumBin(ix,iy,iz); double xmin = g->GetHistogram()->GetXaxis()->GetBinCenter(ix); double ymin = g->GetHistogram()->GetYaxis()->GetBinCenter(iy); ```
Rene

I’m sorry, but there is something that I don’t understand in this.

Why are the values that I obtain in ix and iy and iz not the same? If I understand correctly, these are indeces of the arrays (x,y,z) that I use to produce my TGraph2D, like:

According to this iz should be the index of the element that is the minimum value of the array z. The corresponding elements of x and y should be in the same position, as they are the other two coordinates of the same point.

Or are ix, iy and iz something else?

Thanks,
Estela

ix, iy, iz returned by g->GetHistogram()->GetMinimumBin(ix,iy,iz); are histogram bins in the underlying histogram build by GetHistogram(). They are not indexes in the x, y and z arrays. But the coordinates returned by :

double xmin = g->GetHistogram()->GetXaxis()->GetBinCenter(ix);
double ymin = g->GetHistogram()->GetYaxis()->GetBinCenter(iy);

should be correct.