Pi0 RunDatabase

From Hall A Wiki
Revision as of 21:16, 13 April 2008 by 129.57.164.43 (Talk)

Jump to: navigation, search

The Pi0 Run Database (e04007) MySQL server is currently (online) run on adaqh1. It is automatically generated but can easily be reconstructed with the available scripts that can be run from any adaq machine.

This page is meant to be for documentation for what is available, and not as a HOWTO.

Available Tables

  • RunInfo
    • Generated at the beginning of the run
  • scalerinfo
    • Generated at the end of the run using scaler information from the "End of Run" HALOG entries
  • AnalysisInfo
    • First entry automatically generated at the start of the run.
    • Further information is filled in by those doing the analysis (online and offline)

General Database Structure

The RunInfo table is intended to be a static table, whose entries are constant and fixed. Only on rare occasions of data corruption/mishandling, should its elements be modified. For this reason, the RunNumber column has been set as the primary key. Thus... there may be only one entry for each RunNumber.

Other tables, related to e04007, are considered to be derived from the RunInfo table. They are connected through the RunNumber using Foreign Keys. This means that an entry for a given run in a derived table MUST have a corresponding entry in the RunInfo table.

Each derived table has its Key set to auto-increment. This provides us with the ability to save the history of changes made to the table. To grab the most recent entry, order by the key in descending order and pick the first entry. For example, to grab the most recent entry from the AnalysisInfo table for runnumber 3918:

SELECT * FROM AnalysisInfo WHERE RunInfo.RunNumber=3918 ORDER BY anaID DESC LIMIT 1

Scripts

These are the scripts that generate the database and fill the tables. All are located here:

~a-onl/scripts/mysql
  • addRun2runlist.pl
    • Main script for adding entries to the RunInfo table
  • ~a-onl/bbite/scripts/grabRunInfo.pl
    • Main script for adding entries to the scalerinfo table
  • setAnalysisInfo.pl
    • Main script for adding entries to the AnalysisInfo table
Usage:
      setAnalysisInfo.pl [OPTION]
----
Command-line options:
  -r, --runnum [LOW NUMBER]-[HIGH NUMBER]
      Specify the range of runnumbers to modify.  One number will work
      for single run modifications.
----
  -u, --username [USERNAME]
      Specify the name of the person making the modification
----
  -k, --kinematic [KINEMATIC]
      Specify the kinematic name.
----
  -p, --production [0,1]
      Specify if the run is production (1) or not (0)
----
  -c, --comment "[COMMENT]"
      Add a comment.  For best results, put the entire comment in 
      quotation marks.
----
  -v, --verbose
      Be verbose.

Table Descriptions

RunInfo

+----------------+-------------+------+-----+-------------------+-------+
| Field          | Type        | Null | Key | Default           | Extra |
+----------------+-------------+------+-----+-------------------+-------+
| RunNumber      | int(11)     |      | PRI | 0                 |       |
| RunStartTime   | datetime    | YES  |     | NULL              |       |
| EntryTime      | timestamp   | YES  |     | CURRENT_TIMESTAMP |       |
| TargetName     | varchar(50) | YES  |     | NULL              |       |
| TargetPosition | int(11)     | YES  |     | NULL              |       |
| LeftMomentum   | float       | YES  |     | NULL              |       |
| LeftAngle      | float       | YES  |     | NULL              |       |
| Energy         | float       | YES  |     | NULL              |       |
| BBCurrent      | float       | YES  |     | NULL              |       |
| BBAngle        | float       | YES  |     | NULL              |       |
+----------------+-------------+------+-----+-------------------+-------+

scalerinfo

+-------------------+-----------+------+-----+-------------------+----------------+
| Field             | Type      | Null | Key | Default           | Extra          |
+-------------------+-----------+------+-----+-------------------+----------------+
| scalerID          | int(11)   |      | PRI | NULL              | auto_increment |
| RunInfo_RunNumber | int(11)   | YES  | MUL | NULL              |                |
| EntryTime         | timestamp | YES  |     | CURRENT_TIMESTAMP |                |
| Events            | int(11)   | YES  |     | NULL              |                |
| Time              | float     | YES  |     | NULL              |                |
| T1prescaled       | int(11)   | YES  |     | NULL              |                |
| T1real            | int(11)   | YES  |     | NULL              |                |
| T2prescaled       | int(11)   | YES  |     | NULL              |                |
| T2real            | int(11)   | YES  |     | NULL              |                |
| T3prescaled       | int(11)   | YES  |     | NULL              |                |
| T3real            | int(11)   | YES  |     | NULL              |                |
| T4prescaled       | int(11)   | YES  |     | NULL              |                |
| T4real            | int(11)   | YES  |     | NULL              |                |
| T5prescaled       | int(11)   | YES  |     | NULL              |                |
| T5real            | int(11)   | YES  |     | NULL              |                |
| T6prescaled       | int(11)   | YES  |     | NULL              |                |
| T6real            | int(11)   | YES  |     | NULL              |                |
| T7prescaled       | int(11)   | YES  |     | NULL              |                |
| T7real            | int(11)   | YES  |     | NULL              |                |
| T8prescaled       | int(11)   | YES  |     | NULL              |                |
| T8real            | int(11)   | YES  |     | NULL              |                |
| u1charge          | float     | YES  |     | NULL              |                |
| u3charge          | float     | YES  |     | NULL              |                |
| u10charge         | float     | YES  |     | NULL              |                |
| d1charge          | float     | YES  |     | NULL              |                |
| d3charge          | float     | YES  |     | NULL              |                |
| d10charge         | float     | YES  |     | NULL              |                |
| lhrs_colli        | text      | YES  |     | NULL              |                |
| bb_colli          | text      | YES  |     | NULL              |                |
| sw_comment        | longtext  | YES  |     | NULL              |                |
+-------------------+-----------+------+-----+-------------------+----------------+

AnalysisInfo

+-------------------+------------+------+-----+-------------------+----------------+
| Field             | Type       | Null | Key | Default           | Extra          |
+-------------------+------------+------+-----+-------------------+----------------+
| anaID             | int(11)    |      | PRI | NULL              | auto_increment |
| EntryTime         | timestamp  | YES  |     | CURRENT_TIMESTAMP |                |
| RunInfo_RunNumber | int(11)    | YES  | MUL | NULL              |                |
| UserName          | longtext   | YES  |     | NULL              |                |
| KineName          | longtext   | YES  |     | NULL              |                |
| Production        | tinyint(4) | YES  |     | NULL              |                |
| Comment           | longtext   | YES  |     | NULL              |                |
+-------------------+------------+------+-----+-------------------+----------------+

Display

Runlist

A current runlist, using the e04007 MySQL database, is found here:

 E04007 Runlist

Kinematic Summary

A summary of the production runs, sorted by kinematic letter, is found here:

 E04007 Kinematics Summary