User and Programmers’ Guide to the X Ray-Tracing Package McXtrace, version 3.8.6

1.2  Scientific background

What makes scientists happy? Probably to collect good quality data, pushing beamlines to their limits, and fit that data to physical models. Among available measurement techniques, x-ray scattering provides a large variety of beamlines to probe structure and dynamics of all kinds of samples.

Achieving a satisfactory experiment on the best beamline is not all. Once collected, the data analysis process raises some questions concerning the signal: what is the background signal? What proportion of coherent and incoherent scattering has been measured? What are the contributions from the sample geometry, the container, the sample environment, and generally the beamline itself? And last but not least, how does multiple scattering affect the signal? Most of the time, the physicist will elude these questions using rough approximations, or applying analytical corrections [Cop+86]. Monte-Carlo techniques provide a mean to evaluate some of these quantities. The technicalities of Monte-Carlo simulation techniques are explained in detail in chapter 4.

1.2.1  The goals of McXtrace

Initially, the McStas project and hence also the present subject the McXtrace project had four main objectives that determined its design.

Correctness. It is essential to minimize the potential for bugs in computer simulations. If a word processing program contains bugs, it will produce bad-looking output or may even crash. This is a nuisance, but at least you know that something is wrong. However, if a simulation contains bugs it produces wrong results, and unless the results are far off, you may not know about it! Complex simulations involve hundreds or even thousands of lines of formulae, making debugging a major issue. Thus the system should be designed from the start to help minimize the potential for bugs to be introduced in the first place, and provide good tools for testing to maximize the chances of finding existing bugs.

Flexibility. When you commit yourself to using a tool for an important project, you need to know if the tool will satisfy not only your present, but also your future requirements. The tool must not have fundamental limitations that restrict its potential usage. Thus the McXtrace systems needs to be flexible enough to simulate different kinds of instruments as well as many different kind of optical components, and it must also be extensible so that future, as yet unforeseen, needs can be satisfied.

Power.Simple things should be simple; complex things should be possible”. New ideas should be easy to try out, and the time from thought to action should be as short as possible. If you are faced with the prospect of programming for two weeks before getting any results on a new idea, you will most likely drop it. Ideally, if you have a good idea at lunch time, the simulation should be running in the afternoon.

Efficiency. Monte Carlo simulations are computationally intensive, hardware capacities are finite (albeit impressive), and humans are impatient. Thus the system must assist in producing simulations that run as fast as possible, without placing unreasonable burdens on the user in order to achieve this.