19using namespace Kernel;
20using namespace Geometry;
24 :
AbsorptionCorrection(), m_slabHeight(0.0), m_slabWidth(0.0), m_slabThickness(0.0), m_numXSlices(0),
25 m_numYSlices(0), m_numZSlices(0), m_XSliceThickness(0), m_YSliceThickness(0), m_ZSliceThickness(0) {}
28 auto mustBePositive = std::make_shared<BoundedValidator<double>>();
29 mustBePositive->setLower(0.0);
30 declareProperty(
"SampleHeight", -1.0, mustBePositive,
"The height of the plate in cm");
31 declareProperty(
"SampleWidth", -1.0, mustBePositive,
"The width of the plate in cm");
32 declareProperty(
"SampleThickness", -1.0, mustBePositive,
"The thickness of the plate in cm");
34 auto moreThanZero = std::make_shared<BoundedValidator<double>>();
35 moreThanZero->setLower(0.001);
36 declareProperty(
"ElementSize", 1.0, moreThanZero,
"The size of one side of an integration element cube in mm");
64 const V3D samplePos =
m_inputWS->getInstrument()->getSample()->getPos();
70 std::ostringstream xmlShapeStream;
71 xmlShapeStream <<
" <cuboid id=\"sample-shape\"> "
72 <<
"<left-front-bottom-point x=\"" << szX + samplePos.
X() <<
"\" y=\"" << -szY + samplePos.
Y()
73 <<
"\" z=\"" << -szZ + samplePos.
Z() <<
"\" /> "
74 <<
"<left-front-top-point x=\"" << szX + samplePos.
X() <<
"\" y=\"" << szY + samplePos.
Y()
75 <<
"\" z=\"" << -szZ + samplePos.
Z() <<
"\" /> "
76 <<
"<left-back-bottom-point x=\"" << szX + samplePos.
X() <<
"\" y=\"" << -szY + samplePos.
Y()
77 <<
"\" z=\"" << szZ + samplePos.
Z() <<
"\" /> "
78 <<
"<right-front-bottom-point x=\"" << -szX + samplePos.
X() <<
"\" y=\"" << -szY + samplePos.
Y()
79 <<
"\" z=\"" << -szZ + samplePos.
Z() <<
"\" /> "
82 return xmlShapeStream.str();
95 g_log.
error(
"Too many volume elements requested - try increasing the value "
96 "of the ElementSize property.");
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A base class for absorption correction algorithms.
std::vector< double > m_elementVolumes
Cached element volumes.
Kernel::V3D m_beamDirection
The direction of the beam.
double m_sampleVolume
The total volume of the sample.
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.
double m_ZSliceThickness
The thickness of a Z slice in m.
int m_numXSlices
The number of slices in X.
double m_slabThickness
The thickness of the sample in m.
FlatPlateAbsorption()
(Empty) Constructor
double m_slabHeight
The height of the sample in m.
double m_XSliceThickness
The thickness of an X slice in m.
void defineProperties() override
A virtual function in which additional properties of an algorithm should be declared.
double m_slabWidth
The width of the sample in m.
void initialiseCachedDistances() override
Calculate the distances for L1 and element size for each element in the sample.
int m_numZSlices
The number of slices in Z.
void retrieveProperties() override
Fetch the properties and set the appropriate member variables.
double m_YSliceThickness
The thickness of a Y slice in m.
int m_numYSlices
The number of slices in Y.
std::string sampleXML() override
Returns the XML string describing the sample, which can be used by the ShapeFactory.
virtual int interceptSurface(Geometry::Track &) const =0
virtual bool isValid(const Kernel::V3D &) const =0
Defines a track as a start point and a direction.
LType::const_iterator cbegin() const
Returns an interator to the start of the set of links (const version)
Exception for errors associated with the instrument definition.
void error(const std::string &msg)
Logs at error level.
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
constexpr double Z() const noexcept
Get z.