Mantid
Loading...
Searching...
No Matches
ComptonProfile.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2013 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#pragma once
8
12#include "MantidCurveFitting/DllConfig.h"
14#include "MantidHistogramData/Histogram.h"
15
16namespace Mantid {
17namespace CurveFitting {
18namespace Algorithms {
19//---------------------------------------------------------------------------
20// Forward declarations
21//---------------------------------------------------------------------------
22struct DetectorParams;
23} // namespace Algorithms
24
25namespace Functions {
30class MANTID_CURVEFITTING_DLL ComptonProfile : public API::ParamFunction, public API::IFunction1D {
31public:
34
38 void function1D(double *out, const double *xValues, const size_t nData) const override;
40 void setUpForFit() override;
42 void setMatrixWorkspace(std::shared_ptr<const API::MatrixWorkspace> workspace, size_t wsIndex, double startX,
43 double endX) override;
44
47 void buildCaches();
48
50 void cacheYSpaceValues(const HistogramData::Points &tseconds, const Algorithms::DetectorParams &detpar,
51 const ResolutionParams &respar);
52
54 virtual void cacheYSpaceValues(const HistogramData::Points &tseconds, const Algorithms::DetectorParams &detpar);
56 void disableLogging() { m_log.setEnabled(false); }
58
61 virtual void massProfile(double *result, const size_t nData) const = 0;
63 virtual std::vector<size_t> intensityParameterIndices() const = 0;
66 virtual size_t fillConstraintMatrix(Kernel::DblMatrix &cmatrix, const size_t start,
67 const HistogramData::HistogramE &errors) const = 0;
68
69 void setParameter(size_t i, const double &value, bool explicitlySet = true) override;
70
71 void setParameter(const std::string &name, const double &value, bool explicitlySet = true) override {
72 ParamFunction::setParameter(name, value, explicitlySet);
73 }
74
75protected:
77 void declareParameters() override;
78
80 inline const std::vector<double> &ySpace() const { return m_yspace; }
82 inline const std::vector<double> &modQ() const { return m_modQ; }
84 inline const std::vector<double> &e0() const { return m_e0; }
86 inline double mass() const { return m_mass; }
87
89 void voigtApproxDiff(std::vector<double> &voigtDiff, const std::vector<double> &yspace, const double lorentzPos,
90 const double lorentzAmp, const double lorentzWidth, const double gaussWidth) const;
92 void voigtApprox(std::vector<double> &voigt, const std::vector<double> &yspace, const double lorentzPos,
93 const double lorentzAmp, const double lorentzWidth, const double gaussWidth) const;
94
95protected:
98
100 std::shared_ptr<const API::MatrixWorkspace> m_workspace;
102 size_t m_wsIndex;
103
104 double m_startX;
105 double m_endX;
106
108 std::shared_ptr<API::IPeakFunction> m_voigt;
110 std::shared_ptr<VesuvioResolution> m_resolutionFunction;
111
115 std::vector<double> m_yspace;
117 std::vector<double> m_modQ;
119 std::vector<double> m_e0;
121 double m_mass;
123};
124
125} // namespace Functions
126} // namespace CurveFitting
127} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
This is a specialization of IFunction for functions of one real argument.
Definition: IFunction1D.h:43
Implements the part of IFunction interface dealing with parameters.
Definition: ParamFunction.h:33
This class serves as a base-class for ComptonProfile type functions.
virtual void massProfile(double *result, const size_t nData) const =0
Override to calculate the value of the profile for this mass and store in the given array.
virtual size_t fillConstraintMatrix(Kernel::DblMatrix &cmatrix, const size_t start, const HistogramData::HistogramE &errors) const =0
Fill the appropriate columns of the given matrix with the values of the mass profile.
const std::vector< double > & modQ() const
Access Q values cache.
std::vector< double > m_e0
Incident energies.
std::shared_ptr< const API::MatrixWorkspace > m_workspace
Current workspace.
virtual std::vector< size_t > intensityParameterIndices() const =0
Returns the indices of the intensity parameters.
std::shared_ptr< VesuvioResolution > m_resolutionFunction
Vesuvio resolution function.
std::shared_ptr< API::IPeakFunction > m_voigt
Voigt function.
const std::vector< double > & ySpace() const
Access y-values cache.
void voigtApprox(std::vector< double > &voigt, const std::vector< double > &yspace, const double lorentzPos, const double lorentzAmp, const double lorentzWidth, const double gaussWidth) const
Compute Voigt function.
void setParameter(const std::string &name, const double &value, bool explicitlySet=true) override
Set parameter by name.
const std::vector< double > & e0() const
Access e0 values.
size_t m_wsIndex
Current workspace index, required to access instrument parameters.
The Logger class is in charge of the publishing messages from the framework through various channels.
Definition: Logger.h:52
Helper class which provides the Collimation Length for SANS instruments.
Simple data structure to store nominal detector values It avoids some functions taking a huge number ...
Simple data structure to store resolution parameter values It avoids some functions taking a huge num...