35 std::make_shared<InstrumentValidator>()),
36 "The name of the workspace to save.");
38 "The name to give to the saved file.");
47 const std::string filename =
getProperty(
"Filename");
52 std::ofstream outPAR_file(filename.c_str());
55 g_log.
error(
"Failed to open (PAR) file:" + filename);
61 spCalcDetPar->initialize();
62 spCalcDetPar->setPropertyValue(
"InputWorkspace", inputWorkspace->getName());
64 spCalcDetPar->setPropertyValue(
"ReturnLinearRanges",
"1");
76 spCalcDetPar->execute();
80 throw(std::bad_cast());
82 const std::vector<double> &azimuthal = pCalcDetPar->
getAzimuthal();
83 const std::vector<double> &polar = pCalcDetPar->getPolar();
84 const std::vector<double> &azimuthal_width = pCalcDetPar->getAzimWidth();
85 const std::vector<double> &polar_width = pCalcDetPar->getPolarWidth();
86 const std::vector<double> &secondary_flightpath = pCalcDetPar->getFlightPath();
87 const std::vector<size_t> &det_ID = pCalcDetPar->getDetID();
89 size_t nDetectors = pCalcDetPar->getNDetectors();
92 outPAR_file <<
" " << nDetectors <<
'\n';
94 for (
size_t i = 0; i < nDetectors; ++i) {
96 volatile double NanID = azimuthal[i];
97 if (NanID != azimuthal[i])
101 outPAR_file << std::fixed << std::setprecision(3);
102 outPAR_file.width(10);
103 outPAR_file << secondary_flightpath[i];
104 outPAR_file.width(10);
105 outPAR_file << polar[i];
106 outPAR_file.width(10);
107 outPAR_file << (-azimuthal[i]);
108 outPAR_file.width(10);
109 outPAR_file << polar_width[i];
110 outPAR_file.width(10);
111 outPAR_file << azimuthal_width[i];
112 outPAR_file.width(10);
113 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.
void init() override
Initialisation code.
void exec() override
Execution code.
Records the filename and the description of failure.
void error(const std::string &msg)
Logs at error level.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< const IComponent > IComponent_const_sptr
Typdef of a shared pointer to a const IComponent.
@ Input
An input workspace.