14#include "MantidCurveFitting/DllConfig.h"
19#include <gsl/gsl_sf_erf.h>
22namespace CurveFitting {
31 void function1D(
double *out,
const double *xValues,
const size_t nData)
const override;
34 std::string
name()
const override {
return "ThermalNeutronDtoTOFFunction"; }
37 const std::string
category()
const override {
return "General"; }
40 void function1D(std::vector<double> &out,
const std::vector<double> &xValues)
const;
48 inline double corefunction(
double dh,
double dtt1,
double dtt1t,
double dtt2t,
double zero,
double zerot,
49 double width,
double tcross)
const;
52 void functionDerivLocal(
API::Jacobian *,
const double *,
const size_t);
59 void functionDeriv1D(
API::Jacobian *out,
const double *xValues,
const size_t nData)
override;
68inline double calThermalNeutronTOF(
double dh,
double dtt1,
double dtt1t,
double dtt2t,
double zero,
double zerot,
69 double width,
double tcross) {
70 double n = 0.5 * gsl_sf_erfc(width * (tcross - 1 / dh));
71 double Th_e = zero + dtt1 * dh;
72 double Th_t = zerot + dtt1t * dh - dtt2t / dh;
73 double tof_h =
n * Th_e + (1 -
n) * Th_t;
This is a specialization of IFunction for functions of one real argument.
Represents the Jacobian in IFitFunction::functionDeriv.
Implements the part of IFunction interface dealing with parameters.
ThermalNeutronDtoTOFFunction : TODO: DESCRIPTION.
const std::string category() const override
Overwrite IFunction.
std::string name() const override
overwrite IFunction base class methods
double corefunction(double dh, double dtt1, double dtt1t, double dtt2t, double zero, double zerot, double width, double tcross) const
Core function (inline) to calcualte TOF_h from d-spacing.
double calThermalNeutronTOF(double dh, double dtt1, double dtt1t, double dtt2t, double zero, double zerot, double width, double tcross)
Calcualte TOF from d-spacing value for thermal neutron.
std::shared_ptr< ThermalNeutronDtoTOFFunction > ThermalNeutronDtoTOFFunction_sptr
Helper class which provides the Collimation Length for SANS instruments.