How to do bias voltage scans for the EPD

 I have tried to make this as clear as possible; if there are errors or confusing points, please let me know!


Taking the runs

You should be doing this bias voltage scan after physics has been declared (so the run configuration will be "production") and you will be running "in the background", not taking runs specifically for this scan.

1) Log in to daqman. If you don't have gateway access or are having issues logging on, see
here.
  • $ ssh -A you@rssh.rhic.bnl.gov
  • $ ssh stargw.starp.bnl.gov
  • $ ssh -A -X -t evpops@daqman
2) Back up the current mapping file (the file named "EPD_TUFFmap.txt" in /RTS/conf/epd/ determines the EPD's voltage settings)
  • $ cd /RTS/conf/epd/
  • $ cp EPD_TUFFmap.txt EPD_TUFFmap_(DDMMYYYY).txt
    • e.g. $ cp EPD_TUFFmap.txt EPD_TUFFmap_12Dec2019.txt
3) As soon as the current run has finished, load and set the appropriate bias voltages, starting with 54 V and ending with 63 V
  • e.g. $ cp VbiasScan/Vbias54.txt EPD_TUFFmap.txt
  • In the EPD GUI, click "PHYSICS" on the top bar, then "PHYSICS" in the upper-left-hand box; wait for the yellow circle in "SC State" to finish its loop and turn green.
4) When the next run has started, make a note in the shift log, specifying what you did (e.g. "Vbias set to XX V for all channels for EPD Vbias scan")
5) If the run finished with ~100k events or more, move on to the next voltage; else, wait for a run with enough events to finish.
6) Repeat steps 3-5 until all ten runs have finished. 
7) Set the voltages back to their original values
  • $ cp EPD_TUFFmap_(DDMMMYYYY).txt EPD_TUFFmap.txt
  • In the EPD GUI, click "PHYSICS" on the top bar, then "PHYSICS" in the upper-left-hand box; wait for the yellow circle in "SC State" to finish its loop and turn green.
8) Make a note in the shift log, specifying what you did (e.g. "Vbias set back to original values for all channels. EPD Vbias scan complete.")

Making mapped histogram files



1) Get on the gateway and copy over the things you need.
  • $ ssh -A -Y you@rssh.rhic.bnl.gov
  • $ ssh -t -A -Y stargw.starp.bnl.gov
  • $ rterm -i
  • $ cp -r /ldaphome/adams92/VbiasScan_Master/ VbiasScan_(DDMMMYYY)/
  • $ cd VbiasScan_(DDMMMYYY)
  • $ chmod +x runepdhist.sh
  • $ stardev
  • $ cons
ln the following, W is the run "year", Y is the day, and Z is the run number (e.g. 20344029: W = 20, X = 344, Y = 029)
For each run in the Vbias scan:
2) Find the largest number output with 
$ ls /trg/data/trgdata/runWXY.*.dat 
or be lazy with 
$ ls /trg/data/trgdata/runWXY.*.dat | awk -F '.' '{print $2}' | awk -v max=0 '{if($1>max){max=$1}}END{print max}'
This number is Z below. To save time, do Z = (Z > 10)?10:Z.
3) ./runepdhist X Y Z
X = day (3 digits), Y = run (3 digits), Z = number of indices ( >= 1 digit) (10k events per index)
This creates a folder with name WX
4) hadd /WX/epdhist.WXY* epdhist.WXY.root
5) In map_EpdHistos.C, change "dbMk->SetDateTime(...)" so that the first argument is the date of the run.
6) root4star -q -b 'map_EpdHistos.C("epdhist.WXY.root")'

Finding and setting the new bias voltages

1) Take BiasScan.C and the mapped histogram files (and MakeNewTuffFile.C, which you'll need soon anyways) from the gateway to your computer.
  • In the same directory as above:
    • $ scp BiasScan.C you@rftpexp.rhic.bnl.gov:
    • $ scp mapped* you@rftpexp.rhic.bnl.gov:
    • $ scp MakeNewTuffFile.C
  • In a new terminal:
    • $ scp you@rftpexp.rhic.bnl.gov:BiasScan.C .
    • $ scp you@rftpexp.rhic.bnl.gov:mapped* .
    • $ scp you@rftpexp.rhic.bnl.gov:MakeNewTuffFile.C .
2) Edit the beginning (lines 56 to 65) of BiasScan.C to run over your files. Also, I changed line 105
        Relevant[crate-1][slot][chan] = kFalse; ---> Relevant[crate-1][slot][chan] = kTRUE;
so that the code is impervious to mapping changes (although this does double the number of pages in the already-huge document). Change this back if you don't like it, and deal with the mapping changes yourself!
3) Decide what the target ADCs are for the QT32Bs and Cs. These are your arguments to BiasScan.C and may change from year to year.
4) Generate the relevant plots
  • $ root 'BiasScan.C(TargetQt32B, TargetQt32C)'
  • This outputs "BiasScan.pdf" which is a huge file broken up into different sections. They are:
    1. Each page shows, for a single tile, the ADC distribution over all bias voltages used in the scan along with the Landau fit. These pages make up the majority of the document.
    2. Each page shows, for all channels in a slot, the Landau fit's MPV as a function of bias voltage.
    3. Each page shows, for all channels in a slot, the Landau fit's Width/MPV as a function of bias voltage. This should roughly flat.
    4. The distribution of Landau fit MPVs for QT32Bs and Cs, for different bias voltages.
    5. The same as section 2, but this time with a horizontal line drawn at TargetQt32B or TargetQt32C (the arguments of BiasScan.C) and a vertical line drawn through the intersection of the horizontal line and the point-to-point linear fit of the markers. This vertical line's position is the bias voltage that should be applied to that channel in order to enforce the ADC distribution Landau fit's MPV to be at the desired value. Also, these pages are organized by supersector position instead of by slot number as in section 2.
    6. The distribution of bias voltages.
5) Edit the output file "Vbias.txt" and put it in a TUFF-readable format
  • From left to right, the rows are East-West (0 = East, 1 = West), supersector position, tile, and new bias voltage. A number of entries in the right-most column will show: "-999   PROBLEM - NONMONOTONIC behaviour.  Human intervention needed". Some may show "63   Warning.  Bias set to highest measured value.  Larger value would be needed". Find the relevant tile in section 5 (see above) of BiasScan.pdf.
    • Almost always, the "NONMONOTONIC behaviour" problems come from a fit that didn't converge for some reason. You could re-take a run with that bias voltage or run "BiasScan.C" excluding that file, but that's overkill. Eyeballing the correct intersection point (and entering that value in the right-most column) is perfectly fine.
    • If you're lucky (which is likely), if you have "Larger value would be needed", the horizontal line will be close to the last point and you can eyeball the value (and enter it into the right-most column); otherwise you should take another run with a higher bias voltage.
    • If you want to look at the ADC distributions, it will be useful to know the mapping (since the plots in section 1 are arranged by crate and slot). Find the (hopefully up-to-date) version here.
  • $ mv Vbias.txt VbiasFixedUpByHand.txt
  • $ root MakeNewTuffFile.C
6) Set the new voltages!
  • $ scp VbiasFixedUpByHand.txt you@rftpexp.rhic.bnl.gov:
  • $ ssh -A you@rssh.rhic.bnl.gov
  • $ ssh -t -A -Y stargw.starp.bnl.gov
  • $ ssh -t evpops@daqman
  • $ cd /RTS/conf/epd/
  • $ cp EPD_TUFFmap.txt EPD_TUFFmap_BeforeChangingToNewVbiases_(DDMMMYYYY).txt
  • $ scp you@rftpexp.rhic.bnl.gov:VbiasFixedUpByHand.txt EPD_TUFFmap.txt
  • In the EPD GUI, click "PHYSICS" on the top bar, then "PHYSICS" in the upper-left-hand box; wait for the yellow circle in "SC State" to finish its loop and turn green.

Congrats, you're all done with EPD calibrations!