gecal1 - Tcl/Tk script help

please note: this file was generate by make_tcl from the file: gecal1.hlp. Please update that file and regenerate the gecal1.html. Do not update the gecal1.html file directly!


This Tcl/Tk script is meant for the energy calibration of the GAMMASPHERE germanium detector array - both before a run and during a run. The script is called up by clicking on the gecal button in the CALibration menu from the main openwindows menu in the gs account. The script will have a cmdtool window attached to it and will operate from the gs/cal directory. A list of event filter formatters (EFFs) and germaniums for the calibrations can be specified so that a selected calibration can be done. In addition, the script has tools for 'get' and 'put' of the calibration coefficients in the EFFs. The script also allows for the retrieval of germanium spectra accumulated in the EFFs. A simple 2 line calibration of the germanium detectors can be done as well as a more advanced multi-line calibration. Doppler corrections on the calibration parameters can be imposed so as to line peaks up during runs where thin targets are used. Specific gain and offset parameters can be deposited and, finally, the script allows for an online gain correction during a run . BE SURE TO HAVE THE GE CALIBRATION SWITCHED ON IN THE MAIN DAQ EPICS WINDOW BEFORE USING THIS SCRIPT.


A list of event filter formatters and germanium detectors can be specified using the 'sunken' windows at the top of the script. This allows for a selected calibration of detectors, thus, 'bad' detectors can be avoided. The format is the usual Bob Belshe format. For example, to specify all germanium detectors from 1 to 30 except detectors 2, 13, 14, 15 and 21 use the following string: '1,3-12,16-20,22-30. The same rule applies to the event filter formatters - although mostly this string would just be '1-6'. All 'sunken window' parameters in this script are stored in a file that is read when the script is invoked (via the openwin menus). All the current parameters in the script are stored in this default file when the 'save par' button is pushed.


The current selection of germaniums are save in a special file as 'the master set of detectors' when the 'sav master set' button is pushed. The 'restore master set' will restore this set again. These buttons allows the user to maintain a complete list of all enabled germanium detectors - independt of the 'save par' option (which saves all parameters of the script).


To store the current calibration parameters, select a filename and push the 'get cal par' button. ALL the 110 offsets and gains are retrieved from the EFFs and stored in the file (not just the selected ones). Thus, the germanium selection in the top of the script is NOT used in this operation. Note: the calibration parameters are actually retrieved from the LAST selected EFF. Likewise, the values in the stored calibration file can be deposited in the selected EFFs by specifying the filename and pushing the 'put cal par' button. As for the save operation, ALL detectors (not just the selected ones) will have their calibration parameters set to what is specified in the file. The 'type' utility types the cal file specified in the sunken window and the 'ls cal files' will make a list of all the .cal files in the calibration directory. There are separate entries for the high resolution and side channel calibrations. During the save operations, the calibration files used in the bump-less restart are updated (so two files are actually saved). Hence, when the EFF processors are rebooted they will restore the correct/current gain calibration parameters.


This script allows the user to retrieve various EFF spectra accumulated in the event filter formatters. Specify the output file in the sunken windows. The recovered spectra are stored as individual Radford-format spe files with file names expanded to contain the detector number. E.g., if the filename is specified as "x" then the files will be called x_001.spe, x_002.spe,... etc. Only the spectra selected in the germanium selection are downloaded and the spectra from the selected EFFs are added together. Some cmd files: 'x1.cmd', 'x2.cmd' and 'ref.cmd' are also generated for easy display in Radfords fg2 (for example, use command 'cf x1' in this display program). The command files will show: all spectra overlayed, one at a time and compared to reference spectra, respectively. A hit pattern spectrum is also generated. By pushing the 'CLEAR ALL EFF SPECTRA' the spectra in the EFFs are cleared.


When the "peak to total" button is pushed, the peak to totals for the germaniums specified at the top of the script are found. The lower limit for the total count integration (in real data value) is specified to the right of the button. The utility will locate the two stronges peaks in the spectra and use a statistical approach to define the peak region. It will then find the area of the peaks with (linear) background subtraction. The total area is taken to be the sum of counts from the cut value to the end of the spectrum. The utility will in find the resolution of the peaks as well, and also the skewness of the peaks are determined. A large skewness usually signifies neutron damage. The final tables generated by this program are written to a file called "pt.log". This file is typed in the in this script so the information is in the tcl output window. The file can also be printed manually.


A specific COMMON set of offset and gain parameters can be specified by typing the desired values in the sunken 'gain' and 'offset' windows and pushing the red 'deposit above gains and offsets' button. NOTE: only the germaniums that are selected are affected by this operation. Likewise, only the selected EFFs are accessed in this operation.


'auto 207-Bi' is a two line calibration function. The two-line calibration routine is designed to give the first level energy calibration of the enabled detectors, e.g., using a simple two line source like 207Bi. The routine will take into account the current calibration coefficients, so there is no need to set the offset and gains to any particular values before executing the this procedure. The calibration files used in the bumpless restart are also updated . Hence, when the EFF processors are rebooted they will restore to the new gain calibration parameters.


The germanium online task will allow the germanium detectors to be re-calibrated (gain and drift adjusted) while the data acquisition is going on. There is no need to stop the acquisition to do this task unless you want a run header on the data tape as a marker. The task will use the spectra kept in the event filter formatters (EFF) and compare them to reference spectra stored at the beginning of the run (see below). If the task finds that the current gains kept in the EFF's must be changed (there are thressholds) to make the spectra in the EFFs match the stored reference spectra, the gain and offset parameters are reloaded to the selected EFFs and the EFF spectra are zapped. For the online calibration during the run (drift correction, see separate help entry), a set of reference spectra are needed. The spectra that are currently in the event filter formatters will be fetched and stored as these reference spectra by pushing the '*INITIALIZE* dmp ref spectra' button. This should be done after the array has been calibrated using sources (and after a Doppler correction, if applicable) and after a 'reasonable' amount of reaction data has been accumulated. The reference spectra are the spectra that the online gain drift routine will adjust gains and offsets to reproduce during the run! The routine performs a grid search in both offset and gain. The spectra in the EFFs and the reference spectra are stripped of their smooth backgrounds and, for each offset and gain in the grid, the reference spectrum and the (trial) calibrated EFF spectrum are multiplied to give a figure of merit value. The figure of merit is defined as the sum of each multiplied channel contents. Thus, each trial offset and gain set in the grid will have a figure of merit value a attached to it. The set with the highest figure of merit will be the best (new) gain and offset parameters. Only when both the reference spectrum and gain adjusted EFF spectrum are lined up perfectly will the figure of merit value be at maximum. The Tcl/TK script have 'sunken window' entries for the number of points in the grid, typically 20. I.e, 20*20=400 offset and gain pairs are tried in such a case. The center of the grid is the old gain and offset that was present in the EFFs at the time the on-line calibration was started. When an offset range of, e.g., 2.0 is specified it means that the trial offset will be from (cur_offset)-1.0 to (cur_offset)+1.0, where (cur_offset) is the current offset. Likewise the gain range is specified, a typical value being 0.002. A value of 0.002 means a search range of 2 channels around channel 1000. To speed up the grid search, only a selected range of the EFF spectrum is used to calculate the figure of merit values. This range is specified in the sunken windows to the left of the 'drift correction' activation button. A typical range might be from channel 800 to channel 5000 (in the raw data stream). Select a reasonable wide region with strong peaks and avoid higher channels wit Only the germaniums specified in the top of the script are calibrated. The EFF spectra in the enabled EFF selection are added up to one spectrum to get as much statistics as possible. Off-line tests on a sparc-20 with the 'typical' parameter values mentioned above (and a sorting program running in the background) showed that it takes about 15 seconds per detector to do this drift correction. You may want to do this drift correction on a workstation with a good floating point performance since the grid search is quite cpu intensive. For each detector, the routine will list: the change in parameter (gain and offset), the percent change for the gain and channel change for the offset and the position of the new calibration parameters in the grid. For example, if the new offset is very close to the lower edge of the offset range in the grid, the latter value will be close to -100% (+100% if it was at the high end of the grid). It is important to inspect the new gain and offset values and make sure they are well inside the search grid. Otherwise the online drift correction routine will only partially correct for the drift. On the other hand, you will want to keep the grid as small as possible in order not to introduce 'noise' stemming from a too coarse grid. The calibration files used in the bumpless restart are also updated. Hence, when the EFF processors are rebooted they will restore to the new gain calibration parameters.