Mantid
Loading...
Searching...
No Matches
SCDCalibratePanels2.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 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
10#include "MantidCrystal/DllConfig.h"
13
14#include <boost/container/flat_set.hpp>
15#include <limits>
16
17namespace Mantid {
18namespace Crystal {
19
36class MANTID_CRYSTAL_DLL SCDCalibratePanels2 : public Mantid::API::Algorithm {
37public:
39 const std::string name() const override { return "SCDCalibratePanels"; }
40
42 const std::string summary() const override {
43 return "Panel parameters and L1 are optimized to "
44 "minimize errors between theoretical and actual q values for the "
45 "peaks";
46 }
47
49 int version() const override { return 2; }
50
52 const std::string category() const override { return "Crystal\\Corrections"; }
53
55 const std::vector<std::string> seeAlso() const override { return {"CalculateUMatrix"}; }
56
57private:
59 void init() override;
60
62 void exec() override;
63
65 std::map<std::string, std::string> validateInputs() override;
66
68 std::vector<double> captureTOF(const Mantid::API::IPeaksWorkspace_sptr &pws);
69
71 void parseLatticeConstant(const Mantid::API::IPeaksWorkspace_sptr &pws);
72
74 void updateUBMatrix(const Mantid::API::IPeaksWorkspace_sptr &pws);
75
78
80 void getBankNames(const Mantid::API::IPeaksWorkspace_sptr &pws);
81
84
87
89 void optimizeBanks(Mantid::API::IPeaksWorkspace_sptr pws, const Mantid::API::IPeaksWorkspace_sptr &pws_original,
90 const bool &docalibsize, const double &sizesearchradius, const bool &fixdetxyratio);
91
93 void optimizeSamplePos(Mantid::API::IPeaksWorkspace_sptr pws, Mantid::API::IPeaksWorkspace_sptr pws_original);
94
97 const std::string &bankname, const std::string &outputwsn);
98
101 Mantid::API::MatrixWorkspace_sptr getIdealQSampleAsHistogram1D(const Mantid::API::IPeaksWorkspace_sptr &pws);
102
104 void adjustComponent(double dx, double dy, double dz, double drx, double dry, double drz, double scalex,
105 double scaley, const std::string &cmptName, Mantid::API::IPeaksWorkspace_sptr &pws);
106
108 Mantid::API::ITableWorkspace_sptr generateCalibrationTable(std::shared_ptr<Geometry::Instrument> &instrument,
110
112 void saveXmlFile(const std::string &FileName, const boost::container::flat_set<std::string> &AllBankNames,
113 std::shared_ptr<Geometry::Instrument> &instrument, const Geometry::ParameterMap &pmap);
114
116 void saveIsawDetCal(const std::string &filename, boost::container::flat_set<std::string> &AllBankName,
117 std::shared_ptr<Geometry::Instrument> &instrument, double T0);
118
120 void saveCalibrationTable(const std::string &FileName, Mantid::API::ITableWorkspace_sptr &tws);
121
124 void profileBanks(Mantid::API::IPeaksWorkspace_sptr &pws, const Mantid::API::IPeaksWorkspace_sptr &pws_original);
126 void profileL1T0(Mantid::API::IPeaksWorkspace_sptr &pws, Mantid::API::IPeaksWorkspace_sptr pws_original);
127
129 std::pair<double, double> getRectangularDetectorScaleFactors(std::shared_ptr<Geometry::Instrument> &instrument,
130 const std::string &bankname,
132
134 double m_a, m_b, m_c, m_alpha, m_beta, m_gamma;
135 double m_T0 = 0.0;
136 bool LOGCHILDALG{true};
137 int maxFitIterations{500};
138 const int MINIMUM_PEAKS_PER_BANK{6};
139 std::string mCalibBankName{""};
140 const double PI{3.1415926535897932384626433832795028841971693993751058209};
141 static constexpr double Tolerance = std::numeric_limits<double>::epsilon();
142
143 // Column names and types
144 const std::vector<std::string> calibrationTableColumnNames{
145 "ComponentName", "Xposition", "Yposition", "Zposition", "XdirectionCosine",
146 "YdirectionCosine", "ZdirectionCosine", "RotationAngle", "ScaleX", "ScaleY"};
147 const std::vector<std::string> calibrationTableColumnTypes{"str", "double", "double", "double", "double",
148 "double", "double", "double", "double", "double"};
149
150 boost::container::flat_set<std::string> m_BankNames;
152};
153
154} // namespace Crystal
155} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
SCDCalibratePanels2 : Using input peakworkspace with indexation results to calibrate each individual ...
Mantid::API::ITableWorkspace_sptr mCaliTable
double m_a
unique vars for a given instance of calibration
const std::vector< std::string > seeAlso() const override
Extra help info.
boost::container::flat_set< std::string > m_BankNames
int version() const override
Algorithm's version, overriding a virtual method.
const std::string category() const override
Algorithm's category, overriding a virtual method.
const std::string name() const override
Algorithm's name for identification.
const std::string summary() const override
Summary of algorithm's purpose.
std::shared_ptr< IPeaksWorkspace > IPeaksWorkspace_sptr
shared pointer to Mantid::API::IPeaksWorkspace
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
constexpr double Tolerance
Standard tolerance value.
Definition: Tolerance.h:12
Helper class which provides the Collimation Length for SANS instruments.
Generate a tableworkspace to store the calibration results.
adjust instrument component position and orientation
: detector size scale at y-direction