29 struct FitterGlobals {
30 FitterGlobals() : fFitter(nullptr),fMaxPar(0) {}
36 static FitterGlobals &GetGlobals() {
37 TTHREAD_TLS_DECL(FitterGlobals,globals);
41 return GetGlobals().fFitter;
43 static Int_t &GetGlobalMaxPar() {
44 return GetGlobals().fMaxPar;
46 static TString &GetGlobalDefault() {
47 return GetGlobals().fDefault;
58#ifdef R__COMPLETE_MEM_TERMINATION
60 struct TVirtualFitterCleanup {
61 ~TVirtualFitterCleanup() {
65 TVirtualFitterCleanup cleanup;
100 fZfirst(tvf.fZfirst),
102 fNpoints(tvf.fNpoints),
103 fPointSize(tvf.fPointSize),
104 fCacheSize(tvf.fCacheSize),
106 fObjectFit(tvf.fObjectFit),
107 fUserFunc(tvf.fUserFunc),
108 fMethodCall(tvf.fMethodCall),
146 if ( GetGlobalFitter() ==
this ) {
147 GetGlobalFitter() = 0;
148 GetGlobalMaxPar() = 0;
161 if (GetGlobalFitter() && maxpar > GetGlobalMaxPar()) {
162 delete GetGlobalFitter();
163 GetGlobalFitter() = 0;
166 if (!GetGlobalFitter()) {
168 if (GetGlobalDefault().Length() == 0) GetGlobalDefault() =
gEnv->
GetValue(
"Root.Fitter",
"Minuit");
169 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TVirtualFitter",GetGlobalDefault()))) {
170 if (
h->LoadPlugin() == -1)
173 GetGlobalMaxPar() = maxpar;
177 if (GetGlobalFitter()) GetGlobalFitter()->SetObjectFit(obj);
178 return GetGlobalFitter();
211 return GetGlobalFitter();
248 if (GetGlobalDefault() ==
name)
return;
249 delete GetGlobalFitter();
250 GetGlobalFitter() = 0;
251 GetGlobalDefault() =
name;
259 GetGlobalFitter() = fitter;
260 GetGlobalMaxPar() = maxpar;
312 if (!GetGlobalFitter())
return;
315 GetGlobalFitter()->ExecuteCommand(
"SET ERRORDEF", arglist, 1);
static void SetDefaultMinimizer(const char *type, const char *algo=0)
static void SetDefaultMaxFunctionCalls(int maxcall)
static double DefaultTolerance()
static void SetDefaultErrorDef(double up)
static const std::string & DefaultMinimizerType()
static int DefaultMaxFunctionCalls()
static void SetDefaultTolerance(double tol)
static double DefaultErrorDef()
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
The TNamed class is the base class for all named ROOT classes.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Mother of all ROOT objects.
Abstract Base Class for Fitting.
Foption_t fOption
Struct with the fit options.
static void SetDefaultFitter(const char *name="")
static: set name of default fitter
static void SetPrecision(Double_t prec=1e-6)
static: Set the tolerance used in the minimization algorithm For example for MIGRAD this is tolerance...
Int_t fPointSize
Number of words per point in the cache.
virtual void GetConfidenceIntervals(Int_t n, Int_t ndim, const Double_t *x, Double_t *ci, Double_t cl=0.95)
return confidence intervals in array x of dimension ndim implemented in TFitter and TLinearFitter
TObject * fUserFunc
Pointer to user theoretical function (a TF1*)
TMethodCall * fMethodCall
Pointer to MethodCall in case of interpreted function.
static Int_t GetMaxIterations()
static: Return the maximum number of iterations actually max number of function calls
static Double_t GetPrecision()
static: Return the fit relative precision
Int_t fYlast
Last bin on Y axis.
Int_t fXfirst
First bin on X axis.
Int_t fZfirst
First bin on Z axis.
Int_t fXlast
Last bin on X axis.
virtual Double_t * SetCache(Int_t npoints, Int_t psize)
Initialize the cache array npoints is the number of points to be stored (or already stored) in the ca...
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...
TVirtualFitter()
Default constructor.
static const char * GetDefaultFitter()
static: return the name of the default fitter
virtual ~TVirtualFitter()
Cleanup virtual fitter.
Double_t * fCache
[fCacheSize] Array of points data (fNpoints*fPointSize < fCacheSize words)
static void SetMaxIterations(Int_t niter=5000)
static: Set the maximum number of function calls for the minimization algorithm For example for MIGRA...
void(* fFCN)(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag)
static Double_t GetErrorDef()
static: Return the Error Definition
TObject * fObjectFit
Pointer to object being fitted.
Int_t fCacheSize
Size of the fCache array.
TVirtualFitter & operator=(const TVirtualFitter &tvf)
assignment operator
Int_t fYfirst
First bin on Y axis.
static void SetErrorDef(Double_t errdef=1)
static: Set the Error Definition (default=1) For Minuit this is the value passed with the "SET ERR" c...
static TVirtualFitter * GetFitter()
static: return the current Fitter
Int_t fZlast
Last bin on Z axis.
Int_t fNpoints
Number of points to fit.
static TVirtualFitter * Fitter(TObject *obj, Int_t maxpar=25)
Static function returning a pointer to the current fitter.
static void SetFitter(TVirtualFitter *fitter, Int_t maxpar=25)
Static function to set an alternative fitter.