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:
82
87 virtual void defineProperties() { /*Empty in base class*/
88 }
91 virtual void retrieveProperties() { /*Empty in base class*/
92 }
95 virtual std::string sampleXML() = 0;
102 virtual void initialiseCachedDistances() = 0;
103
107 std::vector<double> m_L1s,
109 std::vector<Kernel::V3D> m_elementPositions;
112
113private:
115 void init() override;
116 std::map<std::string, std::string> validateInputs() override;
118 void exec() override;
119
120 void retrieveBaseProperties();
121 void constructSample(API::Sample &sample);
122 void calculateDistances(const Geometry::IDetector &detector, std::vector<double> &L2s) const;
123 inline double doIntegration(const double linearCoefAbs, const std::vector<double> &L2s, const size_t startIndex,
124 const size_t endIndex) const;
125 inline double doIntegration(const double linearCoefAbsL1, const double linearCoefAbsL2,
126 const std::vector<double> &L2s, const size_t startIndex, const size_t endIndex) const;
127
130 int64_t m_num_lambda;
132 int64_t m_xStep;
136
137 using expfunction = double (*)(double);
139};
140
141} // namespace Algorithms
142} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
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:41
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