Hi all,
Using the below code:
DataPoints.C (4.1 KB)
I create a TSpline3.
I can then do,
double ratio = sp3->Eval(600)/sp3->Eval(500);
double value_of_interest = sp3->Eval(156)/ratio;
Any my question is, how do I then find the ‘X’ value corresponding to ‘value_of_interest’ on the spline?
moneta
2
Hi,
The simplest way is to create a TF1 object based on the TSpline3 using for example a lambda function, and then you can call the TF1::GetX function.
auto lambda = [&](double *x, double *){ return sp3->Eval(x[0]); };
auto f1 = new TF1("f1",lambda, xmin, xmax, 0);
double x_value = f1->GetX( y_value, xmin, xmax);
Best Regards
Lorenzo
1 Like
system
Closed
3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.