Mantid
Loading...
Searching...
No Matches
PlotPeakByLogValue.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
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidAPI/Algorithm.h"
13#include "MantidAPI/IFunction.h"
17
18namespace Mantid {
19namespace CurveFitting {
20namespace Algorithms {
44class MANTID_CURVEFITTING_DLL PlotPeakByLogValue final : public API::Algorithm {
48public:
50 const std::string name() const override { return "PlotPeakByLogValue"; }
52 const std::string summary() const override { return "Fits a number of spectra with the same function."; }
53
55 int version() const override { return 1; }
56 const std::vector<std::string> seeAlso() const override { return {"Fit"}; }
58 const std::string category() const override { return "Optimization"; }
59
60private:
61 // Overridden Algorithm methods
62 void init() override;
63 std::map<std::string, std::string> validateInputs() override;
64 void exec() override;
65
67 void setWorkspaceIndexAttribute(const API::IFunction_sptr &fun, int wsIndex) const;
68
69 std::shared_ptr<Algorithm> runSingleFit(bool createFitOutput, bool outputCompositeMembers,
70 bool outputConvolvedMembers, const API::IFunction_sptr &ifun,
71 const InputSpectraToFit &data, double startX, double endX,
72 const std::string &exclude);
73
74 double calculateLogValue(const std::string &logName, const InputSpectraToFit &data);
75
76 API::ITableWorkspace_sptr createResultsTable(const std::string &logName, const API::IFunction_sptr &ifunSingle,
77 bool &isDataName);
78
79 void appendTableRow(bool isDataName, API::ITableWorkspace_sptr &result, const API::IFunction_sptr &ifun,
80 const InputSpectraToFit &data, double logValue, double chi2) const;
81
82 void finaliseOutputWorkspaces(bool createFitOutput, const std::vector<API::MatrixWorkspace_sptr> &fitWorkspaces,
83 const std::vector<API::ITableWorkspace_sptr> &parameterWorkspaces,
84 const std::vector<API::ITableWorkspace_sptr> &covarianceWorkspaces);
85
86 API::IFunction_sptr setupFunction(bool individual, bool passWSIndexToFunction,
87 const API::IFunction_sptr &inputFunction, const std::vector<double> &initialParams,
88 bool isMultiDomainFunction, int i, const InputSpectraToFit &data) const;
89
91 std::string getMinimizerString(const std::string &wsName, const std::string &wsIndex);
92
94 std::vector<std::string> getExclude(const size_t numSpectra);
95
97 std::string m_baseName;
98
100 std::map<std::string, std::vector<std::string>> m_minimizerWorkspaces;
101};
102
103} // namespace Algorithms
104} // namespace CurveFitting
105} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Takes a workspace group and fits the same spectrum in all workspaces with the same function.
std::map< std::string, std::vector< std::string > > m_minimizerWorkspaces
Record of workspaces output by the minimizer.
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
int version() const override
Algorithm's version for identification overriding a virtual method.
std::string m_baseName
Base name of output workspace.
const std::string summary() const override
Summary of algorithms purpose.
const std::string name() const override
Structure to identify data for fitting.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< IFunction > IFunction_sptr
shared pointer to the function base class
Definition: IFunction.h:732
Helper class which provides the Collimation Length for SANS instruments.