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