Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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, Consider switching to ROOT::Fit::Fitter.}
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
34
35////////////////////////////////////////////////////////////////////////////////
36/// Default constructor
37
39{
40 fMinuit = new TMinuit(maxpar);
41 fNlog = 0;
42 fSumLog = nullptr;
43 fCovar = nullptr;
44 SetName("MinuitFitter");
45}
46
47////////////////////////////////////////////////////////////////////////////////
48/// Default destructor
49
51{
52 if (fCovar) delete [] fCovar;
53 if (fSumLog) delete [] fSumLog;
54 delete fMinuit;
55}
56
57////////////////////////////////////////////////////////////////////////////////
58/// \deprecated
59/// Use ROOT::Fit::Chisquare class instead.
60///
61/// return a chisquare equivalent
62
64{
65 Error("Chisquare","This function is deprecated - use ROOT::Fit::Chisquare class");
66 return TMath::QuietNaN();
67}
68
69////////////////////////////////////////////////////////////////////////////////
70/// reset the fitter environment
71
73{
74 if (fCovar) {delete [] fCovar; fCovar = nullptr;}
75 fMinuit->mncler();
76
77 //reset the internal Minuit random generator to its initial state
78 Double_t val = 3;
79 Int_t inseed = 12345;
80 fMinuit->mnrn15(val,inseed);
81}
82
83////////////////////////////////////////////////////////////////////////////////
84/// Execute a fitter command;
85/// command : command string
86/// args : list of nargs command arguments
87
89{
90 if (fCovar) {delete [] fCovar; fCovar = nullptr;}
91 Int_t ierr = 0;
93 return ierr;
94}
95
96////////////////////////////////////////////////////////////////////////////////
97/// Fix parameter ipar.
98
100{
101 if (fCovar) {delete [] fCovar; fCovar = nullptr;}
102 fMinuit->FixParameter(ipar);
103}
104
105////////////////////////////////////////////////////////////////////////////////
106/// Computes point-by-point confidence intervals for the fitted function
107///
108/// Parameters:
109/// - n - number of points
110/// - ndim - dimensions of points
111/// - x - points, at which to compute the intervals, for ndim > 1
112/// should be in order: (x0,y0, x1, y1, ... xn, yn)
113/// - ci - computed intervals are returned in this array
114/// - cl - confidence level, default=0.95
115///
116/// NOTE, that the intervals are approximate for nonlinear(in parameters) models
117
119{
120 TF1 *f = (TF1*)fUserFunc;
121 Int_t npar = f->GetNumberFreeParameters();
122 Int_t npar_real = f->GetNpar();
123 Double_t *grad = new Double_t[npar_real];
125 Bool_t *fixed=nullptr;
126 Double_t al, bl;
127 if (npar_real != npar){
128 fixed = new Bool_t[npar_real];
129 memset(fixed,0,npar_real*sizeof(Bool_t));
130
131 for (Int_t ipar=0; ipar<npar_real; ipar++){
132 fixed[ipar]=false;
133 f->GetParLimits(ipar,al,bl);
134 if (al*bl != 0 && al >= bl) {
135 //this parameter is fixed
136 fixed[ipar]=true;
137 }
138 }
139 }
140 Double_t c=0;
141
143 if (!matr){
144 delete [] grad;
145 delete [] sum_vector;
146 if (fixed)
147 delete [] fixed;
148 return;
149 }
150
151 Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
152 Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
153 Int_t igrad, ifree=0;
154 for (Int_t ipoint=0; ipoint<n; ipoint++){
155 c=0;
156 f->GradientPar(x+ndim*ipoint, grad);
157 //multiply the covariance matrix by gradient
158 for (Int_t irow=0; irow<npar; irow++){
159 sum_vector[irow]=0;
160 igrad = 0;
161 for (Int_t icol=0; icol<npar; icol++){
162 igrad = 0;
163 ifree=0;
164 if (fixed) {
165 //find the free parameter #icol
166 while (ifree<icol+1){
167 if (fixed[igrad]==0) ifree++;
168 igrad++;
169 }
170 igrad--;
171 //now the [igrad] element of gradient corresponds to [icol] element of cov.matrix
172 } else {
173 igrad = icol;
174 }
175 sum_vector[irow]+=matr[irow*npar_real+icol]*grad[igrad];
176 }
177 }
178 igrad = 0;
179 for (Int_t i=0; i<npar; i++){
180 igrad = 0; ifree=0;
181 if (fixed) {
182 //find the free parameter #icol
183 while (ifree<i+1){
184 if (fixed[igrad]==0) ifree++;
185 igrad++;
186 }
187 igrad--;
188 } else {
189 igrad = i;
190 }
191 c+=grad[igrad]*sum_vector[i];
192 }
193
194 c=TMath::Sqrt(c);
195 ci[ipoint]=c*t*chidf;
196 }
197
198 delete [] grad;
199 delete [] sum_vector;
200 if (fixed)
201 delete [] fixed;
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// Computes confidence intervals at level cl. Default is 0.95
206///
207/// The TObject parameter can be a TGraphErrors, a TGraph2DErrors or a TH1,2,3.
208/// For Graphs, confidence intervals are computed for each point,
209/// the value of the graph at that point is set to the function value at that
210/// point, and the graph y-errors (or z-errors) are set to the value of
211/// the confidence interval at that point.
212/// For Histograms, confidence intervals are computed for each bin center
213/// The bin content of this bin is then set to the function value at the bin
214/// center, and the bin error is set to the confidence interval value.
215/// NOTE: confidence intervals are approximate for nonlinear models!
216///
217/// Allowed combinations:
218///
219/// - Fitted object Passed object
220/// - TGraph TGraphErrors, TH1
221/// - TGraphErrors, AsymmErrors TGraphErrors, TH1
222/// - TH1 TGraphErrors, TH1
223/// - TGraph2D TGraph2DErrors, TH2
224/// - TGraph2DErrors TGraph2DErrors, TH2
225/// - TH2 TGraph2DErrors, TH2
226/// - TH3 TH3
227
229{
230 if (obj->InheritsFrom(TGraph::Class())) {
231 TGraph *gr = (TGraph*)obj;
232 if (!gr->GetEY()){
233 Error("GetConfidenceIntervals", "A TGraphErrors should be passed instead of a graph");
234 return;
235 }
237 Error("GetConfidenceIntervals", "A TGraph2DErrors should be passed instead of a graph");
238 return;
239 }
241 if (((TH1*)(fObjectFit))->GetDimension()>1){
242 Error("GetConfidenceIntervals", "A TGraph2DErrors or a TH23 should be passed instead of a graph");
243 return;
244 }
245 }
246 GetConfidenceIntervals(gr->GetN(),1,gr->GetX(), gr->GetEY(), cl);
247 for (Int_t i=0; i<gr->GetN(); i++)
248 gr->SetPoint(i, gr->GetX()[i], ((TF1*)(fUserFunc))->Eval(gr->GetX()[i]));
249 }
250
251 //TGraph2D/////////////////
252 else if (obj->InheritsFrom(TGraph2D::Class())) {
253 TGraph2D *gr2 = (TGraph2D*)obj;
254 if (!gr2->GetEZ()){
255 Error("GetConfidenceIntervals", "A TGraph2DErrors should be passed instead of a TGraph2D");
256 return;
257 }
259 Error("GetConfidenceIntervals", "A TGraphErrors should be passed instead of a TGraph2D");
260 return;
261 }
263 if (((TH1*)(fObjectFit))->GetDimension()==1){
264 Error("GetConfidenceIntervals", "A TGraphErrors or a TH1 should be passed instead of a graph");
265 return;
266 }
267 }
268 TF2 *f=(TF2*)fUserFunc;
269 Double_t xy[2];
270 Int_t np = gr2->GetN();
271 Int_t npar = f->GetNpar();
272 Double_t *grad = new Double_t[npar];
274 Double_t *x = gr2->GetX();
275 Double_t *y = gr2->GetY();
276 Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
277 Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
279 Double_t c = 0;
280 for (Int_t ipoint=0; ipoint<np; ipoint++){
281 xy[0]=x[ipoint];
282 xy[1]=y[ipoint];
283 f->GradientPar(xy, grad);
284 for (Int_t irow=0; irow<f->GetNpar(); irow++){
285 sum_vector[irow]=0;
286 for (Int_t icol=0; icol<npar; icol++)
287 sum_vector[irow]+=matr[irow*npar+icol]*grad[icol];
288 }
289 c = 0;
290 for (Int_t i=0; i<npar; i++)
291 c+=grad[i]*sum_vector[i];
292 c=TMath::Sqrt(c);
293 gr2->SetPoint(ipoint, xy[0], xy[1], f->EvalPar(xy));
294 gr2->GetEZ()[ipoint]=c*t*chidf;
295
296 }
297 delete [] grad;
298 delete [] sum_vector;
299 }
300
301 //TH1/////////////////////////
302 else if (obj->InheritsFrom(TH1::Class())) {
304 if (((TH1*)obj)->GetDimension()>1){
305 Error("GetConfidenceIntervals", "Fitted graph and passed histogram have different number of dimensions");
306 return;
307 }
308 }
310 if (((TH1*)obj)->GetDimension()!=2){
311 Error("GetConfidenceIntervals", "Fitted graph and passed histogram have different number of dimensions");
312 return;
313 }
314 }
316 if (((TH1*)(fObjectFit))->GetDimension()!=((TH1*)(obj))->GetDimension()){
317 Error("GetConfidenceIntervals", "Fitted and passed histograms have different number of dimensions");
318 return;
319 }
320 }
321
322
323 TH1 *hfit = (TH1*)obj;
324 TF1 *f = (TF1*)GetUserFunc();
325 Int_t npar = f->GetNpar();
326 Double_t *grad = new Double_t[npar];
328 Double_t x[3];
329
330 Int_t hxfirst = hfit->GetXaxis()->GetFirst();
331 Int_t hxlast = hfit->GetXaxis()->GetLast();
332 Int_t hyfirst = hfit->GetYaxis()->GetFirst();
333 Int_t hylast = hfit->GetYaxis()->GetLast();
334 Int_t hzfirst = hfit->GetZaxis()->GetFirst();
335 Int_t hzlast = hfit->GetZaxis()->GetLast();
336
337 TAxis *xaxis = hfit->GetXaxis();
338 TAxis *yaxis = hfit->GetYaxis();
339 TAxis *zaxis = hfit->GetZaxis();
340 Double_t t = TMath::StudentQuantile(0.5 + cl/2, f->GetNDF());
341 Double_t chidf = TMath::Sqrt(f->GetChisquare()/f->GetNDF());
343 Double_t c=0;
344 for (Int_t binz=hzfirst; binz<=hzlast; binz++){
345 x[2]=zaxis->GetBinCenter(binz);
346 for (Int_t biny=hyfirst; biny<=hylast; biny++) {
347 x[1]=yaxis->GetBinCenter(biny);
348 for (Int_t binx=hxfirst; binx<=hxlast; binx++) {
349 x[0]=xaxis->GetBinCenter(binx);
350 f->GradientPar(x, grad);
351 for (Int_t irow=0; irow<npar; irow++){
352 sum_vector[irow]=0;
353 for (Int_t icol=0; icol<npar; icol++)
354 sum_vector[irow]+=matr[irow*npar+icol]*grad[icol];
355 }
356 c = 0;
357 for (Int_t i=0; i<npar; i++)
358 c+=grad[i]*sum_vector[i];
359 c=TMath::Sqrt(c);
360 hfit->SetBinContent(binx, biny, binz, f->EvalPar(x));
361 hfit->SetBinError(binx, biny, binz, c*t*chidf);
362 }
363 }
364 }
365 delete [] grad;
366 delete [] sum_vector;
367 }
368 else {
369 Error("GetConfidenceIntervals", "This object type is not supported");
370 return;
371 }
372
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// return a pointer to the covariance matrix
377
379{
380 if (fCovar) return fCovar;
382 ((TFitter*)this)->fCovar = new Double_t[npars*npars];
384 return fCovar;
385}
386
387////////////////////////////////////////////////////////////////////////////////
388/// return element i,j from the covariance matrix
389
391{
395 Error("GetCovarianceMatrixElement","Illegal arguments i=%d, j=%d",i,j);
396 return 0;
397 }
398 return fCovar[j+npars*i];
399}
400
401////////////////////////////////////////////////////////////////////////////////
402/// return current errors for a parameter
403/// ipar : parameter number
404/// eplus : upper error
405/// eminus : lower error
406/// eparab : parabolic error
407/// globcc : global correlation coefficient
408
410{
411
412 Int_t ierr = 0;
413 fMinuit->mnerrs(ipar, eplus,eminus,eparab,globcc);
414 return ierr;
415}
416
417
418////////////////////////////////////////////////////////////////////////////////
419/// return the total number of parameters (free + fixed)
420
425
426////////////////////////////////////////////////////////////////////////////////
427/// return the number of free parameters
428
433
434
435////////////////////////////////////////////////////////////////////////////////
436/// return error of parameter ipar
437
439{
440 Int_t ierr = 0;
443
445 return verr;
446}
447
448
449////////////////////////////////////////////////////////////////////////////////
450/// return current value of parameter ipar
451
453{
454 Int_t ierr = 0;
457
459 return value;
460}
461
462////////////////////////////////////////////////////////////////////////////////
463/// return current values for a parameter
464///
465/// - ipar : parameter number
466/// - parname : parameter name
467/// - value : initial parameter value
468/// - verr : initial error for this parameter
469/// - vlow : lower value for the parameter
470/// - vhigh : upper value for the parameter
471///
472/// WARNING! parname must be suitably dimensioned in the calling function.
473
482
483////////////////////////////////////////////////////////////////////////////////
484/// return name of parameter ipar
485
486const char *TFitter::GetParName(Int_t ipar) const
487{
488 if (!fMinuit || ipar < 0 || ipar > fMinuit->fNu) return "";
489 return fMinuit->fCpnam[ipar];
490}
491
492////////////////////////////////////////////////////////////////////////////////
493/// return global fit parameters
494///
495/// - amin : chisquare
496/// - edm : estimated distance to minimum
497/// - errdef
498/// - nvpar : number of variable parameters
499/// - nparx : total number of parameters
500
507
508////////////////////////////////////////////////////////////////////////////////
509/// return Sum(log(i) i=0,n
510/// used by log likelihood fits
511
513{
514 if (n < 0) return 0;
515 if (n > fNlog) {
516 if (fSumLog) delete [] fSumLog;
517 fNlog = 2*n+1000;
518 fSumLog = new Double_t[fNlog+1];
519 Double_t fobs = 0;
520 for (Int_t j=0;j<=fNlog;j++) {
521 if (j > 1) fobs += TMath::Log(j);
522 fSumLog[j] = fobs;
523 }
524 }
525 if (fSumLog) return fSumLog[n];
526 return 0;
527}
528
529
530////////////////////////////////////////////////////////////////////////////////
531///return kTRUE if parameter ipar is fixed, kFALSE otherwise)
532
534{
535 if (fMinuit->fNiofex[ipar] == 0 ) return kTRUE;
536 return kFALSE;
537}
538
539
540////////////////////////////////////////////////////////////////////////////////
541/// Print fit results
542
544{
545 fMinuit->mnprin(level,amin);
546}
547
548////////////////////////////////////////////////////////////////////////////////
549/// Release parameter ipar.
550
552{
553 if (fCovar) {delete [] fCovar; fCovar = nullptr;}
554 fMinuit->Release(ipar);
555}
556
557////////////////////////////////////////////////////////////////////////////////
558/// Specify the address of the fitting algorithm
559
561{
562 if (fCovar) {delete [] fCovar; fCovar = nullptr;}
565}
566
567////////////////////////////////////////////////////////////////////////////////
568/// ret fit method (chisquare or log-likelihood)
569
571{
572 if (fCovar) {delete [] fCovar; fCovar = nullptr;}
573 if (!strcmp(name,"F2Minimizer")) SetFCN(F2Fit);
574 if (!strcmp(name,"F3Minimizer")) SetFCN(F3Fit);
575}
576
577////////////////////////////////////////////////////////////////////////////////
578/// set initial values for a parameter
579///
580/// - ipar : parameter number
581/// - parname : parameter name
582/// - value : initial parameter value
583/// - verr : initial error for this parameter
584/// - vlow : lower value for the parameter
585/// - vhigh : upper value for the parameter
586
588{
589 if (fCovar) {delete [] fCovar; fCovar = nullptr;}
590 Int_t ierr = 0;
592 return ierr;
593}
594
595
596
597////////////////////////////////////////////////////////////////////////////////
598
599void F2Fit(Int_t &/*npar*/, Double_t * /*gin*/, Double_t &f,Double_t *u, Int_t /*flag*/)
600{
602 TF2 *f2 = (TF2*)fitter->GetObjectFit();
603 f2->InitArgs(u, f2->GetParameters() );
604 f = f2->EvalPar(u);
605}
606
607////////////////////////////////////////////////////////////////////////////////
608
609void F3Fit(Int_t &/*npar*/, Double_t * /*gin*/, Double_t &f,Double_t *u, Int_t /*flag*/)
610{
612 TF3 *f3 = (TF3*)fitter->GetObjectFit();
613 f3->InitArgs(u, f3->GetParameters() );
614 f = f3->EvalPar(u);
615}
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void F3Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Definition TFitter.cxx:609
void F2Fit(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
Definition TFitter.cxx:599
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint xy
char name[80]
Definition TGX11.cxx:110
Class to manage histogram axis.
Definition TAxis.h:32
1-Dim function class
Definition TF1.h:182
virtual Double_t * GetParameters() const
Definition TF1.h:500
virtual void InitArgs(const Double_t *x, const Double_t *params)
Initialize parameters addresses.
Definition TF1.cxx:2507
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=nullptr)
Evaluate function with given coordinates and parameters.
Definition TF1.cxx:1475
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: there will be no bug fixes...
Definition TFitter.h:19
TFitter(const TFitter &)=delete
Int_t GetNumberTotalParameters() const override
return the total number of parameters (free + fixed)
Definition TFitter.cxx:421
~TFitter() override
Default destructor.
Definition TFitter.cxx:50
const char * GetParName(Int_t ipar) const override
return name of parameter ipar
Definition TFitter.cxx:486
void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t)) override
Specify the address of the fitting algorithm.
Definition TFitter.cxx:560
void ReleaseParameter(Int_t ipar) override
Release parameter ipar.
Definition TFitter.cxx:551
TMinuit * fMinuit
Definition TFitter.h:25
Double_t * GetCovarianceMatrix() const override
return a pointer to the covariance matrix
Definition TFitter.cxx:378
Double_t GetParError(Int_t ipar) const override
return error of parameter ipar
Definition TFitter.cxx:438
Double_t * fCovar
Definition TFitter.h:23
Bool_t IsFixed(Int_t ipar) const override
return kTRUE if parameter ipar is fixed, kFALSE otherwise)
Definition TFitter.cxx:533
Double_t GetSumLog(Int_t i) override
return Sum(log(i) i=0,n used by log likelihood fits
Definition TFitter.cxx:512
void Clear(Option_t *option="") override
reset the fitter environment
Definition TFitter.cxx:72
void PrintResults(Int_t level, Double_t amin) const override
Print fit results.
Definition TFitter.cxx:543
Double_t GetParameter(Int_t ipar) const override
return current value of parameter ipar
Definition TFitter.cxx:452
void GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t *x, Double_t *ci, Double_t cl=0.95) override
Computes point-by-point confidence intervals for the fitted function.
Definition TFitter.cxx:118
Double_t * fSumLog
Definition TFitter.h:24
Int_t GetErrors(Int_t ipar, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const override
return current errors for a parameter ipar : parameter number eplus : upper error eminus : lower erro...
Definition TFitter.cxx:409
Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs) override
Execute a fitter command; command : command string args : list of nargs command arguments.
Definition TFitter.cxx:88
void SetFitMethod(const char *name) override
ret fit method (chisquare or log-likelihood)
Definition TFitter.cxx:570
Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const override
return global fit parameters
Definition TFitter.cxx:501
Double_t Chisquare(Int_t npar, Double_t *params) const override
Definition TFitter.cxx:63
void FixParameter(Int_t ipar) override
Fix parameter ipar.
Definition TFitter.cxx:99
Double_t GetCovarianceMatrixElement(Int_t i, Int_t j) const override
return element i,j from the covariance matrix
Definition TFitter.cxx:390
Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh) override
set initial values for a parameter
Definition TFitter.cxx:587
Int_t GetNumberFreeParameters() const override
return the number of free parameters
Definition TFitter.cxx:429
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
static TClass * Class()
Double_t * GetEY() const override
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
static TClass * Class()
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition TGraph.cxx:2290
Int_t GetN() const
Definition TGraph.h:131
Double_t * GetX() const
Definition TGraph.h:138
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
static TClass * Class()
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:6241
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:6613
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:7632
virtual void mnprin(Int_t inkode, Double_t fval)
Prints the values of the parameters at the time of the call.
Definition TMinuit.cxx:6298
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:5664
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
Mother of all ROOT objects.
Definition TObject.h:41
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:543
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
Basic string class.
Definition TString.h:138
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
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754.
Definition TMath.h:913
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Definition TMath.h:767
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
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:2676