Commit 9de01c5b authored by Matt Cumber's avatar Matt Cumber
Browse files

Re #29025 Fix LoadMuonNexusV2

parent ac4ffcf8
......@@ -31,8 +31,8 @@ public:
virtual API::Workspace_sptr loadDetectorGrouping() const = 0;
// Load dead time table
virtual API::Workspace_sptr loadDeadTimeTable() const = 0;
// Set time zero table
virtual API::Workspace_sptr setTimeZeroTable() const = 0;
// Get time zero table
virtual API::Workspace_sptr getTimeZeroTable() = 0;
protected:
// Create grouping table
......
......@@ -27,8 +27,8 @@ public:
API::Workspace_sptr loadDetectorGrouping() const override;
// Load dead time table
API::Workspace_sptr loadDeadTimeTable() const override;
// Set time zero table
API::Workspace_sptr setTimeZeroTable() const override;
// Get time zero table
API::Workspace_sptr getTimeZeroTable() override;
private:
API::WorkspaceGroup &m_workspaceGroup;
......
......@@ -29,8 +29,8 @@ public:
API::Workspace_sptr loadDetectorGrouping() const override;
// Load dead time table
API::Workspace_sptr loadDeadTimeTable() const override;
// Set time zero table
API::Workspace_sptr setTimeZeroTable() const override;
// Get time zero table
API::Workspace_sptr getTimeZeroTable() override;
private:
DataObjects::Workspace2D &m_workspace;
......
......@@ -182,7 +182,7 @@ void LoadMuonNexusV2::execLoader() {
// Time Zero table should be returned if found
if (!getPropertyValue("TimeZerotable").empty()) {
// Create table and set property]
auto timeZeroTable = m_loadMuonStrategy->setTimeZeroTable();
auto timeZeroTable = m_loadMuonStrategy->getTimeZeroTable();
setProperty("TimeZeroTable", timeZeroTable);
}
}
......
......@@ -120,16 +120,15 @@ API::Workspace_sptr MultiPeriodLoadMuonStrategy::loadDeadTimeTable() const {
}
/**
* Sets time zero table from loaded time zeros
* Gets time zero table from loaded time zeros
* Assumes all peridos have same time zero
* @returns :: Time zero table
*/
Workspace_sptr MultiPeriodLoadMuonStrategy::setTimeZeroTable() const {
const double timeZero = m_nexusLoader.loadTimeZeroFromNexusFile();
Workspace_sptr MultiPeriodLoadMuonStrategy::getTimeZeroTable() {
auto workspace =
std::dynamic_pointer_cast<Workspace2D>(m_workspaceGroup.getItem(0));
const auto numSpec = workspace->getNumberHistograms();
std::vector<double> timeZeros(numSpec, timeZero);
auto timeZeros = m_nexusLoader.loadTimeZeroListFromNexusFile(numSpec);
return createTimeZeroTable(numSpec, timeZeros);
}
......
......@@ -94,13 +94,12 @@ Workspace_sptr SinglePeriodLoadMuonStrategy::loadDeadTimeTable() const {
return createDeadTimeTable(m_detectors, deadTimes);
}
/**
* Sets time zero table from loaded time zeros
* Gets time zero table from loaded time zeros
* @returns :: Time zero table
*/
Workspace_sptr SinglePeriodLoadMuonStrategy::setTimeZeroTable() const {
const double timeZero = m_nexusLoader.loadTimeZeroFromNexusFile();
Workspace_sptr SinglePeriodLoadMuonStrategy::getTimeZeroTable() {
const auto numSpec = m_workspace.getNumberHistograms();
std::vector<double> timeZeros(numSpec, timeZero);
auto timeZeros = m_nexusLoader.loadTimeZeroListFromNexusFile(numSpec);
return createTimeZeroTable(numSpec, timeZeros);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment