29double gaus2D(
double *
x,
double *par) {
30 double t1 =
x[0] - par[1];
31 double t2 =
x[1] - par[2];
32 return par[0]*
exp( - 0.5 * (
t1*
t1/( par[3]*par[3]) + t2*t2 /( par[4]*par[4] ) ) ) ;
36double fitFunction(
double *
x,
double *par) {
40void fillHisto(
int n =10000) {
43 for (
int i = 0; i <
n; ++i) {
50void DoFit(
const char* fitter,
TVirtualPad *pad,
int npass) {
58 histo->
Fit(
"fitFcn",
"0");
62 double cputime = timer.
CpuTime();
63 printf(
"%s, npass=%d : RT=%7.3f s, Cpu=%7.3f s\n",fitter,npass,timer.
RealTime(),cputime);
69void minuit2FitBench2D(
int n = 100000) {
74 fitFcn =
new TF2(
"fitFcn",fitFunction,-10,10,-10,10,5);
80 histo =
new TH2D(
"h2",
"2D Gauss",100,-10,10,100,-10,10);
87 DoFit(
"Minuit",
gPad,npass);
91 DoFit(
"Fumili",
gPad,npass);
95 DoFit(
"Minuit2",
gPad,npass);
99 DoFit(
"Fumili2",
gPad,npass);
winID h TVirtualViewer3D TVirtualGLPainter p
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TStyle * gStyle
TDirectory::TContext keeps track and restore the current directory.
virtual void Update()
Called by functions such as SetRange, SetNpx, SetParameters to force the deletion of the associated h...
virtual void SetParameters(const Double_t *params)
A 2-Dim function with parameters.
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.
void Draw(Option_t *option="") override
Draw this histogram with options.
2-D histogram with a double per channel (see TH1 documentation)
Int_t Fill(Double_t) override
Invalid Fill method.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
A Pave (see TPave) with a text centered in the Pave.
Random number generator class based on M.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
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.
void SetStatY(Float_t y=0)
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
static void SetDefaultFitter(const char *name="")
static: set name of default fitter
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)=0
RVec< PromoteType< T > > exp(const RVec< T > &v)