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 API {
17class SpectrumInfo;
18}
19namespace Algorithms {
20
21using namespace Geometry;
22
25class MANTID_ALGORITHMS_DLL MultipleScatteringCorrection final : public API::Algorithm {
26public:
28 const std::string name() const override { return "MultipleScatteringCorrection"; };
29
31 int version() const override { return 1; };
32
34 const std::string category() const override { return "CorrectionFunctions"; };
35
37 const std::string summary() const override {
38 return "Calculate Multiple Scattering Correction using numerical integration with the assumption of"
39 "elastic and isotropic scattering only.";
40 };
41
43 const std::vector<std::string> seeAlso() const override {
44 return {"CalculateCarpenterSampleCorrection", "CarpenterSampleCorrection", "MayersSampleCorrection"};
45 };
46
47protected:
50 int64_t m_num_lambda;
53
54private:
55 void init() override;
56 void exec() override;
57 std::map<std::string, std::string> validateInputs() override;
58
59 void parseInputs();
60 void calculateSingleComponent(const API::MatrixWorkspace_sptr &outws, const Geometry::IObject &shape,
61 const double elementSize);
62 void calculateSampleAndContainer(const API::MatrixWorkspace_sptr &outws);
63 // For single component case
64 void calculateLS1s(const MultipleScatteringCorrectionDistGraber &distGraber, //
65 std::vector<double> &LS1s, //
66 const Geometry::IObject &shape) const;
67 void calculateL12s(const MultipleScatteringCorrectionDistGraber &distGraber, //
68 std::vector<double> &L12s, //
69 const Geometry::IObject &shape);
70 void calculateL2Ds(const MultipleScatteringCorrectionDistGraber &distGraber, //
71 const API::SpectrumInfo &spectrumInfo, const size_t index, //
72 std::vector<double> &L2Ds, //
73 const Geometry::IObject &shape) const;
74 void pairWiseSum(double &A1, double &A2, //
75 const double linearCoefAbs, //
76 const MultipleScatteringCorrectionDistGraber &distGraber, //
77 const std::vector<double> &LS1s, //
78 const std::vector<double> &L12s, //
79 const std::vector<double> &L2Ds, //
80 const int64_t startIndex, const int64_t endIndex) const;
81 // For sample and container case
82 void calculateLS1s(const MultipleScatteringCorrectionDistGraber &distGraberContainer, //
83 const MultipleScatteringCorrectionDistGraber &distGraberSample, //
84 std::vector<double> &LS1sContainer, //
85 std::vector<double> &LS1sSample, //
86 const Geometry::IObject &shapeContainer, //
87 const Geometry::IObject &shapeSample) const;
88 void calculateL12s(const MultipleScatteringCorrectionDistGraber &distGraberContainer, //
89 const MultipleScatteringCorrectionDistGraber &distGraberSample, //
90 std::vector<double> &L12sContainer, //
91 std::vector<double> &L12sSample, //
92 const Geometry::IObject &shapeContainer, //
93 const Geometry::IObject &shapeSample);
94 void calculateL2Ds(const MultipleScatteringCorrectionDistGraber &distGraberContainer, //
95 const MultipleScatteringCorrectionDistGraber &distGraberSample, //
96 const API::SpectrumInfo &spectrumInfo, const size_t index, //
97 std::vector<double> &container_L2Ds, std::vector<double> &sample_L2Ds, //
98 const Geometry::IObject &shapeContainer, const Geometry::IObject &shapeSample) const;
99
100 void pairWiseSum(double &A1, double &A2, //
101 const double linearCoefAbsContainer, const double linearCoefAbsSample, //
102 const int64_t numVolumeElementsContainer, const int64_t numVolumeElementsTotal, //
103 const double totScatterCoefContainer, const double totScatterCoefSample, //
104 const std::vector<double> &elementVolumes, const std::vector<double> &LS1sContainer,
105 const std::vector<double> &LS1sSample, const std::vector<double> &L12sContainer,
106 const std::vector<double> &L12sSample, const std::vector<double> &L2DsContainer,
107 const std::vector<double> &L2DsSample, const int64_t startIndex, const int64_t endIndex) const;
108
109 int64_t m_xStep;
110};
111
112} // namespace Algorithms
113} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
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.
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
IObject : Interface for geometry objects.
Definition IObject.h:43
Class for 3D vectors.
Definition V3D.h:35
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.