17using namespace CurveFitting;
52 const HistogramData::HistogramE &errors)
const {
53 std::vector<double> result(
ySpace().size());
54 const double amplitude = 1.0;
56 std::transform(result.begin(), result.end(), errors.begin(), result.begin(), std::divides<double>());
86 const auto &yspace =
ySpace();
88 std::vector<double> voigt(yspace.size()), voigtDiffResult(yspace.size());
93 const auto &modq =
modQ();
94 const auto &ei =
e0();
95 if (modq.empty() || ei.empty()) {
96 throw std::runtime_error(
"The Q values or e0 values have not been set");
99 for (
size_t j = 0; j < nData; ++j) {
100 const double q = modq[j];
101 const double prefactor =
mass() * std::pow(ei[j], 0.1) / q;
102 result[j] = prefactor * (voigt[j] - std::pow(gaussWidth, 4.0) * voigtDiffResult[j] / (3.0 * q));
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
size_t parameterIndex(const std::string &name) const override
Returns the index of parameter name.
void declareParameter(const std::string &name, double initValue=0, const std::string &description="") override
Declare a new parameter.
double getParameter(size_t i) const override
Get i-th parameter.
This class serves as a base-class for ComptonProfile type functions.
const std::vector< double > & modQ() const
Access Q values cache.
double mass() const
Access the mass.
void declareParameters() override
Declare parameters that will never participate in the fit.
std::shared_ptr< VesuvioResolution > m_resolutionFunction
Vesuvio resolution function.
void voigtApproxDiff(std::vector< double > &voigtDiff, const std::vector< double > &yspace, const double lorentzPos, const double lorentzAmp, const double lorentzWidth, const double gaussWidth) const
Compute Voigt function interpolated around the given values.
const std::vector< double > & ySpace() const
Access y-values cache.
const std::vector< double > & e0() const
Access e0 values.
Implements a function to calculate the Compton profile of a nucleus using a Gaussian approximation co...
std::string name() const override
A string identifier for this function.
void massProfile(double *result, const size_t nData) const override
Compute the function.
std::vector< size_t > intensityParameterIndices() const override
Returns the indices of the intensity parameters.
size_t fillConstraintMatrix(Kernel::DblMatrix &cmatrix, const size_t start, const HistogramData::HistogramE &errors) const override
Fill in the columns of the matrix for this mass.
void declareParameters() override
Declare the function parameters.
void setColumn(const size_t nCol, const std::vector< T > &newCol)
const double STDDEV_TO_HWHM