Dear Rooters,
I’ve stumpled upon something that I don’t understand when using TGraph->Eval. Below there is a small root macro which creates a TGraph object directly from a text file (attached) with data. I then use the Eval method to evalute the TGraph at x coordinates which are given in the text file (i.e. root should not do any interpolation). However, the results are wrong
root [0]
Processing MuenSi.C…
TCanvas::MakeDefCanvas: created default TCanvas with name c1
Eval at 1E-3: 866.679
Eval at 1E-2: 47.8911
Eval at 1E-1: 0.0580743
when compared with the same values in the text file. I’ve tested the exact same code using root 5.18 and this works! What happened, or what have I done wrong?
[code]void MuenSi(){
TGraph *g_test = new TGraph(“MuenSi.txt”);
g_test->GetXaxis()->SetLimits(0.09,0.11);
g_test->GetYaxis()->SetRangeUser(0.,0.06);
g_test->Draw(“ALP”);
cout<<"Eval at 1E-3: "<<g_test->Eval(1E-3)<<endl;
cout<<"Eval at 1E-2: "<<g_test->Eval(1E-2)<<endl;
cout<<"Eval at 1E-1: "<<g_test->Eval(1E-1)<<endl;
}
[/code]
MuenSi.txt (872 Bytes)