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