17constexpr const char *SHAPE_NAME_SLIT =
"Slit";
18constexpr const char *SHAPE_NAME_CIRCLE =
"Circle";
20constexpr const char *WIDTH_PARAM_NAME =
"beam-width";
22constexpr const char *HEIGHT_PARAM_NAME =
"beam-height";
24constexpr const char *RADIUS_PARAM_NAME =
"beam-radius";
26constexpr const char *SHAPE_PARAM_NAME =
"beam-shape";
35const
std::
string SetBeam::name()
const {
return "SetBeam"; }
44const std::string
SetBeam::summary()
const {
return "Set properties of the beam such as size and shape"; }
50 std::map<std::string, std::string> errors;
53 bool s = geometryArgs->existsProperty(
"Shape");
54 bool w = geometryArgs->existsProperty(
"Width");
55 bool h = geometryArgs->existsProperty(
"Height");
56 bool r = geometryArgs->existsProperty(
"Radius");
57 if (s && ((w && h) != r)) {
58 std::string shape = geometryArgs->getProperty(
"Shape");
59 if (shape != SHAPE_NAME_SLIT && shape != SHAPE_NAME_CIRCLE) {
60 errors[
"Geometry"] =
"Only 'Slit' and 'Circle' shapes are supported.";
63 errors[
"Geometry"] =
"'Geometry' flags missing or incorrect. Required flags: Shape, "
64 "plus Width and Height, or Radius";
67 errors[
"Geometry"] =
"No 'Geometry' flags given.";
85 "An input workspace with an attached instrument.");
87 "A dictionary of geometry parameters for the beam");
101 auto instrument = inputWS->getInstrument();
102 auto source = instrument->getSource();
103 auto &
pmap = inputWS->instrumentParameters();
105 std::string shape = geometryArgs->getProperty(
"Shape");
107 if (shape.compare(
"Circle") == 0) {
108 double radius = geometryArgs->getProperty(
"Radius");
113 pmap.addDouble(source->getComponentID(), RADIUS_PARAM_NAME,
radius);
114 pmap.addString(source->getComponentID(), SHAPE_PARAM_NAME, SHAPE_NAME_CIRCLE);
116 double width = geometryArgs->getProperty(
"Width");
117 double height = geometryArgs->getProperty(
"Height");
123 pmap.addDouble(source->getComponentID(), WIDTH_PARAM_NAME, width);
124 pmap.addDouble(source->getComponentID(), HEIGHT_PARAM_NAME,
height);
125 pmap.addString(source->getComponentID(), SHAPE_PARAM_NAME, SHAPE_NAME_SLIT);
#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 validator which checks that a workspace has a valid instrument.
Base MatrixWorkspace Abstract Class.
A property class for workspaces.
Set properties of the beam.
std::map< std::string, std::string > validateInputs() override final
int version() const override final
Algorithm's version for identification.
const std::string summary() const override final
Algorithm's summary for use in the GUI and help.
const std::string category() const override final
Algorithm's category for identification.
void init() override final
Initialize the algorithm's properties.
void exec() override final
Execute.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< PropertyManager > PropertyManager_sptr
Typedef for a shared pointer to a PropertyManager.
Generate a tableworkspace to store the calibration results.
Describes the direction (within an algorithm) of a Property.
@ Input
An input workspace.