10 #ifndef MN_GaussianModelFunction_H_ 11 #define MN_GaussianModelFunction_H_ 13 #define _USE_MATH_DEFINES 76 std::vector<double> param;
94 assert(params.size() == 1);
120 assert(x.size() == 3);
147 double operator()(
const std::vector<double>&
x,
const std::vector<double>& param)
const {
149 assert(param.size() == 1);
150 assert(x.size() == 3);
151 return x[2]*
exp(-0.5*(param[0]-x[0])*(param[0]-x[0])/(x[1]*x[1]))/(
sqrt(2.*
M_PI)*
fabs(x[1]));
163 virtual double Up()
const {
return 1.0; }
171 assert(param.size() == 1);
172 std::vector<double> grad(x.size());
174 double y = (param[0]-x[0])/x[1];
178 grad[0] = y/(x[1])*gaus*x[2];
179 grad[1] = x[2]*gaus*( y*y - 1.0)/x[1];
195 #endif // MN_GaussianModelFunction_H_ virtual void SetParameters(const std::vector< double > ¶ms) const
Sets the parameters of the ParametricFunction.
Namespace for new ROOT classes and functions.
virtual double Up() const
THAT SHOULD BE REMOVED, IT IS ONLY HERE, BECAUSE AT PRESENT FOR GRADIENT CALCULATION ONE NEEDS TO INH...
double operator()(const std::vector< double > &x) const
Calculates the Gaussian as a function of the given input.
virtual const std::vector< double > & GetParameters() const
Accessor for the state of the parameters.
std::vector< double > GetGradient(const std::vector< double > &x) const
Member function returning the Gradient of the function with respect to its variables (but without inc...
Sample implementation of a parametric function.
GaussianModelFunction(const std::vector< double > ¶ms)
Constructor which initializes the ParametricFunction with the parameters given as input...
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Function which has parameters.
double operator()(const std::vector< double > &x, const std::vector< double > ¶m) const
Calculates the Gaussian as a function of the given input.
std::vector< double > par
The vector containing the parameters of the function It is mutable for "historical reasons" as in the...
GaussianModelFunction()
Constructor which initializes the normalized Gaussian with x = 0.0.