Prerequisites

This guide assumes that a baseline run has already been taken and that the resulting file is accessible from one of the clonpc computers in the counting house.

Generating Thresholds File

Begin by logging into clonpc*.  Once that's done, the environment needed to run the SVT quality assurance (QA) code can be setup as follows:

source ~omoreno/setup_qa.csh

This adds the QA executables to your PATH.  The thresholds file can be generated as follows:

cd /local/work/dir
svt_qa -i <EVIO_baseline_file> -e -t <threshold level>

Here the '-e' flag denotes that the input file format is EVIO while the '-t' allows a user to set the threshold level in units of RMS noise. Typically, this will be set to 3. 

The application will take approximately 2 minutes to run and will dump an XML file containing a threshold value for every channel. 

A ROOT file (calibration_results.root) containing histograms of the mean baseline and noise for every hybrid will also be written out.  This file should be used to quickly evaluate if all channels are behaving as expected.

Loading Thresholds to SVT DAQ

In order to "load" the thresholds, the XML file generated in the previous step needs to be copied to the SVT DAQ thresholds directory following the naming convention specified below

cp test.xml /usr/clas12/release/1.3.0/slac_svt/svtdaq/daq/thresholds/YYYYMMDD_<run_number>_thresholds_<level>rms.xml

where YYYYMMDD is the date the file was created (e.g. 20160408), the <run number> indicates the run that was used to create the file and <level> is the threshold level in units of RMS noise. 

Next, a new threshold config file for CODA needs to be created in the directory

/usr/clas12/release/1.3.0/parms/dpm/dpm-3sam-<level>rms-<run_number>.trg

and a link to the new thresholds file needs to be added to it.  This can be done by addding the following to the file:

DPM_CRATE all
DPM_THR_CONFIG_FILE /usr/clas12/release/1.3.0/slac_svt/svtdaq/daq/thresholds/YYMMDD_<run_number>_thresholds_<level>rms.xml
DPM_CRATE end
The easiest (and fastest) way to do this is to copy one of the old config files and making the appropriate changes (e.g. change the run number, threshold file).

Finally, ALL of the HPS trigger configuration files need to be updated to use the new threshold config file.  Those files are located in the directory

/usr/clas12/release/1.3.0/parms/trigger/HPS/Run2016/

The line to edit is most likely the last line, and it is under "SVT stuff." Edit the line

include dpm/dpm-3sam-3rms-<run_number>.trg
Before making any changes to any of the HPS trigger files, you should consult with one of the JLab DAQ experts to find out which one is currently being used.