This section explains how the NeXus file production is integrated into the data acquisition system at DESY. The whole writing process is depicted as a sequence diagram in Figure 9.8.
The Experiment Control Client (ECC), e.g. Spock with its MacroServer and macros, serves as an interface to the researcher. This application prompts the Configuration Server for a list of available components. Depending on the experimental technique the researcher selects required components. The ECC sends the selected components to the Configuration Server where they are merged into the configuration. Next, the ECC reads the created configuration string and passes it to the NeXus Writer. The NeXus Writer parses the configuration and creates a NeXus file with the required hierarchical structure. For each data source an object is created carrying which holds the information of where to fetch the data from and where to store them. These data objects are maintained in lists. There is one list for INIT, STEP and FINAL strategies.
After the NeXus file has been prepared and the lists of data objects have been produced, the measurement starts. The sequence begins by invoking the NeXus Writer for the INIT phase. The process iterates through the list of INIT data objects invoking their function members that transfer the data from the sources to the NeXus file. Likewise the NeXus Writer executes the STEP and FINAL phases. INIT and FINAL data are read once. STEP data are read for each step of a scanning procedure.
Data collected during the INIT phase typically consist of information describing the instrument and the facility. User metadata and the initial state of the beamline devices, motor positions, are also included. The STEP phase generates most of the raw data. An example for FINAL data is the end time of the scan.
In addition there is the POSTRUN strategy for data to be supplied in a post processing step. This feature has been introduced for 2D detectors creating data which, for performance reasons, are not immediately inserted into the NeXus files. Camera servers store their image frames temporarily on ramdisks, local disks or on network file systems. After a measurement is finished the data collection process opens the NeXus file, searches for POSTRUN strategy labels and inserts the images into the file. This way, the NeXus file contains all experimental data belonging to a measurement.