esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

multimca.mac
See other macros in category: Detection MCA
Description:
    Multi Channel Analyser. Macros handling multiple devices at once
Documentation:
    DEPENDENCIES
    saveload.mac sps.mac

Macros:
    MultiMCA_debug
    Usage: MultiMCA_debug
    Toggles the debug mode. if (!(whatis("__MultiMCA_debug") & 2)) rdef __MultiMCA_debug \'#$*\'

    getval_one_char
    Usage: getval_one_char (<message>, <default>)
    Prompts for a single letter until a unique one is entered.

    mcalist
    Usage: mcalist
    List all configured MCA devices and their state

    mcaon
    Usage: mcaon [<device_no>]
    Set all MCA devices ON, or only <device_no>
    If device is on, it is used in standard acquisition macros (scans, ct)

    mcaoff
    Usage: mcaoff [<device_no>]
    Set all MCA devices OFF, or only <device_no>

    mcaactive
    Usage: mcaactive [device_no]
    Set MCA device number <device_no> ACTIVE.
    If device is active, it is used in mca acquisition macro (mcaacq)

    mcainactive
    Usage: mcainactive [device_no]
    Set MCA device number <device_no> INACTIVE.

    mcasetup
    Usage: mcasetup <no> [<size> <num> <tmode> <sync> <noclear> <gui> <scan> <acq> <std> <prefix> <red> <fmt> <whole> <type>]
    MCA device setup
    If no arguments, or only <no>, run an interactive menu.
    If arguments are given, setup mca silently
    Arguments are:
    no: device number as in spec config
    size: memory size (default read from device)
    num: memory group number (default 0)
    tmode: time mode = 0:real time, 1:live time (default 0)
    sync: sync mode = 0:Internal, 1:External (default 0)
    noclear: do not clear buffer between several mcaacq (default 0)
    scan: save spectrum during scans (default 0)
    acq: save spectrum during mcaacq/ct (default 0)
    std: save spectrum to standard file (default 0)
    prefix: mca file prefix (default =\"data\")
    red: spectrum reduction factor (default = 1 = no reduction)
    fmt: file dump format as used in data_dump (default = %%16C)
    whole: read whole spectra or not (default = 0 - whole)
    type: MCA controller type AIM/MAX = 0, MMAX = 1, MUSST = 2 (default = 0-AIM)

    mcaacq
    Usage: mcaacq [counting_time] Do an acquisition for counting_time seconds or until manual stop if no time sp[ecified.


    mcastop
    Usage: mcastop [<device_no>]
    Stop acquisition on all active device or only on device_no.

    mcaclear
    Usage: mcaclear [device_no]
    Clear memory for all active device or only on device_no.

    mcapreset
    Usage: mcapreset [no] <preset_time>
    Set preset_time [s] for all active MCAs or only on MCA no.

    mcastart
    Usage: mcastart [no]
    Start acquisition for all active MCAs or only on MCA no.
    !!No preset time set inside this macro: use mcapreset before.

    mcaread
    Usage: mcaread [no]
    Read data and times for all active MCAs or only on MCA no.

    mcawait
    Usage: mcawait
    Wait for all device to stop counting

    mcakey
    Usage: mcakey
    On-line menu while waiting for acquisition to end.

    mcatimes
    Usage: mcatimes
    Print out live, real, dead times for all active devices.
    !!No read is performed: use macro mcaread before

    mcacalib
    Usage: mcacalib [ <no> <A> <B> <C> ]
    With no arguments, runs an interactive menu to set calib coeff.
    With input arguments, change the calibration shared array

    mcacalibmenu
    Usage: mcacalibmenu
    Interactive menu to change calibration for all devices

    mcacalibshow
    Usage: mcacalibshow
    Show current calibration of all devices

    mcacalibsave
    Usage: mcacalibsave [<filename>]
    Save current calibrations to file
    If no <filename> is specified, use default one.
    Default filename is BLISSADM/local/spec/userconf/mcacalib.USER

    mcacalibload
    Usage: mcacalibload [<filename>]
    Load MCA calibrations from file. This overrides current calibrations
    If no <filename> is specified, use default one.
    Default filename is BLISSADM/local/spec/userconf/mcacalib.USER

    mcaroi
    Usage: mcaroi [<roi_mne> <mca_dev> <roi_min> <roi_max> <roi_alias>]
    Define a new roi. If no arguments is given, call mcaroimenu.
    roi_mne : counter mnemonic
    mca_dev : mca device number
    roi_min : roi first channel
    roi_max : roi last channel
    roi_alias : roi alias
    mmax_ch : mmax channel (if appropriate)

    mcaroidel
    Usage: mcaroidel <roi_mne>
    Deletes ROI <roi_mne>

    mcaroimenu
    Usage: mcaroimenu
    Menu to Add/Modify/Delete/Save/Load rois

    mcaroishow
    Usage: mcaroishow
    Show ROIs definition

    mcaroisave
    Usage: mcaroisave [<filename>]
    Save current rois definition to file
    If no <filename> is specified, use default one.
    Default filename is BLISSADM/local/spec/userconf/mcaroi.def.USER

    mcaroiload
    Usage: mcaroiload [<filename>]
    Load rois definition from file. This overrides current rois definition.
    If no <filename> is specified, use default one.
    Default filename is BLISSADM/local/spec/userconf/mcaroi.def.USER

    mcaguion
    Usage: mcaguion [<no>]
    Set GUI ON for all mca device or just device <no>
    If not already opened, open gui if device is active

    mcaguiopen
    Usage: mcaguiopen [<device_no>]
    Open GUI for <device_no>, or for all active device if <device_no> not specified

    mcaguiclose
    Usage: mcaguiclose [<device_no>]
    Close GUI for <device_no>, or for all devices if <device_no> not specified

    mcasavelast
    Usage: mcasavelast
    Save last acquisition for all active devices
    Do not consider saving options: save all in mca files

    mcalineupon
    Usage: mcalineupon
    Read data from all mca ON (arrays MCA_DATAn) and save data in array MCA_DATA
    Data are written in MCA_DATA in the same order as in spec configuration

    mcalineupoff
    Usage: mcalineupoff
    Set lineup facility off. MCA_DATA is not updated anymore

Internal Macros:
    _mcamsg
    Usage: _mcamsg(no, msg)
    Utility to print mca messages

    _mcalist
    Usage: _mcalist (no)
    short list of the MCA no configuration

    _mcamenu
    Usage: _mcamenu
    print the menu of all the set in the config MCAs

    _mcasubmenu
    Usage: _mcasubmenu (no)
    Configure the MCA no when using the mcasetup menu

    _mcaon
    Usage: _mcaon (no)
    Set MCA device no ON

    _mcaoff
    Usage: _mcaoff (no)
    Set MCA device no OFF

    _mcacheckoff
    Usage: _mcacheckoff()
    Since spec version 6, this pb is fixed so reconfig set auto_run to 0 When doing reconfig, spec sets auto_run to 1 even if mca is off in the macro.
    So, before counting, if mca is off (MCA_ON[]=0), we force auto_run to 0. This will avoid difference between MCA_ON and internal auto_run flag.

    mcaunsetup
    Usage: mcaunsetup


    _mcadefaults
    Usage: _mcadefaults (no)
    Setup defaults parameters for MCA device <no>.

    _mcasetup
    Usage: _mcasetup (no)
    Setup the MCA device no.
    If setup failed, the device is set inactive

    _mcaroisetup
    Usage: _mcaroisetup (no)
    Get the pseudo counter configuration for all defined for MCA device no ROIs. Return 0 if no ROI configured, nb of rois otherwise.

    _mcamemsetup
    Usage: _mcamemsetup (no)
    Setup memory parameters for device <no>
    Return 1 on success, 0 otherwise.

    _mcaio
    Usage: _mcaio (no, command, argument)
    Send command to device no.

    _mcacdef
    Usage: _mcacdef (no)
    Hooks MCA operation to the standard macros for device no.

    _mcadeldef
    Usage: _mcadeldef (no)
    Un-Hooks MCA operation to the standard macros for device no.

    _mcaarraycreate
    Usage: _mcaarraycreate (no)
    Create data array MCA_DATAno where no is the MCA device number. If the array already exists, check its size and eventually change it.

    _mcaarrayclear
    Usage: _mcaarrayclear (no)
    Reset data array MCA_DATAno where no is the MCA device number.

    _mcaarrayread
    Usage: _mcaarrayread (no)
    Read in data from MCA to array MCA_DATAno where no is the MCA device number.

    _mcanbactive
    Usage: _mcanbactive ()
    Get number of active mca devices

    _mcastop
    Usage: _mcastop (no)
    Stop acquisition on device no.

    _mcaclear
    Usage: _mcaclear (no)
    Clear the memory and the arrays on MCA no.

    _mcaclearct
    Usage: _mcaclearct (no)
    Clear the memory and the arrays for MCA no if the device is on.

    _mcapreset
    Usage: _mcapreset (no, pt)
    Set preset time to pt seconds on mca device no.

    _mcastart
    Usage: _mcastart (no)
    Start acquisition on MCA no.

    _mcareadct
    Usage: _mcareadct (no)
    read out data from mca device no
    Spectrum are stored in array MCA_DATA<no>
    Times are stored in array MCA_TIMES. To be used in user_getcounts.

    _mcaread
    Usage: _mcaread (no)
    read out data from mca device no
    Spectrum are stored in array MCA_DATA<no>
    Times are stored in array MCA_TIMES

    _mcatimes
    Usage: _mcatimes (no)
    Read mca times and save it in array MCA_TIMES

    _mcacalibget
    Usage: _mcacalibget (no)
    Return the calibration for MCA no.

    _mcacalibshow
    Usage: _mcacalibshow()


    _mcacalib
    Usage: _mcacalib (no, ca, cb, cc)
    Change calibration coeff for mca no.

    _mcaroishow
    Usage: _mcaroishow()


    _mcaroiadd
    Usage: _mcaroiadd (dev, cnt, min, max, alias)
    Add roi in the list

    _mcammaxroiadd
    Usage: _mcammaxroiadd(dev, emin, emax, alias, mmax_ch, nb)


    _mcagetE
    Usage: _mcagetE (nb, ch)
    Return the energy [keV] as function of the channel ch for the MCA number nb

    _mcagetch
    Usage: _mcagetch (nb, en)
    Return the channel as function of the energy en [keV] for the MCA number nb

    _mcaroidel
    Usage: _mcaroidel (cnt)
    Delete roi from the list

    _mcareadroi
    Usage: _mcareadroi(no)


    _mcaroicounts
    Usage: _mcaroicounts (cnt)
    Hook macro to update roi counter's value

    _mcaguion
    Usage: _mcaguion (no)
    Set GUI ON for device <no>

    mcaguioff
    Usage: mcaguioff [<no>]
    Set GUI OFF for all device or just device <no>
    Close gui if opened.

    _mcaguioff
    Usage: _mcaguioff (no)
    Set GUI OFF for device <no>

    _mcaguiopen
    Usage: _mcaguiopen(no)


    _mcaguiclose
    Usage: _mcaguiclose(no)


    _mcaguistart
    Usage: _mcaguistart(no)


    mcasavescanheader
    Usage: mcasavescanheader <device_no>
    Save MCA specific header during a scan

    mcasavescandata
    Usage: mcasavescandata <device_no>
    Save MCA data during a scan

    mcasavect
    Usage: mcasavect
    Save mca header and data after a ct

    mcasaveacq
    Usage: mcasaveacq
    Save mca header and data after a mcaacq

    mcasavestandard
    Usage: mcasavestandard(nb, std, inct)
    Save mca header and data in standard spec datafile

    _mcasavestandard
    Usage: _mcasavestandard (nb, std, inct)


    mcasaveprivate
    Usage: mcasaveprivate (no)
    Save MCA header and data in a private file
    Return 1 on success, 0 otherwise

    mcafilename
    Usage: mcafilename (no, inscan)
    Create filename for specific mca files

    savemultimcaheader
    Usage: savemultimcaheader (file, no, withtime)
    Save MCA specific header for device <no>
    If <withtime>!= 0, save counting, live and real times
    Return 1 on sucess, 0 otherwise

    savemultimcadata
    Usage: savemultimcadata (file, no)
    Save MCA spectrum data for device <no>
    Return 1 on sucess, 0 otherwise

    _mcadatareduction
    Usage: _mcadatareduction (no)
    Computes reduction on MCA_DATA<no>. Results are stored in MCA_DATARED<no>

    _mcalineupsize
    Usage: _mcalineupsize ()
    Computes size needed for MCA_DATA to store all MCA_DATAn arrays

    _mcalineupdata
    Usage: _mcalineupdata
    Macro used in all read hooks to fillup MCA_DATA

    _mcalineupclear
    Usage: _mcalineupclear
    Clear MCA_DATA

    mcatype
    Usage: mcatype


    _mcatype
    Usage: _mcatype(no, type, flag)


Filename: multimca.mac
Author: MC.Lagier, E.Papillon, A.Beteva
$Revision: 1.45 $ / $Date: 2022/12/05 16:00:36 $
Last mod.: 05/12/2022 17:00 by witsch