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;
22class SpectrumInfo;
23} // namespace API
24namespace Geometry {
25class IDetector;
26class IObject;
27} // namespace Geometry
28
29namespace Algorithms {
68class MANTID_ALGORITHMS_DLL AbsorptionCorrection : public API::Algorithm {
69public:
73 const std::string category() const override { return "CorrectionFunctions\\AbsorptionCorrections"; }
75 const std::string summary() const override {
76 return "Calculates an approximation of the attenuation due to absorption "
77 "and single scattering in a generic sample shape. The sample shape "
78 "can be defined by the CreateSampleShape algorithm.";
79 }
80
81protected:
86 virtual void defineProperties() { /*Empty in base class*/ }
89 virtual void retrieveProperties() { /*Empty in base class*/ }
92 virtual std::string sampleXML() = 0;
99 virtual void initialiseCachedDistances() = 0;
100
104 std::vector<double> m_L1s,
106 std::vector<Kernel::V3D> m_elementPositions;
109
110private:
112 void init() override;
113 std::map<std::string, std::string> validateInputs() override;
115 void exec() override;
116
117 void retrieveBaseProperties();
118 void constructSample(API::Sample &sample);
119 void calculateDistances(const API::SpectrumInfo &spectrumInfo, const size_t index, std::vector<double> &L2s) const;
120 inline double doIntegration(const double linearCoefAbs, const std::vector<double> &L2s, const size_t startIndex,
121 const size_t endIndex) const;
122 inline double doIntegration(const double linearCoefAbsL1, const double linearCoefAbsL2,
123 const std::vector<double> &L2s, const size_t startIndex, const size_t endIndex) const;
124
127 int64_t m_num_lambda;
129 int64_t m_xStep;
133
134 using expfunction = double (*)(double);
136};
137
138} // namespace Algorithms
139} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
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:35
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
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:37
IObject : Interface for geometry objects.
Definition IObject.h:43
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: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.
Type
Define the available energy transfer modes It is important to assign enums proper numbers,...
Definition DeltaEMode.h:29