Logo ROOT  
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////////////////////////////////////////////////////////////////////////////////
24/// \class TFitter
25/// \legacy{TFitter}
26///
27/// The ROOT standard fitter based on TMinuit
28///
29////////////////////////////////////////////////////////////////////////////////
30
31extern void F2Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
32extern void F3Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag);
33
35
36////////////////////////////////////////////////////////////////////////////////
37/// Default constructor
38
40{
41 fMinuit = new TMinuit(maxpar);
42 fNlog = 0;
43 fSumLog = 0;
44 fCovar = 0;
45 SetName("MinuitFitter");
46}
47
48////////////////////////////////////////////////////////////////////////////////
49/// Default destructor
50
52{
53 if (fCovar) delete [] fCovar;
54 if (fSumLog) delete [] fSumLog;
55 delete fMinuit;
56}
57
58////////////////////////////////////////////////////////////////////////////////
59/// \deprecated
60/// Use ROOT::Fit::Chisquare class instead.
61///
62/// return a chisquare equivalent
63
65{
66 Error("Chisquare","This function is deprecated - use ROOT::Fit::Chisquare class");
67 return TMath::QuietNaN();
68}
69
70////////////////////////////////////////////////////////////////////////////////
71/// reset the fitter environment
72
74{
75 if (fCovar) {delete [] fCovar; fCovar = 0;}
76 fMinuit->mncler();
77
78 //reset the internal Minuit random generator to its initial state
79 Double_t val = 3;
80 Int_t inseed = 12345;
81 fMinuit->mnrn15(val,inseed);
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Execute a fitter command;
86/// command : command string
87/// args : list of nargs command arguments
88
89Int_t TFitter::ExecuteCommand(const char *command, Double_t *args, Int_t nargs)
90{
91 if (fCovar) {delete [] fCovar; fCovar = 0;}
92 Int_t ierr = 0;
93 fMinuit->mnexcm(command,args,nargs,ierr);
94 return ierr;
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Fix parameter ipar.
99
101{
102 if (fCovar) {delete [] fCovar; fCovar = 0;}
103 fMinuit->FixParameter(ipar);
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Computes point-by-point confidence intervals for the fitted function
108///
109/// Parameters:
110/// - n - number of points
111/// - ndim - dimensions of points
112/// - x - points, at which to compute the intervals, for ndim > 1
113/// should be in order: (x0,y0, x1, y1, ... xn, yn)
114/// - ci - computed intervals are returned in this array
115/// - cl - confidence level, default=0.95
116///
117/// NOTE, that the intervals are approximate for nonlinear(in parameters) models
118
120{
121 TF1 *f = (TF1*)fUserFunc;
122 Int_t npar = f->GetNumberFreeParameters();
123 Int_t npar_real = f->GetNpar();
124 Double_t *grad = new Double_t[npar_real];
125 Double_t *sum_vector = new Double_t[npar];
126 Bool_t *fixed=0;
127 Double_t al, bl;
128 if (npar_real != npar){
129 fixed = new Bool_t[npar_real];
130 memset(fixed,0,npar_real*sizeof(Bool_t));
131
132 for (Int_t ipar=0; ipar<npar_real; ipar++){
133 fixed[ipar]=0;
134 f->GetParLimits(ipar,al,bl);
135 if (al*bl != 0 && al >= bl) {
136 //this parameter is fixed
137 fixed[ipar]=1;
138 }
139 }
140 }
141 Double_t c=0;
142
144 if (!matr){
145 delete [] grad;
146 delete [] sum_vector;
147 if (fixed)
148 delete [] fixed;
149 return;
150 }
151
152 Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
153 Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
154 Int_t igrad, ifree=0;
155 for (Int_t ipoint=0; ipoint<n; ipoint++){
156 c=0;
157 f->GradientPar(x+ndim*ipoint, grad);
158 //multiply the covariance matrix by gradient
159 for (Int_t irow=0; irow<npar; irow++){
160 sum_vector[irow]=0;
161 igrad = 0;
162 for (Int_t icol=0; icol<npar; icol++){
163 igrad = 0;
164 ifree=0;
165 if (fixed) {
166 //find the free parameter #icol
167 while (ifree<icol+1){
168 if (fixed[igrad]==0) ifree++;
169 igrad++;
170 }
171 igrad--;
172 //now the [igrad] element of gradient corresponds to [icol] element of cov.matrix
173 } else {
174 igrad = icol;
175 }
176 sum_vector[irow]+=matr[irow*npar_real+icol]*grad[igrad];
177 }
178 }
179 igrad = 0;
180 for (Int_t i=0; i<npar; i++){
181 igrad = 0; ifree=0;
182 if (fixed) {
183 //find the free parameter #icol
184 while (ifree<i+1){
185 if (fixed[igrad]==0) ifree++;
186 igrad++;
187 }
188 igrad--;
189 } else {
190 igrad = i;
191 }
192 c+=grad[igrad]*sum_vector[i];
193 }
194
195 c=TMath::Sqrt(c);
196 ci[ipoint]=c*t*chidf;
197 }
198
199 delete [] grad;
200 delete [] sum_vector;
201 if (fixed)
202 delete [] fixed;
203}
204
205////////////////////////////////////////////////////////////////////////////////
206/// Computes confidence intervals at level cl. Default is 0.95
207///
208/// The TObject parameter can be a TGraphErrors, a TGraph2DErrors or a TH1,2,3.
209/// For Graphs, confidence intervals are computed for each point,
210/// the value of the graph at that point is set to the function value at that
211/// point, and the graph y-errors (or z-errors) are set to the value of
212/// the confidence interval at that point.
213/// For Histograms, confidence intervals are computed for each bin center
214/// The bin content of this bin is then set to the function value at the bin
215/// center, and the bin error is set to the confidence interval value.
216/// NOTE: confidence intervals are approximate for nonlinear models!
217///
218/// Allowed combinations:
219///
220/// - Fitted object Passed object
221/// - TGraph TGraphErrors, TH1
222/// - TGraphErrors, AsymmErrors TGraphErrors, TH1
223/// - TH1 TGraphErrors, TH1
224/// - TGraph2D TGraph2DErrors, TH2
225/// - TGraph2DErrors TGraph2DErrors, TH2
226/// - TH2 TGraph2DErrors, TH2
227/// - TH3 TH3
228
230{
231 if (obj->InheritsFrom(TGraph::Class())) {
232 TGraph *gr = (TGraph*)obj;
233 if (!gr->GetEY()){
234 Error("GetConfidenceIntervals", "A TGraphErrors should be passed instead of a graph");
235 return;
236 }
238 Error("GetConfidenceIntervals", "A TGraph2DErrors should be passed instead of a graph");
239 return;
240 }
242 if (((TH1*)(fObjectFit))->GetDimension()>1){
243 Error("GetConfidenceIntervals", "A TGraph2DErrors or a TH23 should be passed instead of a graph");
244 return;
245 }
246 }
247 GetConfidenceIntervals(gr->GetN(),1,gr->GetX(), gr->GetEY(), cl);
248 for (Int_t i=0; i<gr->GetN(); i++)
249 gr->SetPoint(i, gr->GetX()[i], ((TF1*)(fUserFunc))->Eval(gr->GetX()[i]));
250 }
251
252 //TGraph2D/////////////////
253 else if (obj->InheritsFrom(TGraph2D::Class())) {
254 TGraph2D *gr2 = (TGraph2D*)obj;
255 if (!gr2->GetEZ()){
256 Error("GetConfidenceIntervals", "A TGraph2DErrors should be passed instead of a TGraph2D");
257 return;
258 }
260 Error("GetConfidenceIntervals", "A TGraphErrors should be passed instead of a TGraph2D");
261 return;
262 }
264 if (((TH1*)(fObjectFit))->GetDimension()==1){
265 Error("GetConfidenceIntervals", "A TGraphErrors or a TH1 should be passed instead of a graph");
266 return;
267 }
268 }
269 TF2 *f=(TF2*)fUserFunc;
270 Double_t xy[2];
271 Int_t np = gr2->GetN();
272 Int_t npar = f->GetNpar();
273 Double_t *grad = new Double_t[npar];
274 Double_t *sum_vector = new Double_t[npar];
275 Double_t *x = gr2->GetX();
276 Double_t *y = gr2->GetY();
277 Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
278 Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
280 Double_t c = 0;
281 for (Int_t ipoint=0; ipoint<np; ipoint++){
282 xy[0]=x[ipoint];
283 xy[1]=y[ipoint];
284 f->GradientPar(xy, grad);
285 for (Int_t irow=0; irow<f->GetNpar(); irow++){
286 sum_vector[irow]=0;
287 for (Int_t icol=0; icol<npar; icol++)
288 sum_vector[irow]+=matr[irow*npar+icol]*grad[icol];
289 }
290 c = 0;
291 for (Int_t i=0; i<npar; i++)
292 c+=grad[i]*sum_vector[i];
293 c=TMath::Sqrt(c);
294 gr2->SetPoint(ipoint, xy[0], xy[1], f->EvalPar(xy));
295 gr2->GetEZ()[ipoint]=c*t*chidf;
296
297 }
298 delete [] grad;
299 delete [] sum_vector;
300 }
301
302 //TH1/////////////////////////
303 else if (obj->InheritsFrom(TH1::Class())) {
305 if (((TH1*)obj)->GetDimension()>1){
306 Error("GetConfidenceIntervals", "Fitted graph and passed histogram have different number of dimensions");
307 return;
308 }
309 }
311 if (((TH1*)obj)->GetDimension()!=2){
312 Error("GetConfidenceIntervals", "Fitted graph and passed histogram have different number of dimensions");
313 return;
314 }
315 }
317 if (((TH1*)(fObjectFit))->GetDimension()!=((TH1*)(obj))->GetDimension()){
318 Error("GetConfidenceIntervals", "Fitted and passed histograms have different number of dimensions");
319 return;
320 }
321 }
322
323
324 TH1 *hfit = (TH1*)obj;
325 TF1 *f = (TF1*)GetUserFunc();
326 Int_t npar = f->GetNpar();
327 Double_t *grad = new Double_t[npar];
328 Double_t *sum_vector = new Double_t[npar];
329 Double_t x[3];
330
331 Int_t hxfirst = hfit->GetXaxis()->GetFirst();
332 Int_t hxlast = hfit->GetXaxis()->GetLast();
333 Int_t hyfirst = hfit->GetYaxis()->GetFirst();
334 Int_t hylast = hfit->GetYaxis()->GetLast();
335 Int_t hzfirst = hfit->GetZaxis()->GetFirst();
336 Int_t hzlast = hfit->GetZaxis()->GetLast();
337
338 TAxis *xaxis = hfit->GetXaxis();
339 TAxis *yaxis = hfit->GetYaxis();
340 TAxis *zaxis = hfit->GetZaxis();
341 Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
342 Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
344 Double_t c=0;
345 for (Int_t binz=hzfirst; binz<=hzlast; binz++){
346 x[2]=zaxis->GetBinCenter(binz);
347 for (Int_t biny=hyfirst; biny<=hylast; biny++) {
348 x[1]=yaxis->GetBinCenter(biny);
349 for (Int_t binx=hxfirst; binx<=hxlast; binx++) {
350 x[0]=xaxis->GetBinCenter(binx);
351 f->GradientPar(x, grad);
352 for (Int_t irow=0; irow<npar; irow++){
353 sum_vector[irow]=0;
354 for (Int_t icol=0; icol<npar; icol++)
355 sum_vector[irow]+=matr[irow*npar+icol]*grad[icol];
356 }
357 c = 0;
358 for (Int_t i=0; i<npar; i++)
359 c+=grad[i]*sum_vector[i];
360 c=TMath::Sqrt(c);
361 hfit->SetBinContent(binx, biny, binz, f->EvalPar(x));
362 hfit->SetBinError(binx, biny, binz, c*t*chidf);
363 }
364 }
365 }
366 delete [] grad;
367 delete [] sum_vector;
368 }
369 else {
370 Error("GetConfidenceIntervals", "This object type is not supported");
371 return;
372 }
373
374}
375
376////////////////////////////////////////////////////////////////////////////////
377/// return a pointer to the covariance matrix
378
380{
381 if (fCovar) return fCovar;
382 Int_t npars = fMinuit->GetNumPars();
383 ((TFitter*)this)->fCovar = new Double_t[npars*npars];
384 fMinuit->mnemat(fCovar,npars);
385 return fCovar;
386}
387
388////////////////////////////////////////////////////////////////////////////////
389/// return element i,j from the covariance matrix
390
392{
394 Int_t npars = fMinuit->GetNumPars();
395 if (i < 0 || i >= npars || j < 0 || j >= npars) {
396 Error("GetCovarianceMatrixElement","Illegal arguments i=%d, j=%d",i,j);
397 return 0;
398 }
399 return fCovar[j+npars*i];
400}
401
402////////////////////////////////////////////////////////////////////////////////
403/// return current errors for a parameter
404/// ipar : parameter number
405/// eplus : upper error
406/// eminus : lower error
407/// eparab : parabolic error
408/// globcc : global correlation coefficient
409
410Int_t TFitter::GetErrors(Int_t ipar,Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const
411{
412
413 Int_t ierr = 0;
414 fMinuit->mnerrs(ipar, eplus,eminus,eparab,globcc);
415 return ierr;
416}
417
418
419////////////////////////////////////////////////////////////////////////////////
420/// return the total number of parameters (free + fixed)
421
423{
424 return fMinuit->fNpar + fMinuit->fNpfix;
425}
426
427////////////////////////////////////////////////////////////////////////////////
428/// return the number of free parameters
429
431{
432 return fMinuit->fNpar;
433}
434
435
436////////////////////////////////////////////////////////////////////////////////
437/// return error of parameter ipar
438
440{
441 Int_t ierr = 0;
442 TString pname;
443 Double_t value,verr,vlow,vhigh;
444
445 fMinuit->mnpout(ipar, pname,value,verr,vlow,vhigh,ierr);
446 return verr;
447}
448
449
450////////////////////////////////////////////////////////////////////////////////
451/// return current value of parameter ipar
452
454{
455 Int_t ierr = 0;
456 TString pname;
457 Double_t value,verr,vlow,vhigh;
458
459 fMinuit->mnpout(ipar, pname,value,verr,vlow,vhigh,ierr);
460 return value;
461}
462
463////////////////////////////////////////////////////////////////////////////////
464/// return current values for a parameter
465///
466/// - ipar : parameter number
467/// - parname : parameter name
468/// - value : initial parameter value
469/// - verr : initial error for this parameter
470/// - vlow : lower value for the parameter
471/// - vhigh : upper value for the parameter
472///
473/// WARNING! parname must be suitably dimensioned in the calling function.
474
475Int_t TFitter::GetParameter(Int_t ipar, char *parname,Double_t &value,Double_t &verr,Double_t &vlow, Double_t &vhigh) const
476{
477 Int_t ierr = 0;
478 TString pname;
479 fMinuit->mnpout(ipar, pname,value,verr,vlow,vhigh,ierr);
480 strcpy(parname,pname.Data());
481 return ierr;
482}
483
484////////////////////////////////////////////////////////////////////////////////
485/// return name of parameter ipar
486
487const char *TFitter::GetParName(Int_t ipar) const
488{
489 if (!fMinuit || ipar < 0 || ipar > fMinuit->fNu) return "";
490 return fMinuit->fCpnam[ipar];
491}
492
493////////////////////////////////////////////////////////////////////////////////
494/// return global fit parameters
495///
496/// - amin : chisquare
497/// - edm : estimated distance to minimum
498/// - errdef
499/// - nvpar : number of variable parameters
500/// - nparx : total number of parameters
501
502Int_t TFitter::GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const
503{
504 Int_t ierr = 0;
505 fMinuit->mnstat(amin,edm,errdef,nvpar,nparx,ierr);
506 return ierr;
507}
508
509////////////////////////////////////////////////////////////////////////////////
510/// return Sum(log(i) i=0,n
511/// used by log likelihood fits
512
514{
515 if (n < 0) return 0;
516 if (n > fNlog) {
517 if (fSumLog) delete [] fSumLog;
518 fNlog = 2*n+1000;
519 fSumLog = new Double_t[fNlog+1];
520 Double_t fobs = 0;
521 for (Int_t j=0;j<=fNlog;j++) {
522 if (j > 1) fobs += TMath::Log(j);
523 fSumLog[j] = fobs;
524 }
525 }
526 if (fSumLog) return fSumLog[n];
527 return 0;
528}
529
530
531////////////////////////////////////////////////////////////////////////////////
532///return kTRUE if parameter ipar is fixed, kFALSE otherwise)
533
535{
536 if (fMinuit->fNiofex[ipar] == 0 ) return kTRUE;
537 return kFALSE;
538}
539
540
541////////////////////////////////////////////////////////////////////////////////
542/// Print fit results
543
544void TFitter::PrintResults(Int_t level, Double_t amin) const
545{
546 fMinuit->mnprin(level,amin);
547}
548
549////////////////////////////////////////////////////////////////////////////////
550/// Release parameter ipar.
551
553{
554 if (fCovar) {delete [] fCovar; fCovar = 0;}
555 fMinuit->Release(ipar);
556}
557
558////////////////////////////////////////////////////////////////////////////////
559/// Specify the address of the fitting algorithm
560
561void TFitter::SetFCN(void (*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
562{
563 if (fCovar) {delete [] fCovar; fCovar = 0;}
565 fMinuit->SetFCN(fcn);
566}
567
568////////////////////////////////////////////////////////////////////////////////
569/// ret fit method (chisquare or log-likelihood)
570
572{
573 if (fCovar) {delete [] fCovar; fCovar = 0;}
574 if (!strcmp(name,"F2Minimizer")) SetFCN(F2Fit);
575 if (!strcmp(name,"F3Minimizer")) SetFCN(F3Fit);
576}
577
578////////////////////////////////////////////////////////////////////////////////
579/// set initial values for a parameter
580///
581/// - ipar : parameter number
582/// - parname : parameter name
583/// - value : initial parameter value
584/// - verr : initial error for this parameter
585/// - vlow : lower value for the parameter
586/// - vhigh : upper value for the parameter
587
588Int_t TFitter::SetParameter(Int_t ipar,const char *parname,Double_t value,Double_t verr,Double_t vlow, Double_t vhigh)
589{
590 if (fCovar) {delete [] fCovar; fCovar = 0;}
591 Int_t ierr = 0;
592 fMinuit->mnparm(ipar,parname,value,verr,vlow,vhigh,ierr);
593 return ierr;
594}
595
596
597
598////////////////////////////////////////////////////////////////////////////////
599
600void F2Fit(Int_t &/*npar*/, Double_t * /*gin*/, Double_t &f,Double_t *u, Int_t /*flag*/)
601{
603 TF2 *f2 = (TF2*)fitter->GetObjectFit();
604 f2->InitArgs(u, f2->GetParameters() );
605 f = f2->EvalPar(u);
606}
607
608////////////////////////////////////////////////////////////////////////////////
609
610void F3Fit(Int_t &/*npar*/, Double_t * /*gin*/, Double_t &f,Double_t *u, Int_t /*flag*/)
611{
613 TF3 *f3 = (TF3*)fitter->GetObjectFit();
614 f3->InitArgs(u, f3->GetParameters() );
615 f = f3->EvalPar(u);
616}
void Class()
Definition: Class.C:29
#define f(i)
Definition: RSha256.hxx:104
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:364
void F3Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Definition: TFitter.cxx:610
void F2Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Definition: TFitter.cxx:600
char name[80]
Definition: TGX11.cxx:110
XPoint xy[kMAXMK]
Definition: TGX11.cxx:123
Class to manage histogram axis.
Definition: TAxis.h:30
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Definition: TAxis.cxx:478
Int_t GetLast() const
Return last bin on the axis i.e.
Definition: TAxis.cxx:469
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition: TAxis.cxx:458
1-Dim function class
Definition: TF1.h:213
virtual Double_t * GetParameters() const
Definition: TF1.h:520
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
Definition: TF1.cxx:1469
virtual void InitArgs(const Double_t *x, const Double_t *params)
Initialize parameters addresses.
Definition: TF1.cxx:2473
A 2-Dim function with parameters.
Definition: TF2.h:29
A 3-Dim function with parameters.
Definition: TF3.h:28
<div class="legacybox"><h2>Legacy Code</h2> TFitter is a legacy interface: it is not recommended to u...
Definition: TFitter.h:19
virtual void ReleaseParameter(Int_t ipar)
Release parameter ipar.
Definition: TFitter.cxx:552
virtual Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const
return element i,j from the covariance matrix
Definition: TFitter.cxx:391
virtual void SetFitMethod(const char *name)
ret fit method (chisquare or log-likelihood)
Definition: TFitter.cxx:571
TMinuit * fMinuit
Definition: TFitter.h:25
virtual Double_t GetParameter(Int_t ipar) const
return current value of parameter ipar
Definition: TFitter.cxx:453
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:410
virtual Int_t GetNumberTotalParameters() const
return the total number of parameters (free + fixed)
Definition: TFitter.cxx:422
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
Definition: TFitter.cxx:588
Double_t * fCovar
Definition: TFitter.h:23
virtual void FixParameter(Int_t ipar)
Fix parameter ipar.
Definition: TFitter.cxx:100
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.
Definition: TFitter.cxx:119
TFitter(const TFitter &)
virtual Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const
return global fit parameters
Definition: TFitter.cxx:502
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:89
virtual Bool_t IsFixed(Int_t ipar) const
return kTRUE if parameter ipar is fixed, kFALSE otherwise)
Definition: TFitter.cxx:534
Double_t * fSumLog
Definition: TFitter.h:24
virtual Double_t * GetCovarianceMatrix() const
return a pointer to the covariance matrix
Definition: TFitter.cxx:379
virtual void PrintResults(Int_t level, Double_t amin) const
Print fit results.
Definition: TFitter.cxx:544
virtual const char * GetParName(Int_t ipar) const
return name of parameter ipar
Definition: TFitter.cxx:487
virtual void Clear(Option_t *option="")
reset the fitter environment
Definition: TFitter.cxx:73
virtual Double_t Chisquare(Int_t npar, Double_t *params) const
Definition: TFitter.cxx:64
virtual Int_t GetNumberFreeParameters() const
return the number of free parameters
Definition: TFitter.cxx:430
virtual Double_t GetParError(Int_t ipar) const
return error of parameter ipar
Definition: TFitter.cxx:439
virtual Double_t GetSumLog(Int_t i)
return Sum(log(i) i=0,n used by log likelihood fits
Definition: TFitter.cxx:513
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:561
virtual ~TFitter()
Default destructor.
Definition: TFitter.cxx:51
Int_t fNlog
Definition: TFitter.h:22
Graphics object made of three arrays X, Y and Z with the same number of points each.
Definition: TGraph2D.h:41
Double_t * GetY() const
Definition: TGraph2D.h:122
Double_t * GetX() const
Definition: TGraph2D.h:121
virtual Double_t * GetEZ() const
Definition: TGraph2D.h:126
Int_t GetN() const
Definition: TGraph2D.h:120
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Sets point number n.
Definition: TGraph2D.cxx:1804
Double_t * GetEY() const
Definition: TGraphErrors.h:68
A TGraph is an object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition: TGraph.cxx:2298
Int_t GetN() const
Definition: TGraph.h:125
Double_t * GetX() const
Definition: TGraph.h:132
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
TAxis * GetZaxis()
Definition: TH1.h:322
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition: TH1.h:320
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:9049
TAxis * GetYaxis()
Definition: TH1.h:321
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:9065
Implementation in C++ of the Minuit package written by Fred James.
Definition: TMinuit.h:27
virtual Int_t FixParameter(Int_t parNo)
fix a parameter
Definition: TMinuit.cxx:826
virtual Int_t GetNumPars() const
returns the total number of parameters that have been defined as fixed or free.
Definition: TMinuit.cxx:871
virtual Int_t Release(Int_t parNo)
release a parameter
Definition: TMinuit.cxx:893
Int_t fNu
Definition: TMinuit.h:130
virtual void mncler()
Resets the parameter list to UNDEFINED.
Definition: TMinuit.cxx:1102
TString * fCpnam
Character to be plotted at the X,Y contour positions.
Definition: TMinuit.h:165
Int_t fNpfix
Definition: TMinuit.h:37
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:919
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:6248
virtual void mnemat(Double_t *emat, Int_t ndim)
Calculates the external error matrix from the internal matrix.
Definition: TMinuit.cxx:2500
virtual void mnrn15(Double_t &val, Int_t &inseed)
This is a super-portable random number generator.
Definition: TMinuit.cxx:6618
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:2577
Int_t fNpar
Definition: TMinuit.h:41
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:2663
Int_t * fNiofex
Definition: TMinuit.h:127
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:7637
virtual void mnprin(Int_t inkode, Double_t fval)
Prints the values of the parameters at the time of the call.
Definition: TMinuit.cxx:6305
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:5666
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
Abstract Base Class for Fitting.
virtual TObject * GetObjectFit() const
TObject * fUserFunc
Pointer to user theoretical function (a TF1*)
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...
TObject * fObjectFit
Pointer to object being fitted.
static TVirtualFitter * GetFitter()
static: return the current Fitter
virtual TObject * GetUserFunc() const
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
TGraphErrors * gr
Definition: legend1.C:25
int GetDimension(const TH1 *h1)
Definition: HFitImpl.cxx:50
static constexpr double eplus
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754
Definition: TMath.h:851
Double_t Log(Double_t x)
Definition: TMath.h:710
Double_t Sqrt(Double_t x)
Definition: TMath.h:641
Double_t StudentQuantile(Double_t p, Double_t ndf, Bool_t lower_tail=kTRUE)
Computes quantiles of the Student's t-distribution 1st argument is the probability,...
Definition: TMath.cxx:2633