MCPL >= 2.2 support in McStas / McXtrace #2076
willend
announced in
Announcements
Replies: 1 comment
-
|
@tkittel, @g5t please comment/correct anything as you see fit. - I am now fixing the warning message in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR:
weight_mode=1).MCPL_outputwithweight_mode=1MCPL_inputwill automatically handle/support both new mode (weight_mode=1) and classical mode (weight_mode=2)weight_mode=1within 6-12 months.New
stat::sumfeature of MCPLAs recently announced by the MCPL team, the latest versions of MCPL includes a new feature for automatic merging of MCPL files with different statistics/normalisation:
Support for / use of
stat::sumin McStas/McXtraceTo fully support this new feature in McStas and McXtrace, the
MCPL_outputcomponents of both packages have received a newweight_modeinput parameter:weight_mode=1: record initial ray count in MCPL stat:sum entry and rescale particle weights.weight_mode=2: classical (deprecated) mode of outputting particle weights directly.weight_mode=1output (the coming default behaviour of MCPL_output)With
weight_mode=1, the events stored in the output MCPL use thestat::sumstatistic with a keyinitial_ray_count, as visible in the MCPL header:and particle weights in the table are scaled by the same
stat::sumvalue:weight_mode=2classic output (the soon-to-be deprecated behaviour of MCPL_output)With
weight_mode=2, there is nostat::sumstatistic in the MCPL header:and particle weights in the table are stored directly as they are simulated in McStas/McXtrace:
Current component default value of -1 explained:
To make it very clear that the classical behaviour will eventually be removed, the default of
weight_modeis currently "unspecified" (=-1) which prompts a warning message to take you to this GitHub discussion:When will deprecation of
weight_mode=2become effective?Our plan is to fully transition to
weight_mode=1within 6-12 months. Note that MCPL files written in the legacy format before this will still be readable afterwards, and will not become unusable.MCPL_input support:
The
MCPL_inputandMCPL_input_oncecomponents both detect presence of thestat::sumfield and scale simulated events accordingly, i.e.: no action needed on this end - and future simulations based on old (style) MCPL files will continue to function.How to update other code reading these files:
If you don't care about the absolute scale of weights in the MCPL files you are reading, you can skip this. Otherwise, you might need to rescale all the weights to get the same meaning of the weights as before. The following Python code shows how this can be done in a way which supports MCPL files from both before and after this change (this needs MCPL release 2.2.0 or later):
And here is a similar C version:
Here is a small example showing it in action on a file with (
voutput.mcpl.gz) and without (voutput_legacy.mcpl.gz) the newinitial_ray_countfeature:Why this page?
Since the implementation touches what the stored weight value in the (MCPL) output files are, we simply want users to be fully aware of the change. :-) In terms of practical use, implications should be very limited for most users.
Beta Was this translation helpful? Give feedback.
All reactions