An ordinary McStas instrument is a linear sequence of self-contained components: a neutron ray enters a component, something happens to it (or not), and it moves on to the next component in the sequence. This is a good match for the intended beam path through an instrument, but it means that
a single sample component must contain all the physics relevant to that sample – absorption, every scattering process, and any multiple scattering – as one monolithic block of code, and
multiple scattering between physically separate parts of a sample environment (a sample inside a can, inside a cryostat, held by a sample stick, …) is essentially impossible to capture, since each part would need to be a separate component and McStas components do not natively talk to each other.
This is a real limitation for complex sample environments, where multiple scattering between e.g. a powder sample and its aluminium container can be a significant background contribution.
The Union components solve this by splitting the sample simulation task into several cooperating component classes – processes, materials, geometries and a master – and performing the actual ray tracing for all of them together, inside the master component, with full native multiple scattering between every defined volume. Because physics (processes) and geometry are separated, adding a new scattering process is a comparatively small task, and existing processes can be freely combined and reused across different shapes.
| Figure B.1.: | Left: the linear succession of components in a traditional McStas instrument file. Right: the same instrument using Union components – all ray tracing for the sample environment happens inside a single master component, which works around the normal McStas component sequence to achieve native multiple scattering between an arbitrary number of volumes. |
It is entirely possible, and common, to mix ordinary McStas components with Union components in the same instrument file – the Union machinery only takes over at its Union_master components (section B.2).
The central concept of the Union components is the volume: a geometrical shape (box, cylinder, sphere, cone or triangle mesh) combined with a material definition (absorption plus zero or more scattering processes), placed in space using the ordinary AT/ROTATED mechanism. Volumes may be placed in any order in the instrument file, and, unlike ordinary McStas geometry, volumes are allowed to overlap.
Each volume is given a unique priority value. Wherever two or more volumes overlap in space, the material of the volume with the highest priority applies. This single rule makes it straightforward to build geometries that would otherwise require careful, error-prone manual splitting into non-overlapping pieces: a hollow cryostat wall is simply an aluminium cylinder with a vacuum cylinder of higher priority placed inside it; a window is a low-priority vacuum region cut into an otherwise higher-priority wall; a layered sample can with several different powders is built from concentric or adjacent shapes, each its own volume and material.