ROOT  6.06/09
Reference Guide
Public Types | Public Member Functions | List of all members
ROOT::Math::WrappedTF1 Class Reference

Class to Wrap a ROOT Function class (like TF1) in a IParamFunction interface of one dimensions to be used in the ROOT::Math numerical algorithms The wrapper does not own bby default the TF1 pointer, so it assumes it exists during the wrapper lifetime.

The class from ROOT version 6.03 does not contain anymore a copy of the parameters. The parameters are stored in the TF1 class.

Definition at line 41 of file WrappedTF1.h.

Public Types

typedef ROOT::Math::IGradientOneDim IGrad
 
typedef ROOT::Math::IParamGradFunction BaseGradFunc
 
typedef ROOT::Math::IParamGradFunction::BaseFunc BaseFunc
 
- Public Types inherited from ROOT::Math::IParametricGradFunctionOneDim
typedef IParametricFunctionOneDim BaseParamFunc
 
typedef IGradientFunctionOneDim BaseGradFunc
 
typedef IParametricFunctionOneDim::BaseFunc BaseFunc
 
- Public Types inherited from ROOT::Math::IParametricFunctionOneDim
typedef IBaseFunctionOneDim BaseFunc
 
- Public Types inherited from ROOT::Math::IBaseFunctionOneDim
typedef IBaseFunctionOneDim BaseFunc
 

Public Member Functions

 WrappedTF1 (TF1 &f)
 constructor from a TF1 function pointer. More...
 
virtual ~WrappedTF1 ()
 Destructor (no operations). More...
 
 WrappedTF1 (const WrappedTF1 &rhs)
 Copy constructor. More...
 
WrappedTF1operator= (const WrappedTF1 &rhs)
 Assignment operator. More...
 
interface inherited from IFunction
ROOT::Math::IGenFunctionClone () const
 Clone the wrapper but not the original function. More...
 
- Public Member Functions inherited from ROOT::Math::IParametricGradFunctionOneDim
virtual ~IParametricGradFunctionOneDim ()
 Virtual Destructor (no operations) More...
 
void ParameterGradient (double x, double *grad) const
 Evaluate all derivatives using cached parameter values. More...
 
void ParameterGradient (const double *x, const double *p, double *grad) const
 Compatibility interface with multi-dimensional functions. More...
 
void ParameterGradient (const double *x, double *grad) const
 Evaluate all derivatives using cached parameter values (multi-dim like interface) More...
 
double ParameterDerivative (double x, const double *p, unsigned int ipar=0) const
 Partial derivative with respect a parameter. More...
 
double ParameterDerivative (double x, unsigned int ipar=0) const
 Evaluate partial derivative using cached parameter values. More...
 
double ParameterDerivative (const double *x, const double *p, unsigned int ipar=0) const
 Partial derivative with respect a parameter Compatibility interface with multi-dimensional functions. More...
 
double ParameterDerivative (const double *x, unsigned int ipar=0) const
 Evaluate partial derivative using cached parameter values (multi-dim like interface) More...
 
- Public Member Functions inherited from ROOT::Math::IParametricFunctionOneDim
double operator() (double x, const double *p) const
 Evaluate function at a point x and for given parameters p. More...
 
double operator() (const double *x, const double *p) const
 multidim-like interface More...
 
- Public Member Functions inherited from ROOT::Math::IBaseFunctionOneDim
 IBaseFunctionOneDim ()
 
virtual ~IBaseFunctionOneDim ()
 virtual destructor More...
 
double operator() (double x) const
 Evaluate the function at a point x Use the a pure virtual private method DoEval which must be implemented by sub-classes. More...
 
double operator() (const double *x) const
 Evaluate the function at a point x[]. More...
 
- Public Member Functions inherited from ROOT::Math::IBaseParam
virtual ~IBaseParam ()
 Virtual Destructor (no operations) More...
 
- Public Member Functions inherited from ROOT::Math::IGradientOneDim
virtual ~IGradientOneDim ()
 virtual destructor More...
 
double Derivative (double x) const
 Return the derivative of the function at a point x Use the private method DoDerivative. More...
 
double Derivative (const double *x) const
 Compatibility method with multi-dimensional interface for partial derivative. More...
 
void Gradient (const double *x, double *g) const
 Compatibility method with multi-dimensional interface for Gradient. More...
 
void FdF (const double *x, double &f, double *df) const
 Compatibility method with multi-dimensional interface for Gradient and function evaluation. More...
 

interface inherited from IParamFunction

bool fLinear
 
bool fPolynomial
 
TF1fFunc
 
double fX [1]
 
static double fgEps = 0.001
 cached vector for x value (needed for TF1::EvalPar signature) More...
 
const doubleParameters () const
 get the parameter values (return values cachen inside, those inside TF1 might be different) More...
 
void SetParameters (const double *p)
 set parameter values More...
 
unsigned int NPar () const
 return number of parameters More...
 
std::string ParameterName (unsigned int i) const
 return parameter name (this is stored in TF1) More...
 
void ParameterGradient (double x, const double *par, double *grad) const
 evaluate the derivative of the function with respect to the parameters More...
 
void FdF (double x, double &f, double &deriv) const
 calculate function and derivative at same time (required by IGradient interface) More...
 
static void SetDerivPrecision (double eps)
 precision value used for calculating the derivative step-size h = eps * |x|. More...
 
static double GetDerivPrecision ()
 get precision value used for calculating the derivative step-size More...
 
double DoEvalPar (double x, const double *p) const
 evaluate function passing coordinates x and vector of parameters More...
 
double DoEval (double x) const
 evaluate function using the cached parameter values (of TF1) re-implement for better efficiency More...
 
double DoDerivative (double x) const
 return the function derivatives w.r.t. x More...
 
double DoParameterDerivative (double x, const double *p, unsigned int ipar) const
 evaluate the derivative of the function with respect to the parameters More...
 

#include <Math/WrappedTF1.h>

+ Inheritance diagram for ROOT::Math::WrappedTF1:
+ Collaboration diagram for ROOT::Math::WrappedTF1:

Member Typedef Documentation

Definition at line 47 of file WrappedTF1.h.

Definition at line 46 of file WrappedTF1.h.

Definition at line 45 of file WrappedTF1.h.

Constructor & Destructor Documentation

ROOT::Math::WrappedTF1::WrappedTF1 ( TF1 f)

constructor from a TF1 function pointer.

Definition at line 29 of file WrappedTF1.cxx.

Referenced by Clone().

virtual ROOT::Math::WrappedTF1::~WrappedTF1 ( )
inlinevirtual

Destructor (no operations).

TF1 Function pointer is not owned

Definition at line 58 of file WrappedTF1.h.

ROOT::Math::WrappedTF1::WrappedTF1 ( const WrappedTF1 rhs)

Copy constructor.

Definition at line 57 of file WrappedTF1.cxx.

Member Function Documentation

ROOT::Math::IGenFunction* ROOT::Math::WrappedTF1::Clone ( ) const
inlinevirtual

Clone the wrapper but not the original function.

Implements ROOT::Math::IBaseFunctionOneDim.

Definition at line 75 of file WrappedTF1.h.

double ROOT::Math::WrappedTF1::DoDerivative ( double  x) const
privatevirtual

return the function derivatives w.r.t. x

Implements ROOT::Math::IGradientOneDim.

Definition at line 97 of file WrappedTF1.cxx.

Referenced by FdF().

double ROOT::Math::WrappedTF1::DoEval ( double  x) const
inlineprivatevirtual

evaluate function using the cached parameter values (of TF1) re-implement for better efficiency

Reimplemented from ROOT::Math::IParametricFunctionOneDim.

Definition at line 137 of file WrappedTF1.h.

Referenced by FdF().

double ROOT::Math::WrappedTF1::DoEvalPar ( double  x,
const double p 
) const
inlineprivatevirtual

evaluate function passing coordinates x and vector of parameters

Implements ROOT::Math::IParametricFunctionOneDim.

Definition at line 129 of file WrappedTF1.h.

double ROOT::Math::WrappedTF1::DoParameterDerivative ( double  x,
const double p,
unsigned int  ipar 
) const
privatevirtual

evaluate the derivative of the function with respect to the parameters

Implements ROOT::Math::IParametricGradFunctionOneDim.

Definition at line 105 of file WrappedTF1.cxx.

Referenced by ParameterGradient().

void ROOT::Math::WrappedTF1::FdF ( double  x,
double f,
double deriv 
) const
inlinevirtual

calculate function and derivative at same time (required by IGradient interface)

Implements ROOT::Math::IGradientOneDim.

Definition at line 113 of file WrappedTF1.h.

double ROOT::Math::WrappedTF1::GetDerivPrecision ( )
static

get precision value used for calculating the derivative step-size

Definition at line 131 of file WrappedTF1.cxx.

unsigned int ROOT::Math::WrappedTF1::NPar ( ) const
inlinevirtual

return number of parameters

Implements ROOT::Math::IBaseParam.

Definition at line 96 of file WrappedTF1.h.

Referenced by ParameterGradient().

WrappedTF1 & ROOT::Math::WrappedTF1::operator= ( const WrappedTF1 rhs)

Assignment operator.

Definition at line 71 of file WrappedTF1.cxx.

void ROOT::Math::WrappedTF1::ParameterGradient ( double  x,
const double par,
double grad 
) const
virtual

evaluate the derivative of the function with respect to the parameters

Reimplemented from ROOT::Math::IParametricGradFunctionOneDim.

Definition at line 82 of file WrappedTF1.cxx.

std::string ROOT::Math::WrappedTF1::ParameterName ( unsigned int  i) const
inlinevirtual

return parameter name (this is stored in TF1)

Reimplemented from ROOT::Math::IBaseParam.

Definition at line 102 of file WrappedTF1.h.

const double* ROOT::Math::WrappedTF1::Parameters ( ) const
inlinevirtual

get the parameter values (return values cachen inside, those inside TF1 might be different)

Implements ROOT::Math::IBaseParam.

Definition at line 83 of file WrappedTF1.h.

void ROOT::Math::WrappedTF1::SetDerivPrecision ( double  eps)
static

precision value used for calculating the derivative step-size h = eps * |x|.

The default is 0.001, give a smaller in case function changes rapidly

Definition at line 129 of file WrappedTF1.cxx.

void ROOT::Math::WrappedTF1::SetParameters ( const double p)
inlinevirtual

set parameter values

need to call also SetParameters in TF1 in ace some other operations (re-normalizations) are needed

Implements ROOT::Math::IBaseParam.

Definition at line 90 of file WrappedTF1.h.

Referenced by TF1::Derivative(), TF1::Derivative2(), TF1::Derivative3(), TF1::IntegralFast(), and testHisto1DPolFit().

Member Data Documentation

TF1* ROOT::Math::WrappedTF1::fFunc
private
double ROOT::Math::WrappedTF1::fgEps = 0.001
staticprivate

cached vector for x value (needed for TF1::EvalPar signature)

Definition at line 157 of file WrappedTF1.h.

Referenced by DoDerivative(), DoParameterDerivative(), GetDerivPrecision(), ParameterGradient(), and SetDerivPrecision().

bool ROOT::Math::WrappedTF1::fLinear
private

Definition at line 151 of file WrappedTF1.h.

Referenced by DoParameterDerivative(), operator=(), ParameterGradient(), and WrappedTF1().

bool ROOT::Math::WrappedTF1::fPolynomial
private

Definition at line 152 of file WrappedTF1.h.

Referenced by DoParameterDerivative(), operator=(), and WrappedTF1().

double ROOT::Math::WrappedTF1::fX[1]
mutableprivate

Definition at line 154 of file WrappedTF1.h.

Referenced by DoEval(), DoEvalPar(), DoParameterDerivative(), operator=(), and WrappedTF1().


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