From ca0d69aaa831c9dd797b635fe06785a4f06ada2e Mon Sep 17 00:00:00 2001 From: Vickie Lynch Date: Tue, 17 Dec 2013 14:01:00 -0500 Subject: [PATCH 1/2] Refs #8280 warning for overlap --- .../MantidMDAlgorithms/IntegratePeaksMD2.h | 4 +++ .../MDAlgorithms/src/IntegratePeaksMD2.cpp | 33 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD2.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD2.h index f78b1555a8f2..74a78a88ac97 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD2.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegratePeaksMD2.h @@ -51,6 +51,10 @@ namespace MDAlgorithms /// Instrument reference Geometry::Instrument_const_sptr inst; + /// Check if peaks overlap + void checkOverlap(int i, + Mantid::DataObjects::PeaksWorkspace_sptr peakWS, int CoordinatesToUse, double radius); + }; diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index 6d2968fba409..3541f44b1f5e 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -593,6 +593,8 @@ namespace MDAlgorithms } } } + checkOverlap (i, peakWS, CoordinatesToUse, + std::max(PeakRadiusVector[i],BackgroundOuterRadiusVector[i])); // Save it back in the peak object. if (signal != 0. || replaceIntensity) { @@ -676,7 +678,36 @@ namespace MDAlgorithms } return in; } - + void IntegratePeaksMD2::checkOverlap(int i, + Mantid::DataObjects::PeaksWorkspace_sptr peakWS, int CoordinatesToUse, double radius) + { + // Get a direct ref to that peak. + IPeak & p1 = peakWS->getPeak(i); + V3D pos1; + if (CoordinatesToUse == 1) //"Q (lab frame)" + pos1 = p1.getQLabFrame(); + else if (CoordinatesToUse == 2) //"Q (sample frame)" + pos1 = p1.getQSampleFrame(); + else if (CoordinatesToUse == 3) //"HKL" + pos1 = p1.getHKL(); + for (int j=i+1; j < peakWS->getNumberPeaks(); ++j) + { + // Get a direct ref to rest of peaks peak. + IPeak & p2 = peakWS->getPeak(j); + V3D pos2; + if (CoordinatesToUse == 1) //"Q (lab frame)" + pos2 = p2.getQLabFrame(); + else if (CoordinatesToUse == 2) //"Q (sample frame)" + pos2 = p2.getQSampleFrame(); + else if (CoordinatesToUse == 3) //"HKL" + pos2 = p2.getHKL(); + if (pos1.distance(pos2) < radius) + { + g_log.warning() << " Warning: Peak integration spheres for peaks " + << i << " and " << j <<" overlap. Distance between peaks is "<< pos1.distance(pos2)< Date: Wed, 18 Dec 2013 10:23:57 -0500 Subject: [PATCH 2/2] Refs #8280 Need factor of 2 for radius of both peaks --- Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp index 3541f44b1f5e..586bb7287ffd 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp @@ -594,7 +594,7 @@ namespace MDAlgorithms } } checkOverlap (i, peakWS, CoordinatesToUse, - std::max(PeakRadiusVector[i],BackgroundOuterRadiusVector[i])); + 2.0 * std::max(PeakRadiusVector[i],BackgroundOuterRadiusVector[i])); // Save it back in the peak object. if (signal != 0. || replaceIntensity) {