epics_mca.mac

Description

This package provides macros to setup and control multiple epics MCAs. It can save MCA spectra and configured ROIs to SPEC file.

setup_mca

to configure the epics MCA. It asks for the mnemonic, name and PV of the MCA. Multiple MCAs can be configures.It will automatically obtained the number of channels of each MCA. It will also determine if any ROI is in use for each MCA.

show_mca

to display the MCAs setup

rm_mca name

to remove one MCA if its mnemonic name is given as the parameter. All configured ROIs related to this MCA are cleared from SPEC too. If name is all , all MCAs are deleted.

mca_rois

to check out all created ROIS in each MCA and register them in SPEC. You should call it if you create/remove ROIs on the EPICS server after the setup_mca, to refresh the SPEC.

rm_roi name

If name is the mnemonic name of an ROI, that ROI is unregistered from SPEC.
If name is the mnemonic name of one MCA, all ROIS of that MCA are registered.

getandsave_mca time

saves all configure MCAs' spectra in spec file with time as their preset countime. If time is negative, it is treated as the monitor counts.

MCAscanend spec_scan_command

does the spec_scan_command as usual, when it finishs at the end point, obtain the MCA spectra and append them to the SPEC file.

MCAscanpt spec_scan_command

saves each MCA's spectra in a separate file on every scan point.

save_rois on/off

turns on/off the feature to save all registered MCA ROIs as user-defined columns in the data file.

Examples

This is an examples for two MCAs at sector 4:

>show_mca

     Mne            Name        EPICS_PV    Total_Chs      Use_Chs      Data_array
    mca2             TST        4id:mca2         4000         4000     mcadat_mca2
    mca1          vertox        4id:mca1         4000         4000     mcadat_mca1

 

>mca_rois
 
Current configured ROI for mca2:
mne: mca2R0 |pv: 4id:mca2.R0  |name:Roi1  |low: 100  |high: 200
Current configured ROI for mca1:
mne: mca1R0 |pv: 4id:mca1.R0  |name:Mn Ka  |low: 1446  |high: 1600
mne: mca1R1 |pv: 4id:mca1.R1  |name:cr  |low: 1629  |high: 1712

>save_rois on
 
 
Columns defined as pieces of identifier:mcaroi
Ltmca1 :  epics_get("4id:mca1.ELTM")  :  %.8g
Rtmca1 :  epics_get("4id:mca1.ERTM")  :  %.8g
Ltmca2 :  epics_get("4id:mca2.ELTM")  :  %.8g
Rtmca2 :  epics_get("4id:mca2.ERTM")  :  %.8g
Roi1(mca2R0) :  epics_get("4id:mca2.R0")  :  %s
MnKa(mca1R0) :  epics_get("4id:mca1.R0")  :  %s
cr(mca1R1) :  epics_get("4id:mca1.R1")  :  %s

The spectra data  will look like:

#S 1 save_mca  mca1
#D Tue Aug  2 17:38:36 2005
#T 2 (Seconds)
#Q 0 0 0
#U EPICS mca: mca1(4id:mca1)
#@MCA %25C
#@CHANN 4000 0 3999 1
#@CTIME 0 10 9.98
#@CALIB -0.395356 0.00770526 0
#N 1
#L Epics MCA mca1
@A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0\
 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\
.......