28double gaus2D(
double *
x,
double *par) {
29 double t1 =
x[0] - par[1];
30 double t2 =
x[1] - par[2];
31 return par[0]*
exp( - 0.5 * (
t1*
t1/( par[3]*par[3]) + t2*t2 /( par[4]*par[4] ) ) ) ;
35double fitFunction(
double *
x,
double *par) {
39void fillHisto(
int n =10000) {
42 for (
int i = 0; i <
n; ++i) {
49void DoFit(
const char* fitter,
TVirtualPad *pad,
int npass) {
57 histo->
Fit(
"fitFcn",
"0");
61 double cputime = timer.
CpuTime();
62 printf(
"%s, npass=%d : RT=%7.3f s, Cpu=%7.3f s\n",fitter,npass,timer.
RealTime(),cputime);
68void minuit2FitBench2D(
int n = 100000) {
73 fitFcn =
new TF2(
"fitFcn",fitFunction,-10,10,-10,10,5);
79 histo =
new TH2D(
"h2",
"2D Gauss",100,-10,10,100,-10,10);
86 DoFit(
"Minuit",
gPad,npass);
90 DoFit(
"Fumili",
gPad,npass);
94 DoFit(
"Minuit2",
gPad,npass);
98 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
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.
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
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)