Beamline Instrument Software Support |
|
SPEC Macro documentation:
[ Macro Index |
BCU Home ]
|
C111_GFD1D.MAC | ||||||
[ source code | installed at | configured at ] | ||||||
See other macros in category: Other hardware | ||||||
Description:
| ||||||
Documentation:
These macros implement access to C111 Linux TACO device server controlling one C111/P111 C111 card designed by Christian Herve. They work with the version V1.4 of C111 device server [which in turn uses version v.0.4.8 of the C111 device driver library]. These macro set does not cover all possible C111 configurations but is written for the specific configuration which is using C111 for GFD detector equipped with 1 delay line connected to X1,X2 C111 inputs. Anode as usually is connected to COM C111 input. Normally one would always program C111 in Normal mode. The test mode is selected only to make delay line length estimation. When set in test mode, where the choice of the resolution (half/full) is ignored and the C111 behaves as being set in half-resolution mode, the digitized channel where is the data peak (sum ~ DelayLine) must be multiplied by .3 ns (300ps) to obtain the estimation of the delay line length (in fact the number obtained is: DelayLine + (Anode-to-X1 delay) + (Anode-to-X2 delay), but since the 2 A-K delays are normally much shorter than the delay line, this gives a good estimate of the DL. SETUP EXAMPLE STATUS CONFIGURATION ACQUISITION SAVING ROIS Plotting DEPENDENCIES - The file disable.mac from STD ESRF spec macro set must be loaded, if want to mark counters to be enabled/disabled with function: disable_counter(ctn_mne(i), s), where if s = 0 counter is enabled and if s = 1 counter is disabled. Alternative to using the macros from file disable.mac is the following: Counter can be disabled also by: counter_par(ctn_mne(i),"disable",1) and can be enabled by: counter_par(ctn_mne(i),"disable",0) The enable/disable state can be examined with: p counter_par(ctn_mne(i), "disabled") or with: p is_using_counter(ctn_mne(i)) Macros from this macro set (= this file) do not use anywhere calls to macro functions from disable.mac. - The file saveload.mac from STD ESRF spec macro set must be loaded BEFORE this macro file, because certain nb of macro functions are used from it like savefileheader() etc. Instead of macro functions savecntheader() and savecounters() from saveload.mac we use macro functions savecntheader1() and savecounters1() from this macro file. The reason for doing it is that in macros from saveload.mac test: cnt_name(i)!="unused" is used instead of: is_using_counter(cnt_mne(i)) == 1 The test cnt_name()!="unused" is unfortunately not distinguishing between enabled/disabled counters!!! - The file ID01mca.mac does not need any more to be loaded, since its savecntheader is now replaced by savecntheader1() from this macro file and which uses is_using_counter() == 1 in tests and which for ID01 (SPECBL == "ID01") writes Filter info in file. | ||||||
Macros:
Usage: c111version Prints out the version of this software c111setup Usage: c111setup <device_name> <rpc_timeout> This macro should normally be invoked at spec session start after C111 macro set was loaded. Connects to C111 device and sets RPC timeout. c111unsetup Usage: c111unsetup Deletes c111 part in cleanup_always c111 Usage: c111 Display a menu to access all C111 config/options c111status Usage: c111status Gives full status information for C111. For brevity did not name this macro c111getstatus but c111status c111show Usage: c111show Show main C111 config/status parameters c111newfile Usage: c111newfile [<data-directory> <file-prefix> [<run-number>]] Choose a new directory, file prefix and run/series number for data files when data are saved outside counting and scanning. If the run number is not passed as argument or if the file prefix is changed, the run number is reset to 0. This macro can be used at any moment to change data directory c111config Usage: c111config Display a menu to access all possible config Allow to reconfigure using: - values from database - full interactive reconfig - partial interactive reconfig c111reconfig Usage: c111reconfig ReConfigure C111 with values FROM the DATABASE. c111setconfig Usage: c111setconfig ReConfigure C111 with values entered interactively c111tuneconfig Usage: c111tuneconfig Tune + ReConfigure C111 C111 with few new values; i.e. does not cover all parameters but only few which usually need tunning. The following parameters can be changed: - timeout : Timeout in ns - skip : Skip flag = ignored for GFD and MHIP - extinhfc : External inhibit(0) or Fast Clear Flag(1) - offset_x : X offset in ns - offset_y : Y offset in ns - half_res : Half resolution flag - fp_monitor: external signal on front pannel for monitoring - mux_sel : subselection for ASCI monitor c111stattimer Usage: c111stattimer Allows to disable or enable statistics timer with certain duration. Statistcs timer disabling/enabling+defining its duration is done among other things in the c111config (= setting config), but this macro can be convenient. It could also use DevC111SetConfig() D.S. command. Usage: c111stattimer <enable_disable> <duration> c111readreg Usage: c111readreg Read a register (usefull for debugging) Input: - base adddress reg. index: 0 = AMCC, 1/2 = 1st/2dn group of C111 regs - offs : offset to base c111writereg Usage: c111writereg Write a register (usefull for debugging) Input: - base adddress reg. index: 0 = AMCC, 1/2 = 1st/2dn group of C111 regs - offs : offset to base - value : register value c111pupon Usage: c111pupon Enable X pileup c111pupoff Usage: c111pupoff Disable both X and Y pileups c111setacqbank Usage: c111setacqbank Select bank to be used for acquisition. Acq. bank is already selected with c111config, but can be modified with this macro. Usage: c111setacqbank <bank_id> c111swapbanks Usage: c111swapbanks Swap banks c111initbank Usage: c111initbank Init bank that is currently selected for acquisition (= bank on port M). Usage: c111initbank <start_value> <increment_flag> c111initbanks_long Usage: c111initbanks_long Init BOTH banks (start with the one which is already on port M = selected for acquisition, then swap them and clear the other) Usage: c111initbanks_long <start_value> <increment_flag> c111initbanks Usage: c111initbanks Init BOTH banks. Similar to macro above, but this time more "compact" command ["DevC111InitBothBanks"] is used to make macro short. Usage: c111initbanks <start_value> <increment_flag> c111readbank Usage: c111readbank Read data from ONE bank. The limits for reading out are 0 and C111_NBCOLS-1 c111readbanks Usage: c111readbanks Read data from BOTH banks. The limits for reading out are 0 and C111_NBCOLS-1 c111sum1b Usage: c111sum1b Get sum of hits in a histogram(s) from the bank that is not selected for acquisition. Although this set of macros is for GFD use here general macro (good both for GFD and MHIT). c111sum2b Usage: c111sum2b Get sum of hits in a histogram(s) from both banks. Although this set of macros is for GFD use here general macro (good both for GFD and MHIT). c111data Usage: c111data Useful macro for X-check with c111sum1b/2b. This macro is summing up contents in C111_DATAn(n=0->3) for MHIT and C111_DATA for GFD. Although this set of macros is for MHIT use here general macro (good both for GFD and MHIT). Since ROI selected for display and readout can be smaller than whole 2D image area (2K*2K pixels for half-resolution 4K*4K pixels for full-resolution) the sum obtained with this macro can be smaller than sum obtained with c111sum1b/2b. Added in this macro = getting max value and col/row at max value. c111poweron Usage: c111poweron Powers ASIC C111 up c111poweroff Usage: c111poweroff Powers ASIC C111 down c111start Usage: c111start Starts the C111 if it is not running c111stop Usage: c111stop Stops the C111 if it is running. c111poll Usage: c111poll Poll to see when acq. over (only for time limited acq.) Usage: c111poll <refresh_period> <read_data_for_display> c111acq Usage: c111acq Make a finite-time acquisition. If pass only 1 parameter (= acq. time) then the C111 memory is always cleared before the acquisition, while if in addition the second parameter is passed the C111 memory is not cleared. Always (= independent of acq. time) both banks are used. If automatic file-saving was selected in c111config (C111_SAVE) the spectrum is saved in MCA-like file with the name: C111_FILE_PREFIX_C111_RUN_NUMBER. If saving in both MCA-like and file for PADI/JADI was selected in c111config(C111_SAVE_PADI), then in addition to MCA-like file the file for PADI/JADI is written. Its name is: C111_FILE_PREFIX_padi_C111_RUN_NUMBER. If data-saving selected what is pout in MCA-like file are ROI counter values (and not statistics = anode,x1,x2,rej.ev,ALU ovf) and other counters defined in config have no meaning, since they do not count during c111acq!!!. Usage: c111acq <acquisition_time> [<donotclearflag>] c111statacq Usage: c111statacq Make a finite-time acquisition to look at statistics Set statistics timer duration shorter than counting time. This time should be nonzero. If second argument is passed, then the both X+Y pileups are disabled (Y Pup is anyway all the time disabled in GFD 1D mode). Usage: c111statacq <statistics_timer_duration> <disablePileUps> c111savemenu Usage: c111savemenu Display a short menu with all saving options c111savesetup Usage: c111savesetup <save_in_scan> <save_in_ct> <save_in_private> [<save_in_padi>] Set saving options (for filename/directory use c111newfile) All options can be set to 0 (=no) or 1 (=yes) c111saverange Usage: c111saverange < [chmin] [chmax] > Set spectrum range which will be saved c111save Usage: c111save To save data when acquire outside counting and scanning(= when do c111acq dT) or when want to save data after counting (= after ct dT). Writes a header and data in a format that looks like in scan to be able to read file with standard tools. If the full filename is given as input parameter, then it is used, otherwise the filename is composed from C111_DATA_DIR, C111_FILE_PREFIX and C111_RUN_NUMBER. Since this macro is only called at the end of c111acq or after counting outside scan (in _c111_handlecounts) the test if (NPTS == _n1) was removed around the block defining HEADING. Usage: c111save <filename> c111save_padi Usage: c111save_padi Save data in a simple ASCII file (when acquire outside scan) Format in the file is such that the data can be then plotted with padi or jadi. If the full filename is given as input parameter, then it is used, otherwise the filename is composed from C111_DATA_DIR, C111_FILE_PREFIX and C111_RUN_NUMBER. Usage: c111save_padi <filename> c111on Usage: c111on Switch on C111 acq. during ct + scan By modifying user_prepcount + user_getcount rather than measure0 and measure1 the code below is good both for counting AND scanning. If would modify measure0/1 than c111on would swich on C111 acq. only during scan and not during normal counting. c111off Usage: c111off Switch off C111 acq. during ct + scan c111staton Usage: c111staton Enable statistics counters c111statoff Usage: c111statoff Disable statistics counters c111roishow Usage: c111roishow Macro to Show the ROI definitions. c111roi Usage: c111roi Macro to Add/Remove/Modify ROIs used to get integral count for each of them. ROI index goes from 1 to 8. c111roimenu Usage: c111roimenu Macro to Interactively Add/Remove/Modify ROI(s) to get integral of counts for channels within ROI. c111roiclear Usage: c111roiclear Macro to Clear the ROI counters. c111plot Usage: c111plot Macro that wraps _c111splotlin and which is to be used without parameters i.e. it creates a plot covering channels between C111_PLOTMIN and C111_PLOTMAX. So by default the plot is done with linear Y scale. c111tolin Usage: c111tolin Macro to set plot in linear Y-scale. c111tolog Usage: c111tolog Macro to set plot in logarithmic Y-scale. c111plotrange Usage: c111plotrange Macro that allows to change limit channels for plotting if new limits are passed as input parameters. c111splotrange <xmin> <xmax> If no parameters passed then C111_PLOTMIN = 0 and C111_PLOTMAX = C111_NBCOLS-1 | ||||||
Internal Macros: | ||||||
Usage: _c111varinit() Internal macro to declare global variables and initialise some. cdef("c111_user_presave","\n{}\n","c111") cdef("c111_user_postsave","\n{}\n","c111") cdef("c111_user_prescan_loop","\n{}\n","c111") cdef("c111_user_postscan_loop","\n{}\n","c111") _c111_cleanup Usage: _c111_cleanup Macro executed at cleanup(CTRL-C) N.B. On the request of P.Boesecke this macro is modified to avoid error: Cant import ID01/C111/01 when C111 is not used. Note that this is not a 100 percent protection since one can still have C111_ON left set to 1 and C111 not used. c111menu Usage: c111menu c111state Usage: c111state Get and show the state of C111 device For brevity did not name this macro c111getstate but c111state _c111_getconfig Usage: _c111_getconfig Get C111 configuration parameters (less than full status) _c111_getstatus Usage: _c111_getstatus () Read C111 status and update all global variables Return 1 on success, 0 otherwise c111range Usage: c111range _c111_checkrange Usage: _c111_checkrange c111arrays Usage: c111arrays Creates C111 data arrays (C111_DATA, C111_XDATA) _c111_show Usage: _c111_show() _c111_checkconfig Usage: _c111_checkconfig () Checks that the configuration corresponds to GFD 1D case (normal or test mode) _c111_resolchange Usage: _c111_resolchange (old_resolution, new_resolution) Scale properly the C111_PLOTMIN/MAX and min/max channels of any ROI pseudo-counters that might be defined since the resolution changed from half to full or vice-versa. Change min/max channels of any ROI pseudo-counters. This can happen in the following 3 macros: _c111_reconfig ... reconfiguring from database _c111_setconfig ... reconfiguring interactively _c111_tuneconfig ... reconfiguring interactively, but limited set _c111_reconfig Usage: _c111_reconfig _c111_setconfig Usage: _c111_setconfig _c111_tuneconfig Usage: _c111_tuneconfig _c111statistics Usage: _c111statistics Gives statistics information for C111 c111regs Usage: c111regs Read value of some C111 registers (usefull for debugging) _c111_power Usage: _c111_power(onoff) c111save_jadi Usage: c111save_jadi c111statclear Usage: c111statclear Clear all statistics counters (reset to 0) _c111_prepcount Usage: _c111_prepcount Done at each scan point before counting _c111_pollcounts Usage: _c111_pollcounts Done during counting when polling for end of counting with polling interval COUNTERSPOLLTIME (0.01sec) We DO NOT USE it _c111_getcounts Usage: _c111_getcounts Done at each scan point, after counting (i.e. chk_count = 0) and in scan also during counting if selected by setscans. C111 is stopped only when the counting is over (i.e. when chk_count = 0). _c111_handlecounts Usage: _c111_handlecounts Save data after counting. Since called only after counting and NOT after counting in scan test if (NPTS == _n1) was removed since makes no sense. _c111_scan_loop Usage: _c111_scan_loop Adds C111 data to scan file _c111_savemcaroi Usage: _c111_savemcaroi (filename) Save C111 ROI header in specfile _c111_savehead Usage: _c111_savehead Adds info on nb of channels read and elapsed time in scan header Since in C111 server(driver) do not measure the acq. time take the scan time per scan point. TODO: See if instead of COUNT_TIME could also use _ctime _c111_updaterois Usage: _c111_updaterois Update counters with roi values _c111roiset Usage: _c111roiset(cmne,cmin,cmax) Internal macro function to Setup(= Add or Modify) an ROI. _c111roishow Usage: _c111roishow () Internal macro function to show ROI(s) definitions. c111plotunit Usage: c111plotunit _c111splot Usage: _c111splot Internal macro to create plot and display 1D C111 spectrum using standard SPEC plotting with linear/log Y scale. - abscissa array = coloumns array = C111_XDATA - ordinate array = 1D C111 data = C111_DATA The range of C111 channels to be plotted is between minimum and maximum which are passed as parameters along with macro name: _c111splot <xmin> <xmax> c111splotrange Usage: c111splotrange c111plotmenu Usage: c111plotmenu c111forever Usage: c111forever c111getbank Usage: c111getbank c111invest Usage: c111invest savecntheader1 Usage: savecntheader1(file) savecounters1 Usage: savecounters1(file) _mo_loop1 Usage: _mo_loop1 savestdheader1 Usage: savestdheader1(file,flag,lastindex) | ||||||
|