Skip to content
Snippets Groups Projects
Commit e2af417f authored by Danny Hindson's avatar Danny Hindson
Browse files

Improve sampling of scatter pts in absorption correction simulation

The sampling is now performed according to the volume of each part of
the sample\environment that intersects the beam profile

Following changes have been made:

a) the function IObject::generatePointInObject has been modified so that it returns
false rather than raising an exception if it fails to generate a point inside
the object that is also in the active region. This is more efficient when it is
being called with a maxAttempts value of 1 in an attempt to fairly sample the
scatter points among the sample + environment components. This involved a change
in IObject and various child classes (MeshObject, CSGObject, MeshObject2D, Container)

b) the code that calls IObject::generatePointInObject and cycles through the
various parts of the environment\sample has been moved from SampleEnvironment into
MCInteractionVolume so that the sample can be included. There is a new function
MCInteractionVolume::generatePoint that randomly generates a scatter point across the
sample and environment components. Possible the SampleEnvironment class could be retired
entirely and just replaced by a vector of IObject items attached to the sample.

c) change CSGObject::generatePointInObject to stop calling the fallback method when the
maxAttempts parameter equals 1. The fallback method always returns a point if the object's
bounding box is inside the active area which doesn't produce the required sampling across
the env components. This change has modified the random number sequences used in various
tests - including the "sample only" tests

d) added some logging to the simulation to show where the scatter points
occurred. These show that for Pearl around 6% of the scatter points are
in the sample which is less than the 50% assumption previously in the code

e) Several changes to the unit tests (MCInteractionVolumeTest.h, MonteCarloAbsorptionTest.h,
DirectILLSelfShieldingTest.py). The updated sampling means that the absorption corrections
are slightly different than before for cases with a sample + environment.

For DirectILLSelfShieldingTest, an extra parameter has been added to underlying algorithm
(DirectILLSelfShielding) so that this test can continue to use 300 events per point while
the ILLDirectGeometryReductionTest can use 5000 events per point

f) some changes to system tests (ILLDirectGeometryReductionTest, complexShapeAbsorptions)

The calculation used in ILLDirectGeometryReductionTest wasn't converged (changing the seed
gave a ~25% change in the output) so have increased the number of events per point from 300
to 5000. I didn't increase the number of events further because I didn't want to make the
runtime of the system test (esp in debug mode) too large
parent 825f6d08
No related branches found
No related tags found
No related merge requests found
Showing
with 414 additions and 230 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment