-
Notifications
You must be signed in to change notification settings - Fork 128
35373 support for collimator in DiscusMultipleScatteringCorrection algorithm #37648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
35373 support for collimator in DiscusMultipleScatteringCorrection algorithm #37648
Conversation
618b54c
to
e5348ee
Compare
bdb6f48
to
6ff50e7
Compare
👋 Hi, @warunawickramasingha, Conflicts have been detected against the base branch. Please rebase your branch against the base branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, just a few comments/typos - the only big thing is that I'm not sure the way the hexahedron is constructed is sufficiently general to work for both configurations of collimator (axis vertical or along beam). But you have probably spent more time staring at the drawings than I have!
I will give it a quick manual test, but we will need to get in touch with ENGIN-X scientists for proper scientific validation.
Framework/Algorithms/src/DiscusMultipleScatteringCorrection.cpp
Outdated
Show resolved
Hide resolved
Framework/Algorithms/inc/MantidAlgorithms/DiscusMultipleScatteringCorrection.h
Outdated
Show resolved
Hide resolved
Framework/Algorithms/inc/MantidAlgorithms/DiscusMultipleScatteringCorrection.h
Outdated
Show resolved
Hide resolved
const bool radialCollimator = getProperty("RadialCollimator"); | ||
if (radialCollimator) { | ||
auto numberOfHist = inputWS->getNumberHistograms(); | ||
for (size_t histIdx = 0; histIdx < numberOfHist; ++histIdx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, nice idea to add some validation that the collimator is a valid option, I wonder though if we should instead just ignore detectors without a valid shape (and maybe throw a warning)? This could be quite a large loop for e.g. WISH!
Framework/Algorithms/src/DiscusMultipleScatteringCorrection.cpp
Outdated
Show resolved
Hide resolved
const auto &detRightFrontBottomPos = detectorAbsolPos + cuboidGeometry.rightFrontBottom; | ||
const auto detRightFrontTopPos = detLeftFrontTopPos + detRightFrontBottomPos - detLeftFrontBottomPos; | ||
|
||
const auto detCentorPos = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible typo?
const auto detCentorPos = | |
const auto detCenterPos = |
I'm assuming this not always be the same as detectorAbsolPos
which is the center of the 3D cuboid - whereas this is the center of the 2D cross-section of the detector as viewed from the sample?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct. This is the centre of the 2D cross section as viewed from the sample.
Framework/Algorithms/src/DiscusMultipleScatteringCorrection.cpp
Outdated
Show resolved
Hide resolved
// Define the unit vectors needed for calculations | ||
const auto unitVecLeftToRight = | ||
(detRightFrontTopPos - detLeftFrontTopPos) / (detRightFrontTopPos - detLeftFrontTopPos).norm(); | ||
const auto unitVecBottomToUp = (detTopMiddlePos - detCentorPos) / (detTopMiddlePos - detCentorPos).norm(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this - will this still work for both possible configurations of collimator we know about (i.e. axis of cylinder vertical, and axis of cylinder along beam)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should work, the names like *Up given for the variable are just to tally with the paper drawing I had and they should work with vector geometry irrespective of the coordinate system.
6ff50e7
to
aca906b
Compare
As this is not failing on tests associated with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, in simple tests this seems to work well: I can confirm with a sample larger than the gauge volume the multiple scattering is reduced with the collimator. I also tested with a sample much smaller than the gauge volume and the multiple scattering with/without the collimator was consistent as expected.
There's a couple of minor things:
- It would be good to have some explanation of the radial collimator option in the algorithm docs -(e.g. where to specify the collimator details etc.)
- Make determination of vector in scattering plane general (see other comment)
I was talking to Stephen Nneji (SScanSS developer) who is more familiar with the collimator on ENGIN-X - he says that there are multiple collimators with different angular openings that can be used, so I think in separate issue we will probably need to add the angular opening as a input argument (given it's not static on the instrument).
Given we will need to touch this again anyway and this feature is still in development until ENGIN-X scientists can do some testing/validation, the above can be addressed during maintenance - I think we should get this merged as is! After validation we can also beef up the unit tests (assert some values etc.).
Thanks again for all your effort on this and getting it over the line!
const auto unitVecSampleToDet = Kernel::normalize(detCentrePos - samplePos); | ||
const auto unitVecLeftToRight = Kernel::normalize( | ||
V3D(-1.0 * unitVecSampleToDet.Z(), 0, | ||
-1.0 * unitVecSampleToDet.X())); // this is a vector normal to unitVecSampleToDet on XZ plane |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for getting the vector in the scattering plane on ENGIN-X (and WISH - another instrument with a radial collimator)I think - but it won't work for all instruments. In future perhaps you can get the ki vector from the workspace, however I'm happy to leave it as is for now - want to get this in the release (my fault for dragging my feet with the testing sorry)!
Description of work
This work adds support for a radial collimator in
DiscusMultipleScatteringCorrection
algorithm that it restricts scatter points within a small region within the larger sample volume. The algorithm was modified to assign zero weight to tracks where the final scatter is not in a position that allows the final track segment to pass through the collimator toward detectors.Purpose of work
This work allows the use of
DiscusMultipleScatteringCorrection
algorithm for ENGINX instrument that has a radial collimator.Fixes #35373.
Further detail of work
To test:
To test this feature, run the
DiscusMultipleScatteringCorrection
with and withoutRadialCollimator
and compare the output weights assigned by the algorithm for each spectrum(detector) that are un masked. Note: To test the algorithm in reduced time period, many of the detectors are marked as masked.Run below code which will Mask all the detectors from spectrum 10 onwards.
Click
Show Data
for workspaces suffixedScatter_n_Integrated
under each group workspaces namedWith_Collimator
andNo_Collimator
. When the collimator is present (i.eRadialCollimator=True
), the integrated weight forSpectrum index 2
(an unmasked detector) should be lower than the weight when there is no collimator(RadialCollimator=False
).Reviewer
Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.
Code Review
Functional Tests
Does everything look good? Mark the review as Approve. A member of
@mantidproject/gatekeepers
will take care of it.Gatekeeper
If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.