Mantid
Loading...
Searching...
No Matches
PDCalibration.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 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
12#include "MantidAlgorithms/DllConfig.h"
15#include <map>
16
17namespace Mantid {
18namespace Algorithms {
19
22class MANTID_ALGORITHMS_DLL PDCalibration final : public API::Algorithm {
23public:
26
27 const std::string name() const override;
28 int version() const override;
29 const std::vector<std::string> seeAlso() const override { return {}; }
30 const std::string category() const override;
31 const std::string summary() const override;
32
33private:
34 class FittedPeaks; // forward declare of private inner class
35
36 void init() override;
37 std::map<std::string, std::string> validateInputs() override;
38 void exec() override;
39 API::MatrixWorkspace_sptr loadAndBin();
41 API::MatrixWorkspace_sptr load(const std::string &filename);
42 void createCalTableFromExisting();
43 void createCalTableNew();
44 void createInformationWorkspaces();
45 std::tuple<double, double, double> getDSpacingToTof(const std::set<detid_t> &detIds);
46 std::vector<double> dSpacingWindows(const std::vector<double> &centres, const std::vector<double> &widthMax);
47 std::vector<double> getTOFminmax(const double difc, const double difa, const double tzero);
48 void setCalibrationValues(const detid_t detid, const double difc, const double difa, const double tzero);
49 void fitDIFCtZeroDIFA_LM(const std::vector<double> &d, const std::vector<double> &tof,
50 const std::vector<double> &height2, double &difc, double &t0, double &difa);
51 API::MatrixWorkspace_sptr calculateResolutionTable();
52
54 std::pair<API::MatrixWorkspace_sptr, API::MatrixWorkspace_sptr>
55 createTOFPeakCenterFitWindowWorkspaces(const API::MatrixWorkspace_sptr &dataws,
56 const std::vector<double> &peakWindowMaxInDSpacing);
57
59
60 API::MatrixWorkspace_sptr m_uncalibratedWS{nullptr};
61 API::ITableWorkspace_sptr m_calibrationTable{nullptr};
62 API::ITableWorkspace_sptr m_peakPositionTable{nullptr};
63 API::ITableWorkspace_sptr m_peakWidthTable{nullptr};
64 API::ITableWorkspace_sptr m_peakHeightTable{nullptr};
65 std::vector<double> m_peaksInDspacing;
66 std::map<detid_t, size_t> m_detidToRow;
67 double m_tofMin{0.}; // first bin boundary when rebinning in TOF (user input)
68 double m_tofMax{0.}; // last bin boundary when rebinning in TOF (user input)
69 double m_tzeroMin{0.};
70 double m_tzeroMax{0.};
71 double m_difaMin{0.};
72 double m_difaMax{0.};
73 bool m_hasDasIds{false};
74 size_t m_numberMaxParams{0};
75};
76
77} // namespace Algorithms
78} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
PDCalibration : TODO: DESCRIPTION.
Definition: PDCalibration.h:22
std::map< detid_t, size_t > m_detidToRow
Definition: PDCalibration.h:66
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition: PDCalibration.h:29
std::vector< double > m_peaksInDspacing
Definition: PDCalibration.h:65
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
void MANTID_KERNEL_DLL rebin(const std::vector< double > &xold, const std::vector< double > &yold, const std::vector< double > &eold, const std::vector< double > &xnew, std::vector< double > &ynew, std::vector< double > &enew, bool distribution, bool addition=false)
Rebins data according to a new output X array.
Helper class which provides the Collimation Length for SANS instruments.