Hi,
I am trying to make a fit with the Voigt function, but it always gives some errors.
I have tried these alternatives:
TF1 *vfit;
(1) vfit = new TF1(“vfit”, “voigt”, 0., 180.);
(2) vfit = new TF1(“vfit”, “Voigt”, 0., 180.);
(3) vfit = new TF1(“vfit”, “TMath::Voigt”, 0., 180.);
(4) vfit = new TF1(“vfit”, “TMath::voigt”, 0., 180.);
(5) vfit = new TF1(“vfit”, TMath::Voigt, 0., 180.);
(6) vfit = new TF1(“vfit”, TMath::voigt, 0., 180.);
h1LatScat->Fit(vfit, “RS”);
vfit->SetLineColor(3);
vfit->Draw(“same”);
The alternatives (1), (2), (3), (4) compile (make), but when I run the file it gives:
Error in TFormula::Compile: Bad numerical expression : "voigt"
Error in TF1::TF1: function: vfit/voigt has 0 parameters instead of 1
Error in : function is zombie
The alternatives (5), (6) don’t compile and give the error that the expressions are ambiguous:
call of overloaded ‘TF1(const char [5], Double_t (&)(Double_t, Double_t, Double_t, Int_t), double, double)’ is ambiguous
/home/micaela/root/include/TF1.h:98: note: candidates are: TF1::TF1(const char*, ROOT::Math::ParamFunctor, Double_t, Double_t, Int_t)
/home/micaela/root/include/TF1.h:94: note: TF1::TF1(const char*, Double_t ()(const Double_t, const Double_t*), Double_t, Double_t, Int_t)
/home/micaela/root/include/TF1.h:93: note: TF1::TF1(const char*, Double_t ()(Double_t, Double_t*), Double_t, Double_t, Int_t)
The most curious fact about all of this is if I use:
vfit = new TF1(“vfit”, “gaus”, 0., 180.);
It runs wonderfully…
Thanks in advance,
Micaela