28 std::make_shared<InstrumentValidator>()),
29 "The name of the workspace to save.");
31 "The name to give to the saved file.");
39 const std::string filename =
getProperty(
"Filename");
43 spCalcDetPar->initialize();
44 spCalcDetPar->setPropertyValue(
"InputWorkspace", inputWorkspace->getName());
46 spCalcDetPar->setPropertyValue(
"ReturnLinearRanges",
"1");
53 spCalcDetPar->execute();
55 const auto *pCalcDetPar =
dynamic_cast<FindDetectorsPar *
>(spCalcDetPar.get());
57 throw(std::bad_cast());
59 const std::vector<double> &azimuthal = pCalcDetPar->
getAzimuthal();
60 const std::vector<double> &polar = pCalcDetPar->getPolar();
61 const std::vector<double> &azimuthal_width = pCalcDetPar->getAzimWidth();
62 const std::vector<double> &polar_width = pCalcDetPar->getPolarWidth();
63 const std::vector<double> &secondary_flightpath = pCalcDetPar->getFlightPath();
64 const std::vector<size_t> &det_ID = pCalcDetPar->getDetID();
66 size_t nDetectors = pCalcDetPar->getNDetectors();
68 writePAR(filename, azimuthal, polar, azimuthal_width, polar_width, secondary_flightpath, det_ID, nDetectors);
72 const std::vector<double> &polar,
const std::vector<double> &azimuthal_width,
73 const std::vector<double> &polar_width,
const std::vector<double> &secondary_flightpath,
74 const std::vector<size_t> &det_ID,
const size_t nDetectors) {
75 std::ofstream outPAR_file(filename.c_str());
81 outPAR_file <<
" " << nDetectors <<
'\n';
83 for (
size_t i = 0; i < nDetectors; ++i) {
85 volatile double NanID = azimuthal[i];
86 if (NanID != azimuthal[i])
90 outPAR_file << std::fixed << std::setprecision(3);
91 outPAR_file.width(10);
92 outPAR_file << secondary_flightpath[i];
93 outPAR_file.width(10);
94 outPAR_file << polar[i];
95 outPAR_file.width(10);
96 outPAR_file << (-azimuthal[i]);
97 outPAR_file.width(10);
98 outPAR_file << polar_width[i];
99 outPAR_file.width(10);
100 outPAR_file << azimuthal_width[i];
101 outPAR_file.width(10);
102 outPAR_file << det_ID[i] <<
'\n';
#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.
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.
@ Save
to specify a file to write to, the file may or may not exist
A property class for workspaces.
std::vector< double > const & getAzimuthal() const
the accessors, used to return algorithm results when called as Child Algorithm, without setting the p...
std::string det_par_ws_name
The name of the table workpsace with detectors positions used in tests.
static void writePAR(const std::string &filename, const std::vector< double > &azimuthal, const std::vector< double > &polar, const std::vector< double > &azimuthal_width, const std::vector< double > &polar_width, const std::vector< double > &secondary_flightpath, const std::vector< size_t > &det_ID, const size_t nDetectors)
void init() override
Initialisation code.
void exec() override
Execution code.
Records the filename and the description of failure.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
@ Input
An input workspace.