Mantid
Loading...
Searching...
No Matches
ProcessBackground.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
13#include "MantidCurveFitting/DllConfig.h"
18
19#include <span>
20
21namespace Mantid {
22namespace CurveFitting {
23namespace Functions {
24
26public:
27 void setup(const DataObjects::TableWorkspace_sptr &peaktablews);
28
29 DataObjects::Workspace2D_sptr removePeaks(const API::MatrixWorkspace_const_sptr &dataws, int wsindex, double numfwhm);
30
31private:
33 void parsePeakTableWorkspace(const DataObjects::TableWorkspace_sptr &peaktablews, std::vector<double> &vec_peakcentre,
34 std::vector<double> &vec_peakfwhm);
35
37 size_t excludePeaks(std::span<double const> v_inX, std::vector<bool> &v_useX, const std::vector<double> &v_centre,
38 const std::vector<double> &v_fwhm, double num_fwhm);
39
40 std::vector<double> m_vecPeakCentre;
41 std::vector<double> m_vecPeakFWHM;
42};
43
46class MANTID_CURVEFITTING_DLL ProcessBackground final : public API::Algorithm {
47public:
49
50 const std::string category() const override { return "Diffraction\\Utility"; }
51
52 const std::string name() const override { return "ProcessBackground"; }
53
54 int version() const override { return 1; }
55
57 const std::string summary() const override {
58 return "ProcessBackground provides some tools to process powder "
59 "diffraction pattern's "
60 "background in order to help Le Bail Fit.";
61 }
62
63private:
65 void init() override;
66
68 void exec() override;
69
71 void setupDummyOutputWSes();
72
74 void selectBkgdPoints();
75
77 void selectFromGivenXValues();
78
80 void selectFromGivenFunction();
81
83 DataObjects::Workspace2D_sptr autoBackgroundSelection(const DataObjects::Workspace2D_sptr &bkgdWS);
84
86 BackgroundFunction_sptr createBackgroundFunction(const std::string &backgroundtype);
87
89 DataObjects::Workspace2D_sptr filterForBackground(const BackgroundFunction_sptr &bkgdfunction);
90
93
95
98
99 std::string m_bkgdType;
100
101 // bool m_doFitBackground;
102
103 // double mTolerance;
104
106 double m_numFWHM;
107
109 void removePeaks();
110
112 void deleteRegion();
113
115 void addRegion();
116
117 void fitBackgroundFunction(const std::string &bkgdfunctiontype);
118};
119
120} // namespace Functions
121} // namespace CurveFitting
122} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
ProcessBackground : Process background obtained from LeBailFit.
DataObjects::Workspace2D_const_sptr m_dataWS
int version() const override
function to return a version of the algorithm, must be overridden in all algorithms
double m_numFWHM
Number of FWHM of range of peak to be removed.
const std::string summary() const override
Summary of algorithms purpose.
const std::string category() const override
function to return a category of the algorithm.
const std::string name() const override
function to return a name of the algorithm, must be overridden in all algorithms
void parsePeakTableWorkspace(const DataObjects::TableWorkspace_sptr &peaktablews, std::vector< double > &vec_peakcentre, std::vector< double > &vec_peakfwhm)
Parse peak centre and FWHM from a table workspace.
size_t excludePeaks(std::span< double const > v_inX, std::vector< bool > &v_useX, const std::vector< double > &v_centre, const std::vector< double > &v_fwhm, double num_fwhm)
Exclude peak regions.
void setup(const DataObjects::TableWorkspace_sptr &peaktablews)
Set up: parse peak workspace to vectors.
DataObjects::Workspace2D_sptr removePeaks(const API::MatrixWorkspace_const_sptr &dataws, int wsindex, double numfwhm)
Remove peaks from a input workspace.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< BackgroundFunction > BackgroundFunction_sptr
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
std::shared_ptr< TableWorkspace > TableWorkspace_sptr
shared pointer to Mantid::DataObjects::TableWorkspace
std::shared_ptr< const Workspace2D > Workspace2D_const_sptr
shared pointer to Mantid::DataObjects::Workspace2D (const version)
Helper class which provides the Collimation Length for SANS instruments.