Evaluate Spline of a TGraph

I am facing this rather strange issue. Assume the following code

void efficiency(){

	// (1b) Load the efficiency File for the CR39
	std::ifstream input("efficiency.txt");
	std::vector<float> Energy, Efficiency;
	int   lines=0;
	float x, y;
	while ( !input.eof() ){
		input >> x >> y;
		Energy.push_back(x);
		Efficiency.push_back(y);
		lines++;
	}

	TGraph *grEfficiency = new TGraph(lines, &Energy[0], &Efficiency[0]);
	grEfficiency->Draw("ALP");
	//TSpline3 *s = new TSpline3("grs",grEfficiency);
	float effLin  = grEfficiency->Eval(4.53025);
	float effSpli = grEfficiency->Eval(4.53025, 0, "S"); 
	cout << "Efficiency Linear = " << effLin << ", Efficiency Spline = " << effSpli << endl;  

}

which makes a TGraph out of an ascii file. I would like to evaluate the value of the TGraph using a TSpline. Although Eval(x) works fine, Eval(x, *Spline, *Option) seems to be wrong.
So after running this code I get the following

Efficiency Linear = 0.000687147, Efficiency Spline = -nan

Any idea on why is this happening?

The file can be found here

If I run your macro on Mac with the ROOT master I get:

$ root efficiency.C
   -----------------------------------------------------------------
  | Welcome to ROOT 6.11/01                     http://root.cern.ch |
  |                                    (c) 1995-2017, The ROOT Team |
  | Built for macosx64                                              |
  | From heads/master@v6-09-02-1619-g6b7e0e4, Jul 10 2017, 10:14:17 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'      |
   -----------------------------------------------------------------

root [0] 
Processing efficiency.C...
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
Efficiency Linear = 0.000687147, Efficiency Spline = 0.000687148
root [1] 

This is strangeā€¦
The only difference is that I am running Root 5.32 on lxplus.
But is this really the issue?

Yes, some bug fixes may have been done since this version. @moneta might know.

Oh ok!
Thanks a lot!

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