26 #include "RConfigure.h"
37 #ifndef ROOT_TAttMarker
41 #ifndef ROOT_Math_ParamFunctor
63 for (
int i = 0; i < npar; ++i ){
74 if (&rhs ==
this)
return *
this;
83 return (CheckIndex(iparam)) ?
fParameters[iparam] : 0;
96 return (CheckIndex(iparam)) ?
fParNames[iparam].c_str() :
"";
102 if (!CheckIndex(iparam))
return;
116 if (!CheckIndex(iparam))
return;
119 void SetParNames(
const char *name0=
"p0",
const char *name1=
"p1",
const char *name2=
"p2",
120 const char *name3=
"p3",
const char*name4=
"p4",
const char *name5=
"p5",
121 const char *name6=
"p6",
const char *name7=
"p7",
const char *name8=
"p8",
122 const char *name9=
"p9",
const char *name10=
"p10");
129 bool CheckIndex(
Int_t i)
const {
233 template <
typename Func>
237 template <
typename Func>
240 fXmin(xmin), fXmax(xmax),
241 fNpar(npar), fNdim(1),
243 fNpfits(0), fNDF(0), fChisquare(0),
244 fMinimum(-1111), fMaximum(-1111),
248 fParent(0), fHistogram(0),
250 fNormalized(
false), fNormIntegral(0),
251 fFunctor(
ROOT::
Math::ParamFunctor(f)),
267 template <
class PtrObj,
typename MemFn>
270 fXmin(xmin), fXmax(xmax),
271 fNpar(npar), fNdim(ndim),
273 fNpfits(0), fNDF(0), fChisquare(0),
274 fMinimum(-1111), fMaximum(-1111),
278 fParent(0), fHistogram(0),
280 fNormalized(
false), fNormIntegral(0),
281 fFunctor (
ROOT::
Math::ParamFunctor(p,memFn) ),
288 template <
class PtrObj,
typename MemFn>
291 fXmin(xmin), fXmax(xmax),
292 fNpar(npar), fNdim(1),
294 fNpfits(0), fNDF(0), fChisquare(0),
295 fMinimum(-1111), fMaximum(-1111),
299 fParent(0), fHistogram(0),
301 fNormalized(
false), fNormIntegral(0),
302 fFunctor (
ROOT::
Math::ParamFunctor(p,memFn) ),
406 return IntegralMultiple(n,a,b,maxpts, epsrel, epsrel, relerr, nfnevl, ifail);
421 template <
class PtrObj,
typename MemFn>
423 template <
typename Func>
446 if (fFormula) fFormula->
SetParameters(p0,p1,
p2,
p3,p4,p5,p6,p7,p8,p9,p10);
447 else fParams->
SetParameters(p0,p1,
p2,
p3,p4,p5,p6,p7,p8,p9,p10);
451 virtual void SetParNames(
const char *name0=
"p0",
const char *name1=
"p1",
const char *name2=
"p2",
452 const char *name3=
"p3",
const char *name4=
"p4",
const char *name5=
"p5",
453 const char *name6=
"p6",
const char *name7=
"p7",
const char *name8=
"p8",
454 const char *name9=
"p9",
const char *name10=
"p10");
463 virtual void SetTitle(
const char *title=
"");
487 template <
typename Func>
490 fXmin(xmin), fXmax(xmax),
491 fNpar(npar), fNdim(ndim),
493 fNpfits(0), fNDF(0), fChisquare(0),
494 fMinimum(-1111), fMaximum(-1111),
498 fParent(0), fHistogram(0),
500 fNormalized(
false), fNormIntegral(0),
525 TString formulaExpression(formula);
526 Ssiz_t first = formulaExpression.
Index(
"return")+7;
528 TString title = formulaExpression( first, last-first);
539 {
return Eval(x,y,z,t); }
543 if (fMethodCall)
InitArgs(x,params);
553 template <
typename Func>
559 template <
class PtrObj,
typename MemFn>
const std::vector< double > & ParamsVec() const
ROOT::Math::ParamFunctor fFunctor
virtual void SetParameters(Double_t p0, Double_t p1, Double_t p2=0, Double_t p3=0, Double_t p4=0, Double_t p5=0, Double_t p6=0, Double_t p7=0, Double_t p8=0, Double_t p9=0, Double_t p10=0)
virtual Int_t GetQuantiles(Int_t nprobSum, Double_t *q, const Double_t *probSum)
Compute Quantiles for density distribution of this function.
TF1Parameters(Int_t npar)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
virtual void AddParameter(const TString &name, Double_t value)
virtual void SetParameters(const Double_t *params)
virtual Double_t GetRandom()
Return a random number following this function shape.
Bool_t fNormalized
Pointer to MethodCall in case of interpreted function.
const char * GetParName(Int_t iparam) const
virtual TFormula * GetFormula()
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
virtual void ReleaseParameter(Int_t ipar)
Release parameter number ipar If used in a fit, the parameter can vary freely.
static double p3(double t, double a, double b, double c, double d)
virtual void SetParName(Int_t ipar, const char *name)
Set name of parameter number ipar.
Namespace for new ROOT classes and functions.
virtual void SetParNames(const char *name0="p0", const char *name1="p1", const char *name2="p2", const char *name3="p3", const char *name4="p4", const char *name5="p5", const char *name6="p6", const char *name7="p7", const char *name8="p8", const char *name9="p9", const char *name10="p10")
Set up to 10 parameter names.
virtual Int_t GetNumberFreeParameters() const
Return the number of free parameters.
static std::atomic< Bool_t > fgAbsValue
TF1(const char *name, const PtrObj &p, MemFn memFn, Double_t xmin, Double_t xmax, Int_t npar, const char *, const char *, EAddToList addToGlobList=EAddToList::kDefault)
virtual Int_t GetNumberFitPoints() const
virtual const char * GetParName(Int_t ipar) const
void DoInitialize(EAddToList addToGlobList)
Common initialization of the TF1.
virtual const TObject * GetLinearPart(Int_t i) const
virtual Double_t IntegralFast(Int_t num, Double_t *x, Double_t *w, Double_t a, Double_t b, Double_t *params=0, Double_t epsilon=1e-12)
Gauss-Legendre integral, see CalcGaussLegendreSamplingPoints.
static TF1 * GetCurrent()
Static function returning the current function being processed.
TObject * fParent
Array gamma.
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax)
Save values of function in array fSave.
virtual Double_t IntegralMultiple(Int_t n, const Double_t *a, const Double_t *b, Int_t maxpts, Double_t epsrel, Double_t epsabs, Double_t &relerr, Int_t &nfnevl, Int_t &ifail)
This function computes, to an attempted specified accuracy, the value of the integral.
std::vector< std::string > fParNames
virtual void SetNumberFitPoints(Int_t npfits)
static Bool_t DefaultAddToGlobalList(Bool_t on=kTRUE)
Static method to add/avoid to add automatically functions to the global list (gROOT->GetListOfFunctio...
static Double_t DerivativeError()
Static function returning the error of the last call to the of Derivative's functions.
void SetParameter(const char *name, Double_t value)
TObject * GetParent() const
virtual Double_t GetParError(Int_t ipar) const
Return value of parameter number ipar.
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
void SetFunction(PtrObj &p, MemFn memFn)
virtual Double_t Derivative2(Double_t x, Double_t *params=0, Double_t epsilon=0.001) const
Returns the second derivative of the function at point x, computed by Richardson's extrapolation meth...
Internal class used by TF1 for defining template specialization for different TF1 constructors...
void IntegrateForNormalization()
virtual void SetMinimum(Double_t minimum=-1111)
Set the minimum value along Y for this function In case the function is already drawn, set also the minimum in the helper histogram.
const Double_t * GetParameters() const
virtual Double_t Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)
IntegralOneDim or analytical integral.
virtual void SetNormalized(Bool_t flag)
virtual TObject * DrawIntegral(Option_t *option="al")
Draw integral of this function.
ClassImp(TIterator) Bool_t TIterator return false
Compare two iterator objects.
virtual Int_t GetNDF() const
Return the number of degrees of freedom in the fit the fNDF parameter has been previously computed du...
virtual Double_t GetXmin() const
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to vusualize the function.
static void SetCurrent(TF1 *f1)
Static function setting the current function.
virtual Double_t GetMinMaxNDim(Double_t *x, Bool_t findmax, Double_t epsilon=0, Int_t maxiter=0) const
Find the minimum of a function of whatever dimension.
TMethodCall * GetMethodCall() const
TF1(const char *name, Func f, Double_t xmin, Double_t xmax, Int_t npar, const char *, EAddToList addToGlobList=EAddToList::kDefault)
virtual Int_t GetParNumber(const char *name) const
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a function.
virtual Double_t GetMinimumStored() const
virtual Double_t GetMaximumStored() const
virtual void SetParent(TObject *p=0)
virtual Double_t Moment(Double_t n, Double_t a, Double_t b, const Double_t *params=0, Double_t epsilon=0.000001)
Return nth moment of function between a and b.
TFormula * fFormula
Functor object to wrap any C++ callable object.
Fill Area Attributes class.
virtual Bool_t IsValid() const
Return kTRUE if the function is valid.
#define ClassDef(name, id)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Double_t GetChisquare() const
virtual TString GetExpFormula(Option_t *option="") const
The TNamed class is the base class for all named ROOT classes.
virtual Double_t GetVariable(const TString &name)
virtual void GetParameters(Double_t *params)
virtual void DrawF1(Double_t xmin, Double_t xmax, Option_t *option="")
Draw function between xmin and xmax.
static double p2(double t, double a, double b, double c)
virtual void Copy(TObject &f1) const
Copy this F1 to a new F1.
TF1()
TF1 default constructor.
void SetParameters(const Double_t *params)
std::vector< std::vector< double > > Data
virtual Double_t IntegralMultiple(Int_t n, const Double_t *a, const Double_t *b, Int_t, Int_t maxpts, Double_t epsrel, Double_t &relerr, Int_t &nfnevl, Int_t &ifail)
virtual Bool_t IsLinear() const
virtual void GetRange(Double_t *xmin, Double_t *xmax) const
Return range of a generic N-D function.
Method or function calling interface.
virtual Double_t GetXmax() const
ClassDef(TF1Parameters, 1) private std::vector< Double_t > fParameters
Double_t GetParameter(const char *name) const
virtual const Double_t * GetParErrors() const
TF1Parameters & operator=(const TF1Parameters &rhs)
std::vector< Double_t > fIntegral
virtual void GetParLimits(Int_t ipar, Double_t &parmin, Double_t &parmax) const
Return limits for parameter ipar.
virtual Double_t GradientPar(Int_t ipar, const Double_t *x, Double_t eps=0.01)
Compute the gradient (derivative) wrt a parameter ipar.
Using a TBrowser one can browse all ROOT objects.
virtual void SetChisquare(Double_t chi2)
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set limits for parameter ipar.
static Bool_t fgRejectPoint
TH1 * fHistogram
Parent object hooking this function (if one)
Double_t GetParameter(Int_t iparam) const
Class to manage histogram axis.
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
virtual void SetParError(Int_t ipar, Double_t error)
Set error for parameter number ipar.
virtual const TFormula * GetFormula() const
virtual Int_t GetNdim() const
virtual void FixParameter(Int_t ipar, Double_t value)
Fix the value of a parameter The specified value will be used in a fit operation. ...
static void RejectPoint(Bool_t reject=kTRUE)
Static function to set the global flag to reject points the fgRejectPoint global flag is tested by al...
static void InitStandardFunctions()
Create the basic function objects.
static double p1(double t, double a, double b)
virtual Bool_t IsEvalNormalized() const
virtual void Update()
Called by functions such as SetRange, SetNpx, SetParameters to force the deletion of the associated h...
virtual ~TF1()
TF1 default destructor.
virtual Double_t GetProb() const
Return the fit probability.
virtual void SetParameter(const TString &name, Double_t value)
virtual TH1 * DoCreateHistogram(Double_t xmin, Double_t xmax, Bool_t recreate=kFALSE)
Create histogram with bin content equal to function value computed at the bin center This histogram w...
TAxis * GetYaxis() const
Get y axis of the function.
void SetParameter(Int_t iparam, Double_t value)
virtual Double_t Mean(Double_t a, Double_t b, const Double_t *params=0, Double_t epsilon=0.000001)
static void CalcGaussLegendreSamplingPoints(Int_t num, Double_t *x, Double_t *w, Double_t eps=3.0e-11)
Type safe interface (static method) The number of sampling points are taken from the TGraph...
virtual Double_t GetMinimum(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
Returns the minimum value of the function on the (xmin, xmax) interval.
virtual void SetMaximum(Double_t maximum=-1111)
Set the maximum value along Y for this function In case the function is already drawn, set also the maximum in the helper histogram.
virtual void SetTitle(const char *title="")
Set function title if title has the form "fffffff;xxxx;yyyy", it is assumed that the function title i...
virtual Int_t GetNpx() const
TF1(const char *name, const PtrObj &p, MemFn memFn, Double_t xmin, Double_t xmax, Int_t npar, Int_t ndim=1, EAddToList addToGlobList=EAddToList::kDefault)
virtual Double_t Derivative(Double_t x, Double_t *params=0, Double_t epsilon=0.001) const
Returns the first derivative of the function at point x, computed by Richardson's extrapolation metho...
class containg the result of the fit and all the related information (fitted parameter values...
std::vector< Double_t > fSave
virtual Double_t GetX(Double_t y, Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
Returns the X value corresponding to the function value fy for (xmin
std::vector< Double_t > fParErrors
virtual Double_t GetMaximum(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
Returns the maximum value of the function.
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
virtual Double_t Derivative3(Double_t x, Double_t *params=0, Double_t epsilon=0.001) const
Returns the third derivative of the function at point x, computed by Richardson's extrapolation metho...
virtual void Print(Option_t *option="") const
Print TNamed name and title.
void SetParName(Int_t iparam, const char *name)
std::vector< Double_t > fGamma
Array beta. is approximated by x = alpha +beta*r *gamma*r**2.
double func(double *x, double *p)
virtual Double_t Variance(Double_t a, Double_t b, const Double_t *params=0, Double_t epsilon=0.000001)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
std::vector< Double_t > fAlpha
Integral of function binned on fNpx bins.
virtual Int_t GetNumber() const
Int_t GetParNumber(const char *name) const
Returns the parameter number given a name not very efficient but list of parameters is typically smal...
Namespace for new Math classes and functions.
virtual void InitArgs(const Double_t *x, const Double_t *params)
Initialize parameters addresses.
std::vector< Double_t > fBeta
Array alpha. for each bin in x the deconvolution r of fIntegral.
TAxis * GetZaxis() const
Get z axis of the function. (In case this object is a TF2 or TF3)
void SetParNames(const char *name0="p0", const char *name1="p1", const char *name2="p2", const char *name3="p3", const char *name4="p4", const char *name5="p5", const char *name6="p6", const char *name7="p7", const char *name8="p8", const char *name9="p9", const char *name10="p10")
Set parameter names.
virtual Double_t GetSave(const Double_t *x)
Get value corresponding to X in array of fSave values.
virtual Double_t GetParameter(Int_t ipar) const
TAxis * GetXaxis() const
Get x axis of the function.
Mother of all ROOT objects.
virtual Double_t * GetParameters() const
TMethodCall * fMethodCall
Pointer to histogram used for visualisation.
virtual TH1 * CreateHistogram()
virtual Double_t IntegralOneDim(Double_t a, Double_t b, Double_t epsrel, Double_t epsabs, Double_t &err)
Return Integral of function between a and b using the given parameter values and relative and absolut...
virtual Double_t GetMaximumX(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
Returns the X value corresponding to the maximum value of the function.
virtual Double_t operator()(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
static void Build(TF1 *f, Func func)
static Bool_t RejectedPoint()
See TF1::RejectPoint above.
virtual void SetParErrors(const Double_t *errors)
Set errors for all active parameters when calling this function, the array errors must have at least ...
virtual Double_t GetParameter(const TString &name) const
virtual Bool_t AddToGlobalList(Bool_t on=kTRUE)
Add to global list of functions (gROOT->GetListOfFunctions() ) return previous status (true if the fu...
virtual void SetSavedPoint(Int_t point, Double_t value)
Restore value of function saved at point.
virtual void SetFitResult(const ROOT::Fit::FitResult &result, const Int_t *indpar=0)
Set the result from the fit parameter values, errors, chi2, etc...
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
Param Functor class for Multidimensional functions.
static void Build(TF1 *f, const char *formula)
static std::atomic< Bool_t > fgAddToGlobList
static void AbsValue(Bool_t reject=kTRUE)
Static function: set the fgAbsValue flag.
virtual void SetNDF(Int_t ndf)
Set the number of degrees of freedom ndf should be the number of points used in a fit - the number of...
virtual Double_t GetMinimumX(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
Returns the X value corresponding to the minimum value of the function on the (xmin, xmax) interval.
virtual Double_t IntegralError(Double_t a, Double_t b, const Double_t *params=0, const Double_t *covmat=0, Double_t epsilon=1.E-2)
Return Error on Integral of a parameteric function between a and b due to the parameter uncertainties...
TF1 & operator=(const TF1 &rhs)
Operator =.
virtual void SetParameter(Int_t param, Double_t value)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual Bool_t IsInside(const Double_t *x) const
return kTRUE if the point is inside the function range
std::vector< Double_t > fParMax
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Redefines TObject::GetObjectInfo.
virtual Double_t CentralMoment(Double_t n, Double_t a, Double_t b, const Double_t *params=0, Double_t epsilon=0.000001)
Return nth central moment of function between a and b (i.e the n-th moment around the mean value) ...
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
virtual void Browse(TBrowser *b)
Browse.
std::vector< Double_t > fParMin
virtual Int_t GetNpar() const
virtual void Paint(Option_t *option="")
Paint this function with its current attributes.
virtual TObject * DrawDerivative(Option_t *option="al")
Draw derivative of this function.
virtual TF1 * DrawCopy(Option_t *option="") const
Draw a copy of this function with its current attributes.
TF1Parameters(const TF1Parameters &rhs)