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"
13#include "MantidKernel/Unit.h"
15
16namespace Mantid {
17
18namespace HistogramData {
19class HistogramX;
20class HistogramY;
21class HistogramE;
22} // namespace HistogramData
23// forward declarations from other Mantid modules
24namespace Kernel {
25class Unit;
26}
27
28namespace API {
29class SpectrumInfo;
30}
31
32namespace Algorithms {
41class MANTID_ALGORITHMS_DLL BackgroundHelper {
42public:
44
45 // MSVC 2017 does not properly detect that this type contains a move-only
46 // type, so we force delete the copy constructor and copy assignment here.
49
50 void initialize(const API::MatrixWorkspace_const_sptr &bkgWS, const API::MatrixWorkspace_sptr &sourceWS,
51 Kernel::DeltaEMode::Type emode, Kernel::Logger *pLog = nullptr, int nThreads = 1, bool inPlace = true,
52 bool nullifyNegative = false);
53 void removeBackground(int nHist, HistogramData::HistogramX &x_data, HistogramData::HistogramY &y_data,
54 HistogramData::HistogramE &e_data, int threadNum = 0) const;
55
56private:
57 // vector of pointers to the units conversion class for the working workspace;
58 std::vector<std::unique_ptr<Kernel::Unit>> m_WSUnit;
59
60 // shared pointer to the workspace containing background
62 // shared pointer to the workspace where background should be removed
64
66
67 // logger from the hosting algorithm
69 // perform background removal in-place
71
72 // if the background workspace is single value workspace
74 // average number of counts at background for first spectra of a background
75 // workspace
76 double m_NBg;
77 // time interval for measuring the background
78 double m_dtBg;
79 // Squared error of the background for first spectra of the background
80 // workspace
81 double m_ErrSq;
82 // energy conversion mode
84 // if true, negative signals are nullified
86 // removing negative values from ws with background removed previously.
88};
89
90class MANTID_ALGORITHMS_DLL RemoveBackground final : public API::Algorithm {
91public:
95
97 const std::string name() const override { return "RemoveBackground"; }
99 const std::string summary() const override {
100 return "Removes background (constant for now) calculated in TOF units "
101 "from a matrix workspace, expressed in units, different from TOF";
102 }
103
105 int version() const override { return 1; }
107 const std::string category() const override { return "CorrectionFunctions\\BackgroundCorrections"; }
108
109protected:
110 // Overridden Algorithm methods
111 void init() override;
112 void exec() override;
113
114private:
115 // class responsible for background removal
117};
118
119} // namespace Algorithms
120} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
Performs removal of constant (and possibly non-constant after simple modification) background calcula...
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:51
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