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:
25 ~PDCalibration() override;
26
27 const std::string name() const override;
28 int version() const override;
29 const std::string category() const override;
30 const std::string summary() const override;
31
32private:
33 class FittedPeaks; // forward declare of private inner class
34
35 void init() override;
36 std::map<std::string, std::string> validateInputs() override;
37 void exec() override;
38 API::MatrixWorkspace_sptr loadAndBin();
40 API::MatrixWorkspace_sptr load(const std::string &filename);
41 std::set<detid_t> detIdsForTable();
42 void createCalTableHeader();
43 void createCalTableFromExisting();
44 void createCalTableNew();
45 void createInformationWorkspaces();
46 std::tuple<double, double, double> getDSpacingToTof(const std::set<detid_t> &detIds);
47 std::vector<double> dSpacingWindows(const std::vector<double> &centres, const std::vector<double> &widthMax);
48 std::vector<double> getTOFminmax(const double difc, const double difa, const double tzero);
49 void setCalibrationValues(const detid_t detid, const double difc, const double difa, const double tzero);
50 void fitDIFCtZeroDIFA_LM(const std::vector<double> &d, const std::vector<double> &tof,
51 const std::vector<double> &height2, double &difc, double &t0, double &difa);
52 API::MatrixWorkspace_sptr calculateResolutionTable();
53
55 std::pair<API::MatrixWorkspace_sptr, API::MatrixWorkspace_sptr>
56 createTOFPeakCenterFitWindowWorkspaces(const API::MatrixWorkspace_sptr &dataws,
57 const std::vector<double> &peakWindowMaxInDSpacing);
58
60
61 API::MatrixWorkspace_sptr m_uncalibratedWS{nullptr};
62 API::ITableWorkspace_sptr m_calibrationTable{nullptr};
63 API::ITableWorkspace_sptr m_peakPositionTable{nullptr};
64 API::ITableWorkspace_sptr m_peakWidthTable{nullptr};
65 API::ITableWorkspace_sptr m_peakHeightTable{nullptr};
66 std::vector<double> m_peaksInDspacing;
67 std::map<detid_t, size_t> m_detidToRow;
70 double m_tofMin{0.};
71 double m_tofMax{0.};
72 double m_tzeroMin{0.};
73 double m_tzeroMax{0.};
74 double m_difaMin{0.};
75 double m_difaMax{0.};
76 bool m_hasDasIds{false};
77 size_t m_numberMaxParams{0};
78};
79
80} // namespace Algorithms
81} // namespace Mantid
std::string name
Definition Run.cpp:60
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
PDCalibration : TODO: DESCRIPTION.
std::map< detid_t, size_t > m_detidToRow
int m_stopWorkspaceIndex
stop index (workspace index of the last spectrum included)
~PDCalibration() override
Destructor.
std::vector< double > m_peaksInDspacing
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.
int32_t detid_t
Typedef for a detector ID.