Mantid
Loading...
Searching...
No Matches
GeneratePeaks.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 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
14#include "MantidAlgorithms/DllConfig.h"
17
18namespace Mantid {
19namespace Algorithms {
20
26class MANTID_ALGORITHMS_DLL GeneratePeaks final : public API::Algorithm {
27public:
29
31 const std::string name() const override { return "GeneratePeaks"; }
33 const std::string summary() const override {
34 return "Generate peaks in an output workspace according to a "
35 "TableWorkspace containing a list of peak's parameters.";
36 }
37
39 int version() const override { return 1; }
40 const std::vector<std::string> seeAlso() const override { return {"FindPeaks", "MatchPeaks"}; }
42 const std::string category() const override { return "Crystal\\Peaks"; }
43
44private:
45 void init() override;
46
48 void exec() override;
49
51 void processAlgProperties(std::string &peakfunctype, std::string &bkgdfunctype);
52
54 void processTableColumnNames();
55
56 void importPeaksFromTable(std::map<specnum_t, std::vector<std::pair<double, API::IFunction_sptr>>> &functionmap);
57
59 void importPeakFromVector(std::vector<std::pair<double, API::IFunction_sptr>> &functionmap);
60
62 void generatePeaks(const std::map<specnum_t, std::vector<std::pair<double, API::IFunction_sptr>>> &functionmap,
63 const API::MatrixWorkspace_sptr &dataWS);
64
66 bool hasParameter(const API::IFunction_sptr &function, const std::string &paramname);
67
69 API::MatrixWorkspace_sptr createOutputWorkspace();
70
71 API::MatrixWorkspace_sptr createDataWorkspace(std::vector<double> binparameters);
72
73 void createFunction(std::string &peaktype, std::string &bkgdtype);
74
75 void getSpectraSet(const DataObjects::TableWorkspace_const_sptr &peakParmsWS);
76
78 API::IPeakFunction_sptr getPeakFunction(const API::IFunction_sptr &infunction);
79
81 std::vector<std::string> addFunctionParameterNames(const std::vector<std::string> &funcnames);
82
85
88
90 std::vector<double> m_vecPeakParamValues;
92 std::vector<double> m_vecBkgdParamValues;
93
95 std::map<specnum_t, specnum_t> m_SpectrumMap;
96
99 std::set<specnum_t> m_spectraSet;
100
103
106
109
112
114 std::vector<double> binParameters;
115
118
121
123 double m_maxChi2;
124
127
129 std::vector<std::string> m_funcParameterNames;
130
132 int i_height, i_centre, i_width, i_a0, i_a1, i_a2;
133
136
139};
140
141} // namespace Algorithms
142} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
GeneratePeaks : Generate peaks from a table workspace containing peak parameters.
Definition: GeneratePeaks.h:26
API::IBackgroundFunction_sptr m_bkgdFunction
Background function.
Definition: GeneratePeaks.h:87
std::set< specnum_t > m_spectraSet
Set of spectra (workspace indexes) in the original workspace that contain peaks to generate.
Definition: GeneratePeaks.h:99
int m_wsIndex
Spectrum if only 1 peak is to plot.
const std::string summary() const override
Summary of algorithms purpose.
Definition: GeneratePeaks.h:33
std::vector< double > m_vecPeakParamValues
Definition: GeneratePeaks.h:90
bool m_useFuncParamWS
Flag to use parameter table workspace.
std::map< specnum_t, specnum_t > m_SpectrumMap
Spectrum map from full spectra workspace to partial spectra workspace.
Definition: GeneratePeaks.h:95
API::MatrixWorkspace_const_sptr inputWS
Input workspace (optional)
double m_maxChi2
Maximum chi-square to have peak generated.
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
Definition: GeneratePeaks.h:42
std::vector< std::string > m_funcParameterNames
List of functions' parameters naems.
bool m_useRawParameter
Flag to indicate parameter table workspace containing raw parameters names.
std::vector< double > binParameters
Binning parameters.
API::IPeakFunction_sptr m_peakFunction
Peak function.
Definition: GeneratePeaks.h:84
bool m_newWSFromParent
Flag whether the new workspace is exactly as input.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition: GeneratePeaks.h:40
bool m_useAutoBkgd
Flag to use automatic background (???)
bool m_genBackground
Flag to generate background.
int version() const override
Algorithm's version for identification overriding a virtual method.
Definition: GeneratePeaks.h:39
std::vector< double > m_vecBkgdParamValues
Definition: GeneratePeaks.h:92
double m_numPeakWidth
Number of FWHM for peak to extend.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition: GeneratePeaks.h:31
DataObjects::TableWorkspace_sptr m_funcParamWS
Parameter table workspace.
std::shared_ptr< IBackgroundFunction > IBackgroundFunction_sptr
std::shared_ptr< IPeakFunction > IPeakFunction_sptr
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< TableWorkspace > TableWorkspace_sptr
shared pointer to Mantid::DataObjects::TableWorkspace
std::shared_ptr< const TableWorkspace > TableWorkspace_const_sptr
shared pointer to Mantid::DataObjects::TableWorkspace (const version)
Helper class which provides the Collimation Length for SANS instruments.
int32_t specnum_t
Typedef for a spectrum Number.
Definition: IDTypes.h:16