Modifying FMS voltages and gains (update)

Disclaimer: As of this date, the code is still 'in progress' and subject to change. Any information on bugs encountered, or additional features desired, are welcome.

Here is some first documentation for the code I have written for modifying FMS voltages and gains. Once the code's functionality has stabilised I will write up a PDF 'operational manual' for it.

Note: all the code and input files I refer to are currently located here:

/star/institutions/bnl/tpb/FMS/gains

There is a tar file called 'setFmsGains.tar' that contains all the required code and data files.

I have re-written the code so that it no longer runs via a ROOT macro, but as a standalone programme named 'setFmsGains'. There is a Makefile included that compiles the code successfully on my laptop and on RCF. Note that even though it is a standalone programme, it currently relies on some ROOT classes, so it can only be compiled on a system with access to ROOT. The code comprises a number of classes, so please see comments in the code if you need details of the actual implementation. It runs in three possible modes, which I will document further below:

  1. Calibration mode: this provides the automated calibration functionality I originally wrote and documented in my previous posts.
  2. Manual mode: this can be used to modify the gain and/or set the QT bit-shift and pedestal of a list of cells via a text file.
  3. Interactive mode: this can be used to lookup the current voltage and QT settings and modify them using commands.

The code requires a number of data tables to run. I don't currently hard-code a fixed location for the data, so they need to be in the directory from which you are running the code. All the following must be present:

  • qt1_tac.dat, qt2_tac.dat, qt3_tac.dat, qt4_tac.dat: QT settings, one for each of four crates.
  • largeCellGains.txt: voltage and gain of each large cell.
  • smallCellGains.txt: voltage and gain of each small cell.
  • leCroyMappingTable.txt: lookup table for LeCroy slots and channels.
  • large_gaincurve_par.txt: lookup table of ADC vs. voltage curve fit parameters for large cells.
  • small_gaincurve_par.txt: lookup table ADC vs. voltage curve fit parameters for small cells.
  • fmsCellInfoTable.txt: lookup table of various bits of information for each cell (channel, LeCroy, QT numbers etc).

The last four entries in the list are static lookup tables and are not modified when the code is run. The first three - the QT settings and the cell voltages/gains - are updated according to the user's input when the code is run. To help prevent loss of data therefore, all six of these files are backed-up whenever the code is run, regardless of mode. A duplicate is created with a timestamp prepended to the name before any changes are made. The format is as follows:

YYYYMMDD.HHMMSS.<original file name>

For example, if the programme was initialised at 08:43:31 on 19th January 2011, a copy of qt1_tac.dat would be created named 20110119.084331.qt1_tac.dat. These backups are made in the directory from which the code is run.

Whenever the code is run, files are generated to set the new voltage for each cell. For the small cells, a single file called 'setVoltages.txt' is produced. For the large cells, four files (one per LeCroy) are generated, called 'fms_hv_large_<direction>_<number>.sh', for direction = north and south and number = 1 and 2. Examples can be found in the code directory.

Calibration Mode

This functions as before, so please see my previous posts for information on what it does. To run in this mode, pass the argument -calibrate to setFmsGains. Unlike the other two modes, this must be run separately for small and large cells, so also pass the argument -small or -large to specify which. The calibration procedure tries to modify the gain as a function of eta to a flat value. I can implement other forms as they are requested. The file smallCellGains.txt or largeCellGains.txt is then overwritten with the new voltage/gain settings and the files for setting the voltages (either small or large) are generated.

Manual Mode

Instead of using the automated calibration procedure, the user can provide a file to modify the gain by a chosen amount, and/or set the QT bit shift and set the QT pedestal value. This is done by invoking setFmsGains with the argument -manual, followed by a file containing the desired settings, e.g.

setFmsGains -manual mySettings.txt

There is an example called 'manual.txt' in the code directory. The file should contain six values per line, with the following format:

  1. Detector number (1 = large north, 2 =large south, 3 = small north and 4 = small south cells).
  2. Row of the cell (from 0 to 23 for small cells and 0 to 33 for large).
  3. Column of the cell (from 0 to 11 for small cells and 0 to 16 for large).
  4. Multiplication factor by which to modify the gain.
  5. New QT bit shift to set.
  6. New QT pedestal to set.

In columns 4, 5 and 6 a value of -10000 can be used to indicate 'no change to current value'. Note that 4 and 5 are mutually exclusive: if the gain is changed the QT bit-shift should not be set and vice versa (because changing the gain may itself modify the QT bit-shift). As an example:

1 3 8 1.2 -10000 -10000
3 22 4 -10000 -1 10

Line one increases the gain of the large-north cell in row 3, column 8 by 20%, leaving pedestal unchanged. Line two sets the QT bit-shift and pedestal for small-north cell row 22 column 4 to -1 and 10 respectively.

Interactive Mode: setFmsGains can be run interactively by invoking it without arguments. In this mode the gain/voltage and QT tables can be searched by detector and channel or row/column, and values for individual cells can be set by hand. This is most useful for setting just one or two channels or for looking up current settings. As the functionality here is likely to fluctuate as the programme develops, I shan't document the commands here. Instead, the list of available commands in the interactive mode can be found by typing 'help'.