diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/IMCInteractionVolume.h b/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/IMCInteractionVolume.h index 9e090711f2f0f9ed5a2c000c05bb5f5a4871a0ee..7873ffa3980cddf938744c96bd31d4118bf4f537 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/IMCInteractionVolume.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/IMCInteractionVolume.h @@ -40,7 +40,6 @@ public: virtual TrackPair calculateBeforeAfterTrack( Kernel::PseudoRandomNumberGenerator &rng, const Kernel::V3D &startPos, const Kernel::V3D &endPos, MCInteractionStatistics &stats) const = 0; - virtual const Geometry::BoundingBox &getBoundingBox() const = 0; virtual const Geometry::BoundingBox getFullBoundingBox() const = 0; virtual void setActiveRegion(const Geometry::BoundingBox ®ion) = 0; }; diff --git a/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/MCInteractionVolume.h b/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/MCInteractionVolume.h index b479cf6249b9d81a0d751fcd38aa558fe7f4a93e..a4743e3a31ff6d0dde89fa810966023aa53ea331 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/MCInteractionVolume.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/SampleCorrections/MCInteractionVolume.h @@ -37,7 +37,6 @@ public: const ScatteringPointVicinity pointsIn = ScatteringPointVicinity::SAMPLEANDENVIRONMENT); - const Geometry::BoundingBox &getBoundingBox() const override; const Geometry::BoundingBox getFullBoundingBox() const override; virtual TrackPair calculateBeforeAfterTrack( Kernel::PseudoRandomNumberGenerator &rng, const Kernel::V3D &startPos, diff --git a/Framework/Algorithms/src/MonteCarloAbsorption.cpp b/Framework/Algorithms/src/MonteCarloAbsorption.cpp index 2b65a0e69ab64c1c53edda9eda1cec07bfc0db48..7e17eb07a51925312e4d40bee28557402832fcc5 100644 --- a/Framework/Algorithms/src/MonteCarloAbsorption.cpp +++ b/Framework/Algorithms/src/MonteCarloAbsorption.cpp @@ -448,7 +448,7 @@ MatrixWorkspace_uptr MonteCarloAbsorption::createOutputWorkspace( /** * Create the beam profile. Currently only supports Rectangular or Circular. The * dimensions are either specified by those provided by `SetBeam` algorithm or - * default to the width and height of the samples bounding box + * default to the width and height of the sample's bounding box * @param instrument A reference to the instrument object * @param sample A reference to the sample object * @return A new IBeamProfile object @@ -478,6 +478,9 @@ MonteCarloAbsorption::createBeamProfile(const Instrument &instrument, beamRadius); } } // revert to sample dimensions if no return by this point + if (!sample.getShape().hasValidShape()) + throw std::invalid_argument( + "Cannot determine beam profile without a sample shape"); const auto bbox = sample.getShape().getBoundingBox().width(); beamWidth = bbox[frame->pointingHorizontal()]; beamHeight = bbox[frame->pointingUp()]; diff --git a/Framework/Algorithms/src/SampleCorrections/MCAbsorptionStrategy.cpp b/Framework/Algorithms/src/SampleCorrections/MCAbsorptionStrategy.cpp index 7aadade448cb072f860db9caa30a2325fc02a861..dc5c1f1dc6a216372f06f1c4a9f8ef8a60621f56 100644 --- a/Framework/Algorithms/src/SampleCorrections/MCAbsorptionStrategy.cpp +++ b/Framework/Algorithms/src/SampleCorrections/MCAbsorptionStrategy.cpp @@ -79,7 +79,7 @@ void MCAbsorptionStrategy::calculate(Kernel::PseudoRandomNumberGenerator &rng, std::vector<double> &attenuationFactors, std::vector<double> &attFactorErrors, MCInteractionStatistics &stats) { - const auto scatterBounds = m_scatterVol.getBoundingBox(); + const auto scatterBounds = m_scatterVol.getFullBoundingBox(); const auto nbins = static_cast<int>(lambdas.size()); std::vector<double> wgtMean(attenuationFactors.size()), diff --git a/Framework/Algorithms/src/SampleCorrections/MCInteractionVolume.cpp b/Framework/Algorithms/src/SampleCorrections/MCInteractionVolume.cpp index c542794cb024753b7f8d50ee1508f60282529163..9ab623081786067b5f6867a81161814b2fdf79ce 100644 --- a/Framework/Algorithms/src/SampleCorrections/MCInteractionVolume.cpp +++ b/Framework/Algorithms/src/SampleCorrections/MCInteractionVolume.cpp @@ -61,21 +61,13 @@ MCInteractionVolume::MCInteractionVolume( } } -/** - * Returns the axis-aligned bounding box for the volume - * @return A reference to the bounding box - */ -const Geometry::BoundingBox &MCInteractionVolume::getBoundingBox() const { - return m_sample->getBoundingBox(); -} - /** * Returns the axis-aligned bounding box for the volume including env * @return A reference to the bounding box */ const Geometry::BoundingBox MCInteractionVolume::getFullBoundingBox() const { auto sampleBox = m_sample->getBoundingBox(); - if (m_env) { + if (m_pointsIn != ScatteringPointVicinity::SAMPLEONLY && m_env) { const auto &envBox = m_env->boundingBox(); sampleBox.grow(envBox); } diff --git a/Framework/Algorithms/test/MCInteractionVolumeTest.h b/Framework/Algorithms/test/MCInteractionVolumeTest.h index b05ac1ed6a8082ec7c82ce247244f62b024280c0..c1d382a7070c2a0c6b066af3a89ab92321f10b1d 100644 --- a/Framework/Algorithms/test/MCInteractionVolumeTest.h +++ b/Framework/Algorithms/test/MCInteractionVolumeTest.h @@ -43,7 +43,7 @@ public: MCInteractionVolume interactor(sample); interactor.setActiveRegion(sampleBox); - const auto interactionBox = interactor.getBoundingBox(); + const auto interactionBox = interactor.getFullBoundingBox(); TS_ASSERT_EQUALS(sampleBox.minPoint(), interactionBox.minPoint()); TS_ASSERT_EQUALS(sampleBox.maxPoint(), interactionBox.maxPoint()); } diff --git a/Testing/SystemTests/tests/framework/PaalmanPingsMonteCarloAbsorptionTest.py b/Testing/SystemTests/tests/framework/PaalmanPingsMonteCarloAbsorptionTest.py index 7decae3697b7c0eb0af2dfa419829fcdae66274e..c542a470b35e20b1d78d87ccfc47d60fb49c1a0a 100644 --- a/Testing/SystemTests/tests/framework/PaalmanPingsMonteCarloAbsorptionTest.py +++ b/Testing/SystemTests/tests/framework/PaalmanPingsMonteCarloAbsorptionTest.py @@ -41,7 +41,8 @@ class FlatPlateTest(systemtesting.MantidSystemTest): ContainerBackThickness=0.02, ContainerChemicalFormula='V', ContainerDensity=6.0, - CorrectionsWorkspace='flat_plate_corr' + CorrectionsWorkspace='flat_plate_corr', + EventsPerPoint = 5000 ) @@ -76,7 +77,8 @@ class CylinderTest(systemtesting.MantidSystemTest): ContainerRadius=0.22, ContainerChemicalFormula='V', ContainerDensity=6.0, - CorrectionsWorkspace='cylinder_corr' + CorrectionsWorkspace='cylinder_corr', + EventsPerPoint=5000 ) @@ -114,5 +116,5 @@ class AnnulusTest(systemtesting.MantidSystemTest): ContainerChemicalFormula='V', ContainerDensity=6.0, CorrectionsWorkspace='annulus_corr', - EventsPerPoint=5000 + EventsPerPoint=10000 ) diff --git a/Testing/SystemTests/tests/framework/reference/irs_PP_MC_annulus.nxs.md5 b/Testing/SystemTests/tests/framework/reference/irs_PP_MC_annulus.nxs.md5 index 61486a33f7d85a28eb64740763a1a1db0db3b2ae..f54b15880090edcd5ac83a17cb15dd7047ed7387 100644 --- a/Testing/SystemTests/tests/framework/reference/irs_PP_MC_annulus.nxs.md5 +++ b/Testing/SystemTests/tests/framework/reference/irs_PP_MC_annulus.nxs.md5 @@ -1 +1 @@ -ef7856d3e0a14466775eca85e505467f +bb97dc39d482257c7550d5be0d70b963 diff --git a/Testing/SystemTests/tests/framework/reference/irs_PP_MC_cylinder.nxs.md5 b/Testing/SystemTests/tests/framework/reference/irs_PP_MC_cylinder.nxs.md5 index 7ba909cb94cf9084d188cc29317393350d568633..7839aa947e0e837933589638ad64b33d4d347a7d 100644 --- a/Testing/SystemTests/tests/framework/reference/irs_PP_MC_cylinder.nxs.md5 +++ b/Testing/SystemTests/tests/framework/reference/irs_PP_MC_cylinder.nxs.md5 @@ -1 +1 @@ -2bdfdb8111a0963ba744c9b28996a666 +89bc63b5688fa02e399a5e957aa36a57 diff --git a/Testing/SystemTests/tests/framework/reference/irs_PP_MC_flat_plate.nxs.md5 b/Testing/SystemTests/tests/framework/reference/irs_PP_MC_flat_plate.nxs.md5 index 861d88b2b2c90fb393ebf766f30cd2b0e0f9c746..830031eb41976bdc4649fa95a5bc0fa001b4f3d0 100644 --- a/Testing/SystemTests/tests/framework/reference/irs_PP_MC_flat_plate.nxs.md5 +++ b/Testing/SystemTests/tests/framework/reference/irs_PP_MC_flat_plate.nxs.md5 @@ -1 +1 @@ -aedc8214e6828f2752e8d1119cbcb1fa +0259338bccfe474bcebef8ebae2f27c9 diff --git a/docs/source/release/v6.1.0/framework.rst b/docs/source/release/v6.1.0/framework.rst index fac7bd445aca56332cfb42eb446b17923079c747..de97ab3797ebc77a0da905f6eca9bc6722e18ca9 100644 --- a/docs/source/release/v6.1.0/framework.rst +++ b/docs/source/release/v6.1.0/framework.rst @@ -63,5 +63,6 @@ Bugfixes - Fix problem with dictionary parameters on :ref:`SetSample <algm-SetSample>` algorithm when running from the algorithm dialog - Fix segmentation fault when running :ref:`MonteCarloAbsorption <algm-MonteCarloAbsorption>` algorithm on Ubuntu without a material defined on one of the sample\environment shapes +- Fix calculation of region where scattering points are sampled in :ref:`MonteCarloAbsorption <algm-MonteCarloAbsorption>` when a shape is defined for the environment but not the sample :ref:`Release 6.1.0 <v6.1.0>`