Skip to content

[FEATURE]: Make _particle available in Union processes and loggers #2479

@mads-bertelsen

Description

@mads-bertelsen

Is your feature request related to a problem? Please describe.
Currently the Union processes, loggers and abs_loggers only get access to the information they absolutely needs in order to ensure they do not accidentally change anything they should not. This for example means that the random number generation is not using the per particle random number generator, but instead the system that was in place before McStas 3.X which is still available. This older system is not initialized by the seed parameter.

A recent update to the NCrystal_sample addressed the same issue: #2438

Describe the solution you'd like
The best solution is probably to just pass the _particle to processes, loggers and abs_loggers and accept the possible issues that can cause if one of these overwrite parameters in this struct.

Describe alternatives you've considered
Other options include:

  • Passing a copy of the _particle (expensive from a computational standpoint, but safer)
  • Only passing the random state to the functions, but there are other nice features that depend on the _particle

Additional context
When the _particle is available to the abs_loggers, it would be possible to support recording uservars in Union_abs_logger_nD

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions