1 #ifndef _Q_MATH_FUNCTION_
2 #define _Q_MATH_FUNCTION_
9 #include <gsl/gsl_math.h>
42 void SetParameter(
unsigned int p,
const char* name,
double val);
60 double Eval(
double x,
double* params)
const {
return (*
fRoutine)(x,params);}
69 virtual void SetTF1(TF1& tf1);
#define Q_BEGIN_NAMESPACE
double min(const Diana::QVector &v)
error class with error type and description
generic C++ interface on static functions
size_t fNParameters
number of parameters
virtual void Print()
print parameters and names if set
QMathFunction(QRoutinePointer funcpointer, unsigned int NParameters, double LowBound, double UpBound)
constructor
gsl_function GetGSLFunction()
return a gsl function
size_t GetNParameters() const
get number of parameters
const double * GetParameters() const
pointer to array of parameters
const QMathFunction & operator=(const QMathFunction &func)
operator=
QError GetMinimum(double &min, double &minpos, double epsabs=0.001, double epsrel=0.0)
get function minimum
double fUpBound
high function bound
void SetParameter(unsigned int p, double val)
set parameter value
QError GetMaximum(double &max, double &maxpos, double epsabs=0.001, double epsrel=0.0)
get function maximum
double Eval(double x) const
evaluate function
void SetParameters(const double *param)
set all parameters from an array that has to be well sized
virtual ~QMathFunction()
destructor
void SetParName(unsigned int p, const char *name)
set parameter name
std::vector< const char * > fParNames
parameters names
void SetVerbose(bool verbose=true)
set verbose
QRoutinePointer fRoutine
pointer to the underlying static function
double fLowBound
low function bound
double GetParameter(unsigned int p) const
get parameter
double(* QRoutinePointer)(double, double *params)
pointer to function
double * fParameters
array of parameters
double Eval(double x, double *params) const
evaluate function with external parameters
virtual void SetTF1(TF1 &tf1)
set parameters from ROOT TF1
find maximum and minimum of a QMathFunction, the minimum search stops when |a - b| < epsabs + epsrel ...