How to Add Constants

From GlueXWiki
Revision as of 22:35, 27 July 2014 by Sdobbs (Talk | contribs) (Adding Constants)

Jump to: navigation, search

General Issues

The calibration constant database used by GlueX is the CCDB software package. The CCDB provides a feature-rich package for managing calibration constants, with a rich support for history under the philosophy that constants and tables should always be added but never deleted. Two different database backends are supported. The master database is stored in a MySQL database, which is accessible both inside and outside JLab. Standalone SQLite files are also supported for a variety of uses, including testing and running on batch farms. Directions for managing SQLite files can be found here.

To run the CCDB program with a standalone SQLite DB, the CCDB_CONNECTION environmental variable should be set like this: (Note: csh syntax is used in this page)

setenv CCDB_CONNECTION sqlite:////path/to/sqlite.ccdb

To connect to the main MySQL database, set CCDB_CONNECTION like:

setenv CCDB_CONNECTION mysql://ccdb_user@hallddb.jlab.org/ccdb

The creation of database tables is the beyond the scope of this page. For now, the best documentation is the excellent online help, which can be seen with the command "ccdb help mktbl". Please exercise caution since by design CCDB tables should not be deleted, and make such changes in consultation with the Calibration and Software Coordinators.

Adding Constants

Constants tables are stored in a directory-like hierarchy, which can be inspected using the command "ccdb ls". CCDB tables consist of multiple rows and columns. Information about the definition of a particular table can be found using the command "ccdb info", for example, "ccdb info /FCAL/gains".

New versions of constants are added to the CCDB through the use of text files, which have one line per table row and as many values in the line as table columns. For example, a constants file corresponding to a table with 3 columns and two rows is:

0.9  0.8  0.7
0.7  0.8  0.6

An example of adding a new version of constants to the table "/FCAL/gains" where the new constants are stored in the file "new_gains_file" is:

ccdb add /FCAL/gains new_gains_file

The CCDB powerful options for storing multiple versions of constants, but an important example is that sometimes different version of constants are used for Monte Carlo simulations than real data. An example of storing a version of constants for use in Monte Carlo simulation is

ccdb add /FCAL/gains::mc new_gains_file

For more complicated usages, please see the CCDB documentation.

Digi-level Constants