From 07a1fa160798cc0d8a651fd3bee9faaa1f124b8f Mon Sep 17 00:00:00 2001
From: Pete Peterson <petersonpf@ornl.gov>
Date: Tue, 2 Oct 2018 09:57:03 -0400
Subject: [PATCH] Rename functions to clarify what they do

---
 .../inc/MantidLiveData/LoadLiveData.h         |  2 +-
 Framework/LiveData/src/LoadLiveData.cpp       | 20 +++++++++----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/Framework/LiveData/inc/MantidLiveData/LoadLiveData.h b/Framework/LiveData/inc/MantidLiveData/LoadLiveData.h
index 95be2c5e163..cbf7a56c0b3 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 06b3bfa2008..ba5fd01ffbe 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());
     }
   }
 
-- 
GitLab