Dear all,
I created a graph out of an histogram and then I fitted the graph with a cubic Spline3. Now I would like to use the spline to find the x value (abscissa), once the y is given. For the functions TF1 such method is called GetX, but for TSpline3 it does not exist. I think a solution is to define a function using the spline I created, but I could not do it. Could please someone help me? I tried the following but it does not work:
// graph creation from histogram h1
TGraph *gr1;
double t[nbins];
double z[nbins];
for (int i=0;i<=nbins;i++) {
t[i] = h1->GetBinCenter(i);
z[i] = h1->GetBinContent(i);
}
// use a cubic spline to smooth the graph
TSpline3 *s = new TSpline3(“grs”,gr1);
s->SetLineColor(kRed);
s->Draw(“same”);
h1->Draw(“same”);
// attempt to create a function using the spline s
double_t xxx;
TF1 *fInterpolator = new TF1(“fInterpolator”, s->Eval(xxx), h1->GetBinCenter(1), h1->GetBinCenter(nbins));
Regards,
Andrea