diff --git a/Framework/Algorithms/inc/MantidAlgorithms/WorkspaceJoiners.h b/Framework/Algorithms/inc/MantidAlgorithms/WorkspaceJoiners.h index 1b9165ba8c114e0a54014a92082a98f429ef8f96..ea6bad10efd226a41ddefa545920591718fbfc2b 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/WorkspaceJoiners.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/WorkspaceJoiners.h @@ -52,7 +52,8 @@ public: protected: API::MatrixWorkspace_sptr execWS2D(const API::MatrixWorkspace &ws1, const API::MatrixWorkspace &ws2); - API::MatrixWorkspace_sptr execEvent(); + API::MatrixWorkspace_sptr execEvent(const DataObjects::EventWorkspace &event_ws1, + const DataObjects::EventWorkspace &event_ws2); using Mantid::API::Algorithm::validateInputs; void validateInputs(const API::MatrixWorkspace &ws1, @@ -66,10 +67,6 @@ protected: API::MatrixWorkspace &output) = 0; API::Progress *m_progress; ///< Progress reporting object - DataObjects::EventWorkspace_const_sptr - event_ws1; ///< First event workspace input. - DataObjects::EventWorkspace_const_sptr - event_ws2; ///< Second event workspace input. }; } // namespace Algorithms diff --git a/Framework/Algorithms/src/AppendSpectra.cpp b/Framework/Algorithms/src/AppendSpectra.cpp index 6400881d9d21d6696e7349cd05e5cc38e8a3943f..fa86eae8201e2d0858309b670ff9715968ef11f9 100644 --- a/Framework/Algorithms/src/AppendSpectra.cpp +++ b/Framework/Algorithms/src/AppendSpectra.cpp @@ -60,8 +60,8 @@ void AppendSpectra::exec() { // Retrieve the input workspaces MatrixWorkspace_const_sptr ws1 = getProperty("InputWorkspace1"); MatrixWorkspace_const_sptr ws2 = getProperty("InputWorkspace2"); - event_ws1 = boost::dynamic_pointer_cast<const EventWorkspace>(ws1); - event_ws2 = boost::dynamic_pointer_cast<const EventWorkspace>(ws2); + DataObjects::EventWorkspace_const_sptr event_ws1 = boost::dynamic_pointer_cast<const EventWorkspace>(ws1); + DataObjects::EventWorkspace_const_sptr event_ws2 = boost::dynamic_pointer_cast<const EventWorkspace>(ws2); // Make sure that we are not mis-matching EventWorkspaces and other types of // workspaces @@ -85,7 +85,7 @@ void AppendSpectra::exec() { if (event_ws1 && event_ws2) { // Both are event workspaces. Use the special method - MatrixWorkspace_sptr output = this->execEvent(); + MatrixWorkspace_sptr output = this->execEvent(*event_ws1, *event_ws2); if (number > 1) g_log.warning("Number property is ignored for event workspaces"); if (mergeLogs) diff --git a/Framework/Algorithms/src/ConjoinWorkspaces.cpp b/Framework/Algorithms/src/ConjoinWorkspaces.cpp index 37f2fd807fc2a21ea73407fefea9ea6780037e09..29ba6e01b9ef491074259434f42b4ce4f1ad0df4 100644 --- a/Framework/Algorithms/src/ConjoinWorkspaces.cpp +++ b/Framework/Algorithms/src/ConjoinWorkspaces.cpp @@ -46,8 +46,8 @@ void ConjoinWorkspaces::exec() { // Retrieve the input workspaces MatrixWorkspace_const_sptr ws1 = getProperty("InputWorkspace1"); MatrixWorkspace_const_sptr ws2 = getProperty("InputWorkspace2"); - event_ws1 = boost::dynamic_pointer_cast<const EventWorkspace>(ws1); - event_ws2 = boost::dynamic_pointer_cast<const EventWorkspace>(ws2); + DataObjects::EventWorkspace_const_sptr event_ws1 = boost::dynamic_pointer_cast<const EventWorkspace>(ws1); + DataObjects::EventWorkspace_const_sptr event_ws2 = boost::dynamic_pointer_cast<const EventWorkspace>(ws2); // Make sure that we are not mis-matching EventWorkspaces and other types of // workspaces @@ -150,7 +150,7 @@ ConjoinWorkspaces::conjoinEvents(const DataObjects::EventWorkspace &ws1, } // Both are event workspaces. Use the special method - auto output = this->execEvent(); + auto output = this->execEvent(ws1, ws2); // Copy the history from the original workspace output->history().addHistory(ws1.getHistory()); diff --git a/Framework/Algorithms/src/WorkspaceJoiners.cpp b/Framework/Algorithms/src/WorkspaceJoiners.cpp index f2483b3c7432688297a386ccbd3127d36640060b..0131b2e4f1f72781c1d1c6523f6d59d29aa76440 100644 --- a/Framework/Algorithms/src/WorkspaceJoiners.cpp +++ b/Framework/Algorithms/src/WorkspaceJoiners.cpp @@ -118,30 +118,31 @@ MatrixWorkspace_sptr WorkspaceJoiners::execWS2D(const MatrixWorkspace &ws1, * @throw std::invalid_argument If the input workspaces do not meet the * requirements of this algorithm */ -MatrixWorkspace_sptr WorkspaceJoiners::execEvent() { +MatrixWorkspace_sptr WorkspaceJoiners::execEvent(const DataObjects::EventWorkspace &event_ws1, + const DataObjects::EventWorkspace &event_ws2) { // Create the output workspace const size_t totalHists = - event_ws1->getNumberHistograms() + event_ws2->getNumberHistograms(); + event_ws1.getNumberHistograms() + event_ws2.getNumberHistograms(); auto output = - create<EventWorkspace>(*event_ws1, totalHists, event_ws1->binEdges(0)); + create<EventWorkspace>(event_ws1, totalHists, event_ws1.binEdges(0)); // Initialize the progress reporting object m_progress = new API::Progress(this, 0.0, 1.0, totalHists); - const int64_t &nhist1 = event_ws1->getNumberHistograms(); + const int64_t &nhist1 = event_ws1.getNumberHistograms(); for (int64_t i = 0; i < nhist1; ++i) { - output->getSpectrum(i) = event_ws1->getSpectrum(i); + output->getSpectrum(i) = event_ws1.getSpectrum(i); m_progress->report(); } // For second loop we use the offset from the first - const int64_t &nhist2 = event_ws2->getNumberHistograms(); - const auto &spectrumInfo = event_ws2->spectrumInfo(); + const int64_t &nhist2 = event_ws2.getNumberHistograms(); + const auto &spectrumInfo = event_ws2.spectrumInfo(); auto &outSpectrumInfo = output->mutableSpectrumInfo(); for (int64_t j = 0; j < nhist2; ++j) { // This is the workspace index at which we assign in the output int64_t output_wi = j + nhist1; - output->getSpectrum(output_wi) = event_ws2->getSpectrum(j); + output->getSpectrum(output_wi) = event_ws2.getSpectrum(j); // Propagate spectrum masking. First workspace will have been done by the // factory @@ -155,7 +156,7 @@ MatrixWorkspace_sptr WorkspaceJoiners::execEvent() { m_progress->report(); } - fixSpectrumNumbers(*event_ws1, *event_ws2, *output); + fixSpectrumNumbers(event_ws1, event_ws2, *output); return std::move(output); }