Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TF2 Class Reference

A 2-Dim function with parameters.

The following types of functions can be created:

  1. Expression using variables x and y
  2. Expression using a user defined function
  3. Lambda Expression with x and y variables and parameters

Expression using variables x and y

{
auto f2 = new TF2("f2","sin(x)*sin(y)/(x*y)",0,5,0,5);
f2->Draw();
}
TF2()
TF2 default constructor.
Definition TF2.cxx:83

Expression using a user defined function

Double_t func(Double_t *val, Double_t *par)
{
Float_t x = val[0];
Float_t y = val[1];
Double_t f = x*x-y*y;
return f;
}
void fplot()
{
auto f = new TF2("f",func,-1,1,-1,1);
f->Draw("surf1");
}
#define f(i)
Definition RSha256.hxx:104
float Float_t
Definition RtypesCore.h:57
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17

Lambda Expression with x and y variables and parameters

root [0] TF2 f2("f2", [](double* x, double*p) { return x[0] + x[1] * p[0]; }, 0., 1., 0., 1., 1)
(TF2 &) Name: f2 Title: f2
root [1] f2.SetParameter(0, 1.)
root [2] f2.Eval(1., 2.)
(double) 3.0000000
winID h TVirtualViewer3D TVirtualGLPainter p
A 2-Dim function with parameters.
Definition TF2.h:29

See TF1 class for the list of functions formats

Definition at line 29 of file TF2.h.

Public Member Functions

 TF2 ()
 TF2 default constructor.
 
 TF2 (const char *name, const char *formula, Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1, Option_t *opt=nullptr)
 F2 constructor using a formula definition.
 
template<class PtrObj , typename MemFn >
 TF2 (const char *name, const PtrObj &p, MemFn memFn, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, const char *, const char *)
 Backward compatible ctor.
 
template<class PtrObj , typename MemFn >
 TF2 (const char *name, const PtrObj &p, MemFn memFn, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, Int_t ndim=2)
 Template constructors from a pointer to any C++ class of type PtrObj with a specific member function of type MemFn.
 
 TF2 (const char *name, Double_t(*fcn)(const Double_t *, const Double_t *), Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1, Int_t npar=0, Int_t ndim=2)
 F2 constructor using a pointer to a compiled function.
 
 TF2 (const char *name, Double_t(*fcn)(Double_t *, Double_t *), Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1, Int_t npar=0, Int_t ndim=2)
 F2 constructor using a pointer to a compiled function.
 
template<typename Func >
 TF2 (const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, const char *)
 Backward compatible ctor.
 
template<typename Func >
 TF2 (const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, Int_t ndim=2)
 Template constructors from any C++ callable object, defining the operator() (double * , double *) and returning a double.
 
 TF2 (const char *name, ROOT::Math::ParamFunctor f, Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1, Int_t npar=0, Int_t ndim=2)
 F2 constructor using a ParamFunctor, a functor class implementing operator() (double *, double *)
 
 TF2 (const TF2 &f2)
 Copy constructor.
 
 ~TF2 () override
 F2 default destructor.
 
virtual Double_t CentralMoment2 (Double_t nx, Double_t ax, Double_t bx, Double_t ny, Double_t ay, Double_t by, Double_t epsilon=0.000001)
 Return x^nx * y^ny central moment of a 2d function in range [ax,bx],[ay,by].
 
void Copy (TObject &f2) const override
 Copy this F2 to a new F2.
 
virtual Double_t Covariance2XY (Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001)
 
TH1CreateHistogram () override
 Create a histogram from function.
 
Int_t DistancetoPrimitive (Int_t px, Int_t py) override
 Compute distance from point px,py to a function.
 
void Draw (Option_t *option="") override
 Draw this function with its current attributes.
 
TF1DrawCopy (Option_t *option="") const override
 Draw a copy of this function with its current attributes-*.
 
TObjectDrawDerivative (Option_t *="al") override
 Draw derivative of this function.
 
TObjectDrawIntegral (Option_t *="al") override
 Draw integral of this function.
 
void ExecuteEvent (Int_t event, Int_t px, Int_t py) override
 Execute action corresponding to one event.
 
virtual Int_t GetContour (Double_t *levels=nullptr)
 Return contour values into array levels.
 
virtual Double_t GetContourLevel (Int_t level) const
 Return the number of contour levels.
 
virtual Double_t GetMaximum (Double_t *x) const
 Return maximum value of the function See TF2::GetMinimum.
 
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.
 
virtual Double_t GetMaximumXY (Double_t &x, Double_t &y) const
 Compute the X and Y values corresponding to the maximum value of the function.
 
virtual Double_t GetMinimum (Double_t *x) const
 Return minimum/maximum value of the function.
 
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 Double_t GetMinimumXY (Double_t &x, Double_t &y) const
 Compute the X and Y values corresponding to the minimum value of the function.
 
Int_t GetNpy () const
 
char * GetObjectInfo (Int_t px, Int_t py) const override
 Redefines TObject::GetObjectInfo.
 
Double_t GetRandom (Double_t xmin, Double_t xmax, TRandom *rng=nullptr, Option_t *opt=nullptr) override
 Return a random number following this function shape.
 
Double_t GetRandom (TRandom *rng=nullptr, Option_t *opt=nullptr) override
 Return a random number following this function shape.
 
virtual void GetRandom2 (Double_t &xrandom, Double_t &yrandom, TRandom *rng=nullptr)
 Return 2 random numbers following this function shape.
 
virtual void GetRange (Double_t &xmin, Double_t &xmax) const
 Return range of a 1-D function.
 
virtual void GetRange (Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
 Return range of a 2-D function.
 
void GetRange (Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override
 Return range of a 2-D function.
 
virtual void GetRange (Double_t &xmin, Double_t &ymin, Double_t &zmin, Double_t &xmax, Double_t &ymax, Double_t &zmax) const
 Return range of function.
 
void GetRange (Double_t &xmin, Double_t &ymin, Double_t &zmin, Double_t &xmax, Double_t &ymax, Double_t &zmax) const override
 Return range of function.
 
virtual void GetRange (Double_t *xmin, Double_t *xmax) const
 Return range of a generic N-D function.
 
Double_t GetSave (const Double_t *x) override
 Get value corresponding to X in array of fSave values.
 
virtual Double_t GetYmax () const
 
virtual Double_t GetYmin () const
 
virtual Double_t Integral (Double_t a, Double_t b, Double_t epsrel=1.e-12)
 IntegralOneDim or analytical integral.
 
virtual Double_t Integral (Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsrel=1.e-6)
 Return Integral of a 2d function in range [ax,bx],[ay,by] with desired relative accuracy (defined by eps)
 
TClassIsA () const override
 
Bool_t IsInside (const Double_t *x) const override
 Return kTRUE is the point is inside the function range.
 
virtual Double_t Mean2X (Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001)
 
virtual Double_t Mean2Y (Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001)
 
virtual Double_t Moment2 (Double_t nx, Double_t ax, Double_t bx, Double_t ny, Double_t ay, Double_t by, Double_t epsilon=0.000001)
 Return x^nx * y^ny moment of a 2d function in range [ax,bx],[ay,by].
 
TF2operator= (const TF2 &rhs)
 Operator =.
 
void Paint (Option_t *option="") override
 Paint this 2-D function with its current attributes.
 
void Save (Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax) override
 Save values of function in array fSave.
 
void SavePrimitive (std::ostream &out, Option_t *option="") override
 Save primitive as a C++ statement(s) on output stream out.
 
virtual void SetContour (Int_t nlevels=20, const Double_t *levels=nullptr)
 Set the number and values of contour levels.
 
virtual void SetContourLevel (Int_t level, Double_t value)
 Set value for one contour level.
 
virtual void SetNpy (Int_t npy=100)
 Set the number of points used to draw the function.
 
void SetRange (Double_t xmin, Double_t xmax) override
 Initialize the upper and lower bounds to draw the function.
 
void SetRange (Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax) override
 Initialize the upper and lower bounds to draw the function-.
 
void SetRange (Double_t xmin, Double_t ymin, Double_t zmin, Double_t xmax, Double_t ymax, Double_t zmax) override
 
void Streamer (TBuffer &) override
 Stream an object of class TF2.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
virtual Double_t Variance2X (Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001)
 
virtual Double_t Variance2Y (Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001)
 
- Public Member Functions inherited from TF1
 TF1 ()
 TF1 default constructor.
 
 TF1 (const char *name, const char *formula, Double_t xmin, Double_t xmax, Option_t *option)
 Same constructor as above (for TFormula based function) but passing an option strings available options VEC - vectorize the formula expressions (not possible for lambda based expressions) NL - function is not stores in the global list of functions GL - function will be always stored in the global list of functions , independently of the global setting of TF1::DefaultAddToGlobalList.
 
 TF1 (const char *name, const char *formula, Double_t xmin=0, Double_t xmax=1, EAddToList addToGlobList=EAddToList::kDefault, bool vectorize=false)
 F1 constructor using a formula definition.
 
template<class PtrObj , typename MemFn >
 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)
 
template<class PtrObj , typename MemFn >
 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)
 
 TF1 (const char *name, Double_t xmin, Double_t xmax, Int_t npar, Int_t ndim=1, EAddToList addToGlobList=EAddToList::kDefault)
 F1 constructor using name of an interpreted function.
 
 TF1 (const char *name, Double_t(*fcn)(const Double_t *, const Double_t *), Double_t xmin=0, Double_t xmax=1, Int_t npar=0, Int_t ndim=1, EAddToList addToGlobList=EAddToList::kDefault)
 Constructor using a pointer to (const) real function.
 
 TF1 (const char *name, Double_t(*fcn)(Double_t *, Double_t *), Double_t xmin=0, Double_t xmax=1, Int_t npar=0, Int_t ndim=1, EAddToList addToGlobList=EAddToList::kDefault)
 Constructor using a pointer to a real function.
 
template<typename Func >
 TF1 (const char *name, Func f, Double_t xmin, Double_t xmax, Int_t npar, const char *, EAddToList addToGlobList=EAddToList::kDefault)
 
template<typename Func >
 TF1 (const char *name, Func f, Double_t xmin, Double_t xmax, Int_t npar, Int_t ndim=1, EAddToList addToGlobList=EAddToList::kDefault)
 
 TF1 (const char *name, ROOT::Math::ParamFunctor f, Double_t xmin=0, Double_t xmax=1, Int_t npar=0, Int_t ndim=1, EAddToList addToGlobList=EAddToList::kDefault)
 Constructor using the Functor class.
 
template<class T >
 TF1 (const char *name, std::function< T(const T *data, const Double_t *param)> &fcn, Double_t xmin=0, Double_t xmax=1, Int_t npar=0, Int_t ndim=1, EAddToList addToGlobList=EAddToList::kDefault)
 
template<class T >
 TF1 (const char *name, T(*fcn)(const T *, const Double_t *), Double_t xmin=0, Double_t xmax=1, Int_t npar=0, Int_t ndim=1, EAddToList addToGlobList=EAddToList::kDefault)
 Constructor using a pointer to function.
 
 TF1 (const TF1 &f1)
 
 ~TF1 () override
 TF1 default destructor.
 
virtual void AddParameter (const TString &name, Double_t value)
 
virtual Bool_t AddToGlobalList (Bool_t on=kTRUE)
 Add to global list of functions (gROOT->GetListOfFunctions() ) return previous status (true if the function was already in the list false if not)
 
void Browse (TBrowser *b) override
 Browse.
 
virtual Double_t CentralMoment (Double_t n, Double_t a, Double_t b, const Double_t *params=nullptr, 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)
 
TObjectClone (const char *newname=nullptr) const override
 Make a complete copy of the underlying object.
 
virtual Double_t Derivative (Double_t x, Double_t *params=nullptr, Double_t epsilon=0.001) const
 Returns the first derivative of the function at point x, computed by Richardson's extrapolation method (use 2 derivative estimates to compute a third, more accurate estimation) first, derivatives with steps h and h/2 are computed by central difference formulas.
 
virtual Double_t Derivative2 (Double_t x, Double_t *params=nullptr, Double_t epsilon=0.001) const
 Returns the second derivative of the function at point x, computed by Richardson's extrapolation method (use 2 derivative estimates to compute a third, more accurate estimation) first, derivatives with steps h and h/2 are computed by central difference formulas.
 
virtual Double_t Derivative3 (Double_t x, Double_t *params=nullptr, Double_t epsilon=0.001) const
 Returns the third derivative of the function at point x, computed by Richardson's extrapolation method (use 2 derivative estimates to compute a third, more accurate estimation) first, derivatives with steps h and h/2 are computed by central difference formulas.
 
virtual void DrawF1 (Double_t xmin, Double_t xmax, Option_t *option="")
 Draw function between xmin and xmax.
 
virtual Double_t Eval (Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
 Evaluate this function.
 
virtual Double_t EvalPar (const Double_t *x, const Double_t *params=nullptr)
 Evaluate function with given coordinates and parameters.
 
template<class T >
EvalPar (const T *x, const Double_t *params=nullptr)
 EvalPar for vectorized.
 
virtual void FixParameter (Int_t ipar, Double_t value)
 Fix the value of a parameter for a fit operation The specified value will be used in the fit and the parameter will be constant (nor varying) during fitting Note that when using pre-defined functions (e.g gaus), one needs to use the fit option 'B' to have the fix of the paramter effective.
 
Double_t GetChisquare () const
 
virtual TString GetExpFormula (Option_t *option="") const
 
virtual TFormulaGetFormula ()
 
virtual const TFormulaGetFormula () const
 
virtual TH1GetHistogram () const
 Return a pointer to the histogram used to visualise the function Note that this histogram is managed by the function and in same case it is automatically deleted when some TF1 functions are called such as TF1::SetParameters, TF1::SetNpx, TF1::SetRange It is then reccomended either to clone the return object or calling again teh GetHistogram function whenever is needed.
 
virtual const TObjectGetLinearPart (Int_t i) const
 
virtual Double_t GetMaximumStored () const
 
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.
 
TMethodCallGetMethodCall () const
 
virtual Double_t GetMinimumStored () const
 
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 Int_t GetNDF () const
 Return the number of degrees of freedom in the fit the fNDF parameter has been previously computed during a fit.
 
virtual Int_t GetNdim () const
 
virtual Int_t GetNpar () const
 
virtual Int_t GetNpx () const
 
virtual Int_t GetNumber () const
 
virtual Int_t GetNumberFitPoints () const
 
virtual Int_t GetNumberFreeParameters () const
 Return the number of free parameters.
 
virtual Double_t GetParameter (const TString &name) const
 
virtual Double_t GetParameter (Int_t ipar) const
 
virtual Double_tGetParameters () const
 
virtual void GetParameters (Double_t *params)
 
TObjectGetParent () const
 
virtual Double_t GetParError (Int_t ipar) const
 Return value of parameter number ipar.
 
virtual const Double_tGetParErrors () const
 
virtual void GetParLimits (Int_t ipar, Double_t &parmin, Double_t &parmax) const
 Return limits for parameter ipar.
 
virtual const char * GetParName (Int_t ipar) const
 
virtual Int_t GetParNumber (const char *name) const
 
virtual Double_t GetProb () const
 Return the fit probability.
 
virtual Int_t GetQuantiles (Int_t nprobSum, Double_t *q, const Double_t *probSum)
 Compute Quantiles for density distribution of this function.
 
virtual Double_t GetVariable (const TString &name)
 
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<x<xmax).
 
TAxisGetXaxis () const
 Get x axis of the function.
 
virtual Double_t GetXmax () const
 
virtual Double_t GetXmin () const
 
TAxisGetYaxis () const
 Get y axis of the function.
 
TAxisGetZaxis () const
 Get z axis of the function. (In case this object is a TF2 or TF3)
 
virtual void GradientPar (const Double_t *x, Double_t *grad, Double_t eps=0.01)
 Compute the gradient wrt parameters If the TF1 object is based on a formula expression (TFormula) and TFormula::GenerateGradientPar() has been successfully called automatic differentiation using CLAD is used instead of the default numerical differentiation.
 
template<class T >
void GradientPar (const T *x, T *grad, Double_t eps=0.01)
 
virtual Double_t GradientPar (Int_t ipar, const Double_t *x, Double_t eps=0.01)
 Compute the gradient (derivative) wrt a parameter ipar.
 
template<class T >
GradientPar (Int_t ipar, const T *x, Double_t eps=0.01)
 
template<class T >
void GradientParTempl (const T *x, T *grad, Double_t eps=0.01)
 
template<class T >
GradientParTempl (Int_t ipar, const T *x, Double_t eps=0.01)
 
virtual void InitArgs (const Double_t *x, const Double_t *params)
 Initialize parameters addresses.
 
virtual Double_t IntegralError (Double_t a, Double_t b, const Double_t *params=nullptr, const Double_t *covmat=nullptr, Double_t epsilon=1.E-2)
 Return Error on Integral of a parametric function between a and b due to the parameter uncertainties and their covariance matrix from the fit.
 
virtual Double_t IntegralError (Int_t n, const Double_t *a, const Double_t *b, const Double_t *params=nullptr, const Double_t *covmat=nullptr, Double_t epsilon=1.E-2)
 Return Error on Integral of a parametric function with dimension larger than one between a[] and b[] due to the parameters uncertainties.
 
virtual Double_t IntegralFast (Int_t num, Double_t *x, Double_t *w, Double_t a, Double_t b, Double_t *params=nullptr, Double_t epsilon=1e-12)
 Gauss-Legendre integral, see CalcGaussLegendreSamplingPoints.
 
virtual Double_t IntegralMultiple (Int_t n, const Double_t *a, const Double_t *b, Double_t epsrel, Double_t &relerr)
 See more general prototype below.
 
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.
 
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 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 absolute tolerance.
 
virtual Bool_t IsEvalNormalized () const
 
virtual Bool_t IsLinear () const
 
virtual Bool_t IsValid () const
 Return kTRUE if the function is valid.
 
bool IsVectorized ()
 
virtual Double_t Mean (Double_t a, Double_t b, const Double_t *params=nullptr, Double_t epsilon=0.000001)
 
virtual Double_t Moment (Double_t n, Double_t a, Double_t b, const Double_t *params=nullptr, Double_t epsilon=0.000001)
 Return nth moment of function between a and b.
 
template<class T >
operator() (const T *x, const Double_t *params=nullptr)
 
virtual Double_t operator() (Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
 
TF1operator= (const TF1 &rhs)
 Operator =.
 
void Print (Option_t *option="") const override
 This method must be overridden when a class wants to print itself.
 
virtual void ReleaseParameter (Int_t ipar)
 Release parameter number ipar during a fit operation.
 
virtual void SetChisquare (Double_t chi2)
 
virtual void SetFitResult (const ROOT::Fit::FitResult &result, const Int_t *indpar=nullptr)
 Set the result from the fit parameter values, errors, chi2, etc... Optionally a pointer to a vector (with size fNpar) of the parameter indices in the FitResult can be passed This is useful in the case of a combined fit with different functions, and the FitResult contains the global result By default it is assume that indpar = {0,1,2,....,fNpar-1}.
 
template<typename Func >
void SetFunction (Func f)
 
template<class PtrObj , typename MemFn >
void SetFunction (PtrObj &p, MemFn memFn)
 
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 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.
 
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 free parameters.
 
virtual void SetNormalized (Bool_t flag)
 
virtual void SetNpx (Int_t npx=100)
 Set the number of points used to draw the function.
 
virtual void SetNumberFitPoints (Int_t npfits)
 
virtual void SetParameter (const TString &name, Double_t value)
 
virtual void SetParameter (Int_t param, Double_t value)
 
virtual void SetParameters (const Double_t *params)
 
virtual void SetParameters (double p0, double p1=0.0, double p2=0.0, double p3=0.0, double p4=0.0, double p5=0.0, double p6=0.0, double p7=0.0, double p8=0.0, double p9=0.0, double p10=0.0)
 
virtual void SetParent (TObject *p=nullptr)
 
virtual void SetParError (Int_t ipar, Double_t error)
 Set error for parameter number ipar.
 
virtual void SetParErrors (const Double_t *errors)
 Set errors for all active parameters when calling this function, the array errors must have at least fNpar values.
 
virtual void SetParLimits (Int_t ipar, Double_t parmin, Double_t parmax)
 Set lower and upper limits for parameter ipar.
 
virtual void SetParName (Int_t ipar, const char *name)
 Set name of parameter number ipar.
 
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 void SetSavedPoint (Int_t point, Double_t value)
 Restore value of function saved at point.
 
void SetTitle (const char *title="") override
 Set function title if title has the form "fffffff;xxxx;yyyy", it is assumed that the function title is "fffffff" and "xxxx" and "yyyy" are the titles for the X and Y axis respectively.
 
virtual void SetVectorized (Bool_t vectorized)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
virtual void Update ()
 Called by functions such as SetRange, SetNpx, SetParameters to force the deletion of the associated histogram or Integral.
 
virtual Double_t Variance (Double_t a, Double_t b, const Double_t *params=nullptr, Double_t epsilon=0.000001)
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 TNamed copy ctor.
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 TNamed destructor.
 
void Clear (Option_t *option="") override
 Set name and title to empty strings ("").
 
TObjectClone (const char *newname="") const override
 Make a clone of an object using the Streamer facility.
 
Int_t Compare (const TObject *obj) const override
 Compare two TNamed objects.
 
void Copy (TObject &named) const override
 Copy this to obj.
 
virtual void FillBuffer (char *&buffer)
 Encode TNamed into output buffer.
 
const char * GetName () const override
 Returns name of object.
 
const char * GetTitle () const override
 Returns title of object.
 
ULong_t Hash () const override
 Return hash value for this object.
 
TClassIsA () const override
 
Bool_t IsSortable () const override
 
void ls (Option_t *option="") const override
 List TNamed name and title.
 
TNamedoperator= (const TNamed &rhs)
 TNamed assignment operator.
 
void Print (Option_t *option="") const override
 Print TNamed name and title.
 
virtual void SetName (const char *name)
 Set the name of the TNamed.
 
virtual void SetNameTitle (const char *name, const char *title)
 Set all the TNamed parameters (name and title).
 
virtual Int_t Sizeof () const
 Return size of the TNamed part of the TObject.
 
void Streamer (TBuffer &) override
 Stream an object of class TObject.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor.
 
 TObject (const TObject &object)
 TObject copy ctor.
 
virtual ~TObject ()
 TObject destructor.
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract.
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad.
 
ULong_t CheckedHash ()
 Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object.
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs.
 
virtual void Delete (Option_t *option="")
 Delete this object.
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs.
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
 
virtual void Dump () const
 Dump contents of object on stdout.
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message.
 
virtual void Execute (const char *method, const char *params, Int_t *error=nullptr)
 Execute method on this object with the given parameter string, e.g.
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr)
 Execute method on this object with parameters stored in the TObjArray.
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message.
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes.
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes.
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object.
 
virtual const char * GetIconName () const
 Returns mime type name of object.
 
virtual Option_tGetOption () const
 
virtual UInt_t GetUniqueID () const
 Return the unique object id.
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out.
 
Bool_t HasInconsistentHash () const
 Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e.
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message.
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname".
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl.
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas.
 
void InvertBit (UInt_t f)
 
Bool_t IsDestructed () const
 IsDestructed.
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory).
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary).
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification (the base implementation is no-op).
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete.
 
void operator delete (void *ptr)
 Operator delete.
 
void operator delete (void *ptr, void *vp)
 Only called by placement new when throwing an exception.
 
void operator delete[] (void *ptr)
 Operator delete [].
 
void operator delete[] (void *ptr, void *vp)
 Only called by placement new[] when throwing an exception.
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *vp)
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator.
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list.
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory.
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list.
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename.
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f.
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object.
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message.
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked.
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message.
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory.
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory.
 
- Public Member Functions inherited from TAttLine
 TAttLine ()
 AttLine default constructor.
 
 TAttLine (Color_t lcolor, Style_t lstyle, Width_t lwidth)
 AttLine normal constructor.
 
virtual ~TAttLine ()
 AttLine destructor.
 
void Copy (TAttLine &attline) const
 Copy this line attributes to a new TAttLine.
 
Int_t DistancetoLine (Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2)
 Compute distance from point px,py to a line.
 
virtual Color_t GetLineColor () const
 Return the line color.
 
virtual Style_t GetLineStyle () const
 Return the line style.
 
virtual Width_t GetLineWidth () const
 Return the line width.
 
virtual void Modify ()
 Change current line attributes if necessary.
 
virtual void ResetAttLine (Option_t *option="")
 Reset this line attributes to default values.
 
virtual void SaveLineAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
 Save line attributes as C++ statement(s) on output stream out.
 
virtual void SetLineAttributes ()
 Invoke the DialogCanvas Line attributes.
 
virtual void SetLineColor (Color_t lcolor)
 Set the line color.
 
virtual void SetLineColorAlpha (Color_t lcolor, Float_t lalpha)
 Set a transparent line color.
 
virtual void SetLineStyle (Style_t lstyle)
 Set the line style.
 
virtual void SetLineWidth (Width_t lwidth)
 Set the line width.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- Public Member Functions inherited from TAttFill
 TAttFill ()
 AttFill default constructor.
 
 TAttFill (Color_t fcolor, Style_t fstyle)
 AttFill normal constructor.
 
virtual ~TAttFill ()
 AttFill destructor.
 
void Copy (TAttFill &attfill) const
 Copy this fill attributes to a new TAttFill.
 
virtual Color_t GetFillColor () const
 Return the fill area color.
 
virtual Style_t GetFillStyle () const
 Return the fill area style.
 
virtual Bool_t IsTransparent () const
 
virtual void Modify ()
 Change current fill area attributes if necessary.
 
virtual void ResetAttFill (Option_t *option="")
 Reset this fill attributes to default values.
 
virtual void SaveFillAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
 Save fill attributes as C++ statement(s) on output stream out.
 
virtual void SetFillAttributes ()
 Invoke the DialogCanvas Fill attributes.
 
virtual void SetFillColor (Color_t fcolor)
 Set the fill area color.
 
virtual void SetFillColorAlpha (Color_t fcolor, Float_t falpha)
 Set a transparent fill color.
 
virtual void SetFillStyle (Style_t fstyle)
 Set the fill area style.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- Public Member Functions inherited from TAttMarker
 TAttMarker ()
 TAttMarker default constructor.
 
 TAttMarker (Color_t color, Style_t style, Size_t msize)
 TAttMarker normal constructor.
 
virtual ~TAttMarker ()
 TAttMarker destructor.
 
void Copy (TAttMarker &attmarker) const
 Copy this marker attributes to a new TAttMarker.
 
virtual Color_t GetMarkerColor () const
 Return the marker color.
 
virtual Size_t GetMarkerSize () const
 Return the marker size.
 
virtual Style_t GetMarkerStyle () const
 Return the marker style.
 
virtual void Modify ()
 Change current marker attributes if necessary.
 
virtual void ResetAttMarker (Option_t *toption="")
 Reset this marker attributes to the default values.
 
virtual void SaveMarkerAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
 Save line attributes as C++ statement(s) on output stream out.
 
virtual void SetMarkerAttributes ()
 Invoke the DialogCanvas Marker attributes.
 
virtual void SetMarkerColor (Color_t mcolor=1)
 Set the marker color.
 
virtual void SetMarkerColorAlpha (Color_t mcolor, Float_t malpha)
 Set a transparent marker color.
 
virtual void SetMarkerSize (Size_t msize=1)
 Set the marker size.
 
virtual void SetMarkerStyle (Style_t mstyle=1)
 Set the marker style.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TF1
static void AbsValue (Bool_t reject=kTRUE)
 Static function: set the fgAbsValue flag.
 
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.
 
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Bool_t DefaultAddToGlobalList (Bool_t on=kTRUE)
 Static method to add/avoid to add automatically functions to the global list (gROOT->GetListOfFunctions() ) After having called this static method, all the functions created afterwards will follow the desired behaviour.
 
static Double_t DerivativeError ()
 Static function returning the error of the last call to the of Derivative's functions.
 
static TF1GetCurrent ()
 Static function returning the current function being processed.
 
static void InitStandardFunctions ()
 Create the basic function objects.
 
static Bool_t RejectedPoint ()
 See TF1::RejectPoint above.
 
static void RejectPoint (Bool_t reject=kTRUE)
 Static function to set the global flag to reject points the fgRejectPoint global flag is tested by all fit functions if TRUE the point is not included in the fit.
 
static void SetCurrent (TF1 *f1)
 Static function setting the current function.
 
- Static Public Member Functions inherited from TNamed
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TObject
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Longptr_t GetDtorOnly ()
 Return destructor only flag.
 
static Bool_t GetObjectStat ()
 Get status of object stat flag.
 
static void SetDtorOnly (void *obj)
 Set destructor only flag.
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable.
 
- Static Public Member Functions inherited from TAttLine
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TAttFill
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TAttMarker
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Width_t GetMarkerLineWidth (Style_t style)
 Internal helper function that returns the line width of the given marker style (0 = filled marker)
 
static Style_t GetMarkerStyleBase (Style_t style)
 Internal helper function that returns the corresponding marker style with line width 1 for the given style.
 

Protected Member Functions

virtual Double_t FindMinMax (Double_t *x, bool findmax) const
 Return minimum/maximum value of the function.
 
- Protected Member Functions inherited from TF1
 TF1 (EFType functionType, const char *name, Double_t xmin, Double_t xmax, Int_t npar, Int_t ndim, EAddToList addToGlobList, TF1Parameters *params=nullptr, TF1FunctorPointer *functor=nullptr)
 General constructor for TF1. Most of the other constructors delegate on it.
 
Bool_t ComputeCdfTable (Option_t *opt)
 Compute the cumulative function at fNpx points between fXmin and fXmax.
 
virtual TH1DoCreateHistogram (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 will be used to paint the function A re-creation is forced and a new histogram is done if recreate=true.
 
void DoInitialize (EAddToList addToGlobList)
 Common initialization of the TF1.
 
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.
 
void IntegrateForNormalization ()
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected).
 
void MakeZombie ()
 

Protected Attributes

TArrayD fContour
 Array to display contour levels.
 
Int_t fNpy
 Number of points along y used for the graphical representation.
 
Double_t fYmax
 Upper bound for the range in y.
 
Double_t fYmin
 Lower bound for the range in y.
 
- Protected Attributes inherited from TF1
std::vector< Double_tfAlpha
 ! Array alpha. for each bin in x the deconvolution r of fIntegral
 
std::vector< Double_tfBeta
 ! Array beta. is approximated by x = alpha +beta*r *gamma*r**2
 
Double_t fChisquare {}
 Function fit chisquare.
 
std::unique_ptr< TF1AbsCompositionfComposition
 Pointer to composition (NSUM or CONV)
 
std::unique_ptr< TFormulafFormula
 Pointer to TFormula in case when user define formula.
 
std::unique_ptr< TF1FunctorPointerfFunctor
 ! Functor object to wrap any C++ callable object
 
std::vector< Double_tfGamma
 ! Array gamma.
 
TH1fHistogram {nullptr}
 ! Pointer to histogram used for visualisation
 
std::vector< Double_tfIntegral
 ! Integral of function binned on fNpx bins
 
Double_t fMaximum {-1111}
 Maximum value for plotting.
 
std::unique_ptr< TMethodCallfMethodCall
 ! Pointer to MethodCall in case of interpreted function
 
Double_t fMinimum {-1111}
 Minimum value for plotting.
 
Int_t fNDF {}
 Number of degrees of freedom in the fit.
 
Int_t fNdim {}
 Function dimension.
 
Bool_t fNormalized {false}
 Normalization option (false by default)
 
Double_t fNormIntegral {}
 Integral of the function before being normalized.
 
Int_t fNpar {}
 Number of parameters.
 
Int_t fNpfits {}
 Number of points used in the fit.
 
Int_t fNpx {100}
 Number of points used for the graphical representation.
 
std::unique_ptr< TF1ParametersfParams
 Pointer to Function parameters object (exists only for not-formula functions)
 
TObjectfParent {nullptr}
 ! Parent object hooking this function (if one)
 
std::vector< Double_tfParErrors
 Array of errors of the fNpar parameters.
 
std::vector< Double_tfParMax
 Array of upper limits of the fNpar parameters.
 
std::vector< Double_tfParMin
 Array of lower limits of the fNpar parameters.
 
std::vector< Double_tfSave
 Array of fNsave function values.
 
EFType fType {EFType::kTemplScalar}
 
Double_t fXmax {-1111}
 Upper bounds for the range.
 
Double_t fXmin {-1111}
 Lower bounds for the range.
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 
- Protected Attributes inherited from TAttLine
Color_t fLineColor
 Line color.
 
Style_t fLineStyle
 Line style.
 
Width_t fLineWidth
 Line width.
 
- Protected Attributes inherited from TAttFill
Color_t fFillColor
 Fill area color.
 
Style_t fFillStyle
 Fill area style.
 
- Protected Attributes inherited from TAttMarker
Color_t fMarkerColor
 Marker color.
 
Size_t fMarkerSize
 Marker size.
 
Style_t fMarkerStyle
 Marker style.
 

Additional Inherited Members

- Public Types inherited from TF1
enum class  EAddToList { kDefault , kAdd , kNo }
 Add to list behavior. More...
 
enum  EStatusBits { kNotGlobal = (1ULL << ( 10 )) , kNotDraw = (1ULL << ( 9 )) }
 
- Public Types inherited from TObject
enum  {
  kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 ,
  kBitMask = 0x00ffffff
}
 
enum  { kSingleKey = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) }
 
enum  EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) }
 
enum  EStatusBits {
  kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) ,
  kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 ))
}
 
- Protected Types inherited from TF1
enum  EFType {
  kFormula = 0 , kPtrScalarFreeFcn , kInterpreted , kTemplVec ,
  kTemplScalar , kCompositionFcn
}
 
- Protected Types inherited from TObject
enum  { kOnlyPrepStep = (1ULL << ( 3 )) }
 
- Static Protected Attributes inherited from TF1
static std::atomic< Bool_tfgAbsValue
 
static std::atomic< Bool_tfgAddToGlobList
 
static TF1fgCurrent = nullptr
 
static Bool_t fgRejectPoint = kFALSE
 

#include <TF2.h>

Inheritance diagram for TF2:
[legend]

Constructor & Destructor Documentation

◆ TF2() [1/10]

TF2::TF2 ( )

TF2 default constructor.

Definition at line 83 of file TF2.cxx.

◆ TF2() [2/10]

TF2::TF2 ( const char *  name,
const char *  formula,
Double_t  xmin = 0,
Double_t  xmax = 1,
Double_t  ymin = 0,
Double_t  ymax = 1,
Option_t opt = nullptr 
)

F2 constructor using a formula definition.

See TFormula constructor for explanation of the formula syntax.

If formula has the form "fffffff;xxxx;yyyy", it is assumed that the formula string is "fffffff" and "xxxx" and "yyyy" are the titles for the X and Y axis respectively.

Definition at line 97 of file TF2.cxx.

◆ TF2() [3/10]

TF2::TF2 ( const char *  name,
Double_t(*)(Double_t *, Double_t *)  fcn,
Double_t  xmin = 0,
Double_t  xmax = 1,
Double_t  ymin = 0,
Double_t  ymax = 1,
Int_t  npar = 0,
Int_t  ndim = 2 
)

F2 constructor using a pointer to a compiled function.

npar is the number of free parameters used by the function

This constructor creates a function of type C when invoked with the normal C++ compiler.

WARNING! A function created with this constructor cannot be Cloned.

Definition at line 131 of file TF2.cxx.

◆ TF2() [4/10]

TF2::TF2 ( const char *  name,
Double_t(*)(const Double_t *, const Double_t *)  fcn,
Double_t  xmin = 0,
Double_t  xmax = 1,
Double_t  ymin = 0,
Double_t  ymax = 1,
Int_t  npar = 0,
Int_t  ndim = 2 
)

F2 constructor using a pointer to a compiled function.

npar is the number of free parameters used by the function

This constructor creates a function of type C when invoked with the normal C++ compiler.

WARNING! A function created with this constructor cannot be Cloned.

Definition at line 152 of file TF2.cxx.

◆ TF2() [5/10]

TF2::TF2 ( const char *  name,
ROOT::Math::ParamFunctor  f,
Double_t  xmin = 0,
Double_t  xmax = 1,
Double_t  ymin = 0,
Double_t  ymax = 1,
Int_t  npar = 0,
Int_t  ndim = 2 
)

F2 constructor using a ParamFunctor, a functor class implementing operator() (double *, double *)

npar is the number of free parameters used by the function

WARNING! A function created with this constructor cannot be Cloned.

Definition at line 171 of file TF2.cxx.

◆ TF2() [6/10]

template<class PtrObj , typename MemFn >
TF2::TF2 ( const char *  name,
const PtrObj &  p,
MemFn  memFn,
Double_t  xmin,
Double_t  xmax,
Double_t  ymin,
Double_t  ymax,
Int_t  npar,
Int_t  ndim = 2 
)
inline

Template constructors from a pointer to any C++ class of type PtrObj with a specific member function of type MemFn.

Definition at line 50 of file TF2.h.

◆ TF2() [7/10]

template<class PtrObj , typename MemFn >
TF2::TF2 ( const char *  name,
const PtrObj &  p,
MemFn  memFn,
Double_t  xmin,
Double_t  xmax,
Double_t  ymin,
Double_t  ymax,
Int_t  npar,
const char *  ,
const char *   
)
inline

Backward compatible ctor.

Definition at line 59 of file TF2.h.

◆ TF2() [8/10]

template<typename Func >
TF2::TF2 ( const char *  name,
Func  f,
Double_t  xmin,
Double_t  xmax,
Double_t  ymin,
Double_t  ymax,
Int_t  npar,
Int_t  ndim = 2 
)
inline

Template constructors from any C++ callable object, defining the operator() (double * , double *) and returning a double.

Definition at line 68 of file TF2.h.

◆ TF2() [9/10]

template<typename Func >
TF2::TF2 ( const char *  name,
Func  f,
Double_t  xmin,
Double_t  xmax,
Double_t  ymin,
Double_t  ymax,
Int_t  npar,
const char *   
)
inline

Backward compatible ctor.

Definition at line 77 of file TF2.h.

◆ TF2() [10/10]

TF2::TF2 ( const TF2 f2)

Copy constructor.

Definition at line 202 of file TF2.cxx.

◆ ~TF2()

TF2::~TF2 ( )
override

F2 default destructor.

Definition at line 195 of file TF2.cxx.

Member Function Documentation

◆ CentralMoment2()

Double_t TF2::CentralMoment2 ( Double_t  nx,
Double_t  ax,
Double_t  bx,
Double_t  ny,
Double_t  ay,
Double_t  by,
Double_t  epsilon = 0.000001 
)
virtual

Return x^nx * y^ny central moment of a 2d function in range [ax,bx],[ay,by].

Author
Gene Van Buren gene@.nosp@m.bnl..nosp@m.gov

Definition at line 1028 of file TF2.cxx.

◆ Class()

static TClass * TF2::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TF2::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TF2::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 145 of file TF2.h.

◆ Copy()

void TF2::Copy ( TObject f2) const
overridevirtual

Copy this F2 to a new F2.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 210 of file TF2.cxx.

◆ Covariance2XY()

virtual Double_t TF2::Covariance2XY ( Double_t  ax,
Double_t  bx,
Double_t  ay,
Double_t  by,
Double_t  epsilon = 0.000001 
)
inlinevirtual

Definition at line 139 of file TF2.h.

◆ CreateHistogram()

TH1 * TF2::CreateHistogram ( )
overridevirtual

Create a histogram from function.

always created it, even if it is already existing

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 697 of file TF2.cxx.

◆ DeclFileName()

static const char * TF2::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 145 of file TF2.h.

◆ DistancetoPrimitive()

Int_t TF2::DistancetoPrimitive ( Int_t  px,
Int_t  py 
)
overridevirtual

Compute distance from point px,py to a function.

Parameters
[in]pxx position
[in]pyy position

Compute the closest distance of approach from point px,py to this function. The distance is computed in pixels units.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 228 of file TF2.cxx.

◆ Draw()

void TF2::Draw ( Option_t option = "")
overridevirtual

Draw this function with its current attributes.

NB. You must use DrawCopy if you want to draw several times the same function in the current canvas.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 259 of file TF2.cxx.

◆ DrawCopy()

TF1 * TF2::DrawCopy ( Option_t option = "") const
overridevirtual

Draw a copy of this function with its current attributes-*.

This function MUST be used instead of Draw when you want to draw the same function with different parameters settings in the same canvas.

Possible option values are:

option description
"SAME" superimpose on top of existing picture
"L" connect all computed points with a straight line
"C" connect all computed points with a smooth curve.

Note that the default value is "F". Therefore to draw on top of an existing picture, specify option "SL"

Reimplemented from TF1.

Definition at line 286 of file TF2.cxx.

◆ DrawDerivative()

TObject * TF2::DrawDerivative ( Option_t option = "al")
inlineoverridevirtual

Draw derivative of this function.

An intermediate TGraph object is built and drawn with option. The function returns a pointer to the TGraph object. Do:

TGraph *g = (TGraph*)myfunc.DrawDerivative(option);

The resulting graph will be drawn into the current pad. If this function is used via the context menu, it recommended to create a new canvas/pad before invoking this function.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 92 of file TF2.h.

◆ DrawIntegral()

TObject * TF2::DrawIntegral ( Option_t option = "al")
inlineoverridevirtual

Draw integral of this function.

An intermediate TGraph object is built and drawn with option. The function returns a pointer to the TGraph object. Do:

TGraph *g = (TGraph*)myfunc.DrawIntegral(option);

The resulting graph will be drawn into the current pad. If this function is used via the context menu, it recommended to create a new canvas/pad before invoking this function.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 93 of file TF2.h.

◆ ExecuteEvent()

void TF2::ExecuteEvent ( Int_t  event,
Int_t  px,
Int_t  py 
)
overridevirtual

Execute action corresponding to one event.

This member function is called when a F2 is clicked with the locator

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 316 of file TF2.cxx.

◆ FindMinMax()

Double_t TF2::FindMinMax ( Double_t x,
bool  findmax 
) const
protectedvirtual

Return minimum/maximum value of the function.

To find the minimum on a range, first set this range via the SetRange function. If a vector x of coordinate is passed it will be used as starting point for the minimum. In addition on exit x will contain the coordinate values at the minimuma

If x is NULL or x is infinity or NaN, first, a grid search is performed to find the initial estimate of the minimum location. The range of the function is divided into fNpx and fNpy sub-ranges. If the function is "good" (or "bad"), these values can be changed by SetNpx and SetNpy functions

Then, a minimization is used with starting values found by the grid search The minimizer algorithm used (by default Minuit) can be changed by callinga ROOT::Math::Minimizer::SetDefaultMinimizerType("..") Other option for the minimizer can be set using the static method of the MinimizerOptions class

Reimplemented in TF3.

Definition at line 363 of file TF2.cxx.

◆ GetContour()

Int_t TF2::GetContour ( Double_t levels = nullptr)
virtual

Return contour values into array levels.

The number of contour levels can be returned by getContourLevel

Definition at line 326 of file TF2.cxx.

◆ GetContourLevel()

Double_t TF2::GetContourLevel ( Int_t  level) const
virtual

Return the number of contour levels.

Definition at line 338 of file TF2.cxx.

◆ GetMaximum() [1/2]

Double_t TF2::GetMaximum ( Double_t x) const
virtual

Return maximum value of the function See TF2::GetMinimum.

Definition at line 474 of file TF2.cxx.

◆ GetMaximum() [2/2]

Double_t TF1::GetMaximum ( Double_t  xmin = 0,
Double_t  xmax = 0,
Double_t  epsilon = 1.E-10,
Int_t  maxiter = 100,
Bool_t  logx = false 
) const
virtual

Returns the maximum value of the function.

Method: First, the grid search is used to bracket the maximum with the step size = (xmax-xmin)/fNpx. This way, the step size can be controlled via the SetNpx() function. If the function is unimodal or if its extrema are far apart, setting the fNpx to a small value speeds the algorithm up many times. Then, Brent's method is applied on the bracketed interval epsilon (default = 1.E-10) controls the relative accuracy (if |x| > 1 ) and absolute (if |x| < 1) and maxiter (default = 100) controls the maximum number of iteration of the Brent algorithm If the flag logx is set the grid search is done in log step size This is done automatically if the log scale is set in the current Pad

NOTE: see also TF1::GetMaximumX and TF1::GetX

Reimplemented from TF1.

Definition at line 475 of file TF1.cxx.

◆ GetMaximumXY()

Double_t TF2::GetMaximumXY ( Double_t x,
Double_t y 
) const
virtual

Compute the X and Y values corresponding to the maximum value of the function.

Return the maximum value of the function See TF2::GetMinimumXY

Definition at line 440 of file TF2.cxx.

◆ GetMinimum() [1/2]

Double_t TF2::GetMinimum ( Double_t x) const
virtual

Return minimum/maximum value of the function.

To find the minimum on a range, first set this range via the SetRange function If a vector x of coordinate is passed it will be used as starting point for the minimum. In addition on exit x will contain the coordinate values at the minimuma If x is NULL or x is infinity or NaN, first, a grid search is performed to find the initial estimate of the minimum location. The range of the function is divided into fNpx and fNpy sub-ranges. If the function is "good" (or "bad"), these values can be changed by SetNpx and SetNpy functions Then, a minimization is used with starting values found by the grid search The minimizer algorithm used (by default Minuit) can be changed by callinga ROOT::Math::Minimizer::SetDefaultMinimizerType("..") Other option for the minimizer can be set using the static method of the MinimizerOptions class

Definition at line 465 of file TF2.cxx.

◆ GetMinimum() [2/2]

Double_t TF1::GetMinimum ( Double_t  xmin = 0,
Double_t  xmax = 0,
Double_t  epsilon = 1.E-10,
Int_t  maxiter = 100,
Bool_t  logx = false 
) const
virtual

Returns the minimum value of the function on the (xmin, xmax) interval.

Method: First, the grid search is used to bracket the maximum with the step size = (xmax-xmin)/fNpx. This way, the step size can be controlled via the SetNpx() function. If the function is unimodal or if its extrema are far apart, setting the fNpx to a small value speeds the algorithm up many times. Then, Brent's method is applied on the bracketed interval epsilon (default = 1.E-10) controls the relative accuracy (if |x| > 1 ) and absolute (if |x| < 1) and maxiter (default = 100) controls the maximum number of iteration of the Brent algorithm If the flag logx is set the grid search is done in log step size This is done automatically if the log scale is set in the current Pad

NOTE: see also TF1::GetMaximumX and TF1::GetX

Reimplemented from TF1.

Definition at line 476 of file TF1.cxx.

◆ GetMinimumXY()

Double_t TF2::GetMinimumXY ( Double_t x,
Double_t y 
) const
virtual

Compute the X and Y values corresponding to the minimum value of the function.

Return the minimum value of the function To find the minimum on a range, first set this range via the SetRange function

Method: First, a grid search is performed to find the initial estimate of the minimum location. The range of the function is divided into fNpx and fNpy sub-ranges. If the function is "good" (or "bad"), these values can be changed by SetNpx and SetNpy functions Then, a minimization is used with starting values found by the grid search The minimizer algorithm used (by default Minuit) can be changed by callinga ROOT::Math::Minimizer::SetDefaultMinimizerType("..") Other option for the minimizer can be set using the static method of the MinimizerOptions class

Note that this method will always do first a grid search in contrast to GetMinimum

Definition at line 425 of file TF2.cxx.

◆ GetNpy()

Int_t TF2::GetNpy ( ) const
inline

Definition at line 98 of file TF2.h.

◆ GetObjectInfo()

char * TF2::GetObjectInfo ( Int_t  px,
Int_t  py 
) const
overridevirtual

Redefines TObject::GetObjectInfo.

Displays the function value corresponding to cursor position px,py

Reimplemented from TF1.

Definition at line 486 of file TF2.cxx.

◆ GetRandom() [1/2]

Double_t TF2::GetRandom ( Double_t  xmin,
Double_t  xmax,
TRandom rng = nullptr,
Option_t opt = nullptr 
)
overridevirtual

Return a random number following this function shape.

Reimplemented from TF1.

Definition at line 522 of file TF2.cxx.

◆ GetRandom() [2/2]

Double_t TF2::GetRandom ( TRandom rng = nullptr,
Option_t opt = nullptr 
)
overridevirtual

Return a random number following this function shape.

Reimplemented from TF1.

Definition at line 512 of file TF2.cxx.

◆ GetRandom2()

void TF2::GetRandom2 ( Double_t xrandom,
Double_t yrandom,
TRandom rng = nullptr 
)
virtual

Return 2 random numbers following this function shape.

The distribution contained in this TF2 function is integrated over the cell contents. It is normalized to 1. Getting the two random numbers implies:

  • Generating a random number between 0 and 1 (say r1)
  • Look in which cell in the normalized integral r1 corresponds to
  • make a linear interpolation in the returned cell

IMPORTANT NOTE

The integral of the function is computed at fNpx * fNpy points. If the function has sharp peaks, you should increase the number of points (SetNpx, SetNpy) such that the peak is correctly tabulated at several points.

Definition at line 547 of file TF2.cxx.

◆ GetRange() [1/6]

void TF1::GetRange ( Double_t xmin,
Double_t xmax 
) const
virtual

Return range of a 1-D function.

Reimplemented from TF1.

Reimplemented in TF3, and TF3.

Definition at line 553 of file TF1.cxx.

◆ GetRange() [2/6]

void TF1::GetRange ( Double_t xmin,
Double_t ymin,
Double_t xmax,
Double_t ymax 
) const
virtual

Return range of a 2-D function.

Reimplemented from TF1.

Reimplemented in TF3, and TF3.

Definition at line 554 of file TF1.cxx.

◆ GetRange() [3/6]

void TF2::GetRange ( Double_t xmin,
Double_t ymin,
Double_t xmax,
Double_t ymax 
) const
overridevirtual

Return range of a 2-D function.

Reimplemented from TF1.

Reimplemented in TF3, and TF3.

Definition at line 598 of file TF2.cxx.

◆ GetRange() [4/6]

void TF1::GetRange ( Double_t xmin,
Double_t ymin,
Double_t zmin,
Double_t xmax,
Double_t ymax,
Double_t zmax 
) const
virtual

Return range of function.

Reimplemented from TF1.

Reimplemented in TF3, and TF3.

Definition at line 555 of file TF1.cxx.

◆ GetRange() [5/6]

void TF2::GetRange ( Double_t xmin,
Double_t ymin,
Double_t zmin,
Double_t xmax,
Double_t ymax,
Double_t zmax 
) const
overridevirtual

Return range of function.

Reimplemented from TF1.

Reimplemented in TF3, and TF3.

Definition at line 609 of file TF2.cxx.

◆ GetRange() [6/6]

void TF1::GetRange ( Double_t xmin,
Double_t xmax 
) const
virtual

Return range of a generic N-D function.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 319 of file TF1.cxx.

◆ GetSave()

Double_t TF2::GetSave ( const Double_t x)
overridevirtual

Get value corresponding to X in array of fSave values.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 623 of file TF2.cxx.

◆ GetYmax()

virtual Double_t TF2::GetYmax ( ) const
inlinevirtual

Definition at line 114 of file TF2.h.

◆ GetYmin()

virtual Double_t TF2::GetYmin ( ) const
inlinevirtual

Definition at line 113 of file TF2.h.

◆ Integral() [1/2]

Double_t TF1::Integral ( Double_t  a,
Double_t  b,
Double_t  epsrel = 1.e-12 
)
virtual

IntegralOneDim or analytical integral.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 587 of file TF1.cxx.

◆ Integral() [2/2]

Double_t TF2::Integral ( Double_t  ax,
Double_t  bx,
Double_t  ay,
Double_t  by,
Double_t  epsrel = 1.e-6 
)
virtual

Return Integral of a 2d function in range [ax,bx],[ay,by] with desired relative accuracy (defined by eps)

Reimplemented in TF3.

Definition at line 661 of file TF2.cxx.

◆ IsA()

TClass * TF2::IsA ( ) const
inlineoverridevirtual
Returns
TClass describing current object

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 145 of file TF2.h.

◆ IsInside()

Bool_t TF2::IsInside ( const Double_t x) const
overridevirtual

Return kTRUE is the point is inside the function range.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 685 of file TF2.cxx.

◆ Mean2X()

virtual Double_t TF2::Mean2X ( Double_t  ax,
Double_t  bx,
Double_t  ay,
Double_t  by,
Double_t  epsilon = 0.000001 
)
inlinevirtual

Definition at line 133 of file TF2.h.

◆ Mean2Y()

virtual Double_t TF2::Mean2Y ( Double_t  ax,
Double_t  bx,
Double_t  ay,
Double_t  by,
Double_t  epsilon = 0.000001 
)
inlinevirtual

Definition at line 134 of file TF2.h.

◆ Moment2()

Double_t TF2::Moment2 ( Double_t  nx,
Double_t  ax,
Double_t  bx,
Double_t  ny,
Double_t  ay,
Double_t  by,
Double_t  epsilon = 0.000001 
)
virtual

Return x^nx * y^ny moment of a 2d function in range [ax,bx],[ay,by].

Author
Gene Van Buren gene@.nosp@m.bnl..nosp@m.gov

Definition at line 1004 of file TF2.cxx.

◆ operator=()

TF2 & TF2::operator= ( const TF2 rhs)

Operator =.

Definition at line 185 of file TF2.cxx.

◆ Paint()

void TF2::Paint ( Option_t option = "")
overridevirtual

Paint this 2-D function with its current attributes.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 742 of file TF2.cxx.

◆ Save()

void TF2::Save ( Double_t  xmin,
Double_t  xmax,
Double_t  ymin,
Double_t  ymax,
Double_t  zmin,
Double_t  zmax 
)
overridevirtual

Save values of function in array fSave.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 796 of file TF2.cxx.

◆ SavePrimitive()

void TF2::SavePrimitive ( std::ostream &  out,
Option_t option = "" 
)
overridevirtual

Save primitive as a C++ statement(s) on output stream out.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 841 of file TF2.cxx.

◆ SetContour()

void TF2::SetContour ( Int_t  nlevels = 20,
const Double_t levels = nullptr 
)
virtual

Set the number and values of contour levels.

By default the number of contour levels is set to 20.

if argument levels = 0 or missing, equidistant contours are computed

Definition at line 892 of file TF2.cxx.

◆ SetContourLevel()

void TF2::SetContourLevel ( Int_t  level,
Double_t  value 
)
virtual

Set value for one contour level.

Definition at line 913 of file TF2.cxx.

◆ SetNpy()

void TF2::SetNpy ( Int_t  npy = 100)
virtual

Set the number of points used to draw the function.

The default number of points along x is 30 for 2-d/3-d functions. You can increase this value to get a better resolution when drawing pictures with sharp peaks or to get a better result when using TF2::GetRandom2 the minimum number of points is 4, the maximum is 10000 for 2-d/3-d functions

Definition at line 927 of file TF2.cxx.

◆ SetRange() [1/3]

void TF2::SetRange ( Double_t  xmin,
Double_t  xmax 
)
inlineoverridevirtual

Initialize the upper and lower bounds to draw the function.

The function range is also used in an histogram fit operation when the option "R" is specified.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 148 of file TF2.h.

◆ SetRange() [2/3]

void TF2::SetRange ( Double_t  xmin,
Double_t  ymin,
Double_t  xmax,
Double_t  ymax 
)
overridevirtual

Initialize the upper and lower bounds to draw the function-.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 944 of file TF2.cxx.

◆ SetRange() [3/3]

void TF2::SetRange ( Double_t  xmin,
Double_t  ymin,
Double_t  zmin,
Double_t  xmax,
Double_t  ymax,
Double_t  zmax 
)
inlineoverridevirtual

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 150 of file TF2.h.

◆ Streamer()

void TF2::Streamer ( TBuffer R__b)
overridevirtual

Stream an object of class TF2.

Reimplemented from TF1.

Reimplemented in TF3.

Definition at line 956 of file TF2.cxx.

◆ StreamerNVirtual()

void TF2::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 145 of file TF2.h.

◆ Variance2X()

virtual Double_t TF2::Variance2X ( Double_t  ax,
Double_t  bx,
Double_t  ay,
Double_t  by,
Double_t  epsilon = 0.000001 
)
inlinevirtual

Definition at line 136 of file TF2.h.

◆ Variance2Y()

virtual Double_t TF2::Variance2Y ( Double_t  ax,
Double_t  bx,
Double_t  ay,
Double_t  by,
Double_t  epsilon = 0.000001 
)
inlinevirtual

Definition at line 137 of file TF2.h.

Member Data Documentation

◆ fContour

TArrayD TF2::fContour
protected

Array to display contour levels.

Definition at line 35 of file TF2.h.

◆ fNpy

Int_t TF2::fNpy
protected

Number of points along y used for the graphical representation.

Definition at line 34 of file TF2.h.

◆ fYmax

Double_t TF2::fYmax
protected

Upper bound for the range in y.

Definition at line 33 of file TF2.h.

◆ fYmin

Double_t TF2::fYmin
protected

Lower bound for the range in y.

Definition at line 32 of file TF2.h.

Libraries for TF2:

The documentation for this class was generated from the following files: