EPD Vped Scans - 2019

This was not well documented in 2018, so we will document the process here.  A series of runs need to be taken with different values of the vped setting to find the setting that matches the values that are recorded with the CAMAC off.  This is very similar to the mapping check described at (drupal.star.bnl.gov/STAR/subsys/epd/operations-2018/pre-and-post-beam-commissioning)

1) Change the EPD configuration via:
ssh -A -Y you@rssh.rhic.bnl.gov
ssh -t -A -Y stargw.starp.bnl.gov
ssh evpops@daqman
cd /RTS/conf/epd
cp EPD_TUFFmap.txt EPD_TUFFmap_todaydate.txt
Then copy the zeros file:
cp /MappingPatterns2018/Zeros_02262018.txt EPD_TUFFmap.txt

To instantiate this change, click on physics at: https://dashboard1.star.bnl.gov/daq/EPD_UI/?EPD

2) Take a pedestal rhicclock clean for 1000 events only keeping trg and daq in as the systems.

3) Change to each of the vped patterns via:
cp VpedPatterns2018/Epd_vped*.txt EPD_TUFFmap.txt
Click Physics
Take a pedAsPhys for 1000 events.  Repeat for:
 vped -20
 vped -10
 vped 0
 vped +10
 vped +20

4) Turn off the EPD CAMAC crates.  Take a pedAsPhys for 1000 events.

5) Return the EPD to its proper status:
cp EPD_TUFFmap_todaydate.txt EPD_TUFFmap.txt
click physics
Take a pedestal rhicclock clean for 1000 events

6) Next analyze the data.  We can analyze the .dat files that are on the star gateway.  If you have signed out of rcf, you should:
ssh -A -Y you@rssh.rhic.bnl.gov
ssh -t -A -Y stargw.starp.bnl.gov
rterm -i
stardev
The code can be found at: drupal.star.bnl.gov/STAR/blog/rjreed/procedure-make-histograms-various-scans

7)In general:
./runepdhist XX YY ZZ
XX = day, YY = run (3 digits), ZZ = number of indices (10k events per index)
This script executes the EPDreader.C macro, which generates a set of histograms.  (For these runs, there will only be 1 index since all files have 1000 events in them.)

8) root4star -q -b 'map_EpdHistos.C("folder","epdhist.20XXYY.root")'
The mapping algorithm picks up the mapping from the db and saves that information in the titles of the histograms.
Note:  The mapping is important because we have set all the other files to record things via EW/PP/TT so in order to generate things properly we need to have this information.

9) Copy the histograms to where-ever you want to analyze them.    I do so on my laptop by scp them from the laptop using:
scp you@rftpexp.rhic.bnl.gov:path-to-files .

Edit AnalyzeVpedScan.C so that the file names are properly lined up with your files.  (There should be 6.)
root -q -b 'AnalyzeVpedScan.C("filenametag")'

This will generate several files.  First are the pdfs showing the pedestal placement (big size and small size).  For 2019, this can be found at:
big: drupal.star.bnl.gov/STAR/system/files/Compare_big_01282019.pdf
small:  drupal.star.bnl.gov/STAR/system/files/Compare_small_01282019.pdf


A graphical representation of the settings and a big and small size of the fit (only one posted here): drupal.star.bnl.gov/STAR/system/files/VpedScan_big_01282019.pdf

Most importantly, it produces the text file that can be used with the macro that generates the EPD_TuffMap.txt file to create a new version:
VpedOut_date.txt (for this year: drupal.star.bnl.gov/STAR/system/files/VpedOut_01282019.txt )

10) Run the macro that makes the file (drupal.star.bnl.gov/STAR/system/files/MakeVpedVbiasChange.txt)

11) Put this file into place via:
scp new_EPD_TUFFmap.txt you@rftpexp.rhic.bnl.gov:path-to-files .
ssh -A -Y you@rssh.rhic.bnl.gov
ssh -t -A -Y stargw.starp.bnl.gov
ssh evpops@daqman
cd /RTS/conf/epd
cp EPD_TUFFmap.txt EPD_TUFFmap_todaydate.txt
scp you@rftpexp.rhic.bnl.gov:new_EPD_TUFFmap.txt .
Then click physics.  You are done!

For this year:
20028028 - pedestal rhicclock clean w/zeros with trg/daq
20028029 - pedAsPhys - vped -20
20028030 - pedAsPhys - vped -10
20028031 - pedAsPhys - vped 0
20028032 - pedAsPhys - vped +10
20028033 - pedAsPhys - vped +20
20028034 - CAMAC off
20028035 - pedestal rhicclock clean to reset