32using namespace Kernel;
33using namespace Geometry;
35using namespace DataObjects;
38 :
API::
Algorithm(), m_inputWS(), m_sampleObject(nullptr), m_beamDirection(), m_L1s(), m_elementVolumes(),
39 m_elementPositions(), m_numVolumeElements(0), m_sampleVolume(0.), m_refAtten(0.0), m_scattering(0.), n_lambda(0),
40 x_step(0), m_emode(0), m_lambdaFixed(0.) {}
44 auto wsValidator = std::make_shared<CompositeValidator>();
49 "The X values for the input workspace must be in units of wavelength");
51 "Output workspace name");
53 auto mustBePositive = std::make_shared<BoundedValidator<double>>();
54 mustBePositive->setLower(0.0);
56 "The '''absorption''' cross-section, at 1.8 Angstroms, for "
57 "the sample material in barns, if not set with "
58 "SetSampleMaterial.");
60 "The (coherent + incoherent) scattering cross-section for "
61 "the sample material in barns, if not set with "
62 "SetSampleMaterial.");
64 "The number density of the sample in number of atoms per "
65 "cubic angstrom, if not set with SetSampleMaterial");
67 "The radius of the spherical sample in centimetresif "
68 "not set with SetSample.");
80 correctionFactors->setDistribution(
true);
81 correctionFactors->setYUnit(
"");
82 correctionFactors->setYUnitLabel(
"Attenuation factor");
83 double m_sphRadius =
getProperty(
"SphericalSampleRadius");
92 anvred->setProperty(
"PreserveEvents",
true);
93 anvred->setProperty(
"ReturnTransmissionOnly",
true);
94 anvred->setProperty(
"LinearScatteringCoef",
m_scattering);
95 anvred->setProperty(
"LinearAbsorptionCoef",
m_refAtten);
96 anvred->setProperty(
"Radius", m_sphRadius);
97 anvred->executeAsChildAlg();
102 correctionFactors = anvred->getProperty(
"OutputWorkspace");
108 double sigma_atten =
getProperty(
"AttenuationXSection");
109 double sigma_s =
getProperty(
"ScatteringXSection");
121 NeutronAtom neutron(0, 0, 0.0, 0.0, sigma_s, 0.0, sigma_s, sigma_atten);
122 auto shape = std::shared_ptr<IObject>(
123 m_inputWS->sample().getShape().cloneWithMaterial(
Material(
"SetInSphericalAbsorption", neutron,
rho)));
124 m_inputWS->mutableSample().setShape(shape);
#define DECLARE_ALGORITHM(classname)
Base class from which all concrete algorithm classes should be derived.
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.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
A validator which checks that a workspace has a valid instrument.
Helper class for reporting progress from algorithms.
A property class for workspaces.
A validator which checks that the unit of the workspace referred to by a WorkspaceProperty is the exp...
double m_scattering
The scattering cross-section in 1/m.
API::MatrixWorkspace_sptr m_inputWS
A pointer to the input workspace.
void exec() override
Execution code.
void retrieveBaseProperties()
Fetch the properties and set the appropriate member variables.
SphericalAbsorption()
(Empty) Constructor
double m_refAtten
The attenuation cross-section in 1/m at 1.8A.
void init() override
Initialisation code.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
double numberDensity() const
Get the number density.
double absorbXSection(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Get the absorption cross section at a given wavelength in barns.
double totalScatterXSection() const
Return the total scattering cross section for a given wavelength in barns.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
A namespace containing physical constants that are required by algorithms and unit routines.
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
@ Input
An input workspace.
@ Output
An output workspace.
Structure to store neutronic scattering information for the various elements.
static const double ReferenceLambda
The reference wavelength value for absorption cross sections.