diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CalculateCarpenterSampleCorrection.h b/Framework/Algorithms/inc/MantidAlgorithms/CalculateCarpenterSampleCorrection.h index ee7f7346fdc9c7164c06cb094dc1b192dac56a30..cfffe09facf0683307c6a57f3d8936d33717653e 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CalculateCarpenterSampleCorrection.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CalculateCarpenterSampleCorrection.h @@ -55,9 +55,9 @@ public: /// Algorithm's version for identification overriding a virtual method int version() const override; const std::vector<std::string> seeAlso() const override { - return { "CarpenterSampleCorrection", "CylinderAbsorption", - "MonteCarloAbsorption", "MayersSampleCorrection", - "PearlMCAbsorption", "VesuvioCalculateMS" }; + return {"CarpenterSampleCorrection", "CylinderAbsorption", + "MonteCarloAbsorption", "MayersSampleCorrection", + "PearlMCAbsorption", "VesuvioCalculateMS"}; } /// Algorithm's category for identification overriding a virtual method diff --git a/Framework/Algorithms/inc/MantidAlgorithms/CarpenterSampleCorrection.h b/Framework/Algorithms/inc/MantidAlgorithms/CarpenterSampleCorrection.h index 0a8c1c5f16d2643e2f65dedaa98c73a65158242b..5cd32d316f3d6c7fb05abbc0825208e83bacb6e9 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/CarpenterSampleCorrection.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/CarpenterSampleCorrection.h @@ -54,9 +54,9 @@ public: /// Algorithm's version for identification overriding a virtual method int version() const override; const std::vector<std::string> seeAlso() const override { - return { "CalculateCarpenterSampleCorrection", "CylinderAbsorption", - "MonteCarloAbsorption", "MayersSampleCorrection", - "PearlMCAbsorption", "VesuvioCalculateMS" }; + return {"CalculateCarpenterSampleCorrection", "CylinderAbsorption", + "MonteCarloAbsorption", "MayersSampleCorrection", + "PearlMCAbsorption", "VesuvioCalculateMS"}; } /// Algorithm's category for identification overriding a virtual method diff --git a/Framework/Algorithms/inc/MantidAlgorithms/MonteCarloAbsorption.h b/Framework/Algorithms/inc/MantidAlgorithms/MonteCarloAbsorption.h index 67989e4e38fdf755a5e389a6ccae42e25449dae5..715a47c467cef7f57a2e83eccae0c766e4f786b1 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/MonteCarloAbsorption.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/MonteCarloAbsorption.h @@ -50,8 +50,8 @@ public: /// Algorithm's version int version() const override { return 1; } const std::vector<std::string> seeAlso() const override { - return { "MayersSampleCorrection", "CarpenterSampleCorrection", - "PearlMCAbsorption", "VesuvioCalculateMS" }; + return {"MayersSampleCorrection", "CarpenterSampleCorrection", + "PearlMCAbsorption", "VesuvioCalculateMS"}; } /// Algorithm's category for identification const std::string category() const override { diff --git a/Framework/Algorithms/src/CalculateCarpenterSampleCorrection.cpp b/Framework/Algorithms/src/CalculateCarpenterSampleCorrection.cpp index fa5637baf71b7703c31ffdee73e49ddd69abf810..1e6fb5a5e98d8710e8361d9a10faaf586bee7fbc 100644 --- a/Framework/Algorithms/src/CalculateCarpenterSampleCorrection.cpp +++ b/Framework/Algorithms/src/CalculateCarpenterSampleCorrection.cpp @@ -42,36 +42,51 @@ using namespace Geometry; // Chebyshev expansion coefficients copied directly from Carpenter 1969 Table 1 namespace { // anonymous static const double CHEBYSHEV[] = { - // l= 0 1 2 3 4 5 // (m,n) - 0.730284, -0.249987, 0.019448, -0.000006, 0.000249, -0.000004, // (1,1) - 0.848859, -0.452690, 0.056557, -0.000009, 0.000000, -0.000006, // (1,2) - 1.133129, -0.749962, 0.118245, -0.000018, -0.001345, -0.000012, // (1,3) - 1.641112, -1.241639, 0.226247, -0.000045, -0.004821, -0.000030, // (1,4) - 0.848859, -0.452690, 0.056557, -0.000009, 0.000000, -0.000006, // (2,1) - 1.000006, -0.821100, 0.166645, -0.012096, 0.000008, -0.000126, // (2,2) - 1.358113, -1.358076, 0.348199, -0.038817, 0.000022, -0.000021, // (2,3) - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, // (2,4) - 1.133129, -0.749962, 0.118245, -0.000018, -0.001345, -0.000012, // (3,1) - 1.358113, -1.358076, 0.348199, -0.038817, 0.000022, -0.000021, // (3,2) - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, // (3,3) - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, // (3,4) - 1.641112, -1.241639, 0.226247, -0.000045, -0.004821, -0.000030, // (4,1) - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, // (4,2) - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, // (4,3) - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 // (4,4) + // l= 0 1 2 3 4 5 // (m,n) + 0.730284, -0.249987, 0.019448, -0.000006, + 0.000249, -0.000004, // (1,1) + 0.848859, -0.452690, 0.056557, -0.000009, + 0.000000, -0.000006, // (1,2) + 1.133129, -0.749962, 0.118245, -0.000018, + -0.001345, -0.000012, // (1,3) + 1.641112, -1.241639, 0.226247, -0.000045, + -0.004821, -0.000030, // (1,4) + 0.848859, -0.452690, 0.056557, -0.000009, + 0.000000, -0.000006, // (2,1) + 1.000006, -0.821100, 0.166645, -0.012096, + 0.000008, -0.000126, // (2,2) + 1.358113, -1.358076, 0.348199, -0.038817, + 0.000022, -0.000021, // (2,3) + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, // (2,4) + 1.133129, -0.749962, 0.118245, -0.000018, + -0.001345, -0.000012, // (3,1) + 1.358113, -1.358076, 0.348199, -0.038817, + 0.000022, -0.000021, // (3,2) + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, // (3,3) + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, // (3,4) + 1.641112, -1.241639, 0.226247, -0.000045, + -0.004821, -0.000030, // (4,1) + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, // (4,2) + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, // (4,3) + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0 // (4,4) }; static const int Z_size = 36; // Caution, this must be updated if the // algorithm is changed to use a different // size Z array. static const double Z_initial[] = { - 1.0, 0.8488263632, 1.0, 1.358122181, 2.0, 3.104279270, - 0.8488263632, 0.0, 0.0, 0.0, 0.0, 0.0, - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 1.358122181, 0.0, 0.0, 0.0, 0.0, 0.0, - 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 3.104279270, 0.0, 0.0, 0.0, 0.0, 0.0 -}; + 1.0, 0.8488263632, 1.0, 1.358122181, 2.0, 3.104279270, + 0.8488263632, 0.0, 0.0, 0.0, 0.0, 0.0, + 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 1.358122181, 0.0, 0.0, 0.0, 0.0, 0.0, + 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, + 3.104279270, 0.0, 0.0, 0.0, 0.0, 0.0}; static const double LAMBDA_REF = 1.81; ///< Wavelength that the calculations are based on @@ -101,10 +116,10 @@ void CalculateCarpenterSampleCorrection::init() { wsValidator->add<WorkspaceUnitValidator>("Wavelength"); wsValidator->add<InstrumentValidator>(); - declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace> >( + declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace>>( "InputWorkspace", "", Direction::Input, wsValidator), "The name of the input workspace."); - declareProperty(make_unique<WorkspaceProperty<API::WorkspaceGroup> >( + declareProperty(make_unique<WorkspaceProperty<API::WorkspaceGroup>>( "OutputWorkspaceBaseName", "", Direction::Output), "Basename of the output workspace group for corrections." "Absorption suffix = '_abs'. " diff --git a/Framework/Algorithms/test/CalculateCarpenterSampleCorrectionTest.h b/Framework/Algorithms/test/CalculateCarpenterSampleCorrectionTest.h index afebfc372dc3e7a6a6b2fafcc2cdd8e7fdbe5ba8..e27f5808a3b111a695609556b32c55c566c62411 100644 --- a/Framework/Algorithms/test/CalculateCarpenterSampleCorrectionTest.h +++ b/Framework/Algorithms/test/CalculateCarpenterSampleCorrectionTest.h @@ -128,10 +128,9 @@ public: // Check absorption correction const size_t size = 16; std::array<double, size> abs_corr_expected = { - { 0.786608, 0.764593, 0.743221, 0.722473, 0.702329, 0.682772, - 0.663783, 0.645345, 0.627442, 0.610057, 0.593173, 0.576775, - 0.560848, 0.545376, 0.530345, 0.515739 } - }; + {0.786608, 0.764593, 0.743221, 0.722473, 0.702329, 0.682772, 0.663783, + 0.645345, 0.627442, 0.610057, 0.593173, 0.576775, 0.560848, 0.545376, + 0.530345, 0.515739}}; auto &abs_corr_actual = absWksp->y(0); for (size_t i = 0; i < size; i++) @@ -149,19 +148,18 @@ public: AnalysisDataService::Instance().retrieveWS<API::MatrixWorkspace>( "TestAbsWS"); std::array<double, size> abs_ws_expected = { - { 2.54256, 2.61577, 2.69099, 2.76827, 2.84767, 2.92924, 3.01303, 3.09912, - 3.18754, 3.27838, 3.37170, 3.46756, 3.56603, 3.66720, 3.77113, 3.87793 } - }; + {2.54256, 2.61577, 2.69099, 2.76827, 2.84767, 2.92924, 3.01303, 3.09912, + 3.18754, 3.27838, 3.37170, 3.46756, 3.56603, 3.66720, 3.77113, + 3.87793}}; auto &abs_ws_actual = absCorrectedWksp->y(0); for (size_t i = 0; i < size; i++) TS_ASSERT_DELTA(abs_ws_actual[i], abs_ws_expected[i], 0.00001); // Check multiple scattering correction std::array<double, size> ms_corr_expected = { - { 0.159334, 0.161684, 0.164032, 0.166376, 0.168712, 0.171039, - 0.173355, 0.175658, 0.177944, 0.180211, 0.182457, 0.184678, - 0.186873, 0.189038, 0.191171, 0.193268 } - }; + {0.159334, 0.161684, 0.164032, 0.166376, 0.168712, 0.171039, 0.173355, + 0.175658, 0.177944, 0.180211, 0.182457, 0.184678, 0.186873, 0.189038, + 0.191171, 0.193268}}; auto &ms_corr_actual = msWksp->y(0); for (size_t i = 0; i < size; i++) TS_ASSERT_DELTA(ms_corr_actual[i], ms_corr_expected[i], 0.00001); @@ -178,10 +176,9 @@ public: AnalysisDataService::Instance().retrieveWS<API::MatrixWorkspace>( "TestMultScatWS"); std::array<double, size> ms_ws_expected = { - { 0.318668, 0.323369, 0.328065, 0.332751, 0.337424, 0.342079, - 0.346711, 0.351315, 0.355887, 0.360422, 0.364913, 0.369356, - 0.373746, 0.378076, 0.382341, 0.386535 } - }; + {0.318668, 0.323369, 0.328065, 0.332751, 0.337424, 0.342079, 0.346711, + 0.351315, 0.355887, 0.360422, 0.364913, 0.369356, 0.373746, 0.378076, + 0.382341, 0.386535}}; auto &ms_ws_actual = msCorrectedWksp->y(0); for (size_t i = 0; i < size; i++) @@ -199,9 +196,9 @@ public: AnalysisDataService::Instance().retrieveWS<API::MatrixWorkspace>( "TestOutputWS"); std::array<double, size> test_ws_expected = { - { 2.22389, 2.2924, 2.36292, 2.43552, 2.51024, 2.58716, 2.66632, 2.7478, - 2.83166, 2.91796, 3.00678, 3.09820, 3.19228, 3.28912, 3.38879, 3.49139 } - }; + {2.22389, 2.2924, 2.36292, 2.43552, 2.51024, 2.58716, 2.66632, 2.7478, + 2.83166, 2.91796, 3.00678, 3.09820, 3.19228, 3.28912, 3.38879, + 3.49139}}; auto &test_ws_actual = outputWksp->y(0); for (size_t i = 0; i < size; i++) @@ -258,10 +255,9 @@ public: // Check absorption correction const size_t size = 16; std::array<double, size> abs_corr_expected = { - { 0.733553, 0.726500, 0.719519, 0.712607, 0.705765, 0.698992, - 0.692286, 0.685648, 0.679076, 0.672570, 0.666129, 0.659753, - 0.65344, 0.647191, 0.641004, 0.634878 } - }; + {0.733553, 0.726500, 0.719519, 0.712607, 0.705765, 0.698992, 0.692286, + 0.685648, 0.679076, 0.672570, 0.666129, 0.659753, 0.65344, 0.647191, + 0.641004, 0.634878}}; const auto &abs_corr_actual = absWksp->histogram(0).y(); for (size_t i = 0; i < size; i++) TS_ASSERT_DELTA(abs_corr_actual[i], abs_corr_expected[i], 0.00001); @@ -272,10 +268,9 @@ public: // Check multiple scattering correction std::array<double, size> ms_corr_expected = { - { 0.165116, 0.165916, 0.166714, 0.167512, 0.168309, 0.169105, - 0.169900, 0.170693, 0.171486, 0.172277, 0.173066, 0.173854, - 0.17464, 0.175425, 0.176207, 0.176988 } - }; + {0.165116, 0.165916, 0.166714, 0.167512, 0.168309, 0.169105, 0.169900, + 0.170693, 0.171486, 0.172277, 0.173066, 0.173854, 0.17464, 0.175425, + 0.176207, 0.176988}}; auto &ms_corr_actual = msWksp->y(0); for (size_t i = 0; i < size; i++) TS_ASSERT_DELTA(ms_corr_actual[i], ms_corr_expected[i], 0.00001); diff --git a/Framework/Algorithms/test/CarpenterSampleCorrectionTest.h b/Framework/Algorithms/test/CarpenterSampleCorrectionTest.h index d71c03040a847f816ec4dc71f60d8862530df1b6..f2b18bd9fd378a7c5d322d1648da1d5b260cb8c1 100644 --- a/Framework/Algorithms/test/CarpenterSampleCorrectionTest.h +++ b/Framework/Algorithms/test/CarpenterSampleCorrectionTest.h @@ -112,9 +112,9 @@ public: // setup expected values const size_t size = 16; std::array<double, size> y_expected = { - { 2.22389, 2.2924, 2.36292, 2.43552, 2.51024, 2.58716, 2.66632, 2.7478, - 2.83166, 2.91796, 3.00678, 3.0982, 3.19228, 3.28912, 3.38879, 3.49139 } - }; + {2.22389, 2.2924, 2.36292, 2.43552, 2.51024, 2.58716, 2.66632, 2.7478, + 2.83166, 2.91796, 3.00678, 3.0982, 3.19228, 3.28912, 3.38879, + 3.49139}}; // do the final comparison auto &y_actual = test_output_WS->y(0);