Hello everyone!
I have a very strange problem when I store a TF1 function in a ROOT file and then I plot it. If I define a function and I plot it, it looks great. If I save this function to a ROOT file, then open that ROOT file and plot again the previous function it looks different, very different! For example you can run these lines in the command line to see the error what I talking about:
root [0] TFile *rout = new TFile(“test.root”,“RECREATE”);
root [1] double sNeutronsParametrization(double *x, double *par) { return par[0] + par[1]/sqrt(x[0]);}
root [2] TF1 *fn = new TF1(“fn”,sNeutronsParametrization,5e-2,1e6,2);
root [3] fn->SetParameters(193.67300,422.51700)
root [4] fn->Draw(“APL”)
Info in TCanvas::MakeDefCanvas: created default TCanvas with name c1
root [5] fn->Write(“fn”)
(int) 944
root [6] .q
If you now open the “test.root” file and plot the previous saved function you will see the problem:
root [0] Attaching file test.root as _file0…
root [1] .ls
TFile** test.root
TFile* test.root
KEY: TF1 fn;1 fn
root [2] fn->Draw(“APL”)
I have found this problem in a compiled script so it has nothing to do with the command line. The ROOT version that I am running is the 6.22/02