TGraph2D::SetMaximum seems to hang forever

root-config --version
6.22/06

const Int_t N = 4;

TGraph2D graph;

graph.Set(N);

for (Int_t i = 0; i != N; ++i) {
graph.SetPoint(i, (Double_t) i, 0.0, 0.0);
}

graph.SetMaximum(1.0); // hangs forever

Hi and welcome on forum,

It is problem in Math/Delaunay2D class.
@moneta or @couet should check it.

As temporary solution you could call graph.GetHistogram("old"); before setting maximum.
It will use old interpolation method, which does not hang with such data.

TGraph2D algorithm is based on triangles. The points you define are aligned.
It is not possible to find a triangle. That’s why it hangs.

Hi,
We should add a protection against this case and probably use a simple 1D interpolation if the points are aligned.
I will open a GitHub issue for this.

Lorenzo

Wouldn’t it be better to set the limit of the associated histogram only when it already exists but not create a histogram when it doesn’t exist?
It is a bit weird that a function to set a limit can lead to the creation of an internal histogram with the additional complexity.

I will look closer at it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.