Procedures for Online - Offline Transfer of SMT Calibration Constants

1. Login to calib account on an Online node and cd to smt directory.

2. Get a list of good calibration runs. We need to check if the calibration runs were successful in collecting pedestals and gains. This can be done by logging in to smt_calib database account on the Online database and querying the content of the calibration runs.


       > setup oracle_client
       > sqlplus smt_calib@d0onprd1

         SQL*Plus: Release 8.0.5.0.0 - Production on Thu Mar 14 11:53:16 2002

         (c) Copyright 1998 Oracle Corporation.  All rights reserved.

         Enter password: 

       > select count(*) from pedestals where run_number = run_number 
         and pedestal != 0; (sqlplus requires ; to terminate a line.)

             COUNT(*)
           ----------
       no_of_channels
       >
       > select count(*) from gains where run_number = run_number 
         and gain!= 0;

             COUNT(*)
           ----------
       no_of_channels
       >
       > exit
If the number of channels is very small, There is no need to transfer the calibration run. Sometimes only pedestal data are taken. If only pedestal data were taken in a calibration run, one should transfer only pedestal data.

3. We need first to transfer data to the staging tables on the Offline Database.


       > setup onl_calDbTransfer
       > calDbTransfer.py SMT sendRun run_number  
         (if both pedestals and gains are transferred)
       or
       > calDbTransfer.py SMT sendRun run_number PED 
         (if only pedestals are transferred)
       or
       > calDbTransfer.py SMT sendRun run_number GAIN 
         (if only gains are transferred)
The program will ask the following questions:

       > RemoteDb: d0ofprd1
       > LocalDb: d0onprd1
       > Username: smt_calib
       > Password: 
There should be an output on the screen that looks like this:


<23813 03/06/2002 14:42:22 calDbTransfer.INFO> No Rows Found: Transfer Looks Good

############################################################
#                                                          #
#                 calDbTransfer Summary                    #
#----------------------------------------------------------#
Command: ['calDbTransfer.py', 'SMT', 'sendRun', '143940', 'PED']
#----------------------------------------------------------#
#                                                          #
#               Verified Transfer looks Good               #
#                                                          #
############################################################
done with verifySend
           <23813 03/06/2002 14:42:22 DbCore.commit> 

4. Next we need to build a tree of calibration constants on the SMT Offline database. You can do this from the d0 online cluster.


       > setup d0_config -q prd
       > setup smt_calib_db_client
First we move data from the staging tables to the final tables.

       > smtMoveStaged.py SmtDbServer_oracle.user_prd run_number
We then build a collection of calibration constants using the new data and the existing data.

       > smtBuildcollections.py SmtDbServer_oracle.user_prd run_number

5. SMT database is now up to date. We need to tell these new calibration sets to the top level database.


       > setup d0_calib_db_client
We query SMT calibration sets on both the SMT and the top level databases and insert the sets that exist on the SMT database but not on the top level into the update table of the top level database.

       > insert_smt_updates.py

       > Password for smt_calib@d0ofprd1: 
       > Connected to d0ofprd1 as smt_calib
       > Password for offline_calibrationd0ofprd1:                
       > Connected to d0ofprd1 as offline_calibration
We then add branches to the top level tree based on the entries in the update table and the existing tree.

       > update_calibrations.py

         <<<< update_calibrations log:  Thu Mar 14 11:38:36 2002  >>>>

         Enter password for offline_calibration on d0ofprd1:
 

Last modified by Taka Yasuda on: 2003/12/12 15:19:20