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
17#include "MantidKernel/System.h"
18
19namespace Mantid {
20namespace CurveFitting {
21namespace Functions {
22
24public:
25 void setup(const DataObjects::TableWorkspace_sptr &peaktablews);
26
27 DataObjects::Workspace2D_sptr removePeaks(const API::MatrixWorkspace_const_sptr &dataws, int wsindex, double numfwhm);
28
29private:
31 void parsePeakTableWorkspace(const DataObjects::TableWorkspace_sptr &peaktablews, std::vector<double> &vec_peakcentre,
32 std::vector<double> &vec_peakfwhm);
33
35 size_t excludePeaks(std::vector<double> v_inX, std::vector<bool> &v_useX, std::vector<double> v_centre,
36 std::vector<double> v_fwhm, double num_fwhm);
37
38 std::vector<double> m_vecPeakCentre;
39 std::vector<double> m_vecPeakFWHM;
40};
41
44class MANTID_CURVEFITTING_DLL ProcessBackground final : public API::Algorithm {
45public:
47
48 const std::string category() const override { return "Diffraction\\Utility"; }
49
50 const std::string name() const override { return "ProcessBackground"; }
51
52 int version() const override { return 1; }
53
55 const std::string summary() const override {
56 return "ProcessBackground provides some tools to process powder "
57 "diffraction pattern's "
58 "background in order to help Le Bail Fit.";
59 }
60
61private:
63 void init() override;
64
66 void exec() override;
67
69 void setupDummyOutputWSes();
70
72 void selectBkgdPoints();
73
75 void selectFromGivenXValues();
76
78 void selectFromGivenFunction();
79
81 DataObjects::Workspace2D_sptr autoBackgroundSelection(const DataObjects::Workspace2D_sptr &bkgdWS);
82
84 BackgroundFunction_sptr createBackgroundFunction(const std::string &backgroundtype);
85
87 DataObjects::Workspace2D_sptr filterForBackground(const BackgroundFunction_sptr &bkgdfunction);
88
91
93
96
97 std::string m_bkgdType;
98
99 // bool m_doFitBackground;
100
101 // double mTolerance;
102
104 double m_numFWHM;
105
107 void removePeaks();
108
110 void deleteRegion();
111
113 void addRegion();
114
115 void fitBackgroundFunction(const std::string &bkgdfunctiontype);
116};
117
118} // namespace Functions
119} // namespace CurveFitting
120} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
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.
void setup(const DataObjects::TableWorkspace_sptr &peaktablews)
Set up: parse peak workspace to vectors.
size_t excludePeaks(std::vector< double > v_inX, std::vector< bool > &v_useX, std::vector< double > v_centre, std::vector< double > v_fwhm, double num_fwhm)
Exclude peak regions.
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.