Dear ROOT community,
I use x=f->GetX(y) to determine the corresponding x-value to a given y-value of my TF1-function f (which is derived by a pol2-fit to a TGraphErrors).
This method used to work for quite a while in my program but since we updated to ROOT-version 5.20, it fails (the result is always 0). I recognized that the implementation of the function GetX has changed from version 5.18 to 5.20.
The fit-function f is fine (not the reason). It’s plotted and I can evaluate it with in it’s range. So maybe the new GetX() is the problem?
Is this problem known to other users, too? Or has someone an idea, what I might do wrong?
Thank you for any hints.
Christoph
Hi ,
can you post please the details of your function so I can investigate this problem better,
Thank you
Lorenzo
Dear Lorenzo!
You can try the following code which reproduces the problem:
int testGetX() {
double yval[3]={8, 9, 10};
double xval[3]={80, 90.1, 100.5};
TGraphErrors *ge=new TGraphErrors(3,xval,yval,NULL,NULL);
TF1 *f=new TF1(“f”,“pol1”,75,105);
ge->Fit(f,“rw”,“ac”);
double x=f->GetX(9);
printf(“For y=9 => x=%lf\n”,x);
new TCanvas(“c”,"",800,600);
ge->SetMarkerStyle(8);
ge->SetMarkerSize(1);
ge->Draw(“ap”);
}
Cheers,
Christoph
Hello,
this bug has already been fixed in ROOT 5.22. If you cannot move to a new version, you can do as workaround :
f->GetX(9,xmin, xmax);
where xmin and xmax are the function range
Cheers
Lorenzo
Dear Lorenzo,
yes, this works. Thank you!
Christoph