Hello, I’ve been staring at my code for some time, and I am trying to turn a function into a TF1 class.
This is the method:
double yukawa(double mu){
double temp=0.0;
temp=pow((2./(3.-2*mu)),2);
return temp;
}
I try to force it to be TF1:
I get a nice message :
qm3.cxx:160:44: error: call of overloaded ‘TF1(const char [2], double (&)(double), int, int)’ is ambiguous
TF1 *Yukawa_Plot= new TF1("Y",yukawa,-1,1);
^
qm3.cxx:160:44: note: candidates are:
In file included from qm3.cxx:16:0:
/home/SJL/ROOT/include/TF1.h:217:4: note: TF1::TF1(const char*, ROOT::Math::ParamFunctor, Double_t, Double_t, Int_t, Int_t) <near match>
TF1(const char *name, ROOT::Math::ParamFunctor f, Double_t xmin = 0, Double_t xmax = 1, Int_t npar = 0,Int_t ndim = 1);
^
/home/SJL/ROOT/include/TF1.h:217:4: note: no known conversion for argument 2 from ‘double(double)’ to ‘ROOT::Math::ParamFunctor’
/home/SJL/ROOT/include/TF1.h:213:4: note: TF1::TF1(const char*, Double_t (*)(const Double_t*, const Double_t*), Double_t, Double_t, Int_t, Int_t) <near match>
TF1(const char *name, Double_t (*fcn)(const Double_t *, const Double_t *), Double_t xmin=0, Double_t xmax=1, Int_t npar=0,Int_t ndim = 1);
^
/home/SJL/ROOT/include/TF1.h:213:4: note: no known conversion for argument 2 from ‘double(double)’ to ‘Double_t (*)(const Double_t*, const Double_t*) {aka double (*)(const double*, const double*)}’
In file included from qm3.cxx:16:0:
/home/SJL/ROOT/include/TF1.h:212:4: note: TF1::TF1(const char*, Double_t (*)(Double_t*, Double_t*), Double_t, Double_t, Int_t, Int_t) <near match>
TF1(const char *name, Double_t (*fcn)(Double_t *, Double_t *), Double_t xmin=0, Double_t xmax=1, Int_t npar=0, Int_t ndim = 1);
^
/home/SJL/ROOT/include/TF1.h:212:4: note: no known conversion for argument 2 from ‘double(double)’ to ‘Double_t (*)(Double_t*, Double_t*) {aka double (*)(double*, double*)}’
Compilation failed
If 'qm3' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf qm3