PredictSatellitePeaks.h 3.65 KB
Newer Older
1
2
3
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2011 ISIS Rutherford Appleton Laboratory UKRI,
4
5
//   NScD Oak Ridge National Laboratory, European Spallation Source,
//   Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
#pragma once
8
9

#include "MantidAPI/Algorithm.h"
10
#include "MantidAPI/IPeaksWorkspace.h"
11
#include "MantidCrystal/DllConfig.h"
12
#include "MantidDataObjects/LeanElasticPeaksWorkspace.h"
Lynch, Vickie's avatar
Lynch, Vickie committed
13
14
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidGeometry/Crystal/HKLFilterWavelength.h"
Stephen's avatar
Stephen committed
15
#include "MantidGeometry/Crystal/IPeak.h"
Lynch, Vickie's avatar
Lynch, Vickie committed
16
#include "MantidKernel/System.h"
17
18
19

namespace Mantid {
namespace Crystal {
20
/** PredictSatellitePeaks : Algorithm to create a PeaksWorkspace with peaks
21
22
23
   corresponding
    to fractional h,k,and l values.

24
    @author Shiyun Liu/Vickie Lynch
25
    @date   2019-03-2019
26

27
*/
28
class MANTID_CRYSTAL_DLL PredictSatellitePeaks : public API::Algorithm {
29
public:
30
  PredictSatellitePeaks();
31
  /// Algorithm's name for identification
Lynch, Vickie's avatar
Lynch, Vickie committed
32
  const std::string name() const override { return "PredictSatellitePeaks"; };
33
34
35
36
37
38
39
  /// Summary of algorithms purpose
  const std::string summary() const override {
    return "The offsets can be from hkl values in a range of hkl values or "
           "from peaks in the input PeaksWorkspace";
  }

  /// Algorithm's version for identification
Lynch, Vickie's avatar
Lynch, Vickie committed
40
  int version() const override { return 1; };
41
  const std::vector<std::string> seeAlso() const override { return {"PredictPeaks"}; }
42
43
44
45

  /// Algorithm's category for identification
  const std::string category() const override { return "Crystal\\Peaks"; }

46
47
48
  /* Determine which type of workspace we're dealing with */
  enum class workspace_type_enum { regular_peaks, lean_elastic_peaks, invalid };

49
private:
50
51
52
53
54
55
56
57
58
59
  workspace_type_enum determine_workspace_type(API::IPeaksWorkspace_sptr const &iPeaksWorkspace) const;

  std::shared_ptr<Geometry::IPeak> createPeakForOutputWorkspace(Kernel::Matrix<double> const &goniometer,
                                                                Kernel::V3D const &satellite_hkl);

  void addPeakToOutputWorkspace(std::shared_ptr<Geometry::IPeak> iPeak,
                                Kernel::Matrix<double> const &peak_goniometer_matrix, Kernel::V3D const &hkl,
                                Kernel::V3D const &satelliteHKL, int const RunNumber,
                                std::vector<std::vector<int>> &AlreadyDonePeaks, Kernel::V3D const &mnp);

Lynch, Vickie's avatar
Lynch, Vickie committed
60
  const size_t MAX_NUMBER_HKLS = 10000000000;
61
  double m_qConventionFactor;
62
  API::IPeaksWorkspace_sptr Peaks;
63
  API::IPeaksWorkspace_sptr outPeaks;
64
65
66
67
68
  /// Initialise the properties
  void init() override;

  /// Run the algorithm
  void exec() override;
69
  void exec_peaks();
70
  Kernel::V3D getOffsetVector(const std::string &label);
71
72
73

  void predictOffsets(int iVector, Kernel::V3D offsets, int &maxOrder, int RunNumber,
                      Kernel::Matrix<double> const &goniometer, Kernel::V3D &hkl,
74
                      Geometry::HKLFilterWavelength &lambdaFilter, bool &includePeaksInRange, bool &includeOrderZero,
Lynch, Vickie's avatar
Lynch, Vickie committed
75
                      std::vector<std::vector<int>> &AlreadyDonePeaks);
76

77
  void predictOffsetsWithCrossTerms(Kernel::V3D offsets1, Kernel::V3D offsets2, Kernel::V3D offsets3, int &maxOrder,
78
                                    int RunNumber, Kernel::Matrix<double> const &peak_goniometer_matrix,
79
80
81
                                    Kernel::V3D &hkl, Geometry::HKLFilterWavelength &lambdaFilter,
                                    bool &includePeaksInRange, bool &includeOrderZero,
                                    std::vector<std::vector<int>> &AlreadyDonePeaks);
82
83
84
85
};

} // namespace Crystal
} // namespace Mantid