HOWTO update EMCAL Objy DB from calibration ASCII files


Last modified: Thu Dec 20 16:58:04 CET 2001 Valid for emcDB version >= 0.9
Previous version of this document is here

This page will teach you how to use the emcDB program to write calibration data ASCII files into the PHENIX EMCAL Objectivity databases.

Disclaimer: the emcDB program is only a convenient tool to update/dump the EMCAL databases. It is not a bullet-proof program ! It can for sure be improved. If you have special requests, do not hesitate to contact me (aphecetc@in2p3.fr).

Reminder

So far, we have 18 EMCAL calibration databases, corresponding to 9 calibration data "flavours" (there are 2 DBs per flavour : one tag-DB and one data-DB). The database names are of the form : calib.emc.XYZ.pdb, where X is the data flavour :

Y is Tag (for Tag-DB) or Cal (for data-DB), and Z is a sequence number (0000 for the moment).

In the following, databases are referred to by the flavour name (e.g. Gains).

Using the emcDB program

Pre-run check-list

You must set the OO_FD_BOOT environment variable to the PHENIX Federation boot file :

setenv OO_FD_BOOT ${PHENIX_FD_BOOT}

Getting help on the emcDB program

You can get the syntax by doing:

> emcDB --help
emcDB 
      --dump [db full name] 
        Dump DB on screen. 

      --bankID [int] (use with --dump only) Specify a bankID to look for 

      --update [directory name] 
        Read all calibration data files in the directory 
        and write them into DB.

      --updatePbGlGains [top]                 
        Special case of above for PbGlGains,             
        where top is the top directory name,             
        where to find RunXXXX sub-directories, containing  
        normal calibration Gains directory           

      --forceDate "year,month,day,hour,minute,second" 
        used with --update : specify the start-of-validity 
        of all the data to be read from file and written 
        into DB.

      --insertAfter (with --dump only) "year,month,...."
      --insertBefore (with --dump only) "year,month...."
        used to select date interval of bank insertion date

      --startAfter (with --dump only)
      --startBefore (with --dump only)
      --endAfter (with --dump only)
      --endBefore (with --dump only)
        Like --insertAfter/Before, but select on Start and End
        Validity dates.

      --batch Non-interactive mode. Nothing asked to the user.

      --runtimes Make a file with relations Run Number<->TimeStamps.

      --help 
        This message.

      --version

Examples: 
  emcDB --dump calib.emc.Gains
  emcDB --update /afs/rhic/phenix/phnxemc/EMC/m_080701/ToF
        --forceDate "2001,08,01,12,45,00" 
 emcDB --help

Browsing what is in a given flavour database

Use the following syntax :

emcDB --dump calib.emc.[flavourName]
where flavourName is one of Gains, Pedestals, Pedestals5 (for the RunII pedestals), QAs, LCTofs, WalkTofs, TofT0s. Note that flavours are case-sensitive.

The above command is an interactive one, i.e. for each bank header, you'll be asked if you want to dump also the content of this bank (type 0 to continue, -1 to abort program, or any number n in between to see n channels). This can be quite painful for databases with a lot of banks. To overcome this difficulty, you can either use the --batch option to not be prompted for any answer, and/or restrict the set of bank you'd like to inspect, using the --(insert|start|end)(After|Before) and/or --bankID options, e.g.

emcDB --dump calib.emc.Gains --bankID 108 --insertAfter "2001,12,20,12,36,45"

which will show you only Gains banks for FEM 108, inserted into database after 2001, December, the 20th, at 12 h 36 m 45 s.

Putting calibration ASCII files into the Objy DB

The general syntax is :

emcDB --update directory

where directory is the path to the calibration data files. Please note that official ASCII calibration files are usually to be found somewhere under /afs/rhic/phenix/phnxemc.

The above command will read all calibration files to be found under directory and will put them into the relevant database. Special note on pedestals : depending on the number of pedestal-calibration files for one FEM (3 or 5), a different database will be filled (calib.emc.Pedestals or calib.emc.Pedestals5). It should be automatic.

31-Aug-2001 Due to a possible problem in PHTimeStamp::operator >> , please always use the --forceDate option (see below), as the timestamp specified in the ASCII files themselves is currently not properly read out.

Special note on ToF-related calibrations

The ToF directory usually contains 3 calibration flavours : the walk corrections, least-count, and t0-drift ones. If you'd like to update only one of them, here's the procedure to follow :

  1. Make a fresh somewhere/ToF directory
  2. Copy the relevant flavour you'd like to put in the DB, e.g. :
    cp /yourplace/ToF/*WALK* somewhere/ToF
    
  3. Then use emcDB as usual :
    emcDB --forceDate "year,month,day,hour,minute,second" 
          --update somewhere/ToF
    

Specifying the date : the --forceDate option

Usually, start-of-validity dates for the calibration data are fetch from the ASCII files themselves. If you want to override those, use the --forceDate option of the emcDB program. It takes a date string, in a format which is the one of the PHTimeStamp constructor :

> emcDB --forceDate "2001,08,01,12,45,00" 
  --update /afs/rhic/phenix/phnxemc/EMC/m_080701

Special note on PbGl gains for Run II

This is a little bit special case.

Many Gains files are split over many directories in e.g. /phenix/data24/vikonnik/Gains/RunXXXX, each of those directories being a normal top directory for calibration flavours, i.e. :

/phenix/data24/vikonnik/Gains/Run31250/Gains
                             /Run31250/QA
                             /Run33350/Gains
                             /Run33350/QA
...

The idea is to use each RunXXXX directory as a calibration set. For this, we need both start and end of validity period for each set (start=time stamp of first run of the set, end=time stamp of first run of the next set to avoid time-gaps).

So the first step is to get those time stamps. We do have a PHENIX Run Database, so we will use it for that purpose. We could have make it transparent, but a) some run used by PbGl are not in this database and hence the relationship runnumber<->time stamp can not be found using the Run DB and b) for testing purpose we'd like to be able to read PHENIX Run DB while writing Gains into a private Federation (and currently Objy is not able to open 2 Federations in one single process...). So we use an interim file.

cd some_dir
setenv OO_FD_BOOT $PHENIX_FD_BOOT
emcDB --runtimes

will produce a emc_runtimes_initfromfile.tmp.txt file, like :

36503,Sun Dec 16 15:10:53 2001,Sun Dec 16 15:11:22 2001
36504,Sun Dec 16 15:11:43 2001,Sun Dec 16 15:12:13 2001
36505,Sun Dec 16 15:12:34 2001,Sun Dec 16 15:13:02 2001
36506,Sun Dec 16 15:13:25 2001,Sun Dec 16 15:13:52 2001
36507,Sun Dec 16 15:14:14 2001,Sun Dec 16 15:14:42 2001
36508,Sun Dec 16 15:15:03 2001,Sun Dec 16 15:15:32 2001
36509,Sun Dec 16 15:15:59 2001,Sun Dec 16 15:16:26 2001

Then, using information contained in Viktor's files for the run missing in PHENIX Run DB, we completed this file to obtain a new one (emc_runtimes_initfromfile.tmp.txt), covering all the runs we need.

We then use the --updatePbGlGains option to actually read the Gains files and put them into the Gains database, into a given Federation (might be PHENIX_FD_BOOT...).

cd some_dir (same as before !)
setenv OO_FD_BOOT some_federation
emcDB --updatePbGlGains /phenix/data24/vikonnik/Gains

And that's it ! Please note that it might be a little long...


Laurent Aphecetche

Go Home