Neutron ray-tracing simulations and data analysis with RESTRAX

We review the methods of simulating the neutron optics of three-axis spectrometers to optimize their resolution and luminosity and to interpret experimental data collected with them. The program package RESTRAX includes both a high-speed analytical (Gaussian) convolution algorithm and a Monte Carlo ray-tracing code providing enhanced accuracy in description of most of the spectrometer components. The program is designed for a fixed spectrometer layout, with emphasis on the choice of a complete set of usual neutron optical devices and on their realistic representation. The fixed layout permits to generate a highly optimized Fortran code, producing sets of 1000 - 10000 successful events per second. This speed on the turn allows for a truly interactive work when designing a new instrument or refining a model describing the scattering behavior of a sample under investigation. As an illustration, we give several examples of TAS configurations, including high-luminosity focusing arrangements and multianalyzer setups as well a demonstration of the data fitting part of RESTRAX in the case of magnetic excitations.