3) Uploading Pedestal/Status Tables to the Database

Once the ped/stat tables have been QAed satisfactorily, the values need to be uploaded to the database. 

First, the files in /db/bemc/ need to be moved to RCF, where the upload will take place.  This can be done with the following commands:

ssh-agent > agent.sh
source agent.sh
ssh-add
ssh -X -A aohlson@rssh.rhic.bnl.gov % using your own username
rterm -i
mkdir bemcUpload2013 % make a directory to work in
mkdir bemcUpload2013/tables
cd bemcUpload2013/tables/
scp onlmon@onl05.starp.bnl.gov:'/ldaphome/onlmon/emcstatus2013/pp500/db/bemc/*.txt' ./
cd ../


The scripts bemcPedTxtUpload.C and bemcStatTxtUpload.C are used to perform the upload.  They take as input the name of a file which contains a list of the files to be uploaded.  To create the file lists:


% in bemcUpload2013/
mkdir lists
cd tables
ls bemcStatus*.txt > ../lists/bemcStatus.list
ls bemcPed*.txt > ../lists/bemcPed.list
cd ../

Once the file lists have been created, the scripts can be run with:

stardev
setenv DB_ACCESS_MODE write
root4star bemcStatTxtUpload.C
root4star bemcPedTxtUpload.C

 

Important!
1) The upload scripts (bemc*TxtUpload.C) contain return statements to prevent accidental uploads.  Make sure everything is working properly by running the scripts with the return statements included (nothing will be uploaded to the db) first.  When you are sure that you're ready to upload, then comment out the return statements.  After uploading, don't forget to uncomment the return statements! 
2) Try uploading one table first, and then check that it is uploaded correctly (see below), before uploading all the tables for the whole run.  If a table is uploaded wrongly, it can be disactivated by the software team, but this is not something we want to do often.  (In the case of a single table, it may be more efficient to just upload the correct table with a timestamp one second after the incorrect table.)
3) Reminder: this is not a task many people should need to do but should be limited to one or two "experts", who will be given special DB writing priviledges by Dmitry Arkhipkin (arkhipkin@bnl.gov).  


Uploaded tables can be viewed with the online BEMC DB browser.  I find it helpful to spot-check some tables to make sure they have been uploaded correctly.  I find a table with the browser, copy it into an text file, and compare it to the text file I uploaded (in tables/).  For the status tables, this can be done with a simple diff command.  For the pedestal tables, the script checkPeds.C can be used. 

At the beginning of the run (after physics has been declared, L2 is running, etc), it is good to generate a set of ped/stat tables and upload them to the database one second after the initialized values (for example, at 20131220.000001).  (Reminder: The procedure for initializing the timeline with ideal values can be found here.)  This can be done with the bemc*TxtUpload.C scripts; you will see a commented-out line that shows how to set the timestamp manually.  It is good to do this periodically throughout the run, especially if something changes with the detector or beam configuration, so that FastOffline reconstruction can pick up decent DB values.  Each time, the tables should be uploaded one second after the previous tables, so that when we upload the fully-QAed tables at the end of the run, the temporary ones will no longer be picked up.