*********************************************************************************
Minuit
*********************************************************************************
pass : 0
................... FCN=205.276 FROM MINOS STATUS=SUCCESSFUL 44 CALLS 429 TOTAL
EDM=3.83274e-10 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 5.13639e+01 2.01330e+00 -2.79355e-04 -2.05444e-06
2 p1 5.57813e+01 4.80586e+00 3.09152e-03 -9.98323e-07
3 p2 7.42112e+01 1.87043e+00 -1.20323e-03 -1.92352e-07
4 p3 4.27344e+02 2.93232e+00 -1.66250e-02 -7.79026e-07
5 p4 3.58604e-02 3.47006e-04 1.73862e-07 9.80669e-02
6 p5 1.00001e+00 1.64203e-04 1.64203e-04 3.19367e-02
Minuit, npass=20 : RT= 0.238 s, Cpu= 0.230 s
*********************************************************************************
Fumili
*********************************************************************************
pass : 0
...................****************************************
Minimizer is Fumili
Chi2 = 206.284
NDf = 194
NCalls = 4
p0 = 51.4325 +/- 2.01397
p1 = 55.5412 +/- 4.81253
p2 = 74.2976 +/- 1.87298
p3 = 427.425 +/- 2.93868
p4 = 0.0358559 +/- 0.000357243
p5 = 1.00001 +/- 0.00016009
Fumili, npass=20 : RT= 0.104 s, Cpu= 0.060 s
*********************************************************************************
Minuit2
*********************************************************************************
pass : 0
...................****************************************
Minimizer is Minuit2 / Migrad
Chi2 = 205.34
NDf = 194
Edm = 1.91396e-10
NCalls = 85
p0 = 51.3576 +/- 2.0133 -2.01329 +2.0133 (Minos)
p1 = 55.8172 +/- 4.80582 -4.80605 +4.80561 (Minos)
p2 = 74.1981 +/- 1.8704 -1.87032 +1.8705 (Minos)
p3 = 427.317 +/- 2.93218 -2.93197 +2.93246 (Minos)
p4 = 0.0358574 +/- 0.000346961 -0.000345228 +0.000348733 (Minos)
p5 = 1.00001 +/- 0.000164204 -0.000164437 +0.000163973 (Minos)
Minuit2, npass=20 : RT= 0.080 s, Cpu= 0.090 s
*********************************************************************************
Fumili2
*********************************************************************************
pass : 0
...................****************************************
Minimizer is Minuit2 / Fumili
Chi2 = 207.495
NDf = 194
Edm = 1.09727e-10
NCalls = 2
p0 = 51.4278 +/- 2.01392
p1 = 55.5389 +/- 4.81246
p2 = 74.3004 +/- 1.87297
p3 = 427.406 +/- 2.93858
p4 = 0.0358584 +/- 0.000357283
p5 = 1.00001 +/- 0.000160099
Fumili2, npass=20 : RT= 0.036 s, Cpu= 0.030 s
(int) 0
double background(
double *
x,
double *par) {
return par[0] + par[1]*
x[0] + par[2]*
x[0]*
x[0];
}
double lorentzianPeak(
double *
x,
double *par) {
TMath::Max( 1.e-10,(
x[0]-par[2])*(
x[0]-par[2]) + .25*par[1]*par[1]);
}
double fitFunction(
double *
x,
double *par) {
return background(
x,par) + lorentzianPeak(
x,&par[3]);
}
bool DoFit(
const char* fitter,
TVirtualPad *pad,
int npass) {
printf("\n*********************************************************************************\n");
printf("\t %s \n",fitter);
printf("*********************************************************************************\n");
std::string title = std::string(fitter) + " fit bench";
histo =
new TH1D(fitter,title.c_str(),200,0,3);
bool ok = true;
for (int pass=0;pass<npass;pass++) {
if (pass%100 == 0) printf("pass : %d\n",pass);
else printf(".");
for (int i=0;i<5000;i++) {
}
int iret = histo->
Fit(fitFcn,
"Q0");
ok &= (iret == 0);
if (iret!=0)
Error(
"DoFit",
"Fit pass %d failed !",pass);
}
if (!fitterType.Contains("Fumili"))
else
printf(
"%s, npass=%d : RT=%7.3f s, Cpu=%7.3f s\n",fitter,npass,timer.
RealTime(),cputime);
return ok;
}
int minuit2FitBench(int npass=20) {
fitFcn =
new TF1(
"fitFcn",fitFunction,0,3,6);
bool ok = true;
ok &= DoFit(
"Minuit",
gPad,npass);
ok &= DoFit(
"Fumili",
gPad,npass);
ok &= DoFit(
"Minuit2",
gPad,npass);
ok &= DoFit(
"Fumili2",
gPad,npass);
c1->SaveAs(
"FitBench.root");
return (ok) ? 0 : 1;
}
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
static void SetDefaultMinimizer(const char *type, const char *algo=nullptr)
Set the default Minimizer type and corresponding algorithms.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
TDirectory::TContext keeps track and restore the current directory.
virtual void SetNpx(Int_t npx=100)
virtual Double_t GetRandom(TRandom *rng=nullptr, Option_t *opt=nullptr)
virtual void SetParameters(const Double_t *params)
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Fit histogram with function fname.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual TF1 * GetFunction(const char *name) const
Return pointer to function with name.
A Pave (see TPave) with a text centered in the Pave.
void Draw(Option_t *option="") override
Draw this pavelabel with its current attributes.
Random number generator class based on M.
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
void Stop()
Stop the stopwatch.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)=0
virtual void SetLogy(Int_t value=1)=0
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.