Logo ROOT   6.12/07
Reference Guide
TFitter.cxx
Go to the documentation of this file.
1 // @(#)root/minuit:$Id$
2 // Author: Rene Brun 31/08/99
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #include "TMinuit.h"
12 #include "TFitter.h"
13 #include "TH1.h"
14 #include "TF1.h"
15 #include "TF2.h"
16 #include "TF3.h"
17 #include "TList.h"
18 #include "TGraph.h"
19 #include "TGraph2D.h"
20 #include "TMultiGraph.h"
21 #include "TMath.h"
22 
23 // extern void H1FitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
24 // extern void H1FitLikelihood(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
25 // extern void GraphFitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
26 // extern void Graph2DFitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
27 // extern void MultiGraphFitChisquare(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
28 extern void F2Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
29 extern void F3Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
30 
32 
33 ////////////////////////////////////////////////////////////////////////////////
34 /// Default constructor
35 
37 {
38  fMinuit = new TMinuit(maxpar);
39  fNlog = 0;
40  fSumLog = 0;
41  fCovar = 0;
42  SetName("MinuitFitter");
43 }
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// Default destructor
47 
49 {
50  if (fCovar) delete [] fCovar;
51  if (fSumLog) delete [] fSumLog;
52  delete fMinuit;
53 }
54 
55 // ////////////////////////////////////////////////////////////////////////////////
56 // /// return a chisquare equivalent
57 
59 {
60  Error("Chisquare","This function is deprecated - use ROOT::Fit::Chisquare class");
61  //Double_t amin = 0;
62  //H1FitChisquare(npar,params,amin,params,1);
63  return TMath::QuietNaN();
64 }
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 /// reset the fitter environment
68 
70 {
71  if (fCovar) {delete [] fCovar; fCovar = 0;}
72  fMinuit->mncler();
73 
74  //reset the internal Minuit random generator to its initial state
75  Double_t val = 3;
76  Int_t inseed = 12345;
77  fMinuit->mnrn15(val,inseed);
78 }
79 
80 ////////////////////////////////////////////////////////////////////////////////
81 /// Execute a fitter command;
82 /// command : command string
83 /// args : list of nargs command arguments
84 
85 Int_t TFitter::ExecuteCommand(const char *command, Double_t *args, Int_t nargs)
86 {
87  if (fCovar) {delete [] fCovar; fCovar = 0;}
88  Int_t ierr = 0;
89  fMinuit->mnexcm(command,args,nargs,ierr);
90  return ierr;
91 }
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 /// Fix parameter ipar.
95 
97 {
98  if (fCovar) {delete [] fCovar; fCovar = 0;}
99  fMinuit->FixParameter(ipar);
100 }
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 ///Computes point-by-point confidence intervals for the fitted function
104 ///Parameters:
105 ///n - number of points
106 ///ndim - dimensions of points
107 ///x - points, at which to compute the intervals, for ndim > 1
108 /// should be in order: (x0,y0, x1, y1, ... xn, yn)
109 ///ci - computed intervals are returned in this array
110 ///cl - confidence level, default=0.95
111 ///NOTE, that the intervals are approximate for nonlinear(in parameters) models
112 
114 {
115  TF1 *f = (TF1*)fUserFunc;
116  Int_t npar = f->GetNumberFreeParameters();
117  Int_t npar_real = f->GetNpar();
118  Double_t *grad = new Double_t[npar_real];
119  Double_t *sum_vector = new Double_t[npar];
120  Bool_t *fixed=0;
121  Double_t al, bl;
122  if (npar_real != npar){
123  fixed = new Bool_t[npar_real];
124  memset(fixed,0,npar_real*sizeof(Bool_t));
125 
126  for (Int_t ipar=0; ipar<npar_real; ipar++){
127  fixed[ipar]=0;
128  f->GetParLimits(ipar,al,bl);
129  if (al*bl != 0 && al >= bl) {
130  //this parameter is fixed
131  fixed[ipar]=1;
132  }
133  }
134  }
135  Double_t c=0;
136 
137  Double_t *matr = GetCovarianceMatrix();
138  if (!matr){
139  delete [] grad;
140  delete [] sum_vector;
141  return;
142  }
143 
144  Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
145  Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
146  Int_t igrad, ifree=0;
147  for (Int_t ipoint=0; ipoint<n; ipoint++){
148  c=0;
149  f->GradientPar(x+ndim*ipoint, grad);
150  //multiply the covariance matrix by gradient
151  for (Int_t irow=0; irow<npar; irow++){
152  sum_vector[irow]=0;
153  igrad = 0;
154  for (Int_t icol=0; icol<npar; icol++){
155  igrad = 0;
156  ifree=0;
157  if (fixed) {
158  //find the free parameter #icol
159  while (ifree<icol+1){
160  if (fixed[igrad]==0) ifree++;
161  igrad++;
162  }
163  igrad--;
164  //now the [igrad] element of gradient corresponds to [icol] element of cov.matrix
165  } else {
166  igrad = icol;
167  }
168  sum_vector[irow]+=matr[irow*npar_real+icol]*grad[igrad];
169  }
170  }
171  igrad = 0;
172  for (Int_t i=0; i<npar; i++){
173  igrad = 0; ifree=0;
174  if (fixed) {
175  //find the free parameter #icol
176  while (ifree<i+1){
177  if (fixed[igrad]==0) ifree++;
178  igrad++;
179  }
180  igrad--;
181  } else {
182  igrad = i;
183  }
184  c+=grad[igrad]*sum_vector[i];
185  }
186 
187  c=TMath::Sqrt(c);
188  ci[ipoint]=c*t*chidf;
189  }
190 
191  delete [] grad;
192  delete [] sum_vector;
193  if (fixed)
194  delete [] fixed;
195 }
196 
197 ////////////////////////////////////////////////////////////////////////////////
198 ///Computes confidence intervals at level cl. Default is 0.95
199 ///The TObject parameter can be a TGraphErrors, a TGraph2DErrors or a TH1,2,3.
200 ///For Graphs, confidence intervals are computed for each point,
201 ///the value of the graph at that point is set to the function value at that
202 ///point, and the graph y-errors (or z-errors) are set to the value of
203 ///the confidence interval at that point.
204 ///For Histograms, confidence intervals are computed for each bin center
205 ///The bin content of this bin is then set to the function value at the bin
206 ///center, and the bin error is set to the confidence interval value.
207 ///NOTE: confidence intervals are approximate for nonlinear models!
208 ///
209 ///Allowed combinations:
210 ///Fitted object Passed object
211 ///TGraph TGraphErrors, TH1
212 ///TGraphErrors, AsymmErrors TGraphErrors, TH1
213 ///TH1 TGraphErrors, TH1
214 ///TGraph2D TGraph2DErrors, TH2
215 ///TGraph2DErrors TGraph2DErrors, TH2
216 ///TH2 TGraph2DErrors, TH2
217 ///TH3 TH3
218 
220 {
221  if (obj->InheritsFrom(TGraph::Class())) {
222  TGraph *gr = (TGraph*)obj;
223  if (!gr->GetEY()){
224  Error("GetConfidenceIntervals", "A TGraphErrors should be passed instead of a graph");
225  return;
226  }
228  Error("GetConfidenceIntervals", "A TGraph2DErrors should be passed instead of a graph");
229  return;
230  }
232  if (((TH1*)(fObjectFit))->GetDimension()>1){
233  Error("GetConfidenceIntervals", "A TGraph2DErrors or a TH23 should be passed instead of a graph");
234  return;
235  }
236  }
237  GetConfidenceIntervals(gr->GetN(),1,gr->GetX(), gr->GetEY(), cl);
238  for (Int_t i=0; i<gr->GetN(); i++)
239  gr->SetPoint(i, gr->GetX()[i], ((TF1*)(fUserFunc))->Eval(gr->GetX()[i]));
240  }
241 
242  //TGraph2D/////////////////
243  else if (obj->InheritsFrom(TGraph2D::Class())) {
244  TGraph2D *gr2 = (TGraph2D*)obj;
245  if (!gr2->GetEZ()){
246  Error("GetConfidenceIntervals", "A TGraph2DErrors should be passed instead of a TGraph2D");
247  return;
248  }
250  Error("GetConfidenceIntervals", "A TGraphErrors should be passed instead of a TGraph2D");
251  return;
252  }
254  if (((TH1*)(fObjectFit))->GetDimension()==1){
255  Error("GetConfidenceIntervals", "A TGraphErrors or a TH1 should be passed instead of a graph");
256  return;
257  }
258  }
259  TF2 *f=(TF2*)fUserFunc;
260  Double_t xy[2];
261  Int_t np = gr2->GetN();
262  Int_t npar = f->GetNpar();
263  Double_t *grad = new Double_t[npar];
264  Double_t *sum_vector = new Double_t[npar];
265  Double_t *x = gr2->GetX();
266  Double_t *y = gr2->GetY();
267  Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
268  Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
270  Double_t c = 0;
271  for (Int_t ipoint=0; ipoint<np; ipoint++){
272  xy[0]=x[ipoint];
273  xy[1]=y[ipoint];
274  f->GradientPar(xy, grad);
275  for (Int_t irow=0; irow<f->GetNpar(); irow++){
276  sum_vector[irow]=0;
277  for (Int_t icol=0; icol<npar; icol++)
278  sum_vector[irow]+=matr[irow*npar+icol]*grad[icol];
279  }
280  c = 0;
281  for (Int_t i=0; i<npar; i++)
282  c+=grad[i]*sum_vector[i];
283  c=TMath::Sqrt(c);
284  gr2->SetPoint(ipoint, xy[0], xy[1], f->EvalPar(xy));
285  gr2->GetEZ()[ipoint]=c*t*chidf;
286 
287  }
288  delete [] grad;
289  delete [] sum_vector;
290  }
291 
292  //TH1/////////////////////////
293  else if (obj->InheritsFrom(TH1::Class())) {
295  if (((TH1*)obj)->GetDimension()>1){
296  Error("GetConfidenceIntervals", "Fitted graph and passed histogram have different number of dimensions");
297  return;
298  }
299  }
301  if (((TH1*)obj)->GetDimension()!=2){
302  Error("GetConfidenceIntervals", "Fitted graph and passed histogram have different number of dimensions");
303  return;
304  }
305  }
307  if (((TH1*)(fObjectFit))->GetDimension()!=((TH1*)(obj))->GetDimension()){
308  Error("GetConfidenceIntervals", "Fitted and passed histograms have different number of dimensions");
309  return;
310  }
311  }
312 
313 
314  TH1 *hfit = (TH1*)obj;
315  TF1 *f = (TF1*)GetUserFunc();
316  Int_t npar = f->GetNpar();
317  Double_t *grad = new Double_t[npar];
318  Double_t *sum_vector = new Double_t[npar];
319  Double_t x[3];
320 
321  Int_t hxfirst = hfit->GetXaxis()->GetFirst();
322  Int_t hxlast = hfit->GetXaxis()->GetLast();
323  Int_t hyfirst = hfit->GetYaxis()->GetFirst();
324  Int_t hylast = hfit->GetYaxis()->GetLast();
325  Int_t hzfirst = hfit->GetZaxis()->GetFirst();
326  Int_t hzlast = hfit->GetZaxis()->GetLast();
327 
328  TAxis *xaxis = hfit->GetXaxis();
329  TAxis *yaxis = hfit->GetYaxis();
330  TAxis *zaxis = hfit->GetZaxis();
331  Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
332  Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
334  Double_t c=0;
335  for (Int_t binz=hzfirst; binz<=hzlast; binz++){
336  x[2]=zaxis->GetBinCenter(binz);
337  for (Int_t biny=hyfirst; biny<=hylast; biny++) {
338  x[1]=yaxis->GetBinCenter(biny);
339  for (Int_t binx=hxfirst; binx<=hxlast; binx++) {
340  x[0]=xaxis->GetBinCenter(binx);
341  f->GradientPar(x, grad);
342  for (Int_t irow=0; irow<npar; irow++){
343  sum_vector[irow]=0;
344  for (Int_t icol=0; icol<npar; icol++)
345  sum_vector[irow]+=matr[irow*npar+icol]*grad[icol];
346  }
347  c = 0;
348  for (Int_t i=0; i<npar; i++)
349  c+=grad[i]*sum_vector[i];
350  c=TMath::Sqrt(c);
351  hfit->SetBinContent(binx, biny, binz, f->EvalPar(x));
352  hfit->SetBinError(binx, biny, binz, c*t*chidf);
353  }
354  }
355  }
356  delete [] grad;
357  delete [] sum_vector;
358  }
359  else {
360  Error("GetConfidenceIntervals", "This object type is not supported");
361  return;
362  }
363 
364 }
365 
366 ////////////////////////////////////////////////////////////////////////////////
367 /// return a pointer to the covariance matrix
368 
370 {
371  if (fCovar) return fCovar;
372  Int_t npars = fMinuit->GetNumPars();
373  ((TFitter*)this)->fCovar = new Double_t[npars*npars];
374  fMinuit->mnemat(fCovar,npars);
375  return fCovar;
376 }
377 
378 ////////////////////////////////////////////////////////////////////////////////
379 /// return element i,j from the covariance matrix
380 
382 {
384  Int_t npars = fMinuit->GetNumPars();
385  if (i < 0 || i >= npars || j < 0 || j >= npars) {
386  Error("GetCovarianceMatrixElement","Illegal arguments i=%d, j=%d",i,j);
387  return 0;
388  }
389  return fCovar[j+npars*i];
390 }
391 
392 ////////////////////////////////////////////////////////////////////////////////
393 /// return current errors for a parameter
394 /// ipar : parameter number
395 /// eplus : upper error
396 /// eminus : lower error
397 /// eparab : parabolic error
398 /// globcc : global correlation coefficient
399 
400 Int_t TFitter::GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const
401 {
402 
403  Int_t ierr = 0;
404  fMinuit->mnerrs(ipar, eplus,eminus,eparab,globcc);
405  return ierr;
406 }
407 
408 
409 ////////////////////////////////////////////////////////////////////////////////
410 /// return the total number of parameters (free + fixed)
411 
413 {
414  return fMinuit->fNpar + fMinuit->fNpfix;
415 }
416 
417 ////////////////////////////////////////////////////////////////////////////////
418 /// return the number of free parameters
419 
421 {
422  return fMinuit->fNpar;
423 }
424 
425 
426 ////////////////////////////////////////////////////////////////////////////////
427 /// return error of parameter ipar
428 
430 {
431  Int_t ierr = 0;
432  TString pname;
433  Double_t value,verr,vlow,vhigh;
434 
435  fMinuit->mnpout(ipar, pname,value,verr,vlow,vhigh,ierr);
436  return verr;
437 }
438 
439 
440 ////////////////////////////////////////////////////////////////////////////////
441 /// return current value of parameter ipar
442 
444 {
445  Int_t ierr = 0;
446  TString pname;
447  Double_t value,verr,vlow,vhigh;
448 
449  fMinuit->mnpout(ipar, pname,value,verr,vlow,vhigh,ierr);
450  return value;
451 }
452 
453 ////////////////////////////////////////////////////////////////////////////////
454 /// return current values for a parameter
455 /// ipar : parameter number
456 /// parname : parameter name
457 /// value : initial parameter value
458 /// verr : initial error for this parameter
459 /// vlow : lower value for the parameter
460 /// vhigh : upper value for the parameter
461 /// WARNING! parname must be suitably dimensionned in the calling function.
462 
463 Int_t TFitter::GetParameter(Int_t ipar, char *parname,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const
464 {
465  Int_t ierr = 0;
466  TString pname;
467  fMinuit->mnpout(ipar, pname,value,verr,vlow,vhigh,ierr);
468  strcpy(parname,pname.Data());
469  return ierr;
470 }
471 
472 ////////////////////////////////////////////////////////////////////////////////
473 /// return name of parameter ipar
474 
475 const char *TFitter::GetParName(Int_t ipar) const
476 {
477  if (!fMinuit || ipar < 0 || ipar > fMinuit->fNu) return "";
478  return fMinuit->fCpnam[ipar];
479 }
480 
481 ////////////////////////////////////////////////////////////////////////////////
482 /// return global fit parameters
483 /// amin : chisquare
484 /// edm : estimated distance to minimum
485 /// errdef
486 /// nvpar : number of variable parameters
487 /// nparx : total number of parameters
488 
489 Int_t TFitter::GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const
490 {
491  Int_t ierr = 0;
492  fMinuit->mnstat(amin,edm,errdef,nvpar,nparx,ierr);
493  return ierr;
494 }
495 
496 ////////////////////////////////////////////////////////////////////////////////
497 /// return Sum(log(i) i=0,n
498 /// used by log likelihood fits
499 
501 {
502  if (n < 0) return 0;
503  if (n > fNlog) {
504  if (fSumLog) delete [] fSumLog;
505  fNlog = 2*n+1000;
506  fSumLog = new Double_t[fNlog+1];
507  Double_t fobs = 0;
508  for (Int_t j=0;j<=fNlog;j++) {
509  if (j > 1) fobs += TMath::Log(j);
510  fSumLog[j] = fobs;
511  }
512  }
513  if (fSumLog) return fSumLog[n];
514  return 0;
515 }
516 
517 
518 ////////////////////////////////////////////////////////////////////////////////
519 ///return kTRUE if parameter ipar is fixed, kFALSE othersise)
520 
522 {
523  if (fMinuit->fNiofex[ipar] == 0 ) return kTRUE;
524  return kFALSE;
525 }
526 
527 
528 ////////////////////////////////////////////////////////////////////////////////
529 /// Print fit results
530 
531 void TFitter::PrintResults(Int_t level, Double_t amin) const
532 {
533  fMinuit->mnprin(level,amin);
534 }
535 
536 ////////////////////////////////////////////////////////////////////////////////
537 /// Release parameter ipar.
538 
540 {
541  if (fCovar) {delete [] fCovar; fCovar = 0;}
542  fMinuit->Release(ipar);
543 }
544 
545 ////////////////////////////////////////////////////////////////////////////////
546 /// Specify the address of the fitting algorithm
547 
548 void TFitter::SetFCN(void (*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
549 {
550  if (fCovar) {delete [] fCovar; fCovar = 0;}
552  fMinuit->SetFCN(fcn);
553 }
554 
555 ////////////////////////////////////////////////////////////////////////////////
556 /// ret fit method (chisquare or loglikelihood)
557 
558 void TFitter::SetFitMethod(const char *name)
559 {
560  if (fCovar) {delete [] fCovar; fCovar = 0;}
561  // if (!strcmp(name,"H1FitChisquare")) SetFCN(H1FitChisquare);
562  // if (!strcmp(name,"H1FitLikelihood")) SetFCN(H1FitLikelihood);
563  // if (!strcmp(name,"GraphFitChisquare")) SetFCN(GraphFitChisquare);
564  // if (!strcmp(name,"Graph2DFitChisquare")) SetFCN(Graph2DFitChisquare);
565  // if (!strcmp(name,"MultiGraphFitChisquare")) SetFCN(MultiGraphFitChisquare);
566  if (!strcmp(name,"F2Minimizer")) SetFCN(F2Fit);
567  if (!strcmp(name,"F3Minimizer")) SetFCN(F3Fit);
568 }
569 
570 ////////////////////////////////////////////////////////////////////////////////
571 /// set initial values for a parameter
572 /// ipar : parameter number
573 /// parname : parameter name
574 /// value : initial parameter value
575 /// verr : initial error for this parameter
576 /// vlow : lower value for the parameter
577 /// vhigh : upper value for the parameter
578 
579 Int_t TFitter::SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh)
580 {
581  if (fCovar) {delete [] fCovar; fCovar = 0;}
582  Int_t ierr = 0;
583  fMinuit->mnparm(ipar,parname,value,verr,vlow,vhigh,ierr);
584  return ierr;
585 }
586 
587 
588 
589 ////////////////////////////////////////////////////////////////////////////////
590 
591 void F2Fit(Int_t &/*npar*/, Double_t * /*gin*/, Double_t &f,Double_t *u, Int_t /*flag*/)
592 {
594  TF2 *f2 = (TF2*)fitter->GetObjectFit();
595  f2->InitArgs(u, f2->GetParameters() );
596  f = f2->EvalPar(u);
597 }
598 
599 ////////////////////////////////////////////////////////////////////////////////
600 
601 void F3Fit(Int_t &/*npar*/, Double_t * /*gin*/, Double_t &f,Double_t *u, Int_t /*flag*/)
602 {
604  TF3 *f3 = (TF3*)fitter->GetObjectFit();
605  f3->InitArgs(u, f3->GetParameters() );
606  f = f3->EvalPar(u);
607 }
TFitter(const TFitter &)
virtual Bool_t IsFixed(Int_t ipar) const
return kTRUE if parameter ipar is fixed, kFALSE othersise)
Definition: TFitter.cxx:521
virtual void mnstat(Double_t &fmin, Double_t &fedm, Double_t &errdef, Int_t &npari, Int_t &nparx, Int_t &istat)
Returns concerning the current status of the minimization.
Definition: TMinuit.cxx:7645
virtual void mnprin(Int_t inkode, Double_t fval)
Prints the values of the parameters at the time of the call.
Definition: TMinuit.cxx:6313
virtual void PrintResults(Int_t level, Double_t amin) const
Print fit results.
Definition: TFitter.cxx:531
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition: TAxis.cxx:444
Implementation in C++ of the Minuit package written by Fred James.
Definition: TMinuit.h:27
virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const
return element i,j from the covariance matrix
Definition: TFitter.cxx:381
Double_t Log(Double_t x)
Definition: TMath.h:648
virtual void mnemat(Double_t *emat, Int_t ndim)
Calculates the external error matrix from the internal matrix.
Definition: TMinuit.cxx:2510
virtual Double_t * GetCovarianceMatrix() const
return a pointer to the covariance matrix
Definition: TFitter.cxx:369
const char Option_t
Definition: RtypesCore.h:62
virtual Int_t GetNumberFreeParameters() const
Return the number of free parameters.
Definition: TF1.cxx:1785
Double_t QuietNaN()
Definition: TMath.h:783
Double_t StudentQuantile(Double_t p, Double_t ndf, Bool_t lower_tail=kTRUE)
Computes quantiles of the Student&#39;s t-distribution 1st argument is the probability, at which the quantile is computed 2nd argument - the number of degrees of freedom of the Student distribution When the 3rd argument lower_tail is kTRUE (default)- the algorithm returns such x0, that P(x < x0)=p upper tail (lower_tail is kFALSE)- the algorithm returns such x0, that P(x > x0)=p the algorithm was taken from G.W.Hill, "Algorithm 396, Student&#39;s t-quantiles" "Communications of the ACM", 13(10), October 1970.
Definition: TMath.cxx:2614
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual Int_t GetErrors(Int_t ipar, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const
return current errors for a parameter ipar : parameter number eplus : upper error eminus : lower erro...
Definition: TFitter.cxx:400
virtual Double_t * GetEY() const
Definition: TGraph.h:132
Basic string class.
Definition: TString.h:125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs)
Execute a fitter command; command : command string args : list of nargs command arguments.
Definition: TFitter.cxx:85
virtual const char * GetParName(Int_t ipar) const
return name of parameter ipar
Definition: TFitter.cxx:475
virtual Int_t FixParameter(Int_t parNo)
fix a parameter
Definition: TMinuit.cxx:836
virtual ~TFitter()
Default destructor.
Definition: TFitter.cxx:48
virtual Int_t GetNDF() const
Return the number of degrees of freedom in the fit the fNDF parameter has been previously computed du...
Definition: TF1.cxx:1774
Double_t x[n]
Definition: legend1.C:17
void Class()
Definition: Class.C:29
int GetDimension(const TH1 *h1)
Definition: HFitImpl.cxx:51
Int_t fNpar
Definition: TMinuit.h:41
virtual void ReleaseParameter(Int_t ipar)
Release parameter ipar.
Definition: TFitter.cxx:539
TObject * fObjectFit
virtual void mnrn15(Double_t &val, Int_t &inseed)
This is a super-portable random number generator.
Definition: TMinuit.cxx:6626
static constexpr double eplus
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Definition: TAxis.cxx:464
Double_t * fSumLog
Definition: TFitter.h:33
virtual Int_t GetNumberFreeParameters() const
return the number of free parameters
Definition: TFitter.cxx:420
virtual Double_t * GetEZ() const
Definition: TGraph2D.h:123
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
Definition: TH1.cxx:8461
virtual void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
Specify the address of the fitting algorithm.
Definition: TFitter.cxx:548
virtual Double_t GradientPar(Int_t ipar, const Double_t *x, Double_t eps=0.01)
Compute the gradient (derivative) wrt a parameter ipar.
Definition: TF1.cxx:2327
virtual void mnpout(Int_t iuext, TString &chnam, Double_t &val, Double_t &err, Double_t &xlolim, Double_t &xuplim, Int_t &iuint) const
Provides the user with information concerning the current status.
Definition: TMinuit.cxx:6256
TObject * fUserFunc
virtual Double_t GetParameter(Int_t ipar) const
return current value of parameter ipar
Definition: TFitter.cxx:443
Int_t fNpfix
Definition: TMinuit.h:37
Int_t GetLast() const
Return last bin on the axis i.e.
Definition: TAxis.cxx:455
TString * fCpnam
Character to be plotted at the X,Y contour positions.
Definition: TMinuit.h:165
Class to manage histogram axis.
Definition: TAxis.h:30
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
virtual void mncler()
Resets the parameter list to UNDEFINED.
Definition: TMinuit.cxx:1112
virtual void mnparm(Int_t k, TString cnamj, Double_t uk, Double_t wk, Double_t a, Double_t b, Int_t &ierflg)
Implements one parameter definition.
Definition: TMinuit.cxx:5674
A 3-Dim function with parameters.
Definition: TF3.h:28
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
Definition: TH1.cxx:8477
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
Double_t * fCovar
Definition: TFitter.h:32
static TVirtualFitter * GetFitter()
static: return the current Fitter
Int_t GetN() const
Definition: TGraph.h:122
TAxis * GetYaxis()
Definition: TH1.h:316
A 2-Dim function with parameters.
Definition: TF2.h:29
virtual void mnerrs(Int_t number, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &gcc)
Utility routine to get MINOS errors.
Definition: TMinuit.cxx:2587
virtual Double_t Chisquare(Int_t npar, Double_t *params) const
Definition: TFitter.cxx:58
TGraphErrors * gr
Definition: legend1.C:25
Int_t * fNiofex
Definition: TMinuit.h:127
const Bool_t kFALSE
Definition: RtypesCore.h:88
Double_t * GetY() const
Definition: TGraph2D.h:119
Double_t * GetX() const
Definition: TGraph.h:129
Double_t GetChisquare() const
Definition: TF1.h:428
virtual void SetFitMethod(const char *name)
ret fit method (chisquare or loglikelihood)
Definition: TFitter.cxx:558
#define ClassImp(name)
Definition: Rtypes.h:359
virtual Double_t GetSumLog(Int_t i)
return Sum(log(i) i=0,n used by log likelihood fits
Definition: TFitter.cxx:500
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Sets point number n.
Definition: TGraph2D.cxx:1696
double Double_t
Definition: RtypesCore.h:55
void F2Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Definition: TFitter.cxx:591
virtual Double_t GetParError(Int_t ipar) const
return error of parameter ipar
Definition: TFitter.cxx:429
virtual Int_t Release(Int_t parNo)
release a parameter
Definition: TMinuit.cxx:903
virtual void GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t *x, Double_t *ci, Double_t cl=0.95)
Computes point-by-point confidence intervals for the fitted function Parameters: n - number of points...
Definition: TFitter.cxx:113
Int_t fNlog
Definition: TFitter.h:31
Double_t y[n]
Definition: legend1.C:17
The TH1 histogram class.
Definition: TH1.h:56
virtual void mnexcm(const char *comand, Double_t *plist, Int_t llist, Int_t &ierflg)
Interprets a command and takes appropriate action.
Definition: TMinuit.cxx:2673
virtual void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
To set the address of the minimization objective function called by the native compiler (see function...
virtual void FixParameter(Int_t ipar)
Fix parameter ipar.
Definition: TFitter.cxx:96
TMinuit * fMinuit
Definition: TFitter.h:34
virtual void InitArgs(const Double_t *x, const Double_t *params)
Initialize parameters addresses.
Definition: TF1.cxx:2354
Abstract Base Class for Fitting.
TAxis * GetZaxis()
Definition: TH1.h:317
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Int_t GetNpar() const
Definition: TF1.h:465
virtual void GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) const
Return limits for parameter ipar.
Definition: TF1.cxx:1825
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition: TGraph.cxx:2184
virtual void Clear(Option_t *option="")
reset the fitter environment
Definition: TFitter.cxx:69
1-Dim function class
Definition: TF1.h:211
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
Int_t GetN() const
Definition: TGraph2D.h:117
virtual Double_t * GetParameters() const
Definition: TF1.h:504
virtual void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
To set the address of the minimization function.
Definition: TMinuit.cxx:929
Double_t Sqrt(Double_t x)
Definition: TMath.h:590
void F3Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Definition: TFitter.cxx:601
virtual Int_t GetNumPars() const
returns the total number of parameters that have been defined as fixed or free.
Definition: TMinuit.cxx:881
Graphics object made of three arrays X, Y and Z with the same number of points each.
Definition: TGraph2D.h:40
virtual Int_t GetNumberTotalParameters() const
return the total number of parameters (free + fixed)
Definition: TFitter.cxx:412
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
Definition: TF1.cxx:1363
virtual TObject * GetUserFunc() const
virtual TObject * GetObjectFit() const
virtual Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const
return global fit parameters amin : chisquare edm : estimated distance to minimum errdef nvpar : numb...
Definition: TFitter.cxx:489
const Bool_t kTRUE
Definition: RtypesCore.h:87
Int_t fNu
Definition: TMinuit.h:130
const Int_t n
Definition: legend1.C:16
char name[80]
Definition: TGX11.cxx:109
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:315
Double_t * GetX() const
Definition: TGraph2D.h:118
const char * Data() const
Definition: TString.h:345
virtual Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)
set initial values for a parameter ipar : parameter number parname : parameter name value : initial p...
Definition: TFitter.cxx:579