From 5bff5c4441a2c9446683c19d7c48c0ac90532185 Mon Sep 17 00:00:00 2001
From: Vickie Lynch <lynchve@ornl.gov>
Date: Mon, 30 Mar 2015 14:05:01 -0400
Subject: [PATCH] Refs #11435 test adaptive Q integration

---
 .../MDAlgorithms/test/IntegratePeaksMD2Test.h       | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMD2Test.h b/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMD2Test.h
index fa6a6d32bef..f83bbdd97a9 100644
--- a/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMD2Test.h
+++ b/Code/Mantid/Framework/MDAlgorithms/test/IntegratePeaksMD2Test.h
@@ -62,7 +62,7 @@ public:
   /** Run the IntegratePeaksMD2 with the given peak radius integration param */
   static void doRun(double PeakRadius, double BackgroundRadius,
       std::string OutputWorkspace = "IntegratePeaksMD2Test_peaks",
-      double BackgroundStartRadius = 0.0, bool edge = true, bool cyl = false, std::string fnct = "NoFit")
+      double BackgroundStartRadius = 0.0, bool edge = true, bool cyl = false, std::string fnct = "NoFit", double adaptive = 0.0)
   {
     IntegratePeaksMD2 alg;
     TS_ASSERT_THROWS_NOTHING( alg.initialize() )
@@ -79,6 +79,8 @@ public:
     TS_ASSERT_THROWS_NOTHING( alg.setProperty("PercentBackground", 20.0 ) );
     TS_ASSERT_THROWS_NOTHING( alg.setProperty("ProfileFunction", fnct ) );
     TS_ASSERT_THROWS_NOTHING( alg.setProperty("IntegrationOption", "Sum" ) );
+    TS_ASSERT_THROWS_NOTHING( alg.setProperty("AdaptiveQMultiplier", adaptive ) );
+    if (adaptive > 0.0) TS_ASSERT_THROWS_NOTHING( alg.setProperty("AdaptiveQBackground", true ) );
     TS_ASSERT_THROWS_NOTHING( alg.execute() );
     TS_ASSERT( alg.isExecuted() );
   }
@@ -180,6 +182,15 @@ public:
 
     // Error is also calculated
     TS_ASSERT_DELTA( peakWS0->getPeak(0).getSigmaIntensity(), sqrt(2.0), 1e-2);*/
+
+    // ------------- Adaptive Integration r=MQ+b where b is PeakRadius and m is 0.01 ------------------------
+    peakWS0->addPeak( Peak(inst, 15050, 1.0, V3D(2., 3., 4.) ) );
+    doRun(0.1,0.0,"IntegratePeaksMD2Test_peaks",0.0,true,false,"NoFit",0.01);
+    TS_ASSERT_DELTA( peakWS0->getPeak(1).getIntensity(), 29.0, 1e-2);
+
+    // Error is also calculated
+    TS_ASSERT_DELTA( peakWS0->getPeak(1).getSigmaIntensity(), sqrt(29.0), 1e-2);
+
     // ------------- Integrate with 0.1 radius but IntegrateIfOnEdge false------------------------
     doRun(0.1,0.0,"IntegratePeaksMD2Test_peaks",0.0,false);
 
-- 
GitLab