McCode icon indicating copy to clipboard operation
McCode copied to clipboard

RESTORE_NEUTRON/XRAY in McCode 3 should not restore USERVARS

Open willend opened this issue 2 years ago • 6 comments

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.

willend avatar Mar 20 '22 07:03 willend

@farhi discussion most welcome.

willend avatar Mar 20 '22 07:03 willend

@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.

willend avatar Mar 24 '22 15:03 willend

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)

willend avatar Mar 25 '22 12:03 willend

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: Screenshot 2022-03-25 at 13 24 19 After: Screenshot 2022-03-25 at 13 24 21

willend avatar Mar 25 '22 12:03 willend

... more specifically seems related to cylinder geometry "lid and bottom"

willend avatar Mar 25 '22 12:03 willend

Looks like this is likely closer connected to the radial collimator / non-transported particles

willend avatar Mar 25 '22 18:03 willend

This has all fallen into piece with the latest GROUP/restore related edits

willend avatar Sep 22 '22 07:09 willend