Mantid
Loading...
Searching...
No Matches
ConvTempCorrection.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7
10#include <cmath>
11
12namespace {
13// Conversion factor from meV to K
14constexpr double CONVERSIONFACTOR = 11.606;
15} // namespace
16
18
19DECLARE_FUNCTION(ConvTempCorrection)
20
21void ConvTempCorrection::init() { declareParameter("Temperature", 300.0, "Temperature correction value (K)"); }
22
23void ConvTempCorrection::function1D(double *out, const double *xValues, const size_t nData) const {
24 const double T = getParameter("Temperature");
25 for (size_t i = 0; i < nData; ++i) {
26 double x = xValues[i];
27 if (x == 0.0) {
28 out[i] = 1.00;
29 } else {
30 out[i] = (x * CONVERSIONFACTOR) / T / (1 - exp(-((x * CONVERSIONFACTOR) / T)));
31 }
32 }
33}
34} // namespace Mantid::CurveFitting::Functions
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
double getParameter(size_t i) const override
Get i-th parameter.
Temperature correction used in the convolution fitting tab within the IDA GUI.
void function1D(double *out, const double *xValues, const size_t nData) const override
Function you want to fit to.