![]() |
ROOT
6.07/01
Reference Guide
|
1-Dim function class
A TF1 object is a 1-Dim function defined between a lower and upper limit. The function may be a simple function based on a TFormula expression or a precompiled user function. The function may have associated parameters. TF1 graphics function is via the TH1 and TGraph drawing functions.
The following types of functions can be created:
Example a:
This creates a function of variable x with 2 parameters. The parameters must be initialized via:
Parameters may be given a name:
Example b:
gaus(0)
is a substitute for [0]*exp(-0.5*((x-[1])/[2])**2)
and (0)
means start numbering parameters at 0
. expo(3)
is a substitute for exp([3]+[4]*x)
.
TF1 now supports using lambda expressions in the formula. This allows, by using a full C++ syntax the full power of lambda functions and still mantain the capability of storing the function in a file which cannot be done with funciton pointer or lambda written not as expression, but as code (see items belows).
Example on how using lambda to define a sum of two functions. Note that is necessary to provide the number of parameters
Consider the macro myfunc.C below:
In an interactive session you can do:
TF1 objects can reference other TF1 objects of type A or B defined above. This excludes CLing or compiled functions. However, there is a restriction. A function cannot reference a basic function if the basic function is a polynomial polN.
Example:
A TF1 can be created from any C++ class implementing the operator()(double *x, double *p). The advantage of the function object is that he can have a state and reference therefore what-ever other object. In this way the user can customize his function.
Example:
From C++11 we can use both std::function or even better lambda functions to create the TF1. As above the lambda must have the right signature but can capture whatever we want. For example we can make a TF1 from the TGraph::Eval function as shown below where we use a sfunction parameter the graph normalization.
A TF1 can be created in this case from any member function of a class which has the signature of (double * , double *) and returning a double.
Example:
See also the tutorial math/exampleFunctor.C for a running example.
Public Types | |
enum | { kNotDraw = BIT(9) } |
![]() | |
enum | EStatusBits { kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13) } |
enum | { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) } |
Public Member Functions | |
TF1 () | |
TF1 default constructor. More... | |
TF1 (const char *name, const char *formula, Double_t xmin=0, Double_t xmax=1) | |
F1 constructor using a formula definition. More... | |
TF1 (const char *name, Double_t xmin, Double_t xmax, Int_t npar, Int_t ndim=1) | |
F1 constructor using name of an interpreted function. More... | |
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) | |
Constructor using a pointer to a real function. More... | |
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) | |
Constructor using a pointer to real function. More... | |
TF1 (const char *name, ROOT::Math::ParamFunctor f, Double_t xmin=0, Double_t xmax=1, Int_t npar=0, Int_t ndim=1) | |
Constructor using the Functor class. More... | |
template<typename Func > | |
TF1 (const char *name, Func f, Double_t xmin, Double_t xmax, Int_t npar, Int_t ndim=1) | |
ctor implementation More... | |
template<typename Func > | |
TF1 (const char *name, Func f, Double_t xmin, Double_t xmax, Int_t npar, const char *) | |
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) | |
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 *) | |
TF1 (const TF1 &f1) | |
TF1 & | operator= (const TF1 &rhs) |
Operator =. More... | |
virtual | ~TF1 () |
TF1 default destructor. More... | |
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 of functions was already in the list false if not) More... | |
virtual void | Browse (TBrowser *b) |
Browse. More... | |
virtual void | Copy (TObject &f1) const |
Copy this F1 to a new F1. More... | |
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 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
\[ D(h) = \frac{f(x+h) - f(x-h)}{2h} \] the final estimate \[ D = \frac{4D(h/2) - D(h)}{3} \] "Numerical Methods for Scientists and Engineers", H.M.Antia, 2nd edition". More... | |
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 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
\[ D(h) = \frac{f(x+h) - 2f(x) + f(x-h)}{h^{2}} \] the final estimate \[ D = \frac{4D(h/2) - D(h)}{3} \] "Numerical Methods for Scientists and Engineers", H.M.Antia, 2nd edition". More... | |
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 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
\[ D(h) = \frac{f(x+2h) - 2f(x+h) + 2f(x-h) - f(x-2h)}{2h^{3}} \] the final estimate \[ D = \frac{4D(h/2) - D(h)}{3} \] "Numerical Methods for Scientists and Engineers", H.M.Antia, 2nd edition". More... | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Compute distance from point px,py to a function. More... | |
virtual void | Draw (Option_t *option="") |
Draw this function with its current attributes. More... | |
virtual TF1 * | DrawCopy (Option_t *option="") const |
Draw a copy of this function with its current attributes. More... | |
virtual TObject * | DrawDerivative (Option_t *option="al") |
Draw derivative of this function. More... | |
virtual TObject * | DrawIntegral (Option_t *option="al") |
Draw integral of this function. More... | |
virtual void | DrawF1 (Double_t xmin, Double_t xmax, Option_t *option="") |
Draw function between xmin and xmax. More... | |
virtual Double_t | Eval (Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const |
Evaluate this function. More... | |
virtual Double_t | EvalPar (const Double_t *x, const Double_t *params=0) |
Evaluate function with given coordinates and parameters. More... | |
virtual Double_t | operator() (Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const |
virtual Double_t | operator() (const Double_t *x, const Double_t *params=0) |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to one event. More... | |
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. More... | |
Double_t | GetChisquare () const |
virtual TH1 * | GetHistogram () const |
Return a pointer to the histogram used to vusualize the function. More... | |
virtual TH1 * | CreateHistogram () |
virtual TFormula * | GetFormula () |
virtual const TFormula * | GetFormula () const |
virtual TString | GetExpFormula (Option_t *option="") const |
virtual const TObject * | GetLinearPart (Int_t i) const |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
virtual Double_t | GetMaximumStored () const |
virtual Double_t | GetMinimumStored () const |
virtual Int_t | GetNpar () const |
virtual Int_t | GetNdim () const |
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. More... | |
virtual Int_t | GetNpx () const |
TMethodCall * | GetMethodCall () const |
virtual Int_t | GetNumber () const |
virtual Int_t | GetNumberFreeParameters () const |
Return the number of free parameters. More... | |
virtual Int_t | GetNumberFitPoints () const |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Redefines TObject::GetObjectInfo. More... | |
TObject * | GetParent () const |
virtual Double_t | GetParameter (Int_t ipar) const |
virtual Double_t | GetParameter (const TString &name) const |
virtual Double_t * | GetParameters () const |
virtual void | GetParameters (Double_t *params) |
virtual const char * | GetParName (Int_t ipar) const |
virtual Int_t | GetParNumber (const char *name) const |
virtual Double_t | GetParError (Int_t ipar) const |
Return value of parameter number ipar. More... | |
virtual const Double_t * | GetParErrors () const |
virtual void | GetParLimits (Int_t ipar, Double_t &parmin, Double_t &parmax) const |
Return limits for parameter ipar. More... | |
virtual Double_t | GetProb () const |
Return the fit probability. More... | |
virtual Int_t | GetQuantiles (Int_t nprobSum, Double_t *q, const Double_t *probSum) |
Compute Quantiles for density distribution of this function. More... | |
virtual Double_t | GetRandom () |
Return a random number following this function shape. More... | |
virtual Double_t | GetRandom (Double_t xmin, Double_t xmax) |
Return a random number following this function shape in [xmin,xmax]. More... | |
virtual void | GetRange (Double_t &xmin, Double_t &xmax) const |
Return range of a 1-D function. More... | |
virtual void | GetRange (Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const |
Return range of a 2-D function. More... | |
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. More... | |
virtual Double_t | GetSave (const Double_t *x) |
Get value corresponding to X in array of fSave values. More... | |
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). More... | |
virtual Double_t | GetXmin () const |
virtual Double_t | GetXmax () const |
TAxis * | GetXaxis () const |
Get x axis of the function. More... | |
TAxis * | GetYaxis () const |
Get y axis of the function. More... | |
TAxis * | GetZaxis () const |
Get z axis of the function. (In case this object is a TF2 or TF3) More... | |
virtual Double_t | GetVariable (const TString &name) |
virtual Double_t | GradientPar (Int_t ipar, const Double_t *x, Double_t eps=0.01) |
Compute the gradient (derivative) wrt a parameter ipar. More... | |
virtual void | GradientPar (const Double_t *x, Double_t *grad, Double_t eps=0.01) |
Compute the gradient wrt parameters. More... | |
virtual void | InitArgs (const Double_t *x, const Double_t *params) |
Initialize parameters addresses. More... | |
virtual Double_t | Integral (Double_t a, Double_t b, Double_t epsrel=1.e-12) |
IntegralOneDim or analytical integral. More... | |
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. More... | |
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. More... | |
virtual Double_t | IntegralError (Int_t n, const Double_t *a, const 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 with dimension larger tan one between a[] and b[] due to the parameters uncertainties. More... | |
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. More... | |
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. More... | |
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 | IntegralMultiple (Int_t n, const Double_t *a, const Double_t *b, Double_t epsrel, Double_t &relerr) |
See more general prototype below. More... | |
virtual Bool_t | IsEvalNormalized () const |
virtual Bool_t | IsInside (const Double_t *x) const |
return kTRUE if the point is inside the function range More... | |
virtual Bool_t | IsLinear () const |
virtual Bool_t | IsValid () const |
Return kTRUE if the function is valid. More... | |
virtual void | Print (Option_t *option="") const |
Print TNamed name and title. More... | |
virtual void | Paint (Option_t *option="") |
Paint this function with its current attributes. More... | |
virtual void | ReleaseParameter (Int_t ipar) |
Release parameter number ipar If used in a fit, the parameter can vary freely. More... | |
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. More... | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save primitive as a C++ statement(s) on output stream out. More... | |
virtual void | SetChisquare (Double_t chi2) |
virtual void | SetFitResult (const ROOT::Fit::FitResult &result, const Int_t *indpar=0) |
Set the result from the fit parameter values, errors, chi2, etc... More... | |
template<class PtrObj , typename MemFn > | |
void | SetFunction (PtrObj &p, MemFn memFn) |
template<typename Func > | |
void | SetFunction (Func f) |
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. More... | |
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. More... | |
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. More... | |
virtual void | SetNumberFitPoints (Int_t npfits) |
virtual void | SetNormalized (Bool_t flag) |
virtual void | SetNpx (Int_t npx=100) |
Set the number of points used to draw the function. More... | |
virtual void | SetParameter (Int_t param, Double_t value) |
virtual void | SetParameter (const TString &name, Double_t value) |
virtual void | SetParameters (const Double_t *params) |
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 void | SetParName (Int_t ipar, const char *name) |
Set name of parameter number ipar. More... | |
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. More... | |
virtual void | SetParError (Int_t ipar, Double_t error) |
Set error for parameter number ipar. More... | |
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. More... | |
virtual void | SetParLimits (Int_t ipar, Double_t parmin, Double_t parmax) |
Set limits for parameter ipar. More... | |
virtual void | SetParent (TObject *p=0) |
virtual void | SetRange (Double_t xmin, Double_t xmax) |
Initialize the upper and lower bounds to draw the function. More... | |
virtual void | SetRange (Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax) |
virtual void | SetRange (Double_t xmin, Double_t ymin, Double_t zmin, Double_t xmax, Double_t ymax, Double_t zmax) |
virtual void | SetSavedPoint (Int_t point, Double_t value) |
Restore value of function saved at point. More... | |
virtual void | SetTitle (const char *title="") |
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. More... | |
virtual void | Update () |
Called by functions such as SetRange, SetNpx, SetParameters to force the deletion of the associated histogram or Integral. More... | |
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. More... | |
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) More... | |
virtual Double_t | Mean (Double_t a, Double_t b, const Double_t *params=0, Double_t epsilon=0.000001) |
virtual Double_t | Variance (Double_t a, Double_t b, const Double_t *params=0, Double_t epsilon=0.000001) |
![]() | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TString &name, const TString &title) | |
TNamed (const TNamed &named) | |
TNamed & | operator= (const TNamed &rhs) |
TNamed assignment operator. More... | |
virtual | ~TNamed () |
virtual void | Clear (Option_t *option="") |
Set name and title to empty strings (""). More... | |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare two TNamed objects. More... | |
virtual void | FillBuffer (char *&buffer) |
Encode TNamed into output buffer. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
virtual Bool_t | IsSortable () const |
virtual void | SetName (const char *name) |
Change (i.e. More... | |
virtual void | SetNameTitle (const char *name, const char *title) |
Change (i.e. set) all the TNamed parameters (name and title). More... | |
virtual void | ls (Option_t *option="") const |
List TNamed name and title. More... | |
virtual Int_t | Sizeof () const |
Return size of the TNamed part of the TObject. More... | |
![]() | |
TObject () | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual | ~TObject () |
TObject destructor. More... | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. More... | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. More... | |
virtual void | Delete (Option_t *option="") |
Delete this object. More... | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. More... | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current pad. More... | |
virtual void | Dump () const |
Dump contents of object on stdout. More... | |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
Execute method on this object with the given parameter string, e.g. More... | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. More... | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. More... | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. More... | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. More... | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual Option_t * | GetOption () const |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. More... | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". More... | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. More... | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. More... | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). More... | |
Bool_t | IsOnHeap () const |
Bool_t | IsZombie () const |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. More... | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. More... | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. More... | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. More... | |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. More... | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. More... | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. More... | |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. More... | |
void * | operator new (size_t sz) |
void * | operator new[] (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz, void *vp) |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. More... | |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. More... | |
void | SetBit (UInt_t f) |
void | ResetBit (UInt_t f) |
Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
void | InvertBit (UInt_t f) |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. More... | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More... | |
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). More... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
![]() | |
TAttLine () | |
AttLine default constructor. More... | |
TAttLine (Color_t lcolor, Style_t lstyle, Width_t lwidth) | |
AttLine normal constructor. More... | |
virtual | ~TAttLine () |
AttLine destructor. More... | |
void | Copy (TAttLine &attline) const |
Copy this line attributes to a new TAttLine. More... | |
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. More... | |
virtual Color_t | GetLineColor () const |
virtual Style_t | GetLineStyle () const |
virtual Width_t | GetLineWidth () const |
virtual void | Modify () |
Change current line attributes if necessary. More... | |
virtual void | ResetAttLine (Option_t *option="") |
Reset this line attributes to default values. More... | |
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. More... | |
virtual void | SetLineAttributes () |
Invoke the DialogCanvas Line attributes. More... | |
virtual void | SetLineColor (Color_t lcolor) |
virtual void | SetLineColorAlpha (Color_t lcolor, Float_t lalpha) |
Set a transparent line color. More... | |
virtual void | SetLineStyle (Style_t lstyle) |
virtual void | SetLineWidth (Width_t lwidth) |
ClassDef (TAttLine, 2) | |
![]() | |
TAttFill () | |
TAttFill (Color_t fcolor, Style_t fstyle) | |
AttFill normal constructor. More... | |
virtual | ~TAttFill () |
AttFill destructor. More... | |
void | Copy (TAttFill &attfill) const |
Copy this fill attributes to a new TAttFill. More... | |
virtual Color_t | GetFillColor () const |
virtual Style_t | GetFillStyle () const |
virtual Bool_t | IsTransparent () const |
virtual void | Modify () |
Change current fill area attributes if necessary. More... | |
virtual void | ResetAttFill (Option_t *option="") |
Reset this fill attributes to default values. More... | |
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. More... | |
virtual void | SetFillAttributes () |
Invoke the DialogCanvas Fill attributes. More... | |
virtual void | SetFillColor (Color_t fcolor) |
virtual void | SetFillColorAlpha (Color_t fcolor, Float_t falpha) |
Set a transparent fill color. More... | |
virtual void | SetFillStyle (Style_t fstyle) |
![]() | |
TAttMarker () | |
TAttMarker (Color_t color, Style_t style, Size_t msize) | |
TAttMarker normal constructor. More... | |
virtual | ~TAttMarker () |
TAttMarker destructor. More... | |
void | Copy (TAttMarker &attmarker) const |
Copy this marker attributes to a new TAttMarker. More... | |
virtual Color_t | GetMarkerColor () const |
virtual Style_t | GetMarkerStyle () const |
virtual Size_t | GetMarkerSize () const |
virtual void | Modify () |
Change current marker attributes if necessary. More... | |
virtual void | ResetAttMarker (Option_t *toption="") |
Reset this marker attributes to the default values. More... | |
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. More... | |
virtual void | SetMarkerAttributes () |
Invoke the DialogCanvas Marker attributes. More... | |
virtual void | SetMarkerColor (Color_t mcolor=1) |
virtual void | SetMarkerColorAlpha (Color_t mcolor, Float_t malpha) |
Set a transparent marker color. More... | |
virtual void | SetMarkerStyle (Style_t mstyle=1) |
virtual void | SetMarkerSize (Size_t msize=1) |
ClassDef (TAttMarker, 2) | |
Static Public Member Functions | |
static Double_t | DerivativeError () |
Static function returning the error of the last call to the of Derivative's functions. More... | |
static void | InitStandardFunctions () |
Create the basic function objects. More... | |
static TF1 * | GetCurrent () |
Static function returning the current function being processed. More... | |
static void | AbsValue (Bool_t reject=kTRUE) |
Static function: set the fgAbsValue flag. More... | |
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. More... | |
static Bool_t | RejectedPoint () |
See TF1::RejectPoint above. More... | |
static void | SetCurrent (TF1 *f1) |
Static function setting the current function. More... | |
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. More... | |
![]() | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
Protected Types | |
enum | { kNotGlobal = BIT(10) } |
Protected Member Functions | |
void | DoInitialize () |
Common initialization of the TF1. More... | |
void | IntegrateForNormalization () |
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. More... | |
virtual void | GetRange (Double_t *xmin, Double_t *xmax) const |
Return range of a generic N-D function. More... | |
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 will be used to paint the function A re-creation is forced and a new histogram is done if recreate=true. More... | |
![]() | |
void | MakeZombie () |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
Protected Attributes | |
Double_t | fXmin |
Double_t | fXmax |
Int_t | fNpar |
Int_t | fNdim |
Int_t | fNpx |
Int_t | fType |
Int_t | fNpfits |
Int_t | fNDF |
Double_t | fChisquare |
Double_t | fMinimum |
Double_t | fMaximum |
std::vector< Double_t > | fParErrors |
std::vector< Double_t > | fParMin |
std::vector< Double_t > | fParMax |
std::vector< Double_t > | fSave |
std::vector< Double_t > | fIntegral |
std::vector< Double_t > | fAlpha |
Integral of function binned on fNpx bins. More... | |
std::vector< Double_t > | fBeta |
Array alpha. for each bin in x the deconvolution r of fIntegral. More... | |
std::vector< Double_t > | fGamma |
Array beta. is approximated by x = alpha +beta*r *gamma*r**2. More... | |
TObject * | fParent |
Array gamma. More... | |
TH1 * | fHistogram |
Parent object hooking this function (if one) More... | |
TMethodCall * | fMethodCall |
Pointer to histogram used for visualisation. More... | |
Bool_t | fNormalized |
Pointer to MethodCall in case of interpreted function. More... | |
Double_t | fNormIntegral |
ROOT::Math::ParamFunctor | fFunctor |
TFormula * | fFormula |
Functor object to wrap any C++ callable object. More... | |
TF1Parameters * | fParams |
![]() | |
TString | fName |
TString | fTitle |
![]() | |
Color_t | fLineColor |
Style_t | fLineStyle |
Width_t | fLineWidth |
![]() | |
Color_t | fFillColor |
Style_t | fFillStyle |
![]() | |
Color_t | fMarkerColor |
Style_t | fMarkerStyle |
Size_t | fMarkerSize |
Static Protected Attributes | |
static Bool_t | fgAbsValue = kFALSE |
static Bool_t | fgRejectPoint = kFALSE |
static Bool_t | fgAddToGlobList = kTRUE |
static TF1 * | fgCurrent = 0 |
Friends | |
template<class Func > | |
struct | ROOT::Internal::TF1Builder |
#include <TF1.h>
TF1::TF1 | ( | ) |
TF1 default constructor.
Definition at line 392 of file TF1.cxx.
Referenced by InitStandardFunctions().
F1 constructor using a formula definition.
See TFormula constructor for explanation of the formula syntax.
See tutorials: fillrandom, first, fit1, formula1, multifit for real examples.
Creates a function of type A or B between xmin and xmax
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.
F1 constructor using name of an interpreted function.
Creates a function of type C between xmin and xmax. name is the name of an interpreted CINT cunction. The function is defined with npar parameters fcn must be a function of type: Double_t fcn(Double_t *x, Double_t *params)
This constructor is called for functions of type C by CINT.
WARNING! A function created with this constructor cannot be Cloned.
TF1::TF1 | ( | const char * | name, |
Double_t(*)(Double_t *, Double_t *) | fcn, | ||
Double_t | xmin = 0 , |
||
Double_t | xmax = 1 , |
||
Int_t | npar = 0 , |
||
Int_t | ndim = 1 |
||
) |
Constructor using a pointer to a real 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.
see test program test/stress.cxx (function stress1) for an example. note the interface with an intermediate pointer.
WARNING! A function created with this constructor cannot be Cloned.
TF1::TF1 | ( | const char * | name, |
Double_t(*)(const Double_t *, const Double_t *) | fcn, | ||
Double_t | xmin = 0 , |
||
Double_t | xmax = 1 , |
||
Int_t | npar = 0 , |
||
Int_t | ndim = 1 |
||
) |
Constructor using a pointer to real 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.
see test program test/stress.cxx (function stress1) for an example. note the interface with an intermediate pointer.
WARNING! A function created with this constructor cannot be Cloned.
TF1::TF1 | ( | const char * | name, |
ROOT::Math::ParamFunctor | f, | ||
Double_t | xmin = 0 , |
||
Double_t | xmax = 1 , |
||
Int_t | npar = 0 , |
||
Int_t | ndim = 1 |
||
) |
Constructor using the Functor class.
xmin | and |
xmax | define the plotting range of the function |
npar | is the number of free parameters used by the function |
This constructor can be used only in compiled code
WARNING! A function created with this constructor cannot be Cloned.
Static function: set the fgAbsValue flag.
By default TF1::Integral uses the original function value to compute the integral However, TF1::Moment, CentralMoment require to compute the integral using the absolute value of the function.
Add to global list of functions (gROOT->GetListOfFunctions() ) return previous status (true of functions was already in the list false if not)
Definition at line 630 of file TF1.cxx.
Referenced by copyTF1(), and HFit::StoreAndDrawFitFunction().
|
static |
Type safe interface (static method) The number of sampling points are taken from the TGraph.
Type: unsafe but fast interface filling the arrays x and w (static method)
Given the number of sampling points this routine fills the arrays x and w of length num, containing the abscissa and weight of the Gauss-Legendre n-point quadrature formula.
Gauss-Legendre:
\[ W(x)=1 -1<x<1 \\ (j+1)P_{j+1} = (2j+1)xP_j-jP_{j-1} \]
num is the number of sampling points (>0) x and w are arrays of size num eps is the relative precision
If num<=0 or eps<=0 no action is done.
Reference: Numerical Recipes in C, Second Edition
|
virtual |
Return nth central moment of function between a and b (i.e the n-th moment around the mean value)
See TF1::Integral() for parameter definitions Author: Gene Van Buren gene@ bnl. gov
Definition at line 3422 of file TF1.cxx.
Referenced by Variance().
Copy this F1 to a new F1.
Note that the cached integral with its related arrays are not copied (they are also set as transient data members)
Reimplemented from TNamed.
Reimplemented in TF2, TF3, and TF12.
Definition at line 736 of file TF1.cxx.
Referenced by TF12::Copy(), TF2::Copy(), copyTF1(), DrawCopy(), GAMinTutorial(), TFitEditor::GetFitFunction(), TF1Convolution::InitializeDataMembers(), operator=(), ROOT::Math::WrappedMultiTF1::SetAndCopyFunction(), HFit::StoreAndDrawFitFunction(), TF12::TF12(), TF1NormSum::TF1NormSum(), and TF2::TF2().
|
inlinevirtual |
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
\[ D(h) = \frac{f(x+h) - f(x-h)}{2h} \]
the final estimate
\[ D = \frac{4D(h/2) - D(h)}{3} \]
"Numerical Methods for Scientists and Engineers", H.M.Antia, 2nd edition".
if the argument params is null, the current function parameters are used, otherwise the parameters in params are used.
the argument eps may be specified to control the step size (precision). the step size is taken as eps*(xmax-xmin). the default value (0.001) should be good enough for the vast majority of functions. Give a smaller value if your function has many changes of the second derivative in the function range.
Getting the error via TF1::DerivativeError: (total error = roundoff error + interpolation error) the estimate of the roundoff error is taken as follows:
\[ err = k\sqrt{f(x)^{2} + x^{2}deriv^{2}}\sqrt{\sum ai^{2}}, \]
where k is the double precision, ai are coefficients used in central difference formulas interpolation error is decreased by making the step size h smaller.
Author: Anna Kreshuk
Definition at line 829 of file TF1.cxx.
Referenced by ROOT::Math::WrappedTF1::DoDerivative(), TProofBench::DrawCPU(), TProofBench::DrawDataSet(), GraphFitChisquare(), GraphFitChisquareFumili(), and MultiGraphFitChisquare().
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
\[ D(h) = \frac{f(x+h) - 2f(x) + f(x-h)}{h^{2}} \]
the final estimate
\[ D = \frac{4D(h/2) - D(h)}{3} \]
"Numerical Methods for Scientists and Engineers", H.M.Antia, 2nd edition".
if the argument params is null, the current function parameters are used, otherwise the parameters in params are used.
the argument eps may be specified to control the step size (precision). the step size is taken as eps*(xmax-xmin). the default value (0.001) should be good enough for the vast majority of functions. Give a smaller value if your function has many changes of the second derivative in the function range.
Getting the error via TF1::DerivativeError: (total error = roundoff error + interpolation error) the estimate of the roundoff error is taken as follows:
\[ err = k\sqrt{f(x)^{2} + x^{2}deriv^{2}}\sqrt{\sum ai^{2}}, \]
where k is the double precision, ai are coefficients used in central difference formulas interpolation error is decreased by making the step size h smaller.
Author: Anna Kreshuk
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
\[ D(h) = \frac{f(x+2h) - 2f(x+h) + 2f(x-h) - f(x-2h)}{2h^{3}} \]
the final estimate
\[ D = \frac{4D(h/2) - D(h)}{3} \]
"Numerical Methods for Scientists and Engineers", H.M.Antia, 2nd edition".
if the argument params is null, the current function parameters are used, otherwise the parameters in params are used.
the argument eps may be specified to control the step size (precision). the step size is taken as eps*(xmax-xmin). the default value (0.001) should be good enough for the vast majority of functions. Give a smaller value if your function has many changes of the second derivative in the function range.
Getting the error via TF1::DerivativeError: (total error = roundoff error + interpolation error) the estimate of the roundoff error is taken as follows: Begin_Latex err = k::sqrt{f(x)^{2} + x^{2}deriv^{2}}sqrt{#sum ai^{2}}, End_Latex where k is the double precision, ai are coefficients used in central difference formulas interpolation error is decreased by making the step size h smaller.
Author: Anna Kreshuk
|
static |
Compute distance from point px,py to a function.
Compute the closest distance of approach from point px,py to this function. The distance is computed in pixels units.
Note that px is called with a negative value when the TF1 is in TGraph or TH1 list of functions. In this case there is no point looking at the histogram axis.
Reimplemented from TObject.
Reimplemented in TF2, and TF3.
Definition at line 1012 of file TF1.cxx.
Referenced by TF3::DistancetoPrimitive().
|
protectedvirtual |
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.
Definition at line 2727 of file TF1.cxx.
Referenced by CreateHistogram(), and Paint().
|
protected |
Draw this function with its current attributes.
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 |
"FC" | draw a fill area below a smooth curve |
Note that the default value is "L". Therefore to draw on top of an existing picture, specify option "LSAME"
NB. You must use DrawCopy if you want to draw several times the same function in the current canvas.
Reimplemented from TObject.
Reimplemented in TF2, and TF3.
Definition at line 1052 of file TF1.cxx.
Referenced by Browse(), doFit(), TFitEditor::DoFit(), TF1Editor::DoSliderXMoved(), TF1Editor::DoSliderXPressed(), TF1Editor::DoSliderXReleased(), TKDE::Draw(), TGeoPainter::DrawBatemanSol(), TKDE::DrawConfidenceInterval(), DrawF1(), TFitParametersDialog::DrawFunction(), FFT(), FittingDemo(), GAMinTutorial(), langaus(), portfolio(), and TFunctionParametersDialog::RedrawFunction().
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 |
"FC" | draw a fill area below a smooth curve |
Note that the default value is "L". Therefore to draw on top of an existing picture, specify option "LSAME"
Reimplemented in TF2, and TF12.
Definition at line 1080 of file TF1.cxx.
Referenced by GAMinTutorial(), and TestBinomial().
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.
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.
Evaluate this function.
Computes the value of this function (general case for a 3-d function) at point x,y,z. For a 1-d function give y=0 and z=0 The current value of variables x,y,z is passed through x, y and z. The parameters used will be the ones in the array params if params is given otherwise parameters will be taken from the stored data members fParams
Reimplemented in TF12.
Definition at line 1162 of file TF1.cxx.
Referenced by TGraphErrors::Apply(), TGraphAsymmErrors::Apply(), TGraphBentErrors::Apply(), TGraph::Apply(), ClassImp(), TBinomialEfficiencyFitter::ComputeFCN(), ConfidenceIntervals(), DistancetoPrimitive(), TF12::Eval(), TH1::Eval(), FFT(), TH3::FillRandom(), TGLVoxelPainter::FindVoxelColor(), fit3DHist(), fitSparse3D(), Rgl::Mc::TF3Adapter::GetData(), TF2::GetObjectInfo(), GetObjectInfo(), graph2dfit(), TLinearFitter::Graph2DLinearFitter(), TLinearFitter::GraphLinearFitter(), TPainter3dAlgorithms::ImplicitFunction(), TLinearFitter::MultiGraphLinearFitter(), operator()(), TGaxis::PaintAxis(), THistPainter::PaintInit(), THistPainter::PaintInitH(), TGLTH3Slice::PrepareTexCoords(), SavePrimitive(), Rgl::Mc::TF3EdgeSplitter::SplitEdge(), and unuranDistr().
Evaluate function with given coordinates and parameters.
Compute the value of this function at point defined by array x and current values of parameters in array params. If argument params is omitted or equal 0, the internal values of parameters (array fParams) will be used instead. For a 1-D function only x[0] must be given. In case of a multi-dimemsional function, the arrays x must be filled with the corresponding number of dimensions.
WARNING. In case of an interpreted function (fType=2), it is the user's responsability to initialize the parameters via InitArgs before calling this function. InitArgs should be called at least once to specify the addresses of the arguments x and params. InitArgs should be called everytime these addresses change.
Reimplemented in TF12.
Definition at line 1192 of file TF1.cxx.
Referenced by TH1::Add(), TLinearFitter::AddToDesign(), TF2::CreateHistogram(), TLinearFitter::CStep(), TH1::Divide(), DoCreateHistogram(), ROOT::Math::WrappedTF1::DoEval(), ROOT::Math::WrappedMultiTF1::DoEval(), ROOT::Math::WrappedTF1::DoEvalPar(), ROOT::Math::WrappedMultiTF1::DoEvalPar(), TF12::EvalPar(), TFumili::EvalTFN(), F2Fit(), F3Fit(), TFitter::FitChisquare(), TFumili::FitChisquare(), TFitter::FitLikelihood(), TFumili::FitLikelihood(), TFitter::GetConfidenceIntervals(), TF3::GetRandom3(), GradientPar(), Graph2DFitChisquare(), GraphFitChisquare(), GraphFitChisquareFumili(), TLinearFitter::HistLinearFitter(), MultiGraphFitChisquare(), TProfile::Multiply(), THnBase::Multiply(), TH1::Multiply(), operator()(), TF2::Paint(), TF3::Save(), TF2::Save(), Save(), SavePrimitive(), and TestTimeTF1().
Execute action corresponding to one event.
This member function is called when a F1 is clicked with the locator
Reimplemented from TObject.
Reimplemented in TF2, and TF3.
Definition at line 1237 of file TF1.cxx.
Referenced by TF3::ExecuteEvent(), and TF2::ExecuteEvent().
Fix the value of a parameter The specified value will be used in a fit operation.
Definition at line 1253 of file TF1.cxx.
Referenced by TFunctionParametersDialog::DoFix(), TFitParametersDialog::DoParFix(), TFunctionParametersDialog::DoReset(), TFitParametersDialog::DoReset(), TFitParametersDialog::SetParameters(), and testUserFunc().
|
inline |
Definition at line 329 of file TF1.h.
Referenced by TH2::DoFitSlices(), TH3::FitSlicesZ(), FitUsingTFit(), TFitter::GetConfidenceIntervals(), langaufit(), THistPainter::PaintStat(), THistPainter::PaintStat2(), THistPainter::PaintStat3(), TGraphPainter::PaintStats(), TF3::SavePrimitive(), TF2::SavePrimitive(), SavePrimitive(), testGraphFit(), testHisto1DFit(), testHisto1DPolFit(), unuranDistr(), and unuranSimple().
|
static |
Static function returning the current function being processed.
Definition at line 1265 of file TF1.cxx.
Referenced by rr_ctf1_fcn(), and rr_ctf2_fcn().
Definition at line 334 of file TF1.h.
Referenced by copyTF1(), TFitEditor::DoFunction(), TFitEditor::GetFitFunction(), and TFitEditor::SetFitObject().
|
inlinevirtual |
Definition at line 332 of file TF1.h.
Referenced by TLinearFitter::Graph2DLinearFitter(), TLinearFitter::GraphLinearFitter(), TLinearFitter::HistLinearFitter(), TLinearFitter::MultiGraphLinearFitter(), and TF1Convolution::TF1Convolution().
|
inlinevirtual |
|
virtual |
Return a pointer to the histogram used to vusualize the function.
Definition at line 1274 of file TF1.cxx.
Referenced by RooStats::BayesianCalculator::ComputeShortestInterval(), TF1Editor::DoSliderXMoved(), TF1Editor::DoSliderXPressed(), TF1Editor::DoSliderXReleased(), TF1Editor::DoXPoints(), TF1Editor::DoXRange(), TH1::FillRandom(), RooStats::BayesianCalculator::GetMode(), GetXaxis(), GetYaxis(), GetZaxis(), glsurfaces(), portfolio(), TF1Editor::SetModel(), and TestBinomial().
Definition at line 335 of file TF1.h.
Referenced by ROOT::Math::WrappedTF1::DoParameterDerivative(), ROOT::Math::WrappedMultiTF1::DoParameterDerivative(), ROOT::Math::WrappedMultiTF1::WrappedMultiTF1(), and ROOT::Math::WrappedTF1::WrappedTF1().
|
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
|
inlinevirtual |
Definition at line 340 of file TF1.h.
Referenced by THistPainter::PaintInit().
|
virtual |
Returns the X value corresponding to 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::GetX
|
inline |
Definition at line 346 of file TF1.h.
Referenced by ROOT::Math::WrappedTF1::DoEvalPar(), ROOT::Math::WrappedMultiTF1::DoEvalPar(), and ROOT::Math::WrappedTF1::WrappedTF1().
|
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
|
inlinevirtual |
|
virtual |
Returns the X value corresponding to 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::GetX
|
protectedvirtual |
Find the minimum of a function of whatever dimension.
While GetMinimum works only for 1D function , GetMinimumNDim works for all dimensions since it uses the minimizer interface vector x at beginning will contained the initial point, on exit will contain the result
Definition at line 1404 of file TF1.cxx.
Referenced by TF3::FindMinMax(), and TF2::FindMinMax().
|
virtual |
Return the number of degrees of freedom in the fit the fNDF parameter has been previously computed during a fit.
The number of degrees of freedom corresponds to the number of points used in the fit minus the number of free parameters.
Definition at line 1568 of file TF1.cxx.
Referenced by TFitter::GetConfidenceIntervals(), langaufit(), THistPainter::PaintStat(), THistPainter::PaintStat2(), THistPainter::PaintStat3(), TGraphPainter::PaintStats(), SavePrimitive(), testHisto1DFit(), TwoHistoFit2D(), unuranDistr(), and unuranSimple().
|
inlinevirtual |
Definition at line 343 of file TF1.h.
Referenced by HFit::CheckFitFunction(), Derivative(), Derivative2(), Derivative3(), ROOT::Fit::FillData(), TFitEditor::FillFunctionList(), TBinomialEfficiencyFitter::Fit(), HFit::Fit(), GetMinMaxNDim(), GetRange(), TLinearFitter::HistLinearFitter(), IntegralMultiple(), Print(), TFoamSampler::SetFunction(), TUnuranSampler::SetFunction(), SetNpx(), TF2::TF2(), TF3::TF3(), ROOT::Fit::UnBinFit(), and ROOT::Math::WrappedMultiTF1::WrappedMultiTF1().
|
inlinevirtual |
Definition at line 342 of file TF1.h.
Referenced by HFit::CheckFitFunction(), chi2FromFit(), TFitEditor::DoFit(), TH2::DoFitSlices(), TFitEditor::DoFunction(), TBinomialEfficiencyFitter::Fit(), HFit::Fit(), TFitter::FitChisquare(), TFumili::FitChisquare(), TFitter::FitChisquareI(), TFumili::FitChisquareI(), TFitter::FitLikelihood(), TFumili::FitLikelihood(), TFitter::FitLikelihoodI(), TFumili::FitLikelihoodI(), TH3::FitSlicesZ(), FixParameter(), TFitter::GetConfidenceIntervals(), TFitEditor::GetFitFunction(), GetNDF(), GetNumberFreeParameters(), GetParameters(), GetParError(), GradientPar(), Graph2DFitChisquare(), GraphFitChisquare(), GraphFitChisquareFumili(), H1InitPolynom(), TMultiGraph::InitPolynom(), TGraph::InitPolynom(), ROOT::TF1Helper::IntegralError(), IntegralOneDim(), MultiGraphFitChisquare(), ROOT::Math::WrappedTF1::NPar(), ROOT::Math::WrappedMultiTF1::NPar(), THistPainter::PaintStat(), THistPainter::PaintStat2(), THistPainter::PaintStat3(), TGraphPainter::PaintStats(), Print(), ReleaseParameter(), rr_ctf1_fcn(), rr_ctf2_fcn(), TF3::SavePrimitive(), TF2::SavePrimitive(), SavePrimitive(), SetFitResult(), TF1Editor::SetModel(), SetParameters(), SetParError(), SetParErrors(), SetParLimits(), SetParName(), testHisto2DFit(), and ROOT::Fit::UnBinFit().
|
inlinevirtual |
Definition at line 345 of file TF1.h.
Referenced by RooStats::BayesianCalculator::ApproximatePosterior(), TF2::SavePrimitive(), TF1Editor::SetModel(), TGraph::TGraph(), unuranMulti2D(), and unuranMultiDim().
|
inlinevirtual |
Definition at line 347 of file TF1.h.
Referenced by HFit::Fit(), InitParameters(), Integral(), ROOT::Math::WrappedMultiTF1::WrappedMultiTF1(), and ROOT::Math::WrappedTF1::WrappedTF1().
|
inlinevirtual |
Definition at line 349 of file TF1.h.
Referenced by TH2::DoFitSlices(), TBinomialEfficiencyFitter::Fit(), and TH3::FitSlicesZ().
|
virtual |
Return the number of free parameters.
Definition at line 1579 of file TF1.cxx.
Referenced by TFitter::GetConfidenceIntervals(), and THistPainter::PaintStat().
Redefines TObject::GetObjectInfo.
Displays the function info (x, function value) corresponding to cursor position px,py
Reimplemented from TObject.
Reimplemented in TF2.
Definition at line 352 of file TF1.h.
Referenced by TH2::DoFitSlices(), TFitParametersDialog::DoParBound(), TProofBench::DrawCPU(), TBinomialEfficiencyFitter::Fit(), fit2dHist(), TH3::FitSlicesZ(), FitUsingRooFit(), GetParameters(), ROOT::TF1Helper::IntegralError(), IntegralOneDim(), THistPainter::PaintStat(), THistPainter::PaintStat2(), THistPainter::PaintStat3(), TGraphPainter::PaintStats(), Print(), TF3::SavePrimitive(), TF2::SavePrimitive(), SavePrimitive(), solveLinear(), TestBinomial(), and TwoHistoFit2D().
|
inlinevirtual |
Definition at line 358 of file TF1.h.
Referenced by chi2FromFit(), HFit::ComputeChi2(), TF2::CreateHistogram(), DoCreateHistogram(), TH2::DoFitSlices(), ErrorIntegral(), Eval(), F2Fit(), F3Fit(), fitExclude(), TH3::FitSlicesZ(), FittingDemo(), TFitEditor::GetFitFunction(), TF3::GetRandom3(), GradientPar(), InitArgs(), ROOT::TF1Helper::IntegralError(), langaufit(), multifit(), TF2::Paint(), ROOT::Math::WrappedTF1::Parameters(), ROOT::Math::WrappedMultiTF1::Parameters(), TF3::Save(), TF2::Save(), Save(), SavePrimitive(), and SetFitResult().
Return value of parameter number ipar.
Definition at line 1608 of file TF1.cxx.
Referenced by TH2::DoFitSlices(), TBinomialEfficiencyFitter::Fit(), HFit::Fit(), TH3::FitSlicesZ(), GradientPar(), langaufit(), THistPainter::PaintStat(), THistPainter::PaintStat2(), THistPainter::PaintStat3(), TGraphPainter::PaintStats(), TF3::SavePrimitive(), TF2::SavePrimitive(), SavePrimitive(), TestBinomial(), and ROOT::Fit::UnBinFit().
|
inlinevirtual |
Definition at line 370 of file TF1.h.
Referenced by ErrorIntegral().
Return limits for parameter ipar.
Definition at line 1618 of file TF1.cxx.
Referenced by TFitParametersDialog::DoParBound(), TBinomialEfficiencyFitter::Fit(), HFit::Fit(), FitUsingRooFit(), TFitter::GetConfidenceIntervals(), GetParameters(), THistPainter::PaintStat(), TF3::SavePrimitive(), TF2::SavePrimitive(), SavePrimitive(), and ROOT::Fit::UnBinFit().
|
inlinevirtual |
Definition at line 363 of file TF1.h.
Referenced by TH2::DoFitSlices(), TFitParametersDialog::DoParFix(), TBinomialEfficiencyFitter::Fit(), fit2dHist(), TH3::FitSlicesZ(), IntegralOneDim(), THistPainter::PaintStat(), THistPainter::PaintStat2(), THistPainter::PaintStat3(), TGraphPainter::PaintStats(), ROOT::Math::WrappedTF1::ParameterName(), ROOT::Math::WrappedMultiTF1::ParameterName(), Print(), and TwoHistoFit2D().
|
inlinevirtual |
|
virtual |
Return the fit probability.
Definition at line 1633 of file TF1.cxx.
Referenced by TestBinomial(), unuranDistr(), and unuranSimple().
Compute Quantiles for density distribution of this function.
Quantile x_q of a probability distribution Function F is defined as
\[ F(x_{q}) = \int_{xmin}^{x_{q}} f dx = q with 0 <= q <= 1. \]
For instance the median \( x_{\frac{1}{2}} \) of a distribution is defined as that value of the random variable for which the distribution function equals 0.5:
\[ F(x_{\frac{1}{2}}) = \prod(x < x_{\frac{1}{2}}) = \frac{1}{2} \]
code from Eddy Offermann, Renaissance
[in] | this | TF1 function |
[in] | nprobSum | maximum size of array q and size of array probSum |
[in] | probSum | array of positions where quantiles will be computed. It is assumed to contain at least nprobSum values. |
[out] | return | value nq (<=nprobSum) with the number of quantiles computed |
[out] | array | q filled with nq quantiles |
Getting quantiles from two histograms and storing results in a TGraph, a so-called QQ-plot
TGraph *gr = new TGraph(nprob); f1->GetQuantiles(nprob,gr->GetX()); f2->GetQuantiles(nprob,gr->GetY()); gr->Draw("alp");
Definition at line 1669 of file TF1.cxx.
Referenced by RooStats::BayesianCalculator::ComputeIntervalFromApproxPosterior(), TGraphQQ::MakeFunctionQuantiles(), and TGraphQQ::Quartiles().
|
virtual |
Return a random number following this function shape.
The distribution contained in the function fname (TF1) is integrated over the channel contents. It is normalized to 1. For each bin the integral is approximated by a parabola. The parabola coefficients are stored as non persistent data members Getting one random number implies:
If the ratio fXmax/fXmin > fNpx the integral is tabulated in log scale in x The parabolic approximation is very good as soon as the number of bins is greater than 50.
Reimplemented in TF2.
Definition at line 1762 of file TF1.cxx.
Referenced by DoFit(), GAMinTutorial(), testDistr1D(), testHisto1DPolFit(), testPolyFit(), and unuranDistr().
Return a random number following this function shape in [xmin,xmax].
The distribution contained in the function fname (TF1) is integrated over the channel contents. It is normalized to 1. For each bin the integral is approximated by a parabola. The parabola coefficients are stored as non persistent data members Getting one random number implies:
The parabolic approximation is very good as soon as the number of bins is greater than 50.
IMPORTANT NOTE
The integral of the function is computed at fNpx points. If the function has sharp peaks, you should increase the number of points (SetNpx) such that the peak is correctly tabulated at several points.
Reimplemented in TF2.
Return range of a generic N-D function.
Definition at line 1953 of file TF1.cxx.
Referenced by TBinomialEfficiencyFitter::ComputeFCN(), copyTF1(), Derivative(), Derivative2(), Derivative3(), ROOT::Fit::DoFillData(), TFitEditor::DoUseFuncRange(), TF1Editor::DoXPoints(), TH1::FillRandom(), HFit::GetFunctionRange(), and GetMinMaxNDim().
|
virtual |
Returns the X value corresponding to the function value fy for (xmin<x<xmax).
in other words it can find the roots of the function when fy=0 and successive calls by changing the next call to [xmin+eps,xmax] where xmin is the previous root.
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, TF1::GetMinimumX
Definition at line 1545 of file TF1.cxx.
Referenced by runTest().
TAxis * TF1::GetXaxis | ( | ) | const |
Get x axis of the function.
Definition at line 2072 of file TF1.cxx.
Referenced by FFT(), SavePrimitive(), and Rgl::Mc::TF3Adapter::SetDataSource().
|
inlinevirtual |
Definition at line 382 of file TF1.h.
Referenced by GetQuantiles(), Graph2DFitChisquare(), THistPainter::PaintInit(), THistPainter::PaintInitH(), TGaxis::SetFunction(), TF12::TF12(), TGaxis::TGaxis(), and TGraph::TGraph().
|
inlinevirtual |
Definition at line 381 of file TF1.h.
Referenced by GetQuantiles(), Graph2DFitChisquare(), THistPainter::PaintInit(), THistPainter::PaintInitH(), TGaxis::SetFunction(), TF12::TF12(), TGaxis::TGaxis(), and TGraph::TGraph().
TAxis * TF1::GetYaxis | ( | ) | const |
Get y axis of the function.
Definition at line 2083 of file TF1.cxx.
Referenced by FFT(), SavePrimitive(), and Rgl::Mc::TF3Adapter::SetDataSource().
TAxis * TF1::GetZaxis | ( | ) | const |
Get z axis of the function. (In case this object is a TF2 or TF3)
Definition at line 2094 of file TF1.cxx.
Referenced by Rgl::Mc::TF3Adapter::SetDataSource().
Compute the gradient (derivative) wrt a parameter ipar.
ipar | index of parameter for which the derivative is computed |
x | point, where the derivative is computed |
eps | - if the errors of parameters have been computed, the step used in numerical differentiation is eps*parameter_error. |
if the errors have not been computed, step=eps is used default value of eps = 0.01 Method is the same as in Derivative() function
If a parameter is fixed, the gradient on this parameter = 0
Definition at line 2117 of file TF1.cxx.
Referenced by ROOT::Math::WrappedTF1::DoParameterDerivative(), ROOT::Math::WrappedMultiTF1::DoParameterDerivative(), TFitter::GetConfidenceIntervals(), GradientPar(), ROOT::TF1Helper::TGradientParFunction::operator()(), ROOT::Math::WrappedTF1::ParameterGradient(), and ROOT::Math::WrappedMultiTF1::ParameterGradient().
Compute the gradient wrt parameters.
x | point, were the gradient is computed |
grad | used to return the computed gradient, assumed to be of at least fNpar size |
eps | if the errors of parameters have been computed, the step used in numerical differentiation is eps*parameter_error. |
if the errors have not been computed, step=eps is used default value of eps = 0.01 Method is the same as in Derivative() function
If a paramter is fixed, the gradient on this parameter = 0
Initialize parameters addresses.
Definition at line 2198 of file TF1.cxx.
Referenced by TH1::Add(), TF2::CreateHistogram(), TH1::Divide(), DoCreateHistogram(), ROOT::Math::WrappedTF1::DoEvalPar(), ROOT::Math::WrappedMultiTF1::DoEvalPar(), TF12::EvalPar(), F2Fit(), F3Fit(), TFitter::FitChisquare(), TFumili::FitChisquare(), TFitter::FitChisquareI(), TFumili::FitChisquareI(), TFitter::FitLikelihood(), TFumili::FitLikelihood(), TFitter::FitLikelihoodI(), TFumili::FitLikelihoodI(), TF3::GetRandom3(), GradientPar(), Graph2DFitChisquare(), GraphFitChisquare(), GraphFitChisquareFumili(), MultiGraphFitChisquare(), TH1::Multiply(), operator()(), ROOT::Math::WrappedTF1::operator=(), TF2::Paint(), TF3::Save(), TF2::Save(), Save(), SavePrimitive(), and ROOT::Math::WrappedTF1::WrappedTF1().
|
static |
Create the basic function objects.
Definition at line 2213 of file TF1.cxx.
Referenced by TF1Convolution::TF1Convolution(), and TF1NormSum::TF1NormSum().
IntegralOneDim or analytical integral.
Definition at line 2241 of file TF1.cxx.
Referenced by TH1::Add(), TBinomialEfficiencyFitter::ComputeFCN(), ErrorIntegral(), TH1::FillRandom(), TFitter::FitChisquareI(), TFumili::FitChisquareI(), TFitter::FitLikelihoodI(), TFumili::FitLikelihoodI(), GetQuantiles(), GetRandom(), Integration(), myfit(), TestBinomial(), testIntegPerf(), and Update().
|
virtual |
Return Error on Integral of a parameteric function between a and b due to the parameter uncertainties.
A pointer to a vector of parameter values and to the elements of the covariance matrix (covmat) can be optionally passed. By default (i.e. when a zero pointer is passed) the current stored parameter values are used to estimate the integral error together with the covariance matrix from the last fit (retrieved from the global fitter instance)
IMPORTANT NOTE1:
When no covariance matrix is passed and in the meantime a fit is done using another function, the routine will signal an error and it will return zero only when the number of fit parameter is different than the values stored in TF1 (TF1::GetNpar() ). In the case that npar is the same, an incorrect result is returned.
IMPORTANT NOTE2:
The user must pass a pointer to the elements of the full covariance matrix dimensioned with the right size (npar*npar), where npar is the total number of parameters (TF1::GetNpar()), including also the fixed parameters. When there are fixed parameters, the pointer returned from TVirtualFitter::GetCovarianceMatrix() cannot be used. One should use the TFitResult class, as shown in the example below.
To get the matrix and values from an old fit do for example: TFitResultPtr r = histo->Fit(func, "S"); ..... after performing other fits on the same function do
func->IntegralError(x1,x2,r->GetParams(), r->GetCovarianceMatrix()->GetMatrixArray() );
Definition at line 2422 of file TF1.cxx.
Referenced by ErrorIntegral().
|
virtual |
Return Error on Integral of a parameteric function with dimension larger tan one between a[] and b[] due to the parameters uncertainties.
For a TF1 with dimension larger than 1 (for example a TF2 or TF3) TF1::IntegralMultiple is used for the integral calculation
A pointer to a vector of parameter values and to the elements of the covariance matrix (covmat) can be optionally passed. By default (i.e. when a zero pointer is passed) the current stored parameter values are used to estimate the integral error together with the covariance matrix from the last fit (retrieved from the global fitter instance).
IMPORTANT NOTE1:
When no covariance matrix is passed and in the meantime a fit is done using another function, the routine will signal an error and it will return zero only when the number of fit parameter is different than the values stored in TF1 (TF1::GetNpar() ). In the case that npar is the same, an incorrect result is returned.
IMPORTANT NOTE2:
The user must pass a pointer to the elements of the full covariance matrix dimensioned with the right size (npar*npar), where npar is the total number of parameters (TF1::GetNpar()), including also the fixed parameters. When there are fixed parameters, the pointer returned from TVirtualFitter::GetCovarianceMatrix() cannot be used. One should use the TFitResult class, as shown in the example below.
To get the matrix and values from an old fit do for example: TFitResultPtr r = histo->Fit(func, "S"); ..... after performing other fits on the same function do
func->IntegralError(x1,x2,r->GetParams(), r->GetCovarianceMatrix()->GetMatrixArray() );
|
virtual |
This function computes, to an attempted specified accuracy, the value of the integral.
Input parameters:
[in] | n | Number of dimensions [2,15] |
[in] | a,b | One-dimensional arrays of length >= N . On entry A[i], and B[i], contain the lower and upper limits of integration, respectively. |
[in] | maxpts | Maximum number of function evaluations to be allowed. maxpts >= 2^n +2*n*(n+1) +1 if maxpts<minpts, maxpts is set to 10*minpts |
[in] | epsrel | Specified relative accuracy. |
[in] | epsabs | Specified absolute accuracy. The integration algorithm will attempt to reach either the relative or the absolute accuracy. In case the maximum funcion called is reached the algorithm will stop earlier without having reached the desired accuracy |
[out] | relerr | Contains, on exit, an estimation of the relative accuracy of the result. |
[out] | nfnevl | number of function evaluations performed. |
[out] | ifail | 0 Normal exit. At least minpts and at most maxpts calls to the function were performed. 1 maxpts is too small for the specified accuracy eps. The result and relerr contain the values obtainable for the specified value of maxpts. 3 n<2 or n>15 |
Method:
The defult method used is the Genz-Mallik adaptive multidimensional algorithm using the class ROOT::Math::AdaptiveIntegratorMultiDim (see the reference documentation of the class)
Other methods can be used by setting ROOT::Math::IntegratorMultiDimOptions::SetDefaultIntegrator() to different integrators. Other possible integrators are MC integrators based on the ROOT::Math::GSLMCIntegrator class Possible methods are : Vegas, Miser or Plain IN case of MC integration the accuracy is determined by the number of function calls, one should be careful not to use a too large value of maxpts
Definition at line 2556 of file TF1.cxx.
Referenced by TF3::Integral(), TF2::Integral(), ROOT::TF1Helper::IntegralError(), and IntegralMultiple().
|
virtual |
Return Integral of function between a and b using the given parameter values and relative and absolute tolerance.
The defult integrator defined in ROOT::Math::IntegratorOneDimOptions::DefaultIntegrator() is used If ROOT contains the MathMore library the default integrator is set to be the adaptive ROOT::Math::GSLIntegrator (based on QUADPACK) or otherwise the ROOT::Math::GaussIntegrator is used See the reference documentation of these classes for more information about the integration algorithms To change integration algorithm just do : ROOT::Math::IntegratorOneDimOptions::SetDefaultIntegrator(IntegratorName); Valid integrator names are:
In order to use the GSL integrators one needs to have the MathMore library installed
Note 1:
Values of the function f(x) at the interval end-points A and B are not required. The subprogram may therefore be used when these values are undefined.
Note 2:
Instead of TF1::Integral, you may want to use the combination of TF1::CalcGaussLegendreSamplingPoints and TF1::IntegralFast. See an example with the following script:
Definition at line 2330 of file TF1.cxx.
Referenced by Integral(), and ROOT::TF1Helper::IntegralError().
|
protected |
return kTRUE if the point is inside the function range
Reimplemented in TF2, and TF3.
Definition at line 404 of file TF1.h.
Referenced by TH1::Add(), TH1::Divide(), TH1::Eval(), GraphFitChisquare(), GraphFitChisquareFumili(), TLinearFitter::GraphLinearFitter(), TLinearFitter::HistLinearFitter(), ROOT::Fit::HFitInterface::IsPointOutOfRange(), MultiGraphFitChisquare(), TLinearFitter::MultiGraphLinearFitter(), TProfile::Multiply(), THnBase::Multiply(), and TH1::Multiply().
|
inlinevirtual |
Definition at line 405 of file TF1.h.
Referenced by HFit::Fit(), ROOT::Math::WrappedMultiTF1::WrappedMultiTF1(), and ROOT::Math::WrappedTF1::WrappedTF1().
|
virtual |
Return kTRUE if the function is valid.
Definition at line 2586 of file TF1.cxx.
Referenced by TFitEditor::CheckFunctionString().
|
virtual |
Return nth moment of function between a and b.
See TF1::Integral() for parameter definitions
Definition at line 3386 of file TF1.cxx.
Referenced by Mean().
Paint this function with its current attributes.
The function is going to be converted in an histogram and the corresponding histogram is painted. The painted histogram can be retrieved calling afterwards the method TF1::GetHistogram()
Reimplemented from TObject.
Print TNamed name and title.
Reimplemented from TNamed.
Definition at line 2600 of file TF1.cxx.
Referenced by TProofBench::DrawCPU(), TProofBench::DrawDataSet(), and fit1().
|
static |
See TF1::RejectPoint above.
Definition at line 3376 of file TF1.cxx.
Referenced by TH1::Add(), TH1::Divide(), ROOT::Fit::DoFillData(), ROOT::Fit::FillData(), TFitter::FitChisquare(), TFumili::FitChisquare(), TFitter::FitChisquareI(), TFumili::FitChisquareI(), TFitter::FitLikelihood(), TFumili::FitLikelihood(), TFitter::FitLikelihoodI(), TFumili::FitLikelihoodI(), Graph2DFitChisquare(), GraphFitChisquare(), GraphFitChisquareFumili(), MultiGraphFitChisquare(), TProfile::Multiply(), and TH1::Multiply().
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.
This flag can be set by a user in a fitting function. The fgRejectPoint flag is reset by the TH1 and TGraph fitting functions.
Definition at line 3367 of file TF1.cxx.
Referenced by TH1::Add(), TH1::Divide(), ROOT::Fit::DoFillData(), ROOT::Fit::FillData(), TFitter::FitChisquare(), TFumili::FitChisquare(), TFitter::FitChisquareI(), TFumili::FitChisquareI(), TFitter::FitLikelihood(), TFumili::FitLikelihood(), TFitter::FitLikelihoodI(), TFumili::FitLikelihoodI(), fline(), Graph2DFitChisquare(), GraphFitChisquare(), GraphFitChisquareFumili(), MultiGraphFitChisquare(), TProfile::Multiply(), THnBase::Multiply(), and TH1::Multiply().
Release parameter number ipar If used in a fit, the parameter can vary freely.
The parameter limits are reset to 0,0.
Definition at line 2820 of file TF1.cxx.
Referenced by TFitParametersDialog::DoParBound(), TFitParametersDialog::DoParValue(), and TFitParametersDialog::SetParameters().
Definition at line 412 of file TF1.h.
Referenced by TBinomialEfficiencyFitter::Fit(), HFit::Fit(), fit2dHist(), TLinearFitter::Graph2DLinearFitter(), TLinearFitter::GraphLinearFitter(), TLinearFitter::HistLinearFitter(), TLinearFitter::MultiGraphLinearFitter(), SetFitResult(), and TwoHistoFit2D().
|
virtual |
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}.
Definition at line 3038 of file TF1.cxx.
Referenced by combinedFit(), and exampleFit3D().
void TF1::SetFunction | ( | PtrObj & | p, |
MemFn | memFn | ||
) |
Set the maximum value along Y for this function In case the function is already drawn, set also the maximum in the helper histogram.
Definition at line 3077 of file TF1.cxx.
Referenced by TGeoPainter::DrawBatemanSol(), fitEllipseTGraphRMM(), graph2dfit(), and THistPainter::PaintFunction().
Set the minimum value along Y for this function In case the function is already drawn, set also the minimum in the helper histogram.
Definition at line 3090 of file TF1.cxx.
Referenced by TGeoPainter::DrawBatemanSol(), and THistPainter::PaintFunction().
Set the number of degrees of freedom ndf should be the number of points used in a fit - the number of free parameters.
Definition at line 3102 of file TF1.cxx.
Referenced by TBinomialEfficiencyFitter::Fit(), HFit::Fit(), fit2dHist(), SetFitResult(), TwoHistoFit2D(), and ROOT::Fit::UnBinFit().
Set the number of points used to draw the function.
The default number of points along x is 100 for 1-d functions and 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 TF1::GetRandom the minimum number of points is 4, the maximum is 10000000 for 1-d and 10000 for 2-d/3-d functions
Definition at line 3116 of file TF1.cxx.
Referenced by RooStats::BayesianCalculator::ApproximatePosterior(), ConfidenceIntervals(), TF1Editor::DoSliderXMoved(), TF1Editor::DoSliderXPressed(), TF1Editor::DoSliderXReleased(), TF1Editor::DoXPoints(), fit2a(), FittingDemo(), TKDE::GetKDEApproximateBias(), TKDE::GetKDEFunction(), TKDE::GetPDFLowerConfidenceInterval(), TKDE::GetPDFUpperConfidenceInterval(), glrose(), glsurfaces(), minuit2FitBench(), testDistrMultiDim(), unuranMulti2D(), and unuranMultiDim().
Definition at line 421 of file TF1.h.
Referenced by TBinomialEfficiencyFitter::ComputeFCN(), HFit::Fit(), TFitter::FitChisquare(), TFumili::FitChisquare(), TFitter::FitChisquareI(), TFumili::FitChisquareI(), TFitter::FitLikelihood(), TFumili::FitLikelihood(), TFitter::FitLikelihoodI(), TFumili::FitLikelihoodI(), Graph2DFitChisquare(), GraphFitChisquare(), GraphFitChisquareFumili(), MultiGraphFitChisquare(), SetFitResult(), and ROOT::Fit::UnBinFit().
Definition at line 424 of file TF1.h.
Referenced by TFitParametersDialog::DoParBound(), TFunctionParametersDialog::DoParValue(), TFitParametersDialog::DoParValue(), TFunctionParametersDialog::DoReset(), TFitParametersDialog::DoReset(), TFunctionParametersDialog::DoSlider(), TFitParametersDialog::DoSlider(), TProofBench::DrawCPU(), TProofBench::DrawDataSet(), ErrorIntegral(), FittingDemo(), FixParameter(), TKDE::GetPDFLowerConfidenceInterval(), TKDE::GetPDFUpperConfidenceInterval(), H1InitExpo(), H1InitGaus(), H1InitPolynom(), ROOT::Fit::Init2DGaus(), TMultiGraph::InitExpo(), TGraph::InitExpo(), TMultiGraph::InitGaus(), ROOT::Fit::InitGaus(), TGraph::InitGaus(), TMultiGraph::InitPolynom(), TGraph::InitPolynom(), portfolio(), TFitParametersDialog::SetParameters(), SetParameters(), SimpleFitting(), TestBinomial(), testDiscDistr(), testHisto1DFit(), testHisto1DPolFit(), testPoisson(), and testPolyFit().
Definition at line 432 of file TF1.h.
Referenced by combinedFit(), TBinomialEfficiencyFitter::ComputeFCN(), ConfidenceIntervals(), DoFit(), doFit(), TH2::DoFitSlices(), ROOT::Math::WrappedTF1::DoParameterDerivative(), ROOT::Math::WrappedMultiTF1::DoParameterDerivative(), ErrorIntegral(), exampleFit3D(), TBinomialEfficiencyFitter::Fit(), HFit::Fit(), fit2(), fit2a(), fit2dHist(), fit3DHist(), TFitter::FitChisquareI(), TFumili::FitChisquareI(), fitEllipseTGraphRMM(), fitExclude(), fithist(), TFitter::FitLikelihoodI(), TH3::FitSlicesZ(), fitSparse3D(), FittingDemo(), FitUsingRooFit(), FitUsingTFit(), FitUsingTTreeFit(), GAMinTutorial(), TFitEditor::GetFitFunction(), graph2dfit(), histgen(), ROOT::Fit::InitExpo(), InitStandardFunctions(), ROOT::TF1Helper::IntegralError(), langaufit(), multifit(), myfit(), ROOT::Math::WrappedTF1::ParameterGradient(), ROOT::Math::WrappedMultiTF1::ParameterGradient(), qa2(), ROOT::Math::WrappedTF1::SetParameters(), ROOT::Math::WrappedMultiTF1::SetParameters(), h1analysisTreeReader::Terminate(), testBinomial(), testDistr1D(), testDistrMultiDim(), testGraphFit(), testHisto1DFit(), testHisto1DPolFit(), testHisto2DFit(), testIntegPerf(), testUserFunc(), TwoHistoFit2D(), ROOT::Fit::UnBinFit(), unuranDistr(), unuranGraf(), unuranGraf2D(), unuranMulti2D(), and unuranMultiDim().
Definition at line 451 of file TF1.h.
Referenced by copyTF1(), and HFit::StoreAndDrawFitFunction().
Set error for parameter number ipar.
Definition at line 3158 of file TF1.cxx.
Referenced by TFunctionParametersDialog::DoReset(), TFitParametersDialog::DoReset(), and TestBinomial().
Set errors for all active parameters when calling this function, the array errors must have at least fNpar values.
Definition at line 3169 of file TF1.cxx.
Referenced by TBinomialEfficiencyFitter::Fit(), HFit::Fit(), fit2dHist(), TwoHistoFit2D(), and ROOT::Fit::UnBinFit().
Set limits for parameter ipar.
The specified limits will be used in a fit operation when the option "B" is specified (Bounds). To fix a parameter, use TF1::FixParameter
Definition at line 3183 of file TF1.cxx.
Referenced by TFunctionParametersDialog::DoFix(), TFitParametersDialog::DoParBound(), TFitParametersDialog::DoParFix(), TFunctionParametersDialog::DoParValue(), TFitParametersDialog::DoParValue(), TFunctionParametersDialog::DoReset(), TFitParametersDialog::DoReset(), TFunctionParametersDialog::DoSlider(), TFitParametersDialog::DoSlider(), fithist(), FixParameter(), H1InitGaus(), ROOT::Fit::Init2DGaus(), TMultiGraph::InitGaus(), ROOT::Fit::InitGaus(), TGraph::InitGaus(), langaufit(), ReleaseParameter(), TFitParametersDialog::SetParameters(), SetParameters(), and TestBinomial().
|
virtual |
Set up to 10 parameter names.
Definition at line 3147 of file TF1.cxx.
Referenced by TProofBench::AssertFittingFun(), fitEllipseTGraphRMM(), langaufit(), and myfit().
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 in TF2, and TF3.
Definition at line 3200 of file TF1.cxx.
Referenced by combinedFit(), copyTF1(), TH2::DoFitSlices(), TFunctionParametersDialog::DoOK(), TF1Editor::DoXPoints(), DrawF1(), TH3::FitSlicesZ(), TFunctionParametersDialog::RedrawFunction(), TFitParametersDialog::SetParameters(), TF2::SetRange(), SetRange(), HFit::StoreAndDrawFitFunction(), and unuranDistr().
|
virtual |
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.
Reimplemented from TNamed.
Definition at line 3227 of file TF1.cxx.
Referenced by ROOT::Internal::TF1Builder< const char * >::Build(), TGeoPainter::DrawBatemanSol(), DrawPopulation(), TKDE::GetKDEFunction(), graph2dfit(), and TF12::SetXY().
|
virtual |
Called by functions such as SetRange, SetNpx, SetParameters to force the deletion of the associated histogram or Integral.
Definition at line 3337 of file TF1.cxx.
Referenced by DoFit(), SetFitResult(), SetNormalized(), SetNpx(), TF2::SetNpy(), TF3::SetNpz(), SetParameter(), SetParameters(), TF3::SetRange(), TF2::SetRange(), and SetRange().
|
friend |
|
protected |
Integral of function binned on fNpx bins.
Definition at line 171 of file TF1.h.
Referenced by GetRandom(), and Update().
|
protected |
Array alpha. for each bin in x the deconvolution r of fIntegral.
Definition at line 172 of file TF1.h.
Referenced by GetRandom(), and Update().
|
protected |
Definition at line 163 of file TF1.h.
Referenced by Copy(), GetChisquare(), GetProb(), and SetChisquare().
|
protected |
Functor object to wrap any C++ callable object.
Definition at line 180 of file TF1.h.
Referenced by AddParameter(), ROOT::Internal::TF1Builder< const char * >::Build(), Copy(), Eval(), EvalPar(), GetExpFormula(), GetFormula(), GetLinearPart(), GetNumber(), GetParameter(), GetParameters(), GetParName(), GetParNumber(), GetVariable(), IsLinear(), IsValid(), Print(), SetParameter(), SetParameters(), SetParName(), SetParNames(), TF1(), and ~TF1().
|
protected |
Definition at line 179 of file TF1.h.
Referenced by ROOT::Internal::TF1Builder< Func >::Build(), Copy(), EvalPar(), IsValid(), Print(), and SetFunction().
Definition at line 183 of file TF1.h.
Referenced by AbsValue(), and IntegralOneDim().
Definition at line 185 of file TF1.h.
Referenced by DoInitialize().
|
protected |
Array beta. is approximated by x = alpha +beta*r *gamma*r**2.
Definition at line 173 of file TF1.h.
Referenced by GetRandom(), and Update().
|
staticprotected |
Definition at line 186 of file TF1.h.
Referenced by EvalPar(), GetCurrent(), Paint(), and SetCurrent().
Definition at line 184 of file TF1.h.
Referenced by RejectedPoint(), and RejectPoint().
|
protected |
Parent object hooking this function (if one)
Definition at line 175 of file TF1.h.
Referenced by TF2::DistancetoPrimitive(), DistancetoPrimitive(), DoCreateHistogram(), ExecuteEvent(), TF2::GetContourLevel(), GetHistogram(), TF3::Paint(), TF2::Paint(), Paint(), Print(), TF3::SetClippingBoxOff(), TF3::SetClippingBoxOn(), SetMaximum(), SetMinimum(), SetTitle(), TF12::SetXY(), Update(), and ~TF1().
|
protected |
Definition at line 170 of file TF1.h.
Referenced by GetRandom(), TF2::GetRandom2(), TF3::GetRandom3(), and Update().
|
protected |
Definition at line 165 of file TF1.h.
Referenced by Copy(), TF2::CreateHistogram(), DoCreateHistogram(), DoInitialize(), GetMaximumStored(), TF2::Paint(), Paint(), and SetMaximum().
|
protected |
Pointer to histogram used for visualisation.
Definition at line 176 of file TF1.h.
Referenced by Copy(), EvalPar(), GetMethodCall(), InitArgs(), IsValid(), operator()(), TF3::SavePrimitive(), TF2::SavePrimitive(), TF1(), and ~TF1().
|
protected |
Definition at line 164 of file TF1.h.
Referenced by Copy(), TF2::CreateHistogram(), DoCreateHistogram(), DoInitialize(), GetMinimumStored(), TF2::Paint(), Paint(), and SetMinimum().
|
protected |
|
protected |
|
protected |
Pointer to MethodCall in case of interpreted function.
Definition at line 177 of file TF1.h.
Referenced by Copy(), EvalPar(), IsEvalNormalized(), SetNormalized(), and Update().
|
protected |
|
protected |
Definition at line 157 of file TF1.h.
Referenced by ROOT::Internal::TF1Builder< Func >::Build(), ROOT::Internal::TF1Builder< const char * >::Build(), Copy(), GetNpar(), GetParLimits(), Print(), and TF1().
|
protected |
Definition at line 161 of file TF1.h.
Referenced by Copy(), GetNDF(), GetNumberFitPoints(), and SetNumberFitPoints().
|
protected |
Definition at line 159 of file TF1.h.
Referenced by Copy(), TF3::CreateHistogram(), TF2::CreateHistogram(), DoCreateHistogram(), TF3::FindMinMax(), TF2::FindMinMax(), GetMaximum(), GetMaximumX(), GetMinimum(), GetMinimumX(), GetNpx(), GetQuantiles(), GetRandom(), TF2::GetRandom2(), TF3::GetRandom3(), GetX(), TF3::Integral(), TF2::Integral(), IntegralMultiple(), TF3::Paint(), TF2::Paint(), TF3::Save(), TF2::Save(), Save(), SavePrimitive(), TF3::SetClippingBoxOff(), TF3::SetClippingBoxOn(), SetNpx(), SetSavedPoint(), and TF2::TF2().
|
protected |
Definition at line 181 of file TF1.h.
Referenced by ROOT::Internal::TF1Builder< Func >::Build(), Copy(), EvalPar(), GetParameter(), GetParameters(), GetParName(), GetParNumber(), SetParameter(), SetParameters(), SetParName(), SetParNames(), and ~TF1().
|
protected |
Array gamma.
Definition at line 174 of file TF1.h.
Referenced by Copy(), GetParent(), GetSave(), Save(), SetParent(), and ~TF1().
|
protected |
Definition at line 166 of file TF1.h.
Referenced by Copy(), GetParError(), GetParErrors(), SetFitResult(), SetParError(), SetParErrors(), and TF1().
|
protected |
Definition at line 168 of file TF1.h.
Referenced by Copy(), GetParLimits(), SetParLimits(), and TF1().
|
protected |
Definition at line 167 of file TF1.h.
Referenced by Copy(), GetParLimits(), SetParLimits(), and TF1().
|
protected |
Definition at line 169 of file TF1.h.
Referenced by Copy(), TF3::GetSave(), TF2::GetSave(), GetSave(), IsValid(), Print(), TF3::Save(), TF2::Save(), Save(), and SetSavedPoint().
|
protected |
Definition at line 160 of file TF1.h.
Referenced by ROOT::Internal::TF1Builder< Func >::Build(), ROOT::Internal::TF1Builder< const char * >::Build(), Copy(), Eval(), EvalPar(), Print(), SavePrimitive(), and SetFunction().
|
protected |
Definition at line 156 of file TF1.h.
Referenced by Copy(), TF3::CreateHistogram(), TF2::CreateHistogram(), CreateHistogram(), TF2::DistancetoPrimitive(), DistancetoPrimitive(), TF3::FindMinMax(), TF2::FindMinMax(), GetMaximum(), GetMaximumX(), GetMinimum(), GetMinimumX(), TF2::GetObjectInfo(), GetRandom(), TF2::GetRandom2(), TF3::GetRandom3(), TF3::GetRange(), TF2::GetRange(), GetRange(), GetX(), GetXmax(), TF3::IsInside(), TF2::IsInside(), IsInside(), TF3::Paint(), TF2::Paint(), Paint(), TF3::Save(), TF2::Save(), Save(), TF3::SavePrimitive(), TF2::SavePrimitive(), SavePrimitive(), TF3::SetClippingBoxOff(), TF3::SetClippingBoxOn(), TF3::SetRange(), TF2::SetRange(), SetRange(), TF1(), TF12::TF12(), and Update().
|
protected |
Definition at line 155 of file TF1.h.
Referenced by Copy(), TF3::CreateHistogram(), TF2::CreateHistogram(), CreateHistogram(), TF2::DistancetoPrimitive(), DistancetoPrimitive(), TF3::FindMinMax(), TF2::FindMinMax(), GetMaximum(), GetMaximumX(), GetMinimum(), GetMinimumX(), TF2::GetObjectInfo(), GetRandom(), TF2::GetRandom2(), TF3::GetRandom3(), TF3::GetRange(), TF2::GetRange(), GetRange(), GetX(), GetXmin(), TF3::IsInside(), TF2::IsInside(), IsInside(), TF3::Paint(), TF2::Paint(), Paint(), TF3::Save(), TF2::Save(), Save(), TF3::SavePrimitive(), TF2::SavePrimitive(), SavePrimitive(), TF3::SetClippingBoxOff(), TF3::SetClippingBoxOn(), TF3::SetRange(), TF2::SetRange(), SetRange(), TF1(), TF12::TF12(), and Update().