19#include <Poco/DOM/DOMParser.h>
20#include <Poco/DOM/Document.h>
21#include <Poco/DOM/NodeList.h>
23using Poco::XML::Element;
25using Poco::XML::NodeList;
39 "Load the transmission related data from the file if it is present "
40 "(optional, default False).");
53 std::string out_wsname = this->
getProperty(
"OutputWorkspace");
68 const std::string &trans_name,
const std::string &output_name) {
70 std::string trans_wsname = std::string(output_name).append(
"_trans_").append(trans_name);
73 std::string propertyWS;
74 if (trans_name ==
"sample")
75 propertyWS =
"TransmissionWorkspace";
77 propertyWS =
"TransmissionCanWorkspace";
78 const std::string doc =
"The transmission workspace";
82 WS->mutableRun().addProperty(
"Filename", fileName);
89 for (
unsigned int i = 0; i <
trans_gp.size(); i++) {
92 newWork->mutableRun().addProperty(
"Filename", fileName);
93 std::stringstream pname;
94 std::stringstream
name;
95 pname << propertyWS << i;
96 name << trans_wsname << i;
100 group->addWorkspace(newWork);
102 std::string pname = std::string(propertyWS).append(
"GP");
126 auto *workspaceElem =
dynamic_cast<Element *
>(workspaceData);
129 Poco::AutoPtr<NodeList> sasTransList = workspaceElem->getElementsByTagName(
"SAStransmission_spectrum");
130 if (!sasTransList->length()) {
135 for (
unsigned short trans_index = 0; trans_index < sasTransList->length(); trans_index++) {
137 Node *idataElem = sasTransList->item(trans_index);
138 auto *sasTrasElem =
dynamic_cast<Element *
>(idataElem);
141 std::vector<API::MatrixWorkspace_sptr> &group =
145 Poco::AutoPtr<NodeList> tdataElemList = sasTrasElem->getElementsByTagName(
"Tdata");
146 size_t nBins = tdataElemList->length();
152 std::string title = main_out->getTitle();
154 title += sasTrasElem->getAttribute(
"name");
155 dataWS->setTitle(title);
156 dataWS->setDistribution(
true);
157 dataWS->setYUnit(
"");
160 auto &
X = dataWS->mutableX(0);
161 auto &
Y = dataWS->mutableY(0);
162 auto &E = dataWS->mutableE(0);
167 idataElem = tdataElemList->item(
index);
168 auto *elem =
dynamic_cast<Element *
>(idataElem);
172 Element *qElem = elem->getChildElement(
"Lambda");
173 check(qElem,
"Lambda");
174 nodeVal = qElem->innerText();
175 std::stringstream
x(nodeVal);
181 Element *iElem = elem->getChildElement(
"T");
183 nodeVal = iElem->innerText();
184 std::stringstream
y(nodeVal);
189 Element *idevElem = elem->getChildElement(
"Tdev");
191 check(qElem,
"Tdev");
192 nodeVal = idevElem->innerText();
193 std::stringstream e(nodeVal);
197 E[vecindex] = std::sqrt(
d);
205 dataWS->getAxis(0)->setUnit(
"Wavelength");
208 group.emplace_back(dataWS);
std::map< DeltaEMode::Type, std::string > index
#define DECLARE_FILELOADER_ALGORITHM(classname)
DECLARE_FILELOADER_ALGORITHM should be used in place of the standard DECLARE_ALGORITHM macro when wri...
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Class to hold a set of workspaces.
A property class for workspaces.
This algorithm loads 1 CanSAS1d xml file into a workspace.
std::vector< API::MatrixWorkspace_sptr > trans_gp
void exec() override
Overwrites Algorithm method.
std::vector< API::MatrixWorkspace_sptr > trans_can_gp
void processTransmission(const std::vector< API::MatrixWorkspace_sptr > &trans_gp, const std::string &trans_name, const std::string &output_name)
Process the Transmission workspaces in order to output them to Mantid.
API::MatrixWorkspace_sptr loadEntry(Poco::XML::Node *const workspaceData, std::string &runName) override
Extends the LoadEntry to deal with the possibility of Transmission data.
void exec() override
Overwrites Algorithm method.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
void runLoadInstrument(const std::string &inst_name, const API::MatrixWorkspace_sptr &localWorkspace)
Run LoadInstrument Child Algorithm.
void init() override
Overwrites Algorithm method.
void check(const Poco::XML::Element *const toCheck, const std::string &name) const
Checks if the pointer to the loaded data is not null or throws if it is.
void createLogs(const Poco::XML::Element *const sasEntry, const API::MatrixWorkspace_sptr &wSpace) const
Loads data into the run log.
virtual API::MatrixWorkspace_sptr loadEntry(Poco::XML::Node *const workspaceData, std::string &runName)
Loads an individual SASentry element into a new workspace.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void warning(const std::string &msg)
Logs at warning level.
The concrete, templated class for properties.
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
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
@ Input
An input workspace.
@ Output
An output workspace.