15using namespace CurveFitting;
23 declareParameter(
"A0", 0.0,
"Coefficient for constant term");
24 declareParameter(
"A1", 0.0,
"Coefficient for linear term");
25 declareParameter(
"A2", 0.0,
"Coefficient for quadratic term");
26 declareParameter(
"Height", 1.0,
"Height");
27 declareParameter(
"Lifetime", 1.0,
"Lifetime");
43 for (
size_t i = 0; i < nData; i++) {
44 double x = xValues[i];
45 double expComponent = Height * std::exp(-
x / Lifetime);
46 double linearComponent = (A1 *
x) + A0;
48 out->
set(i, 0, ((A2 *
x *
x) + (A1 *
x)) * expComponent);
49 out->
set(i, 1, ((A2 *
x *
x) +
x + A0) * expComponent);
50 out->
set(i, 2, ((
x *
x) + (A1 *
x) + A0) * expComponent);
51 out->
set(i, 3, linearComponent * expComponent / Height);
52 out->
set(i, 4, linearComponent * expComponent *
x / (Lifetime * Lifetime));
69 for (
size_t i = 0; i < nData; ++i) {
70 out[i] = (A0 + (A1 * xValues[i]) + (A2 * xValues[i] * xValues[i])) * Height * std::exp(-xValues[i] / Lifetime);
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
Represents the Jacobian in IFitFunction::functionDeriv.
virtual void set(size_t iY, size_t iP, double value)=0
Set a value to a Jacobian matrix element.
double getParameter(size_t i) const override
Get i-th parameter.
ProductQuadraticExp : Function that evauates the product of an exponential and quadratic function.
void function1D(double *out, const double *xValues, const size_t nData) const override
Evaluate the 1D function.
void functionDeriv1D(API::Jacobian *out, const double *xValues, const size_t nData) override
Calculate the 1D function derivatives.