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#include "MantidKernel/Logger.h"
16
17namespace Mantid {
18namespace CurveFitting {
19namespace Algorithms {
20//---------------------------------------------------------------------------
21// Forward declarations
22//---------------------------------------------------------------------------
23struct DetectorParams;
24} // namespace Algorithms
25
26namespace Functions {
31class MANTID_CURVEFITTING_DLL ComptonProfile : public API::ParamFunction, public API::IFunction1D {
32public:
35
39 void function1D(double *out, const double *xValues, const size_t nData) const override;
41 void setUpForFit() override;
43 void setMatrixWorkspace(std::shared_ptr<const API::MatrixWorkspace> workspace, size_t wsIndex, double startX,
44 double endX) override;
45
48 void buildCaches();
49
51 void cacheYSpaceValues(const HistogramData::Points &tseconds, const Algorithms::DetectorParams &detpar,
52 const ResolutionParams &respar);
53
55 virtual void cacheYSpaceValues(const HistogramData::Points &tseconds, const Algorithms::DetectorParams &detpar);
57 void disableLogging() { m_log.setEnabled(false); }
59
62 virtual void massProfile(double *result, const size_t nData) const = 0;
64 virtual std::vector<size_t> intensityParameterIndices() const = 0;
67 virtual size_t fillConstraintMatrix(Kernel::DblMatrix &cmatrix, const size_t start,
68 const HistogramData::HistogramE &errors) const = 0;
69
70 void setParameter(size_t i, const double &value, bool explicitlySet = true) override;
71
72 void setParameter(const std::string &name, const double &value, bool explicitlySet = true) override {
73 ParamFunction::setParameter(name, value, explicitlySet);
74 }
75
76protected:
78 void declareParameters() override;
79
81 inline const std::vector<double> &ySpace() const { return m_yspace; }
83 inline const std::vector<double> &modQ() const { return m_modQ; }
85 inline const std::vector<double> &e0() const { return m_e0; }
87 inline double mass() const { return m_mass; }
88
90 void voigtApproxDiff(std::vector<double> &voigtDiff, const std::vector<double> &yspace, const double lorentzPos,
91 const double lorentzAmp, const double lorentzWidth, const double gaussWidth) const;
93 void voigtApprox(std::vector<double> &voigt, const std::vector<double> &yspace, const double lorentzPos,
94 const double lorentzAmp, const double lorentzWidth, const double gaussWidth) const;
95
96protected:
99
101 std::shared_ptr<const API::MatrixWorkspace> m_workspace;
103 size_t m_wsIndex;
104
105 double m_startX;
106 double m_endX;
107
109 std::shared_ptr<API::IPeakFunction> m_voigt;
111 std::shared_ptr<VesuvioResolution> m_resolutionFunction;
112
116 std::vector<double> m_yspace;
118 std::vector<double> m_modQ;
120 std::vector<double> m_e0;
122 double m_mass;
124};
125
126} // namespace Functions
127} // namespace CurveFitting
128} // namespace Mantid
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
IPeaksWorkspace_sptr workspace
This is a specialization of IFunction for functions of one real argument.
Definition IFunction1D.h:42
Implements the part of IFunction interface dealing with parameters.
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:51
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...