diff --git a/Framework/LiveData/inc/MantidLiveData/LoadLiveData.h b/Framework/LiveData/inc/MantidLiveData/LoadLiveData.h index 95be2c5e1634a860172f0efb8908b91f5bbacb0b..cbf7a56c0b39a6b27e1fd36f8ab5b3a291e99383 100644 --- a/Framework/LiveData/inc/MantidLiveData/LoadLiveData.h +++ b/Framework/LiveData/inc/MantidLiveData/LoadLiveData.h @@ -66,7 +66,7 @@ private: void appendChunk(Mantid::API::Workspace_sptr chunkWS); API::Workspace_sptr appendMatrixWSChunk(API::Workspace_sptr accumWS, Mantid::API::Workspace_sptr chunkWS); - void resetAllXToSingleBin(API::Workspace *workspace); + void updateDefaultBinBoundaries(API::Workspace *workspace); /// The "accumulation" workspace = after adding, but before post-processing Mantid::API::Workspace_sptr m_accumWS; diff --git a/Framework/LiveData/src/LoadLiveData.cpp b/Framework/LiveData/src/LoadLiveData.cpp index 06b3bfa200887825342416ff18480def93f9ea65..ba5fd01ffbec0515c3607933438386e504dc5987 100644 --- a/Framework/LiveData/src/LoadLiveData.cpp +++ b/Framework/LiveData/src/LoadLiveData.cpp @@ -418,7 +418,7 @@ Workspace_sptr LoadLiveData::appendMatrixWSChunk(Workspace_sptr accumWS, } namespace { -bool shouldResetAllXToSingleBin(const EventWorkspace *workspace) { +bool isUsingDefaultBinBoundaries(const EventWorkspace *workspace) { // only check first spectrum const auto &x = workspace->binEdges(0); if (x.size() > 2) @@ -439,16 +439,16 @@ bool shouldResetAllXToSingleBin(const EventWorkspace *workspace) { * * @param workspace :: Workspace(Group) that will have its bins reset */ -void LoadLiveData::resetAllXToSingleBin(API::Workspace *workspace) { +void LoadLiveData::updateDefaultBinBoundaries(API::Workspace *workspace) { if (auto *ws_event = dynamic_cast<EventWorkspace *>(workspace)) { - if (shouldResetAllXToSingleBin(ws_event)) + if (isUsingDefaultBinBoundaries(ws_event)) ws_event->resetAllXToSingleBin(); } else if (auto *ws_group = dynamic_cast<WorkspaceGroup *>(workspace)) { auto num_entries = static_cast<size_t>(ws_group->getNumberOfEntries()); for (size_t i = 0; i < num_entries; ++i) { auto ws = ws_group->getItem(i); if (auto *ws_event = dynamic_cast<EventWorkspace *>(ws.get())) - if (shouldResetAllXToSingleBin(ws_event)) + if (isUsingDefaultBinBoundaries(ws_event)) ws_event->resetAllXToSingleBin(); } } @@ -505,11 +505,10 @@ void LoadLiveData::exec() { this->setPropertyValue("LastTimeStamp", lastTimeStamp.toISO8601String()); // For EventWorkspaces, we adjust the X values such that all events fit - // within the bin boundaries. This is done both before and after the - // "Process" step. Any custom rebinning should be done in Post-Processing. + // within the bin boundaries const bool preserveEvents = this->getProperty("PreserveEvents"); if (preserveEvents) - this->resetAllXToSingleBin(chunkWS.get()); + this->updateDefaultBinBoundaries(chunkWS.get()); // Now we process the chunk Workspace_sptr processed = this->processChunk(chunkWS); @@ -569,11 +568,10 @@ void LoadLiveData::exec() { // Default to Add. this->addChunk(processed); - // For EventWorkspaces, we adjust the X values such that all events fit - // within the bin boundaries. This is done both before and after the - // "Process" step. Any custom rebinning should be done in Post-Processing. + // When adding events, the default bin boundaries may need to be updated. + // The function itself checks to see if it is appropriate if (preserveEvents) { - this->resetAllXToSingleBin(m_accumWS.get()); + this->updateDefaultBinBoundaries(m_accumWS.get()); } }