diff --git a/Framework/Algorithms/inc/MantidAlgorithms/FindPeakBackground.h b/Framework/Algorithms/inc/MantidAlgorithms/FindPeakBackground.h index d00abf1a413b285fb346ba20cbd0eca089904440..a92f02e4c58f032b0aba7f7bb177a4d029329ee9 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/FindPeakBackground.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/FindPeakBackground.h @@ -53,6 +53,25 @@ public: /// Algorithm's category for identification overriding a virtual method const std::string category() const override { return "Utility\\Calculation"; } + /// set sigma constant + void setSigma(const double &sigma); + + /// set background order + void setBackgroundOrder(size_t order); + + /// set fit window + void setFitWindow(const std::vector<double> &window); + + /// find fit window's data point index + void findWindowIndex(const HistogramData::Histogram &histogram, size_t &l0, + size_t &n); + + /// main method to calculate background + int findBackground(const HistogramData::Histogram &histogram, + const size_t &l0, const size_t &n, + std::vector<size_t> &peak_min_max_indexes, + std::vector<double> &bkgd3); + private: std::string m_backgroundType; //< The type of background to fit @@ -74,29 +93,9 @@ private: /// create output workspace void createOutputWorkspaces(); - /// set histogram data to find background - // void setHistogram(const HistogramData::Histogram &histogram); + // Histogram cannot be defined due to lack of default constructor. shared_ptr + // will do the copy - /// set sigma constant - void setSigma(const double &sigma); - - /// set background order - void setBackgroundOrder(size_t order); - - /// set fit window - void setFitWindow(const std::vector<double> &window); - - int findBackground(const HistogramData::Histogram &histogram, - const size_t &l0, const size_t &n, - std::vector<size_t> &peak_min_max_indexes, - std::vector<double> &bkgd3); - - /// Histogram cannot be defined due to lack of default constructor. shared_ptr - /// will do the copy - /// histogram data to find peak background - /// boost::shared_ptr<const HistogramData::Histogram> m_histogram; - - // HistogramData::Histogram& m_histogram; /// fit window std::vector<double> m_vecFitWindows; /// background order: 0 for flat, 1 for linear, 2 for quadratic @@ -110,15 +109,6 @@ private: /// workspace index size_t m_inputWSIndex; - // /// find background (main algorithm) - // void findPeakBackground(); - - // /// get result - // void getBackgroundResult(); - - void findWindowIndex(const HistogramData::Histogram &histogram, size_t &l0, - size_t &n); - struct cont_peak { size_t start; size_t stop; diff --git a/Framework/Algorithms/src/FindPeakBackground.cpp b/Framework/Algorithms/src/FindPeakBackground.cpp index 9e1c90721556860370f8fe332c285a10bc0d5cd4..cb58a596f719c1e7476b522a53fc0e4c9d67abde 100644 --- a/Framework/Algorithms/src/FindPeakBackground.cpp +++ b/Framework/Algorithms/src/FindPeakBackground.cpp @@ -122,6 +122,16 @@ void FindPeakBackground::exec() { setProperty("OutputWorkspace", m_outPeakTableWS); } +//---------------------------------------------------------------------------------------------- +/** + * @brief FindPeakBackground::findBackground + * @param histogram + * @param l0 + * @param n + * @param peak_min_max_indexes + * @param bkgd3 + * @return + */ int FindPeakBackground::findBackground( const HistogramData::Histogram &histogram, const size_t &l0, const size_t &n, std::vector<size_t> &peak_min_max_indexes,