Mantid
Loading...
Searching...
No Matches
CalculateFlatBackground.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2009 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"
11
12namespace Mantid {
13namespace HistogramData {
14class Histogram;
15}
16namespace Algorithms {
38class MANTID_ALGORITHMS_DLL CalculateFlatBackground : public API::ParallelAlgorithm {
39public:
41 const std::string name() const override { return "CalculateFlatBackground"; }
43 const std::string summary() const override { return "Finds a constant background value of each desired histogram."; }
44
46 int version() const override { return (1); }
48 const std::string category() const override { return "SANS;CorrectionFunctions\\BackgroundCorrections"; }
49
50private:
52 void init() override;
54 void exec() override;
55
58 void checkRange(double &startX, double &endX);
59 void Mean(const HistogramData::Histogram &histogram, double &background, double &variance, const double startX,
60 const double endX) const;
61 void LinearFit(const HistogramData::Histogram &histogram, double &background, double &variance, const double startX,
62 const double endX);
63 void MovingAverage(const HistogramData::Histogram &histogram, double &background, double &variance,
64 const size_t windowWidth) const;
65
67 std::unique_ptr<API::Progress> m_progress = nullptr;
68};
69
70} // namespace Algorithms
71} // namespace Mantid
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
Base class for algorithms that can run in parallel on all MPI ranks but not in a distributed fashion.
Finds a constant background value of each desired spectrum and optionally subtracts that value from t...
const std::string name() const override
Algorithm's name.
const std::string summary() const override
Summary of algorithms purpose.
void convertToDistribution(API::MatrixWorkspace_sptr workspace)
int version() const override
Algorithm's version.
const std::string category() const override
Algorithm's category for identification.
void restoreDistributionState(API::MatrixWorkspace_sptr workspace)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.