User and Programmers Guide to the Neutron Ray-Tracing Package McStas, version 3.8.6

6.1  McStas and MANTID

As of McStas 2.1 and MANTID 3.2, the teams of the two codes provide a mechanism to transfer simulated McStas events and monitor data to MANTID, via NeXus files.

6.1.1  System requirements

To enable the software link, you need the following codes installed on your system:

6.1.2  Requirements for the instrument file

A special naming convention in the instrument file is needed for the automatic transfer of geometry to a Mantid IDF file:

The two instruments templateSANS_Mantid.instr and ILL_H16_IN5_Mantid.instr have these features enabled.

Other, ordinary McStas monitors will also be visible in the resulting Mantid workspace, but will not be easily processible using the Mantid TOF data reduction schemes.

6.1.3  Compiling and running your simulation for Mantid output

Geometry information in Mantid is handled via a so-called Instrument Definition File (IDF) in xml-format, possibly embedded in a NeXus file. The creation of the IDF and related NeXus file is handled in the following steps:

  1. First of all, enable NeXus in the compilation process:

    1   export MCSTAS_CFLAGS="-g -lm -O2 -DUSE_NEXUS -lNeXus"
          
    2
  2. Compile the instrument via the mcrun utility (add --mpi if you need parallelization support):

    1   mcrun -c ILL_H16_IN5_Mantid.instr -n0
          
    2
  3. Generate the IDF via the mcdisplay utility (and press enter until the simulation runs):

    1   mcdisplay --format=Mantid ILL_H16_IN5_Mantid.instr -n0
          
    2
  4. Finally, run a simulation with NeXus output:

    1   mcrun --format=NeXus ILL_H16_IN5_Mantid.instr
          
    2

6.1.4  Looking at instrument output in Mantid

In Mantid, your new NeXus file should behave more or less as usual, that is

The instrument ILL_H16_IN5_Mantid.instr included in McStas 2.1 will load and present simulated event-data, but the current time-definition of the event data does not comply fully with Mantid for data-reduction purposes - this should be corrected for the next McStas release.