McCode
McCode copied to clipboard
RESTORE_NEUTRON/XRAY in McCode 3 should not restore USERVARS
Currently a component like e.g.
COMPONENT L_monitor = L_monitor(... restore_neutron...=1)
AT (...)
EXTEND %{
if(SCATTERED) flag=1;
%}
will in fact suppress the flag - which is very confusing.
I believe a better solution than the current direct overwriting of a particle in the restoration case would be to directly set the "physical" particle parameters.
Alternatively, e.g. monitors should not use RESTORE_NEUTRON internally but rather make local copies of the physical parameters and restore these with the comp restore flag set.
@farhi discussion most welcome.
@farhi I have now implemented a prototype which simply copies back x, y, z, .... p inside a function. This should leave USERVARS and other logic parameters alone.
Let's see how this works out.
After a pretty awful typo on the McStas side, the test last night gave lots of errors: http://new-nightly.mcstas.org/latest/2022-03-25_output.html
- a rerun after correction puts most things right, except:
- ILL_D2B / ILL_D2B_noenv
- ILL_H22_D1A / ILL_H22_D1A_noenv
- templateDIFF
(templateNMX also produces wrong results in the first test, but this is all across the board == Example val should be updated)
The common denominator in the diff's is very likely related to Monitor_nD restore_neutron=1 which seems affected to the new way of restoring... (Shadow on the "non-scattered" part of the beam??)
A couple of examples here from D2B, before change:
After:
... more specifically seems related to cylinder geometry "lid and bottom"
Looks like this is likely closer connected to the radial collimator / non-transported particles
This has all fallen into piece with the latest GROUP/restore related edits