-
Notifications
You must be signed in to change notification settings - Fork 122
/
PDCalibration.h
104 lines (87 loc) · 3.94 KB
/
PDCalibration.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef MANTID_ALGORITHMS_PDCALIBRATION_H_
#define MANTID_ALGORITHMS_PDCALIBRATION_H_
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/ITableWorkspace_fwd.h"
#include "MantidAPI/MatrixWorkspace_fwd.h"
#include "MantidAlgorithms/DllConfig.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidGeometry/IDTypes.h"
#include <map>
namespace Mantid {
namespace Algorithms {
/** PDCalibration : TODO: DESCRIPTION
Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class MANTID_ALGORITHMS_DLL PDCalibration : public API::Algorithm {
public:
PDCalibration();
~PDCalibration();
const std::string name() const override;
int version() const override;
const std::vector<std::string> seeAlso() const override {
return {"CalibrateRectangularDetectors"};
}
const std::string category() const override;
const std::string summary() const override;
private:
class FittedPeaks; // forward declare of private inner class
void init() override;
std::map<std::string, std::string> validateInputs() override;
void exec() override;
API::MatrixWorkspace_sptr loadAndBin();
API::MatrixWorkspace_sptr rebin(API::MatrixWorkspace_sptr wksp);
API::MatrixWorkspace_sptr load(const std::string filename);
void createCalTableFromExisting();
void createCalTableNew();
void createInformationWorkspaces();
std::function<double(double)> getDSpacingToTof(const detid_t detid);
std::vector<double> dSpacingWindows(const std::vector<double> ¢res,
const double widthMax);
std::vector<double> getTOFminmax(const double difc, const double difa,
const double tzero);
void setCalibrationValues(const detid_t detid, const double difc,
const double difa, const double tzero);
void fitDIFCtZeroDIFA_LM(const std::vector<double> &d,
const std::vector<double> &tof,
const std::vector<double> &height2, double &difc,
double &t0, double &difa);
API::MatrixWorkspace_sptr calculateResolutionTable();
/// NEW: convert peak positions in dSpacing to peak centers workspace
std::pair<API::MatrixWorkspace_sptr, API::MatrixWorkspace_sptr>
createTOFPeakCenterFitWindowWorkspaces(API::MatrixWorkspace_sptr dataws,
const double peakWindowMaxInDSpacing);
API::ITableWorkspace_sptr
sortTableWorkspace(API::ITableWorkspace_sptr &table);
API::MatrixWorkspace_sptr m_uncalibratedWS{nullptr};
API::ITableWorkspace_sptr m_calibrationTable{nullptr};
API::ITableWorkspace_sptr m_peakPositionTable{nullptr};
API::ITableWorkspace_sptr m_peakWidthTable{nullptr};
API::ITableWorkspace_sptr m_peakHeightTable{nullptr};
std::vector<double> m_peaksInDspacing;
std::map<detid_t, size_t> m_detidToRow;
double m_tofMin{0.};
double m_tofMax{0.};
double m_tzeroMin{0.};
double m_tzeroMax{0.};
double m_difaMin{0.};
double m_difaMax{0.};
bool m_hasDasIds{false};
size_t m_numberMaxParams{0};
};
} // namespace Algorithms
} // namespace Mantid
#endif /* MANTID_ALGORITHMS_PDCALIBRATION_H_ */