Fitting turn-on curve

Hi,

I’m trying to do a fit to a turn-on curve by using TMath:ERF. This works pretty well, however I have one turn-on curve where the fit is not working at all. This is what I get:

root [13] to_all->Fit(“fit”)
Warning in TH1F::Fit: Abnormal termination of minimization.
FCN=nan FROM MIGRAD STATUS=CALL LIMIT 5010 CALLS 5011 TOTAL
EDM=nan STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 nan 4.80000e+00 nan nan
2 p1 nan 2.40000e-01 nan nan
3 p2 nan 2.10000e-01 nan nan
(Int_t)4
Warning in TCanvas::ResizePad: Inf/NaN propagated to the pad. Check drawn objects.
Warning in TCanvas::ResizePad: c1 height changed from 0 to 10

The data points look OK, but I have no idea how to proceed and find the error. I’m assuming that something in the histogram give Minuit a headache, but I don’t know what.

Any ideas?
Cheers,
Carsten

Carsten,

Please send a short script reproducing the problem

Rene

Hi Rene,

just do line-by-line the commands written in script.C. For some reason it doesn’t work as a macro…

Cheers,
Carsten
script.C (141 Bytes)
histo.root (5.89 KB)
TurnOnFit.C (2.05 KB)

Carsten,

Could you send me a working macro? something like:

{
gROOT->ProcessLine(".L TurnOnFit.C");
TFile f = new TFile(“histo.root”);
TH1F
to_all = (TH1F*)f->Get(“to_all”);
to_all->Draw();
TF1 *fit3 = new TF1(“fit3”,turnon_func,10.,18.,3);
fit3->SetParameters(13.0,1.0,0.75);
to_tr->Fit(“fit3”);
}

with the right call to TurnOnFit

Also, you may be interested by a new function in TGraphAsymErrors

root.cern.ch/root/htmldoc/TGraph … ayesDivide

Rene

Hi Rene,

the macro which you’ve just posted works fine with me - but only if you comment out the last line. However the last line “to_all->Fit(“fit3”);” leads to this funny error message which I don’t understand. … Do you want anothe histogram file which looks the same and which works?

Cheers,
Carsten
macro.C (344 Bytes)

Carsten,

If you want to restrict the fit to the range where the function is defined, you must specify the option “r”, eg
to_all->Fit(“fit3”,“r”);

Rene

Hi Rene,

thanks for your help! That did it.

Cheers,
Carsten