LoadMcStas v1


LoadMcStas dialog.


Loads a McStas NeXus file into an workspace.


Name Direction Type Default Description
Filename Input string Mandatory The name of the Nexus file to load. Allowed extensions: [‘.h5’, ‘.nxs’]
OutputWorkspace Output Workspace Mandatory An output workspace.
ErrorBarsSetTo1 Input boolean False When this property is set to false errors are set equal to data values, and when set to true all errors are set equal to one. This property defaults to false


Reads a McStas Nexus file into a Mantid WorkspaceGroup with a user-supplied name. Data generated by McStas monitor components are stored in workspaces of type Workspace2D or Event.

For further information about Mcstas and Mantid see here. This includes how to generate a McStas 2.1 event data file and the corresponding IDF. It also includes McStas event data conventions. The information in the link is work in progress.

LoadMcStas replaces LoadMcStasEventNexus. LoadMcStas can be used for reading McStas 2.1 histogram and event data. LoadMcStasNexus v1 can be used for reading McStas 2.0 histogram data.

LoadMcStas will be called by Load, if the file has an /entry1/simulation/name item whose value is "mccode".

The output workspace will contain one workspace for each group of class NXdata and not of name "content_nxs" found in a group of class NXDetector of name "Data". The name of the workspace is the same as the name of the group, but with __mcstas_event_hist added to the end.

Description of Data Found in Nexus file (within ‘run’) Placed in Workspace (Workspace2D) or output
All data Group of class NXDetector of name "data" See below
Generic group including either event or histrogram data each group of class NXdata in "data", henceforth referred to as [DATA] one workspace each
Event data item in a [DATA] with a long_name attribute containing "Neutron_ID" and name "events" event data
Histrogram data items in a [DATA] with a long_name attribute not containing "Neutron_ID" histogram data
Instrument /instrument loaded into workspace, only if events are loaded
Instrument definition /instrument/instrument_xml/data is needed for events to be loaded loaded into workspace, only if events are loaded

The event data of the McStas file occurs in a table with six columns:

  1. Weight
  2. X coordinate
  3. Y coordinate
  4. Number of previous events
  5. Detector ID
  6. Time

The ErrorBarsSetTo1 property applies to event data, but not to histogram data.


For more information about McStas and its general usage for simulating neutron scattering instruments and experiments visit the McStas homepage http://www.mcstas.org.

Categories: Algorithms | DataHandling\Nexus


C++ source: LoadMcStas.cpp

C++ header: LoadMcStas.h