Mantid
Loading...
Searching...
No Matches
RemoveBackground.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 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
10#include "MantidAlgorithms/DllConfig.h"
14
15namespace Mantid {
16
17namespace HistogramData {
18class HistogramX;
19class HistogramY;
20class HistogramE;
21} // namespace HistogramData
22// forward declarations from other Mantid modules
23namespace Kernel {
24class Unit;
25}
26
27namespace API {
28class SpectrumInfo;
29}
30
31namespace Algorithms {
40class MANTID_ALGORITHMS_DLL BackgroundHelper {
41public:
43
44 // MSVC 2017 does not properly detect that this type contains a move-only
45 // type, so we force delete the copy constructor and copy assignment here.
48
49 void initialize(const API::MatrixWorkspace_const_sptr &bkgWS, const API::MatrixWorkspace_sptr &sourceWS,
50 Kernel::DeltaEMode::Type emode, Kernel::Logger *pLog = nullptr, int nThreads = 1, bool inPlace = true,
51 bool nullifyNegative = false);
52 void removeBackground(int nHist, HistogramData::HistogramX &x_data, HistogramData::HistogramY &y_data,
53 HistogramData::HistogramE &e_data, int threadNum = 0) const;
54
55private:
56 // vector of pointers to the units conversion class for the working workspace;
57 std::vector<std::unique_ptr<Kernel::Unit>> m_WSUnit;
58
59 // shared pointer to the workspace containing background
61 // shared pointer to the workspace where background should be removed
63
65
66 // logger from the hosting algorithm
68 // perform background removal in-place
70
71 // if the background workspace is single value workspace
73 // average number of counts at background for first spectra of a background
74 // workspace
75 double m_NBg;
76 // time interval for measuring the background
77 double m_dtBg;
78 // Squared error of the background for first spectra of the background
79 // workspace
80 double m_ErrSq;
81 // energy conversion mode
83 // if true, negative signals are nullified
85 // removing negative values from ws with background removed previously.
87};
88
89class MANTID_ALGORITHMS_DLL RemoveBackground final : public API::Algorithm {
90public:
94
96 const std::string name() const override { return "RemoveBackground"; }
98 const std::string summary() const override {
99 return "Removes background (constant for now) calculated in TOF units "
100 "from a matrix workspace, expressed in units, different from TOF";
101 }
102
104 int version() const override { return 1; }
106 const std::string category() const override { return "CorrectionFunctions\\BackgroundCorrections"; }
107
108protected:
109 // Overridden Algorithm methods
110 void init() override;
111 void exec() override;
112
113private:
114 // class responsible for background removal
116};
117
118} // namespace Algorithms
119} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
Definition: SpectrumInfo.h:53
Performs removal of constant (and possibly non-constant after simple modification) background calcula...
Kernel::DeltaEMode::Type m_Emode
BackgroundHelper(const BackgroundHelper &)=delete
BackgroundHelper & operator=(const BackgroundHelper &)=delete
const API::SpectrumInfo * m_spectrumInfo
std::vector< std::unique_ptr< Kernel::Unit > > m_WSUnit
API::MatrixWorkspace_const_sptr m_wkWS
API::MatrixWorkspace_const_sptr m_bgWs
int version() const override
Algorithm's version for identification overriding a virtual method.
RemoveBackground & operator=(const RemoveBackground &)=delete
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
const std::string summary() const override
Summary of algorithms purpose.
RemoveBackground(const RemoveBackground &)=delete
The Logger class is in charge of the publishing messages from the framework through various channels.
Definition: Logger.h:52
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.
Type
Define the available energy transfer modes It is important to assign enums proper numbers,...
Definition: DeltaEMode.h:29