MCA - IDL Multichannel Analyzer Program

Mark Rivers



The IDL Multichannel Analyzer (MCA) program provides a multichannel analyzer display using IDL widgets. It emulates the look and feel of the Canberra MCA package on the VAX.

This program with the MCA hardware via the EPICS MCA record. It requires at least version 2.X of the MCA record, which supports fields for ROI labels and calibration parameters.

The EPICS MCA record presently has device support for the Canberra AIM MCA, which is an NIM module which communicates over Ethernet. There is presently a beta version of device support for the DXP MCA from X-Ray Instrumentation Associates. This is a 4-channel CAMAC module.

This is an early release of the MCA program, and this documentation in particular is in an early draft form.

Acquisition Control

These controls allow one to turn data acquisition On and Off and to Erase the present spectrum. The Acquisition Setup allows one to set preset live time, preset real time, and/or preset counts between a starting and ending channel.

Markers and Cursor

The program has two markers, which are indicated with short red lines on the display, and one cursor, which is indicated with a longer red line.

The cursor is positioned with the left mouse button, or by typing in a new channel number or energy in the text widgets on the bottom center of the display.

The left marker is positioned with the middle mouse button, (or by pressing the left and right mouse buttons together) or by typing in a new channel number or energy in the text widgets on the bottom center of the display.

The right marker is positioned with the right mouse button, or by typing in a new channel number or energy in the text widgets on the bottom center of the display.

Statistical information on the region of the spectrum between the left and right markers is shown at the bottom of the display. This includes the total counts, background counts, net counts, total counts/second, background counts/second, and net counts/second. It also includes the centroid and and the full width at half maximum (FWHM), which are derived from fitting a Gaussian peak to the background subtracted counts between the left and right markers. Obviously, the centroid and FWHM are most meaningful if the left and right markers are positioned on either side of a single peak.

Regions of Interest (ROIs)

Regions-of-Interest (ROIs) are regions of adjacent channels in the spectrum. The ROIs highlighted in a different color and to which one can quickly move the markers and cursor. They are typically used to highlight interesting peaks.

The MCA program uses the ROI fields which are implemented in the EPICS MCA record. Each ROI in the MCA record has the following properties:

Of these properties, only the start channel, end channel and label are controlled by the IDL MCA program. The Add ROI control creates a new ROI between the left and right markers. The new ROI will be highlighted in a color different from that of the rest of the spectrum. It will be added to the ROIs in the MCA record. Note that the MCA program sorts the ROIs into ascending order of the Start Channel, so the location of other ROIs in the record may change.

The Delete ROI control deletes the ROI which is delimited by the left and right markers. If the markers are not positioned exactly on the edges of an ROI this control has no effect. Use the ROI arrow widgets to position the markers and cursors to the ROI to be deleted.

The right ROI arrow widget moves the markers and cursors to the next ROI. The statistics on the screen will then reflect the counts in this portion of the spectrum. If the next ROI is not visible because the display is zoomed up then the display will be redrawn with this ROI in the center of the screen. This control does nothing if there are no ROIs presently defined.

The left ROI arrow widget is similar to the right ROI arrow control, except that it selects the previous ROI.

Display Controls

The right Zoom arrow widget and left Zoom arrow widget controls expand and contract the horizontal scale by a factor of two each time they are pressed. The zoomed display is centered on the position of the cursor (the longer red line).

The right Shift arrow widget and left Shift arrow widget controls shift the horizontal scale by half a screen width each time they are pressed.

The Display Setup screen allows one to select the vertical scaling (linear, logarithmic), vertical autoscaling (On/Off), plot line style (dotted, solid or histogram), plot update rate, and horizontal and vertical plot limits. The vertical plot limits are disabled if vertical autoscaling is On. NOTE: This is not currently functional

Environment Variables

The MCA program requires that the following environment variables be set:
MCA_PREFERENCES File name to save/restore for MCA program preferences, such as size, colors, line style, etc. If environment variable not set then the file mca.preferences in the current default directory is used.
MCA_HELP_COMMAND Command to display the MCA help text. This is typically defined as
netscape -remote "openURL("
XRF_PEAK_LIBRARY File containing XRF line data. Used by
JCPDS_PATH Full path to directory containing the JCPDS powder diffraction data files. Used by
PATH The PATH environment variable must contain the directory that contains the files ezca.dll, EzcaScan.dll, ezcaIDL.dll, ca.dll, and com.dll (on Windows), or the equivalent .so files on Linux or Unix.
EZCA_IDL_SHARE Full path to the file ezcaIDL.dll (Windows) or (Linux or Unix).

On Unix systems adding lines like the following to your .cshrc file will define these environment variables:

setenv MCA_HELP_COMMAND 'netscape -remote "openURL("'
setenv MCA_PREFERENCES ~/mca.preferences
setenv XRF_PEAK_LIBRARY /usr/local/idl_user/epics/mca/xrf_peak_library.txt
setenv JCPDS_PATH /usr/local/idl_user/epics/mca/jcpds/
setenv EZCA_IDL_SHARE /usr/local/idl_user/epics/extensions/bin/Linux/

On Windows systems go to Control Panel/System/Environment (NT) or Control Panel/System/Advanced/Environment Variables (XP) and add definitions like the following (assuming the IDL MCA code was unpacked in C:\EPICS\IDL_MCA):

MCA_PREFERENCES c:\epics\idl_mca\mca.preferences
XRF_PEAK_LIBRARY c:\epics\idl_mca\xrf_peak_library.txt
JCPDS_PATH c:\epics\idl_mca\jcpds\
EZCA_IDL_SHARE c:\epics\idl_mca\dlls\ezcaIDL.dll
PATH ...;C:\epics\idl_mca\dlls;...


The following table briefly describes all of the files used by the MCA program. These files can all be obtained in a tar file. This file should be untarred in a directory in your IDL path.
mcaRecord.ascii This file contains the definition of the MCA record fields. This file is needed to create the new version of the MCA record which has fields for calibration parameters and ROI labels. Note that there has been no change to the C code of the record. To build the new version of the MCA record:
  • Copy mcaRecord.ascii to a cat_ascii directory
  • Run makesdr to build the new record definition files
  • Run gnumake in the mcaApp directory to compile the new version of the record. Routine to look up the atomic number of an element. Routine to look up the atomic symbol of an element. Routine to solve the third-order Birch-Murnaghan equation of state. This is used for computing the positions of diffraction peaks at high-pressure. Structure definitions and methods (procedures and functions) for the object class epics_mca. This file contains the only EPICS device-dependent code. Class epics_mca is a subclass of mca. Routine to return the name of a font given a description of it. Routine to increment the extension of a filename, assuming the extension is numberic.
jcpds Directory containing files of powder diffraction data for standard materials. Users can add new materials to this directory by copying the format of the existing files. Routine to look up the energy of an x-ray fluorescence line. The main source file for the MCA program. This is a very simple routine which simply creates an object of type mca_display. Structure definitions and methods (procedures and functions) for the object class mca. This file contains the device-independent code for MCA objects. Structure definitions and methods (procedures and functions) for the object class mca_display. This file contains most of the code for the display program itself. An IDL MCA display window is an instance of an mca_display object. Routine to create a popup widget to display information with an optional timeout. Routine to read the data files in the jcpds directory. Routine to read data files created by the MCA program. Not actually used by MCA.PRO, but provided as a convenience for users. Returns two arrays, energy and counts. Optionally returns an object called mca which can be used to access all of the information in the file, including calibration coefficients, ROIs, elapsed live and real time, etc.
xrf_peak_library.txt The database of XRF energies, used by lookup_xrf_line.

Release Notes

Version 2.0 Beta 1, January 22, 1997.

First public release of new program. The new program, MCA.PRO replaces an earlier program which was called CAMCA.PRO.

Version 2.0.1, February 1, 1997

Version 2.0.2, February 2, 1997

Version 3.0, July 18, 1997

Version 3.01, July 28, 1997

Version 3.02, August 20, 1997

Version 3.03, November 26, 1997

Version 3.04, December 15, 1997

Future Additions

The following features are planned for the MCA program in the near future.
Suggestions and comments to: Mark Rivers : (
Last modified: August 20, 1997