mca

Multichannel Analyzer Support

INTRODUCTION

In spec, an MCA-type device is something that returns a one-dimensional array of data. Such devices include multichannel analyzers, multichannel scalers, and digital correlators. Operation of most of these devices is through either manual commands to start and stop acquisition when appropriate to the experiment or automatic operation with the standard counting commands and macros.

A list of currently supported devices is at the end of this document.

All MCA-type devices (except CAMAC) are selected on the Acquistion device screen of spec's hardware configuration editor, and are assigned a unit number from 0 to 31. spec's MCA functions mca_get(), mca_put() and mca_par() operate on the MCA device last selected with the mca_sel() function. The functions mca_sget(), mca_sput() and mca_spar() take the assigned unit number as an additional initial parameter.

CAMAC MCA-type devices (which are selected on the CAMAC screen of the configuration editor) are numbered automatically starting with the lowest available unit number not otherwise taken when spec reads the config file. Use the mca_sel("?") to see what unit numbers have been assigned.

The built-in read-only global variable MCAS is set to a value one greater than the highest numbered MCA from the config file. If there are no empty slots between the first and last MCA, the value will equal the number of MCAs configured. To loop through all available MCAs, use code like this:

for (unit = 0; unit < MCAS; unit++) {
    if (mca_spar(unit, "unusable") || mca_spar(unit, "disable"))
          continue
    ...
}

Some MCA hardware includes multiple modules per unit. See Multiple Modules below for addressing syntax.

See the acq help file for instructions on using the acqsetup macro to configure automatica data acquistion from MCAs during scans and for configuration region of interest (ROI) counters.

DATA ARRAYS (AND DATA GROUPS)

The mca_get() and mca_put() functions, which transfer data between the MCA-type hardware and spec, can use either data arrays or data groups. Data groups are an older and deprecated method of handling arrays of numbers in spec and are explained in the data help file. Support for three very old devices -- Keithley 2001, Nicomp autocorrelator, Ortec 918 -- only works with data groups.

The recommended method of handling MCA data is with data arrays. The arrays help file explains general features of the array data type. In brief, the arrays are declared with a type and dimension. For example,

SPEC.1> ulong array mca_data[8192]

declares an unsigned-long data array of 8,192 elements. The mca_get() and mca_put() functions can be invoked with the array name as an argument. If the declared type of the array matches that of the hardware, the data will be transferred directly to the array. If the type doesn't match, spec will create a temporary buffer of the correct type, read the data into that, then copy the data to the user's array, all transparently to the user. Either way will work, though there is a slight efficiency advantage in declaring the array to match the native type of the hardware. The command

SPEC.2> print mca_par("native_type")
long

shows the native type of the selected MCA device.

Even better, if the arrays are declared as "shared" as in:

SPEC.3> shared ulong array mca_data[8192]

an external utility, such as the Python splot program included with spec, can be configured to show a live-time display of the array data.

FUNCTIONS

Not all functions or mca_par() options are implemented for all MCA devices. Some functions can't be implemented due to hardware limitations. Others just haven't been implemented yet. If the hardware-specific documentation doesn't yet exist, contact CSS to determine which features are implemented for particular devices.

For the most part, the parameters listed below are ones that are processed partly or completely in spec's device-independent MCA support. Unrecognized parameters are passed to the device-dependent code. See the help file associated with particular MCA models for the additional parameter descriptions.

mca_sel(n)
Selects which MCA-type device to use for subsequent calls of the mca_get(), mca_put() and mca_par() functions. The MCA unit numbering is set in the config file with the string @mca_N, where N is the unit number (from 0 to 31). Returns -1 if not configured for device n, otherwise returns zero. It is not necessary to use mca_sel() if only one MCA-type device is configured and is configured as device 0.
mca_sel("?") or mca_spar("config")
Lists the configured MCA devices and indicates which device is currently selected for the mca_get(), mca_put() and mca_par() functions with an asterisk. Also displays the MCA unit number for use with the mca_sget(), mca_sput() and mca_spar() functions. Additional information includes whether the presence test found the unit unresponsive and whether the unit has been disabled either by the user or in the config file. Returns the total number of MCA devices recognized in the config file, including disabled devices. Note, the value may differ from that of the built-in global variable MCAS, which is set to one greater than the highest MCA unit number. The values will differ if there are empty slots in the config file.
mca_sel(n, "?") or mca_spar(n, "config")
Returns a string containing one line of information about MCA device n, or 0 if spec isn't configured for device n.
mca_par("config")
Returns a string containing one line of information about the currently selected MCA device.
mca_get(arr [, roi_beg [, roi_end]])

Gets data from the currently selected MCA-type device, and transfers it to the array arr. If the optional starting channel and ending channel are given, the data is read from those hardware channels and placed starting at the beginning of the array. For example,

SPEC.1> ulong array data[1024]
SPEC.2> mca_get(data)
SPEC.3> mca_get(data, 32, 128)
SPEC.4> mca_get(data[32:128], 32, 128)

The last example uses subarray syntax to position the data in array elements corresponding to the MCA channel positions.

mca_get(g, e [, roi_beg [, roi_end]])
As above, but transfers the data to element e of data group g instead of an array. Returns the number of points transferred.
mca_sget(sel, ...)
Like the above functions, but uses the MCA device with unit number sel as set in the config file.
mca_put(...) and mca_sput(sel, ...)
These functions have the same syntax as the above, but transfer data to the MCA device (for devices that support transfer in that direction).
mca_par(cmd [, arg])
A function to access various features and parameters of the currently selected MCA device. The string cmd selects an option. The argument arg contains an optional value. Some values for cmd apply to all MCA devices, while some apply only to certain devices.
mca_spar(sel, cmd [, arg])
Like the above, but uses the MCA device with unit number sel in the config file.
mca_spar(sel, "unusable")
Returns nonzero if MCA unit number sel is unusable. The device might be unusable because it failed a presence test, because it is marked OFF in the config file, or because there is no device at that number in the config file. (As of spec release 6.06.01.)
mca_par("active")
Returns a nonzero value if the associated MCA device is actively acquiring data. (As of spec release 6.11.03.)
mca_par("info")
Displays the native type, the currently configured number of channels and the maximum number of hardware channels for the selected MCA device. Also displays the current settings for auto-clear mode, auto-run mode and soft-preset mode (as of spec release 6.00.06).
mca_par("chans")
Returns the currently configured number of channels.
mca_par("max_chans") or mca_par("max_channels")
Returns the maximum number of hardware channels.
mca_par("modules" [, arg])
Returns the number of modules associated with the unit. For some devices, it may be possible to set the number of modules.
mca_par("disable" [, arg])
With no arguments, returns nonzero if the selected MCA device has been disabled by the user, otherwise returns zero. If arg is 1, disables the MCA. If arg is 0, turns off the disabled mode. When the device is disabled, spec will not access the hardware. On start up, and after the standard config macro or the reconfig command is run, disabled mode is off.
mca_par("auto_run" [, arg])
With no arguments, returns nonzero if the selected MCA device has auto-run mode set, otherwise returns zero. If arg is 1, enables auto-run mode. If arg is 0, turns off auto-run mode. When auto-run mode is set the device is started and stopped with the counting functions tcount(), mcount(), etc. When not set, the counting functions are ignored, but the device can be controlled with the "run" and "halt" options described below. In addition, the device can be halted with the stop() function and will be halted with ^C. Some devices default to auto-run mode on and some to auto-run mode off on start up and after the standard config macro or the reconfig command is run.
mca_par("soft_preset" [, arg])
With no arguments, returns nonzero if the selected MCA device has soft-preset mode set, otherwise returns zero. If arg is 1, enables soft-preset mode. If arg is 0, turns off soft-preset mode. When set, and if auto-run mode is enabled (see above), the MCA device is set to count for the time preset given as an argument to the tcount() function. The wait() function will wait until both the timer and the MCA device have counted to their respective presets. When soft-preset mode is not set, but auto-run mode is, the device is programmed for continuous data acquisition and will be stopped when the timer's preset is reached. Currently, when both soft-preset and auto-run modes are in effect, when counting to monitor (using mcount()) rather than to time, the device is also programmed for continuous data acquisition, as above.
mca_par("auto_clear" [, arg])
With no arguments, returns nonzero if the selected MCA device has auto-clear mode set, otherwise returns zero. If arg is 1, enables auto-clear mode. If arg is 0, turns off auto-clear mode. When set, spec automatically sends commands to clear the MCA data before acquisition is started. Note, for some MCA devices, the clear operation takes time, so may affect the duration of data acquisition when not in soft-preset mode. Auto-clear mode is set at start up and after each hardware reconfiguration.
mca_par("native_type")
Returns one of the strings byte, ubyte, short, ushort, long, long64, ulong, ulong64, float, double or unknown to describe the native data type of the MCA device.
mca_par("preset" [, arg])
With no arguments, returns the current preset value. Otherwise, sets the preset to arg. The preset value is in seconds for live-time and real-time modes or number of counts for integral mode. If the preset is zero, the device will programmed for continuous run, except when the soft-preset mode is in effect, as described above.
mca_par("run")
Programs the MCA device with the appropriate parameters and starts acquisition.
mca_par("halt")
Halts the MCA device.
mca_par("clear")
Clears the data in the current group.
mca_par("send", msg)
For message-based devices, sends the string msg to the device.
mca_par("read", msg)
For message-based devices, sends the string msg to the device, and returns the device's reply.
mca_par("chan#")
Returns the contents of channel number #.
mca_par("chan#", value)
Set the contents of channel number # to value.
mca_par("hdw_roi?")
Returns nonzero if the MCA supports hardware regions of interest (ROI).
mca_par("hdw_roi", beg, end [, action])
Sets a hardware region of interest from channels beg to end to perform the given action. If none is specified, the default action is "sum".

MULTIPLE MODULES

An MCA unit is generally associated with a single interface address, such as an IP address for ethernet, a GPIB address or a device node for a serial interface, such as /dev/ttyS0. Some MCA devices may have multiple modules associated with a given unit, with each module accumulating a separate spectrum. For such devices, the functions mca_spar(), mca_sget() and mca_sput() use an expanded syntax to specify both the unit and module number. To select a specific module, address arguments may be given as 0.0, 0.1, 0.2, ..., where the first digit is the MCA unit number from the config file, and the digit to the right of the decimal point is the MCA module number. Modules are numbered starting from 0. The arguments can be enclosed in quotation marks, but spec doesn't require that. In the context of these MCA functions, spec treats the first argument as a string. The syntax "0:0", "0:1", "0:2", ..., is also recognized, although here the quotation marks are necessary to satisfy the spec parser.

CURRENTLY SUPPORTED DEVICES

Currently supported MCA-type devices include:


Amptek DP5/PX5/MCA8000D (FW6) (Ethernet)
Bruker Vantec-1 (Ethernet)
Canberra LYNX/DSA-3000 (Ethernet)
Dectris Mythen (Ethernet)
Seiko/EG&G Orsim MCA 7700 (Ethernet)

ESRF MUSST MCA (GPIB)
Photometrics Star-1 CCD Camera (GPIB)
Princeton Applied Research Model 283 (GPIB)
Princeton Instruments ST116 PDA (GPIB)
Ortec 918A Multichannel Buffer (GPIB)
Seiko/EG&G Orsim MCA 7700 (GPIB)
Silena 7328 MCA (8K) (GPIB)
Silena 7329 MCA (16K) (GPIB)

BSI SP350-based Detector (Serial)
MBraun PSD-50M (Serial)
Bruker (Roentec) XFlash MAX MCA (Serial)

Ortec TRUMP PCI (PCI Board)
Ortec MCS-PCI (PCI Board)

XIA X10P MCA (parallel port)

EPICS MCA Record
TACO MCA Device Server

Hasylab Model 8701 MCA (VME)

FAST ComTec MCD/PC (ISA Board)
FAST ComTec MCDLAP (ISA Board)
Hecus ASA-32 MCA (ISA Board)
Ortec TRUMP 8K/2K Multichannel Buffer (ISA Board)

DSP 2190 MCS Averager (CAMAC)
LeCroy 3512 Spectroscopy ADC (CAMAC)
LeCroy 3521A Multichannel Scaler (CAMAC)
XIA DXP (CAMAC)

Brookhaven Instruments BI-9000 Autocorrelator (ISA Board)

Keithley 2001 Multimeter (GPIB)

SEE ALSO

MPII amptek dp5 dxp hecus kisim lc2301 lc3588 mac_hdw mcspci microfast mythen nicomp nt2400 pca px4 server_hdw sis3820 usbctr