Slew Corrections for the EPD

Some Documentation:
A helpful email from Jack is: drupal.star.bnl.gov/STAR/system/files/JackMailSlew.txt
The tac offset Readme is: drupal.star.bnl.gov/STAR/system/files/README.SettingTacOffsets.txt
The slew correction Readme is: drupal.star.bnl.gov/STAR/system/files/README.GenerateSlewTables.txt
An example tac offset file: drupal.star.bnl.gov/STAR/system/files/eq1_tac.txt
An example slew coffection file: drupal.star.bnl.gov/STAR/system/files/eq1_slew_corr.txt
Instructions from 2018: drupal.star.bnl.gov/STAR/system/files/Trigger_Tier1_aux_files.pdf
EPD Trigger Scheme (Run 19): drupal.star.bnl.gov/STAR/system/files/epd_run19_L0standard_v2.pdf
Ring Group Arrangements: drupal.star.bnl.gov/STAR/system/files/EPDRingGroup.pdf

Introduction

There is a relationship between TAC and ADC that needs to be corrected so that signals with a large ADC value are not assumed to be earlier than signals with a low ADC value.  Additionally, there are channel-to-channel variations that mean some channels will be given more weight than others.  This can be corrected through slew corrections, either offline or on the QT board.  The latter is important if we wish to have an EPD based trigger.

I address some of these concerns when I determined the spatial resolution of the EPD:

drupal.star.bnl.gov/STAR/blog/rjreed/epd-vertex-resolution

It should be noted that the above study was done with the 200 GeV Isobar runs, the beam is a bit different for 27 GeV which is what I will focus on here.

Order of operations:
QT LUT (TAC Offset/ADC Pedestal Subtraction)
Slew Corrections
QT Channel Masks

First Step:
You need to be able to log into the startrg machine as staruser.   (You also need to be able to log in as trg as well.)  If you do not have permission, follow the instructions at:
www.star.bnl.gov/starkeyw

Logging In:
ssh -A -Y you@rssh.rhic.bnl.gov
ssh -t -A -Y stargw.starp.bnl.gov
ssh trg@startrg.starp.bnl.gov

You can see the current files at: /home/startrg/trg/cal/qt

File details
Files are called <crate>_slew_corr.txt, so for the epd we have 3 different slew correction files, one for each of our crates.  In each file, you can use "#" to comment things, it is good to label the different boards by their names such as "#EP017" etc. 

The boards are then listed as 0xYY where YY is top two hex digits of board address (0x19, 0x1C, etc).  All numbers are separated by tabs.

The channels go from 0-31; but only TAC channels are valid (4,5,6,7,12,13,14,15,20,21,22,23,28,29,30,31).  So each line first has the board address and then the channel number. 

The next number is the NumBins must be exactly equal to the number of ADC Bins implemented in the QT VHDL --> This is always 8.

The next number (BinOrOffset) is either 0 or 1, where it is 0 for a Bin Limit row, 1 for an Offset row.

For the Bin Limit Rows this lists the ADC values that are used as the different breaks for the TAC correction.  There can be only 8 numbers, and the last one must be 4095.  They must be the same for each channel.  An example is:

0x19    4    8    0    75    100    125    150    175    200    500    4095

For Offsets, the next 8 numbers are the correction factor that is applied to the TAC value.  A positive value is added, a negative number is subtracted.  ***NOTE: THE MAXIMUM VALUES ARE -255 and 255***!!  An example would be:

0x19    4    8    1    255    101    -95    -226    -255    -255    -255    -255
0x19    5    8    1    255    -33    -221    -255    -255    -255    -255    -255
0x19    6    8    1    255    65    -108    -236    -255    -255    -255    -255

Unfortunately, this means that the range can't be adjusted by that much....  The first bin should always be put to the max of 255, strategy-wise.  It may be that my bin choices aren't sufficiently good, this is something that can be studied.

So one would have sets of lines that look like:

0x19    4    8    0    75    100    125    150    175    200    500    4095   
0x19    4    8    1    255    101    -95    -226    -255    -255    -255    -255   
0x19    5    8    0    75    100    125    150    175    200    500    4095   
0x19    5    8    1    255    -33    -221    -255    -255    -255    -255    -255   
0x19    6    8    0    75    100    125    150    175    200    500    4095   
0x19    6    8    1    255    65    -108    -236    -255    -255    -255    -255   
0x19    7    8    0    75    100    125    150    175    200    500    4095   
0x19    7    8    1    255    112    -79    -211    -255    -255    -255    -255