Mantid
Loading...
Searching...
No Matches
AbsorptionCorrection.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 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
11#include "MantidAlgorithms/DllConfig.h"
16#include "MantidKernel/V3D.h"
17
18namespace Mantid {
19
20namespace API {
21class Sample;
22}
23namespace Geometry {
24class IDetector;
25class IObject;
26} // namespace Geometry
27
28namespace Algorithms {
67class MANTID_ALGORITHMS_DLL AbsorptionCorrection : public API::Algorithm {
68public:
72 const std::string category() const override { return "CorrectionFunctions\\AbsorptionCorrections"; }
74 const std::string summary() const override {
75 return "Calculates an approximation of the attenuation due to absorption "
76 "and single scattering in a generic sample shape. The sample shape "
77 "can be defined by the CreateSampleShape algorithm.";
78 }
79
80protected:
85 virtual void defineProperties() { /*Empty in base class*/ }
88 virtual void retrieveProperties() { /*Empty in base class*/ }
91 virtual std::string sampleXML() = 0;
98 virtual void initialiseCachedDistances() = 0;
99
103 std::vector<double> m_L1s,
105 std::vector<Kernel::V3D> m_elementPositions;
108
109private:
111 void init() override;
112 std::map<std::string, std::string> validateInputs() override;
114 void exec() override;
115
116 void retrieveBaseProperties();
117 void constructSample(API::Sample &sample);
118 void calculateDistances(const Geometry::IDetector &detector, std::vector<double> &L2s) const;
119 inline double doIntegration(const double linearCoefAbs, const std::vector<double> &L2s, const size_t startIndex,
120 const size_t endIndex) const;
121 inline double doIntegration(const double linearCoefAbsL1, const double linearCoefAbsL2,
122 const std::vector<double> &L2s, const size_t startIndex, const size_t endIndex) const;
123
126 int64_t m_num_lambda;
128 int64_t m_xStep;
132
133 using expfunction = double (*)(double);
135};
136
137} // namespace Algorithms
138} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
This class stores information about the sample used in particular run.
Definition Sample.h:33
A base class for absorption correction algorithms.
std::vector< double > m_elementVolumes
Cached element volumes.
virtual void retrieveProperties()
A virtual function in which additional properties should be retrieved into member variables.
virtual void defineProperties()
A virtual function in which additional properties of an algorithm should be declared.
double(*)(double) expfunction
Typedef pointer to exponential function.
const std::string category() const override
Algorithm's category for identification.
double m_linearCoefTotScatt
The total scattering cross-section in 1/m.
double m_lambdaFixed
The wavelength corresponding to the fixed energy,.
Kernel::V3D m_beamDirection
The direction of the beam.
expfunction EXPONENTIAL
Pointer to exponential function.
double m_sampleVolume
The total volume of the sample.
const std::string summary() const override
Algorithm's summary.
API::MatrixWorkspace_sptr m_inputWS
A pointer to the input workspace.
const Geometry::IObject * m_sampleObject
Local cache of sample object.
size_t m_numVolumeElements
The number of volume elements.
std::vector< Kernel::V3D > m_elementPositions
Cached element positions.
std::vector< double > m_L1s
Cached L1 distances.
virtual std::string sampleXML()=0
Returns the XML string describing the sample, which can be used by the ShapeFactory.
int64_t m_num_lambda
The number of points in wavelength, the rest is.
virtual void initialiseCachedDistances()=0
Calculate the distances for L1 and element size for each element in the sample.
Interface class for detector objects.
Definition IDetector.h:43
IObject : Interface for geometry objects.
Definition IObject.h:42
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
Definition Material.h:50
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.
Type
Define the available energy transfer modes It is important to assign enums proper numbers,...
Definition DeltaEMode.h:29