Mantid
Loading...
Searching...
No Matches
MultipleScatteringCorrection.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2021 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 "MantidAlgorithms/DllConfig.h"
13#include "MantidKernel/V3D.h"
14
15namespace Mantid {
16namespace Algorithms {
17
18using namespace Geometry;
19
22class MANTID_ALGORITHMS_DLL MultipleScatteringCorrection final : public API::Algorithm {
23public:
25 const std::string name() const override { return "MultipleScatteringCorrection"; };
26
28 int version() const override { return 1; };
29
31 const std::string category() const override { return "CorrectionFunctions"; };
32
34 const std::string summary() const override {
35 return "Calculate Multiple Scattering Correction using numerical integration with the assumption of"
36 "elastic and isotropic scattering only.";
37 };
38
40 const std::vector<std::string> seeAlso() const override {
41 return {"CalculateCarpenterSampleCorrection", "CarpenterSampleCorrection", "MayersSampleCorrection"};
42 };
43
44protected:
47 int64_t m_num_lambda;
50
51private:
52 void init() override;
53 void exec() override;
54 std::map<std::string, std::string> validateInputs() override;
55
56 void parseInputs();
57 void calculateSingleComponent(const API::MatrixWorkspace_sptr &outws, const Geometry::IObject &shape,
58 const double elementSize);
59 void calculateSampleAndContainer(const API::MatrixWorkspace_sptr &outws);
60 // For single component case
61 void calculateLS1s(const MultipleScatteringCorrectionDistGraber &distGraber, //
62 std::vector<double> &LS1s, //
63 const Geometry::IObject &shape) const;
64 void calculateL12s(const MultipleScatteringCorrectionDistGraber &distGraber, //
65 std::vector<double> &L12s, //
66 const Geometry::IObject &shape);
67 void calculateL2Ds(const MultipleScatteringCorrectionDistGraber &distGraber, //
68 const IDetector &detector, //
69 std::vector<double> &L2Ds, //
70 const Geometry::IObject &shape) const;
71 void pairWiseSum(double &A1, double &A2, //
72 const double linearCoefAbs, //
73 const MultipleScatteringCorrectionDistGraber &distGraber, //
74 const std::vector<double> &LS1s, //
75 const std::vector<double> &L12s, //
76 const std::vector<double> &L2Ds, //
77 const int64_t startIndex, const int64_t endIndex) const;
78 // For sample and container case
79 void calculateLS1s(const MultipleScatteringCorrectionDistGraber &distGraberContainer, //
80 const MultipleScatteringCorrectionDistGraber &distGraberSample, //
81 std::vector<double> &LS1sContainer, //
82 std::vector<double> &LS1sSample, //
83 const Geometry::IObject &shapeContainer, //
84 const Geometry::IObject &shapeSample) const;
85 void calculateL12s(const MultipleScatteringCorrectionDistGraber &distGraberContainer, //
86 const MultipleScatteringCorrectionDistGraber &distGraberSample, //
87 std::vector<double> &L12sContainer, //
88 std::vector<double> &L12sSample, //
89 const Geometry::IObject &shapeContainer, //
90 const Geometry::IObject &shapeSample);
91 void calculateL2Ds(const MultipleScatteringCorrectionDistGraber &distGraberContainer, //
92 const MultipleScatteringCorrectionDistGraber &distGraberSample, //
93 const IDetector &detector, //
94 std::vector<double> &container_L2Ds, std::vector<double> &sample_L2Ds, //
95 const Geometry::IObject &shapeContainer, const Geometry::IObject &shapeSample) const;
96
97 void pairWiseSum(double &A1, double &A2, //
98 const double linearCoefAbsContainer, const double linearCoefAbsSample, //
99 const int64_t numVolumeElementsContainer, const int64_t numVolumeElementsTotal, //
100 const double totScatterCoefContainer, const double totScatterCoefSample, //
101 const std::vector<double> &elementVolumes, const std::vector<double> &LS1sContainer,
102 const std::vector<double> &LS1sSample, const std::vector<double> &L12sContainer,
103 const std::vector<double> &L12sSample, const std::vector<double> &L2DsContainer,
104 const std::vector<double> &L2DsSample, const int64_t startIndex, const int64_t endIndex) const;
105
106 int64_t m_xStep;
107};
108
109} // namespace Algorithms
110} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
MultipleScatteringCorrectionDistGraber : This is a helper class to calculate the distance from source...
MultipleScatteringCorrection : TODO: DESCRIPTION.
const std::string summary() const override
Algorithm's summary.
double m_sampleElementSize
The size of the integration element for sample in meters.
API::MatrixWorkspace_sptr m_inputWS
A pointer to the input workspace.
const std::string name() const override
Algorithm's name.
int version() const override
Algorithm's version.
int64_t m_num_lambda
The number of points in wavelength, the rest is interpolated linearly.
const std::string category() const override
Algorithm's category.
int64_t m_xStep
The step in bin number between adjacent points for linear interpolation.
const std::vector< std::string > seeAlso() const override
Algorithm's see also.
double m_containerElementSize
the size of the integration element for container in meters
Interface class for detector objects.
Definition: IDetector.h:43
IObject : Interface for geometry objects.
Definition: IObject.h:41
Class for 3D vectors.
Definition: V3D.h:34
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.