32 return par[0] + par[1]*x[0] + par[2]*x[0]*x[0];
38 TMath::Max( 1.
e-10,(x[0]-par[2])*(x[0]-par[2]) + .25*par[1]*par[1]);
43 return background(x,par) + lorentzianPeak(x,&par[3]);
47 printf(
"\n*********************************************************************************\n");
48 printf(
"\t %s \n",fitter);
49 printf(
"*********************************************************************************\n");
59 std::string title = std::string(fitter) +
" fit bench";
60 histo =
new TH1D(fitter,title.c_str(),200,0,3);
69 for (
Int_t pass=0;pass<npass;pass++) {
70 if (pass%100 == 0) printf(
"pass : %d\n",pass);
73 for (
Int_t i=0;i<5000;i++) {
76 int iret = histo->
Fit(fitFcn,
"Q0");
78 if (iret!=0)
Error(
"DoFit",
"Fit pass %d failed !",pass);
81 if (!fitterType.Contains(
"Fumili"))
82 histo->
Fit(fitFcn,
"E");
84 histo->
Fit(fitFcn,
"");
92 printf(
"%s, npass=%d : RT=%7.3f s, Cpu=%7.3f s\n",fitter,npass,timer.
RealTime(),cputime);
95 p->SetTextColor(
kRed+3);
101 int minuit2FitBench(
Int_t npass=20) {
107 fitFcn =
new TF1(
"fitFcn",fitFunction,0,3,6);
115 ok &= DoFit(
"Minuit",
gPad,npass);
119 ok &= DoFit(
"Fumili",
gPad,npass);
123 ok &= DoFit(
"Minuit2",
gPad,npass);
127 ok &= DoFit(
"Fumili2",
gPad,npass);
129 c1->
SaveAs(
"FitBench.root");
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void SetParameters(const Double_t *params)
virtual Double_t GetRandom()
Return a random number following this function shape.
Random number generator class based on M.
virtual void SetLogy(Int_t value=1)=0
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
virtual TF1 * GetFunction(const char *name) const
Return pointer to function with name.
R__EXTERN TStyle * gStyle
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
void SetStatY(Float_t y=0)
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
void Stop()
Stop the stopwatch.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
void Error(const char *location, const char *msgfmt,...)
A Pave (see TPave) with a text centered in the Pave.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
char * Form(const char *fmt,...)
virtual void Update()
Called by functions such as SetRange, SetNpx, SetParameters to force the deletion of the associated h...
R__EXTERN TRandom * gRandom
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
Short_t Max(Short_t a, Short_t b)
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save Pad contents in a file in one of various formats.
static void SetDefaultMinimizer(const char *type, const char *algo=0)
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 void SetGrid(Int_t valuex=1, Int_t valuey=1)=0