From 009ca9c393fb777e93ebc0bae4c3824cfd21e611 Mon Sep 17 00:00:00 2001
From: "Zhang, Chen" <zhangc@ornl.gov>
Date: Fri, 26 Mar 2021 11:35:31 -0400
Subject: [PATCH] modification based on PR feedback

---
 .../Algorithms/src/CompareWorkspaces.cpp      | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/Framework/Algorithms/src/CompareWorkspaces.cpp b/Framework/Algorithms/src/CompareWorkspaces.cpp
index 50434a90165..2db836f5b03 100644
--- a/Framework/Algorithms/src/CompareWorkspaces.cpp
+++ b/Framework/Algorithms/src/CompareWorkspaces.cpp
@@ -1112,7 +1112,7 @@ void CompareWorkspaces::doPeaksComparison(PeaksWorkspace_sptr tws1,
       if (name == "RunNumber") {
         s1 = double(peak1.getRunNumber());
         s2 = double(peak2.getRunNumber());
-      } else if (name == "detid") {
+      } else if (name == "DetID") {
         s1 = double(peak1.getDetectorID());
         s2 = double(peak2.getDetectorID());
       } else if (name == "h") {
@@ -1130,7 +1130,7 @@ void CompareWorkspaces::doPeaksComparison(PeaksWorkspace_sptr tws1,
       } else if (name == "Energy") {
         s1 = peak1.getInitialEnergy();
         s2 = peak2.getInitialEnergy();
-      } else if (name == "tof") {
+      } else if (name == "TOF") {
         s1 = peak1.getTOF();
         s2 = peak2.getTOF();
       } else if (name == "DSpacing") {
@@ -1145,10 +1145,10 @@ void CompareWorkspaces::doPeaksComparison(PeaksWorkspace_sptr tws1,
       } else if (name == "BinCount") {
         s1 = peak1.getBinCount();
         s2 = peak2.getBinCount();
-      } else if (name == "row") {
+      } else if (name == "Row") {
         s1 = peak1.getRow();
         s2 = peak2.getRow();
-      } else if (name == "col") {
+      } else if (name == "Col") {
         s1 = peak1.getCol();
         s2 = peak2.getCol();
       }
@@ -1212,9 +1212,6 @@ void CompareWorkspaces::doLeanElasticPeaksComparison(
       } else if (name == "Wavelength") {
         s1 = ipws1->getPeak(i).getWavelength();
         s2 = ipws2->getPeak(i).getWavelength();
-      } else if (name == "Energy") {
-        s1 = ipws1->getPeak(i).getFinalEnergy();
-        s2 = ipws2->getPeak(i).getFinalEnergy();
       } else if (name == "DSpacing") {
         s1 = ipws1->getPeak(i).getDSpacing();
         s2 = ipws2->getPeak(i).getDSpacing();
@@ -1235,6 +1232,14 @@ void CompareWorkspaces::doLeanElasticPeaksComparison(
           s1 += (q1[i] - q2[i]) * (q1[i] - q2[i]);
         }
         s1 = std::sqrt(s1);
+      } else if (name == "QSample") {
+        V3D q1 = ipws1->getPeak(i).getQSampleFrame();
+        V3D q2 = ipws2->getPeak(i).getQSampleFrame();
+        // using s1 here as the diff
+        for (int i = 0; i < 3; ++i) {
+          s1 += (q1[i] - q2[i]) * (q1[i] - q2[i]);
+        }
+        s1 = std::sqrt(s1);
       }
       if (std::fabs(s1 - s2) > tolerance) {
         g_log.debug() << "Data mismatch at cell (row#,col#): (" << i << "," << j
-- 
GitLab