Logo ROOT   6.14/05
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  if (fixed)
142  delete [] fixed;
143  return;
144  }
145 
146  Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
147  Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
148  Int_t igrad, ifree=0;
149  for (Int_t ipoint=0; ipoint<n; ipoint++){
150  c=0;
151  f->GradientPar(x+ndim*ipoint, grad);
152  //multiply the covariance matrix by gradient
153  for (Int_t irow=0; irow<npar; irow++){
154  sum_vector[irow]=0;
155  igrad = 0;
156  for (Int_t icol=0; icol<npar; icol++){
157  igrad = 0;
158  ifree=0;
159  if (fixed) {
160  //find the free parameter #icol
161  while (ifree<icol+1){
162  if (fixed[igrad]==0) ifree++;
163  igrad++;
164  }
165  igrad--;
166  //now the [igrad] element of gradient corresponds to [icol] element of cov.matrix
167  } else {
168  igrad = icol;
169  }
170  sum_vector[irow]+=matr[irow*npar_real+icol]*grad[igrad];
171  }
172  }
173  igrad = 0;
174  for (Int_t i=0; i<npar; i++){
175  igrad = 0; ifree=0;
176  if (fixed) {
177  //find the free parameter #icol
178  while (ifree<i+1){
179  if (fixed[igrad]==0) ifree++;
180  igrad++;
181  }
182  igrad--;
183  } else {
184  igrad = i;
185  }
186  c+=grad[igrad]*sum_vector[i];
187  }
188 
189  c=TMath::Sqrt(c);
190  ci[ipoint]=c*t*chidf;
191  }
192 
193  delete [] grad;
194  delete [] sum_vector;
195  if (fixed)
196  delete [] fixed;
197 }
198 
199 ////////////////////////////////////////////////////////////////////////////////
200 ///Computes confidence intervals at level cl. Default is 0.95
201 ///The TObject parameter can be a TGraphErrors, a TGraph2DErrors or a TH1,2,3.
202 ///For Graphs, confidence intervals are computed for each point,
203 ///the value of the graph at that point is set to the function value at that
204 ///point, and the graph y-errors (or z-errors) are set to the value of
205 ///the confidence interval at that point.
206 ///For Histograms, confidence intervals are computed for each bin center
207 ///The bin content of this bin is then set to the function value at the bin
208 ///center, and the bin error is set to the confidence interval value.
209 ///NOTE: confidence intervals are approximate for nonlinear models!
210 ///
211 ///Allowed combinations:
212 ///Fitted object Passed object
213 ///TGraph TGraphErrors, TH1
214 ///TGraphErrors, AsymmErrors TGraphErrors, TH1
215 ///TH1 TGraphErrors, TH1
216 ///TGraph2D TGraph2DErrors, TH2
217 ///TGraph2DErrors TGraph2DErrors, TH2
218 ///TH2 TGraph2DErrors, TH2
219 ///TH3 TH3
220 
222 {
223  if (obj->InheritsFrom(TGraph::Class())) {
224  TGraph *gr = (TGraph*)obj;
225  if (!gr->GetEY()){
226  Error("GetConfidenceIntervals", "A TGraphErrors should be passed instead of a graph");
227  return;
228  }
230  Error("GetConfidenceIntervals", "A TGraph2DErrors should be passed instead of a graph");
231  return;
232  }
234  if (((TH1*)(fObjectFit))->GetDimension()>1){
235  Error("GetConfidenceIntervals", "A TGraph2DErrors or a TH23 should be passed instead of a graph");
236  return;
237  }
238  }
239  GetConfidenceIntervals(gr->GetN(),1,gr->GetX(), gr->GetEY(), cl);
240  for (Int_t i=0; i<gr->GetN(); i++)
241  gr->SetPoint(i, gr->GetX()[i], ((TF1*)(fUserFunc))->Eval(gr->GetX()[i]));
242  }
243 
244  //TGraph2D/////////////////
245  else if (obj->InheritsFrom(TGraph2D::Class())) {
246  TGraph2D *gr2 = (TGraph2D*)obj;
247  if (!gr2->GetEZ()){
248  Error("GetConfidenceIntervals", "A TGraph2DErrors should be passed instead of a TGraph2D");
249  return;
250  }
252  Error("GetConfidenceIntervals", "A TGraphErrors should be passed instead of a TGraph2D");
253  return;
254  }
256  if (((TH1*)(fObjectFit))->GetDimension()==1){
257  Error("GetConfidenceIntervals", "A TGraphErrors or a TH1 should be passed instead of a graph");
258  return;
259  }
260  }
261  TF2 *f=(TF2*)fUserFunc;
262  Double_t xy[2];
263  Int_t np = gr2->GetN();
264  Int_t npar = f->GetNpar();
265  Double_t *grad = new Double_t[npar];
266  Double_t *sum_vector = new Double_t[npar];
267  Double_t *x = gr2->GetX();
268  Double_t *y = gr2->GetY();
269  Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
270  Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
272  Double_t c = 0;
273  for (Int_t ipoint=0; ipoint<np; ipoint++){
274  xy[0]=x[ipoint];
275  xy[1]=y[ipoint];
276  f->GradientPar(xy, grad);
277  for (Int_t irow=0; irow<f->GetNpar(); irow++){
278  sum_vector[irow]=0;
279  for (Int_t icol=0; icol<npar; icol++)
280  sum_vector[irow]+=matr[irow*npar+icol]*grad[icol];
281  }
282  c = 0;
283  for (Int_t i=0; i<npar; i++)
284  c+=grad[i]*sum_vector[i];
285  c=TMath::Sqrt(c);
286  gr2->SetPoint(ipoint, xy[0], xy[1], f->EvalPar(xy));
287  gr2->GetEZ()[ipoint]=c*t*chidf;
288 
289  }
290  delete [] grad;
291  delete [] sum_vector;
292  }
293 
294  //TH1/////////////////////////
295  else if (obj->InheritsFrom(TH1::Class())) {
297  if (((TH1*)obj)->GetDimension()>1){
298  Error("GetConfidenceIntervals", "Fitted graph and passed histogram have different number of dimensions");
299  return;
300  }
301  }
303  if (((TH1*)obj)->GetDimension()!=2){
304  Error("GetConfidenceIntervals", "Fitted graph and passed histogram have different number of dimensions");
305  return;
306  }
307  }
309  if (((TH1*)(fObjectFit))->GetDimension()!=((TH1*)(obj))->GetDimension()){
310  Error("GetConfidenceIntervals", "Fitted and passed histograms have different number of dimensions");
311  return;
312  }
313  }
314 
315 
316  TH1 *hfit = (TH1*)obj;
317  TF1 *f = (TF1*)GetUserFunc();
318  Int_t npar = f->GetNpar();
319  Double_t *grad = new Double_t[npar];
320  Double_t *sum_vector = new Double_t[npar];
321  Double_t x[3];
322 
323  Int_t hxfirst = hfit->GetXaxis()->GetFirst();
324  Int_t hxlast = hfit->GetXaxis()->GetLast();
325  Int_t hyfirst = hfit->GetYaxis()->GetFirst();
326  Int_t hylast = hfit->GetYaxis()->GetLast();
327  Int_t hzfirst = hfit->GetZaxis()->GetFirst();
328  Int_t hzlast = hfit->GetZaxis()->GetLast();
329 
330  TAxis *xaxis = hfit->GetXaxis();
331  TAxis *yaxis = hfit->GetYaxis();
332  TAxis *zaxis = hfit->GetZaxis();
333  Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
334  Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
336  Double_t c=0;
337  for (Int_t binz=hzfirst; binz<=hzlast; binz++){
338  x[2]=zaxis->GetBinCenter(binz);
339  for (Int_t biny=hyfirst; biny<=hylast; biny++) {
340  x[1]=yaxis->GetBinCenter(biny);
341  for (Int_t binx=hxfirst; binx<=hxlast; binx++) {
342  x[0]=xaxis->GetBinCenter(binx);
343  f->GradientPar(x, grad);
344  for (Int_t irow=0; irow<npar; irow++){
345  sum_vector[irow]=0;
346  for (Int_t icol=0; icol<npar; icol++)
347  sum_vector[irow]+=matr[irow*npar+icol]*grad[icol];
348  }
349  c = 0;
350  for (Int_t i=0; i<npar; i++)
351  c+=grad[i]*sum_vector[i];
352  c=TMath::Sqrt(c);
353  hfit->SetBinContent(binx, biny, binz, f->EvalPar(x));
354  hfit->SetBinError(binx, biny, binz, c*t*chidf);
355  }
356  }
357  }
358  delete [] grad;
359  delete [] sum_vector;
360  }
361  else {
362  Error("GetConfidenceIntervals", "This object type is not supported");
363  return;
364  }
365 
366 }
367 
368 ////////////////////////////////////////////////////////////////////////////////
369 /// return a pointer to the covariance matrix
370 
372 {
373  if (fCovar) return fCovar;
374  Int_t npars = fMinuit->GetNumPars();
375  ((TFitter*)this)->fCovar = new Double_t[npars*npars];
376  fMinuit->mnemat(fCovar,npars);
377  return fCovar;
378 }
379 
380 ////////////////////////////////////////////////////////////////////////////////
381 /// return element i,j from the covariance matrix
382 
384 {
386  Int_t npars = fMinuit->GetNumPars();
387  if (i < 0 || i >= npars || j < 0 || j >= npars) {
388  Error("GetCovarianceMatrixElement","Illegal arguments i=%d, j=%d",i,j);
389  return 0;
390  }
391  return fCovar[j+npars*i];
392 }
393 
394 ////////////////////////////////////////////////////////////////////////////////
395 /// return current errors for a parameter
396 /// ipar : parameter number
397 /// eplus : upper error
398 /// eminus : lower error
399 /// eparab : parabolic error
400 /// globcc : global correlation coefficient
401 
402 Int_t TFitter::GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const
403 {
404 
405  Int_t ierr = 0;
406  fMinuit->mnerrs(ipar, eplus,eminus,eparab,globcc);
407  return ierr;
408 }
409 
410 
411 ////////////////////////////////////////////////////////////////////////////////
412 /// return the total number of parameters (free + fixed)
413 
415 {
416  return fMinuit->fNpar + fMinuit->fNpfix;
417 }
418 
419 ////////////////////////////////////////////////////////////////////////////////
420 /// return the number of free parameters
421 
423 {
424  return fMinuit->fNpar;
425 }
426 
427 
428 ////////////////////////////////////////////////////////////////////////////////
429 /// return error of parameter ipar
430 
432 {
433  Int_t ierr = 0;
434  TString pname;
435  Double_t value,verr,vlow,vhigh;
436 
437  fMinuit->mnpout(ipar, pname,value,verr,vlow,vhigh,ierr);
438  return verr;
439 }
440 
441 
442 ////////////////////////////////////////////////////////////////////////////////
443 /// return current value of parameter ipar
444 
446 {
447  Int_t ierr = 0;
448  TString pname;
449  Double_t value,verr,vlow,vhigh;
450 
451  fMinuit->mnpout(ipar, pname,value,verr,vlow,vhigh,ierr);
452  return value;
453 }
454 
455 ////////////////////////////////////////////////////////////////////////////////
456 /// return current values for a parameter
457 /// ipar : parameter number
458 /// parname : parameter name
459 /// value : initial parameter value
460 /// verr : initial error for this parameter
461 /// vlow : lower value for the parameter
462 /// vhigh : upper value for the parameter
463 /// WARNING! parname must be suitably dimensionned in the calling function.
464 
465 Int_t TFitter::GetParameter(Int_t ipar, char *parname,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const
466 {
467  Int_t ierr = 0;
468  TString pname;
469  fMinuit->mnpout(ipar, pname,value,verr,vlow,vhigh,ierr);
470  strcpy(parname,pname.Data());
471  return ierr;
472 }
473 
474 ////////////////////////////////////////////////////////////////////////////////
475 /// return name of parameter ipar
476 
477 const char *TFitter::GetParName(Int_t ipar) const
478 {
479  if (!fMinuit || ipar < 0 || ipar > fMinuit->fNu) return "";
480  return fMinuit->fCpnam[ipar];
481 }
482 
483 ////////////////////////////////////////////////////////////////////////////////
484 /// return global fit parameters
485 /// amin : chisquare
486 /// edm : estimated distance to minimum
487 /// errdef
488 /// nvpar : number of variable parameters
489 /// nparx : total number of parameters
490 
491 Int_t TFitter::GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const
492 {
493  Int_t ierr = 0;
494  fMinuit->mnstat(amin,edm,errdef,nvpar,nparx,ierr);
495  return ierr;
496 }
497 
498 ////////////////////////////////////////////////////////////////////////////////
499 /// return Sum(log(i) i=0,n
500 /// used by log likelihood fits
501 
503 {
504  if (n < 0) return 0;
505  if (n > fNlog) {
506  if (fSumLog) delete [] fSumLog;
507  fNlog = 2*n+1000;
508  fSumLog = new Double_t[fNlog+1];
509  Double_t fobs = 0;
510  for (Int_t j=0;j<=fNlog;j++) {
511  if (j > 1) fobs += TMath::Log(j);
512  fSumLog[j] = fobs;
513  }
514  }
515  if (fSumLog) return fSumLog[n];
516  return 0;
517 }
518 
519 
520 ////////////////////////////////////////////////////////////////////////////////
521 ///return kTRUE if parameter ipar is fixed, kFALSE othersise)
522 
524 {
525  if (fMinuit->fNiofex[ipar] == 0 ) return kTRUE;
526  return kFALSE;
527 }
528 
529 
530 ////////////////////////////////////////////////////////////////////////////////
531 /// Print fit results
532 
533 void TFitter::PrintResults(Int_t level, Double_t amin) const
534 {
535  fMinuit->mnprin(level,amin);
536 }
537 
538 ////////////////////////////////////////////////////////////////////////////////
539 /// Release parameter ipar.
540 
542 {
543  if (fCovar) {delete [] fCovar; fCovar = 0;}
544  fMinuit->Release(ipar);
545 }
546 
547 ////////////////////////////////////////////////////////////////////////////////
548 /// Specify the address of the fitting algorithm
549 
550 void TFitter::SetFCN(void (*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
551 {
552  if (fCovar) {delete [] fCovar; fCovar = 0;}
554  fMinuit->SetFCN(fcn);
555 }
556 
557 ////////////////////////////////////////////////////////////////////////////////
558 /// ret fit method (chisquare or loglikelihood)
559 
560 void TFitter::SetFitMethod(const char *name)
561 {
562  if (fCovar) {delete [] fCovar; fCovar = 0;}
563  // if (!strcmp(name,"H1FitChisquare")) SetFCN(H1FitChisquare);
564  // if (!strcmp(name,"H1FitLikelihood")) SetFCN(H1FitLikelihood);
565  // if (!strcmp(name,"GraphFitChisquare")) SetFCN(GraphFitChisquare);
566  // if (!strcmp(name,"Graph2DFitChisquare")) SetFCN(Graph2DFitChisquare);
567  // if (!strcmp(name,"MultiGraphFitChisquare")) SetFCN(MultiGraphFitChisquare);
568  if (!strcmp(name,"F2Minimizer")) SetFCN(F2Fit);
569  if (!strcmp(name,"F3Minimizer")) SetFCN(F3Fit);
570 }
571 
572 ////////////////////////////////////////////////////////////////////////////////
573 /// set initial values for a parameter
574 /// ipar : parameter number
575 /// parname : parameter name
576 /// value : initial parameter value
577 /// verr : initial error for this parameter
578 /// vlow : lower value for the parameter
579 /// vhigh : upper value for the parameter
580 
581 Int_t TFitter::SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh)
582 {
583  if (fCovar) {delete [] fCovar; fCovar = 0;}
584  Int_t ierr = 0;
585  fMinuit->mnparm(ipar,parname,value,verr,vlow,vhigh,ierr);
586  return ierr;
587 }
588 
589 
590 
591 ////////////////////////////////////////////////////////////////////////////////
592 
593 void F2Fit(Int_t &/*npar*/, Double_t * /*gin*/, Double_t &f,Double_t *u, Int_t /*flag*/)
594 {
596  TF2 *f2 = (TF2*)fitter->GetObjectFit();
597  f2->InitArgs(u, f2->GetParameters() );
598  f = f2->EvalPar(u);
599 }
600 
601 ////////////////////////////////////////////////////////////////////////////////
602 
603 void F3Fit(Int_t &/*npar*/, Double_t * /*gin*/, Double_t &f,Double_t *u, Int_t /*flag*/)
604 {
606  TF3 *f3 = (TF3*)fitter->GetObjectFit();
607  f3->InitArgs(u, f3->GetParameters() );
608  f = f3->EvalPar(u);
609 }
TFitter(const TFitter &)
virtual Bool_t IsFixed(Int_t ipar) const
return kTRUE if parameter ipar is fixed, kFALSE othersise)
Definition: TFitter.cxx:523
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:533
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:383
Double_t Log(Double_t x)
Definition: TMath.h:759
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:371
const char Option_t
Definition: RtypesCore.h:62
virtual Int_t GetNumberFreeParameters() const
Return the number of free parameters.
Definition: TF1.cxx:1787
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754
Definition: TMath.h:900
Double_t StudentQuantile(Double_t p, Double_t ndf, Bool_t lower_tail=kTRUE)
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:402
virtual Double_t * GetEY() const
Definition: TGraph.h:132
Basic string class.
Definition: TString.h:131
#define f(i)
Definition: RSha256.hxx:104
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:477
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:1776
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:541
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:422
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:8498
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:550
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:2334
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:445
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:8514
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:560
#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:502
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Sets point number n.
Definition: TGraph2D.cxx:1706
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:593
virtual Double_t GetParError(Int_t ipar) const
return error of parameter ipar
Definition: TFitter.cxx:431
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:2361
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:1827
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
#define c(i)
Definition: RSha256.hxx:101
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:690
void F3Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Definition: TFitter.cxx:603
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:414
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
Definition: TF1.cxx:1365
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:491
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:364
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:581