20using namespace Kernel;
24using namespace Geometry;
37 auto wsValidator = std::make_shared<CompositeValidator>();
42 algCalcCarpenter->initialize();
46 "The name of the input workspace.");
48 "The name of the output workspace.");
71 auto absWksp = std::dynamic_pointer_cast<MatrixWorkspace>(absPtr);
72 auto msWksp = std::dynamic_pointer_cast<MatrixWorkspace>(msPtr);
77 const auto NUM_HIST =
static_cast<int64_t
>(inputWksp->getNumberHistograms());
79 for (int64_t i = 0; i < NUM_HIST; ++i) {
81 auto &
y = absWksp->mutableY(i);
82 for (
size_t j = 0; j <
y.size(); j++) {
90 auto correctionWksp =
minus(absWksp, msWksp);
99 auto outputWkspEvent = std::dynamic_pointer_cast<EventWorkspace>(outputWksp);
100 setProperty(
"OutputWorkspace", outputWkspEvent);
102 setProperty(
"OutputWorkspace", outputWksp);
106 double coeff1,
double coeff2,
double coeff3,
107 bool doAbs,
bool doMS) {
109 calculate->setProperty(
"InputWorkspace", inputWksp);
110 calculate->setProperty(
"CylinderSampleRadius",
radius);
111 calculate->setProperty(
"AttenuationXSection", coeff1);
112 calculate->setProperty(
"SampleNumberDensity", coeff2);
113 calculate->setProperty(
"ScatteringXSection", coeff3);
114 calculate->setProperty(
"Absorption", doAbs);
115 calculate->setProperty(
"MultipleScattering", doMS);
116 calculate->execute();
124 minus->setProperty(
"LHSWorkspace", lhsWS);
125 minus->setProperty(
"RHSWorkspace", rhsWS);
134 multiply->setProperty(
"LHSWorkspace", lhsWS);
135 multiply->setProperty(
"RHSWorkspace", rhsWS);
#define DECLARE_ALGORITHM(classname)
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
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) override
Create a Child Algorithm.
void copyProperty(const API::Algorithm_sptr &alg, const std::string &name)
Copy a property from an existing algorithm.
Kernel::IPropertyManager::TypedValue getProperty(const std::string &name) const override
Get the property held by this object.
A validator which checks that a workspace has a valid instrument.
A property class for workspaces.
A validator which checks that the unit of the workspace referred to by a WorkspaceProperty is the exp...
API::MatrixWorkspace_sptr multiply(const API::MatrixWorkspace_sptr &lhsWS, const API::MatrixWorkspace_sptr &rhsWS)
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
int version() const override
Algorithm's version for identification overriding a virtual method.
void init() override
Initialize the properties to default values.
API::MatrixWorkspace_sptr minus(const API::MatrixWorkspace_sptr &lhsWS, const API::MatrixWorkspace_sptr &rhsWS)
void exec() override
Execute the algorithm.
API::WorkspaceGroup_sptr calculateCorrection(API::MatrixWorkspace_sptr &inputWksp, double radius, double coeff1, double coeff2, double coeff3, bool doAbs, bool doMS)
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
@ Input
An input workspace.
@ Output
An output workspace.