Database

These pages describe how to use the BEMC database.  There is a browser-based tool that you can use to view any and all BEMC tables available at:

http://www.star.bnl.gov/Browser/BEMC/

Frequently Asked Questions

How do I use the database as it looked at a particular time?

You might be interested in this tip if e.g. you want to repeat an analysis performed before additional tables were added to the BEMC database.  Add the following lines of code to your macro after St_db_Maker is instantiated, and change myDate and myTime as appropriate:
 

Int_t myDate = 20051231;
Int_t myTime = 235959;
dbMaker->SetMaxEntryTime(myDate,myTime);

How do I force St_db_Maker to use the event time I specify?

If you're running over simulation files, where the event timestamp is not a meaningful quantity (at least, it's not meaningful for the BEMC database), you need to choose a particular event timestamp that best represents the state of the BEMC during the data-taking period to which you're comparing the simulations.  A list of timestamps is being compiled at Simulation Timestamps.  Add the following lines of code to your macro, and change myDate and myTime as appropriate:
Int_t myDate = 20051231;
Int_t myTime = 235959;
dbMaker->SetDateTime(myDate,myTime);

Calibrations Database

All calibration information is stored in the STAR database.  We have the following tables for BEMC calibrations:
  • For the BTOW and BPRS detectors:
    • St_emcCalib - this table contains absolute gain information for each channel
    • St_emcPed - this table contains pedestal values for each channel
    • St_emcGain - this table contains a gain correction factor vs. time for each channel (not currently used)
    • St_emcStatus - this table contains the final status for each channel
  • For the BSMDe and BSMDp detectors:
    • St_smdCalib - this table contains absolute gain information for each channel
    • St_smdPed - this table contains pedestal values for each channel
    • St_smdGain - this table contains a gain correction factor vs. time for each channel (not currently used)
    • St_smdStatus - this table contains the final status for each channel
The tables are stored in the STAR database under the directory /Calibrations/emc/y3[DETNAME] and are called bemcCalib, bemcPed, bemcGain, and bemcStatus in the case of the BTOW detector.

To get a pointer for those tables in an analysis maker do:
TDataSet *DB = GetInputDB("Calibrations/emc/y3bemc"); // for towers

St_emcCalib *table = (St_emcCalib*) DB->Find("bemcCalib");
emcCalib_st *struct = table->GetTable();

Important Information About Pedestal Tables

In order to save space and make the download faster, PEDESTALS and RMS are saved as SHORT.  So, the real pedestal value is PED/100.  Similarly, in order to save tables in the database you have to multiply the real pedestal by 100.  The same goes for the RMS.

SMD has different pedestals for different capacitors.  Only 3 pedestal values are saved:
  • Pedestal 0 is the average of 126 capacitors
  • Pedestal 1 is the pedestal value for capacitor 124
  • Pedestal 2 is the pedestal value for capacitor 125
Capacitor numbers for the BSMD can be retrieved from an StEmcRawHit by using the calibrationType() method:
unsigned char cap = (char) rawHit->calibrationType();
if(cap > 127) mCap[i][did-1]-=128;

Status Information

The St_emcStatus and St_smdStatus tables contain final status codes for each tower.  The final status is a combination of installation/run status, pedestal status and calibration status.  The final status has a bit pattern as follows:
  • 0 - not installed
  • 1 - installed / running
  • 2 - calibration problem
  • 4 - pedestal problem
  • 8 - other problem (channel removed, dead channel, etc.)
So, status==1 means the channel is installed and running OK.  Status==7 means that the channel is installed but that we have a calibration problem and a pedestal problem.

To check individual bits of the final status do
  • (status&1) == 1 means tower is installed
  • (status&2) == 2 means a calibration problem
  • (status&4) == 4 means a pedestal problem
  • (status&8) == 8 means another problem

Tables Structure

/* emcCalib.idl
*
* Table: emcCalib
*
* description: //: Table which contains all calibration information
*/
struct emcCalib {
octet Status[4800]; /* status of the tower/wire (0=problem, 1=ok) */
float AdcToE[4800][5]; /* ADC to Energy */
};
/* emcPed.idl
*
* Table: emcPed
*
* description: * //: Table which contains pedestal information for emctower ADCs
*/
struct emcPed {
octet Status[4800]; /* status of the emc tower(0=problem, 1=ok) */
short AdcPedestal[4800]; /* ADC pedestal of emc tower x 100 */
short AdcPedestalRMS[4800]; /* ADC pedestal RMS of emc tower x 100 */
float ChiSquare[4800]; /* chi square of Pedestal fit */
};
/* emcGain.idl
*
* Table: emcGain
*
* description: //: Table which contains gain correction information
*/
struct emcGain {
octet Status[4800]; /* status of the tower/wire (0=problem, 1=ok) */
float Gain[4800]; /* Gain Variation */
};
/* emcStatus.idl
*
* Table: emcStatus
*
* description: // which emc towers are up and running
*/
struct emcStatus {
octet Status[4800]; /* */
};
/* smdCalib.idl
*
* Table: smdCalib
*
* description: //: Table which contains all calibration information
*/
struct smdCalib {
octet Status[18000]; /* status of the tower/wire (0=problem, 1=ok) */
float AdcToE[18000][5]; /* ADC to Energy */
};
/* smdPed.idl
*
* Table: smdPed
*
* description: * //: Table which contains pedestal information for shower max ADCs
*/
struct smdPed {
octet Status[18000]; /* status of the smd stripe (0=problem,1=ok) */
short AdcPedestal[18000][3]; /* ADC pedestals of smd strip x 100 */
short AdcPedestalRMS[18000][3]; /* ADC pedestals RMS of smd strip x 100 */
};
/* smdGain.idl
*
* Table: smdGain
*
* description: //: Table which contains gain information
*/
struct smdGain {
octet Status[18000]; /* status of the tower/wire (0=problem, 1=ok) */
float Gain[18000]; /* Gain Variation */
};
/* smdStatus.idl
*
* Table: smdStatus
*
* description: // which smds are up and running
*/
struct smdStatus {
octet Status[18000]; /* */
};


Control Room

We use a crontab on emc01.starp.bnl.gov to update the trigger database tables as well as the "offline" pedestals throughout the run.  Here's the relevant portion of /etc/crontab:

00 4 * * * emc /home/emc/online/emc/pedestal/job

00 * * * * emc /home/emc/online/emc/trigger/job
10 * * * * emc /home/emc/online/emc/trigger/job
20 * * * * emc /home/emc/online/emc/trigger/job
30 * * * * emc /home/emc/online/emc/trigger/job
40 * * * * emc /home/emc/online/emc/trigger/job
50 * * * * emc /home/emc/online/emc/trigger/job


Pedestal Job

The job runs every day at 4:00 AM and executes the script

$EMCONLINE/pedestal/updateOnlinePed 

which in turn calls the root4star macro

$EMCONLINE/pedestal/makeOnlinePed.C

This macro calculates pedestals for all 4 subdetectors and uploads the tables to the STAR database.  A local backup copy of each table is stored in

$EMCONLINE/pedestal/tables/tables/


Trigger Job

The job runs $EMCONLINE/trigger/updateTriggerDB every ten minutes.  If the file $EMCONLINE/trigger/RUNMODE contains STOP, the job will do nothing.  $EMCONLINE/trigger/startTriggerDB and $EMCONLINE/trigger/stopTriggerDB can be used to change the content of RUNMODE.  The updateTriggerDB shell script contains some decent documentation which I've reproduced here:

# this script checks if ANY of the BEMC trigger
# configuration had changed. If so, it updated the
# database with the new trigger configuration
#
# it runs as a cronjob every 5-10 minutes in the star01
# machine
#
# this script follows the steps bellow
#
# 1. check the file RUNMODE. If content is STOP, exit the
# program. This is done if, for some reason, we
# want to stop the script from updating the DB
#
# 2. SCP the config_crate* and pedestal_crate* files
# from sc3.starp.bnl.gov machine
#
# 3. SCP the trigegr masks from startrg2.starp.bnl.gov machine
#
# 4. Copy these files to the sc3 and startrg2 directories
#
# 5. Compare these files to the files saved in the sc3.saved
# and startrg2.saved directories
#
# 6. If there is no difference, clear the sc3 and startrg2
# directories and exit
#
# 7. If ANY difference was found, copy the contents of the
# sc3 and startrg2 directories to sc3.saved and startrg2.saved
# Also saves the directory with timestamped names in the
# backup directory
#
# 8. runs the root4star macro that create the tables from
# the files in those directories and save them to the DB
# It also creates plain text file bemcStatus.txt with the same information
# for the trigger people and Pplots
#
# 9. clear the sc3 and startrg2 directories and exit
#
# you can also run it by hand with the command
#
# updateTriggerDB TIMESTAMP FORCE
#
# where TIMESTAMP is on the format
#
# YYYYMMDD.hhmmss
#
# if FORCE = yes we force saving the DB
#
# this procedure overwrites the RUNMODE variable
#
# AAPSUAIDE, 12/2004
#

Basically the job is always checking for changes to the trigger pedestals, status tables, and LUTs and uploaded a new table if any changes are found.

Mapping DB Proposal

Proposal

We propose to add a new set of tables to the Calibrations_emc database that will track the electronics mapping for the BEMC, BSMD, and BPRS and allow for an alternative implementation of StEmcDecoder.

Motivation

The existing BEMC electronics mapping code (StDaqLib/EMC/StEmcDecoder) has become difficult to maintain. Each time we discover something about the BEMC that requires an update to our lookup tables we have to decipher the algorithms that generate these lookup tables, and more often than not our first guess about how to add the new information is wrong.

StEmcDecoder is also inefficient because it doesn’t track the validity range of the current lookup tables and so it rebuilds the tables every event. Analysis jobs spend a non-neglible amount of CPU time rebuilding these decoder tables.

The information in the decoder is critical for BEMC experts, but the interface to that information is less than ideal. StEmcDecoder does not even have CINT bindings. An SQL interface would allow for much easier debugging.

For the End User

We are preserving the StEmcDecoder interface and reimplementing it to use the DB tables. Offline users should see a seamless transition. StEmcDecoder also plays an important role in the online p-plots. We’ll need to find a solution that allows access to the DB tables in that framework.

For Experts

The new mapping tables will contain a row for each detector element, so we expect that querying the tables using SQL will prove to be a valuable debugging tool. A simplified query might look like:

SELECT elementID,m,e,s FROM bemcMapping WHERE triggerPatch=5 and beginTime='2007-11-01 00:00:00';

which would yield

+-----------+------+------+------+
| elementID | m | e | s |
+-----------+------+------+------+
| 1709 | 43 | 9 | 2 |
| 1710 | 43 | 10 | 2 |
| 1711 | 43 | 11 | 2 |
| 1712 | 43 | 12 | 2 |
| 1729 | 44 | 9 | 1 |
| 1730 | 44 | 10 | 1 |
| 1731 | 44 | 11 | 1 |
| 1732 | 44 | 12 | 1 |
| 1749 | 44 | 9 | 2 |
| 1750 | 44 | 10 | 2 |
| 1751 | 44 | 11 | 2 |
| 1752 | 44 | 12 | 2 |
| 1769 | 45 | 9 | 1 |
| 1770 | 45 | 10 | 1 |
| 1771 | 45 | 11 | 1 |
| 1772 | 45 | 12 | 1 |
+-----------+------+------+------+
16 rows in set (0.12 sec)

Previously, we needed to write one-off compiled programs to export this kind of information out of the decoder.

Draft IDLs

struct emcMapping {
octet m; /* module 1-120 */
octet e; /* eta index 1-20 */
octet s; /* sub index 1-2 */
unsigned short daqID; /* ordering of elements in DAQ file 0-4799 */
octet crate; /* electronics crates 1-30 */
octet crateChannel; /* index within a crate 0-159 */
octet TDC; /* index in crate 80, 0-29 */
unsigned short triggerPatch; /* tower belongs to this TP 0-299 */
octet jetPatch; /* tower belongs to this JP 0-11 */
unsigned short DSM; /* just integer div TP/10 0-29 */
float eta; /* physical pseudorapidity of tower center */
float phi; /* physical azimuth of tower center */
char comment[255];
}
struct smdMapping {
octet m; /* module 1-120 */
octet e; /* eta index 1-150 (eta), 1-10 (phi) */
octet s; /* sub index 1 (eta), 1-15 (phi) */
octet rdo; /* readout crate 0-7 */
unsigned short rdoChannel; /* index in crate 0-4799 */
octet wire; /* wire number 2-80 */
octet feeA; /* A value for FEE 1-4 */
float eta; /* physical pseudorapidity of strip center */
float phi; /* physical azimuth of strip center */
char comment[255];
}
struct prsMapping {
octet m; /* module 1-120 */
octet e; /* eta index 1-20 */
octet s; /* sub index 1-2 */
octet PMTbox; /* PMT box 1-30 (West), 31-60 (East) */
octet MAPMT; /* MAPMT # for this element in PMTbox 1-5 */
octet pixel; /* index inside MAPMT 1-16 */
octet rdo; /* readout crate 0-3 */
unsigned short rdoChannel; /* index in readout crate 0-4799 */
octet wire; /* wire number 1-40 */
octet feeA; /* A value for FEE 1-2 */
octet SCA; /* switched capacitor array 1-2 */
octet SCAChannel; /* index inside SCA 0-15 */
octet powerSupply; /* 1-2 */
octet powerSupplyModule; /* 1-15 */
octet powerSupplyChannel; /* 0-14 */
float eta; /* physical pseudorapidity of tower center */
float phi; /* physical azimuth of tower center */
char comment[255];
}

I also proposed MySQL schemata on my blog, but I guess in STAR these IDLs define the schema.

Performance Estimates

I’ve temporarily installed tables on our MIT mirror and filled them with data describing the 2008 BEMC electronics mapping. Here are the stats:

*************************** 1. row ***************************
Name: bemcMapping
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 4800
Avg_row_length: 55
Data_length: 268732
Max_data_length: 281474976710655
Index_length: 163840
Data_free: 0
Auto_increment: 4801
Create_time: 2008-11-14 16:03:51
Update_time: 2008-11-14 16:05:45
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 2. row ***************************
Name: bprsMapping
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 4800
Avg_row_length: 70
Data_length: 336036
Max_data_length: 281474976710655
Index_length: 165888
Data_free: 0
Auto_increment: 4801
Create_time: 2008-11-14 17:52:53
Update_time: 2008-11-14 17:59:40
Check_time: 2008-11-14 17:52:53
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 3. row ***************************
Name: bsmdeMapping
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 18000
Avg_row_length: 52
Data_length: 936000
Max_data_length: 281474976710655
Index_length: 604160
Data_free: 0
Auto_increment: 18001
Create_time: 2008-11-14 16:03:51
Update_time: 2008-11-18 01:48:36
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
*************************** 4. row ***************************
Name: bsmdpMapping
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 18000
Avg_row_length: 52
Data_length: 936000
Max_data_length: 281474976710655
Index_length: 604160
Data_free: 0
Auto_increment: 18001
Create_time: 2008-11-14 16:03:51
Update_time: 2008-11-18 02:13:36
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
4 rows in set (0.11 sec)

This information is supposed to be static, even from year-to-year. In reality, we discover some details about the mapping each year which will require updates to some of these rows. There should certainly be no intra-run changes, so StEmcDecoder will need to retrieve 4800+4800+18000+18000 rows from the DB for each BFC and user job.

The equivalent C++ array sizes (excluding the comment field as I’m not sure how its handled) will be 101 KB (4800*21) for BEMC, 115 KB (4800*24) for BPRS and 288 KB (18000*16) for each SMD plane.

Pedestals / Status Tables

Code for the calculation of the BTOW & BSMD status tables has been made publicly accessible. BTOW status code is in StRoot/StEmcPool/CSMStatusUtils. The following studies of pedestals and status tables have been performed:

BTOW

2006
Dave S. - status

2004
Thorsten - 62 GeV AuAu status tables
Oleksandr - 200 GeV AuAu pedestals
Oleksandr - 62 GeV AuAu pedestals

2003
Oleksandr - dAu status tables
Oleksandr - pp status tables


BSMD & BPSD

2006
Priscilla - SMD pedestals

2005
Frank - SMD status for pp (bug found in code http://rhig.physics.yale.edu/~knospe/cucu200/bsmd_status_bug.htm)
Frank's code used to generate status tables from MuDsts

2004
200 GeV AuAu SMD status - taken by Martijn
Marcia - 200 GeV AuAu SMD pedestals
Subhasis - 62 GeV AuAu SMD & PSD pedestals

2003
Martijn - dAu SMD status

CSMStatusUtils

This is CSMStatusUtils, which outputs the status of either calorimeter to text and root status files.  Documentation is by Dave Relyea.  The code can be found at

StRoot/StEmcPool/CSMStatusUtils

History:
I was given code from both Joanna and Thorsten to figure out the status of the calorimeter towers over all pp production runs.  I merged the two sets of code, and and created a package called CSMStatusUtils.

Method:
The first piece of code in CSMSU takes every run and fills a 2-d histogram of ALL channels vs hit number (in ADC counts, from 0 to 150).  A second routine then combines these histograms from run subsets into single histograms for each run.  From the second routine and on down, the EEMC and BEMC are done entirely separately; the code needs to be run twice, once for each detector.

The code has an algorithm which then takes runs in each fill and combines them until the average number of hits above pedestal for all channels is greater than 100.  If runs are left over at the end of a fill, their statistics are added to prior runs in the fill.

For each combined set of runs, the code puts each channel through a series of tests.  It finds the pedestal (and writes it out to a file, btw) and determines if the pedestal is abnormally wide, or whether it falls outside acceptable limits (ADC channels 0 to 3, or 147 to 150).  It compares all towers' mean number of hits (ten sigma) above pedestal, and then flags towers which have 10x as many hits as the average, or 40x fewer.  Finally, it looks for stuck bits (either on or off) in the 1, 2, 4, or 8 position, and flags channels with stuck bits.

The code writes out a table (in text format) for each set of runs with the status of each channel clearly marked.  This table is also written in ROOT format, to be read by existing BEMC algorithms.  Also written is a hot tower plot, so the hot tower results can be eyeballed.  The code can also write out gif files of the spectra of every channel that failed a status test, so long as the number of channels in a given run set that failed the test is less than 25 (**for 2004 pp, gif files were not written out**).  Finally, the code creates a nice html file containing links to html subfiles detailing the channel status for each run set, which in turn link to the gif files.

As a final step, the code takes the text files and creates a new series of text status files with the results in differential format, meaning channels whose status didn't change from run set to run set are omitted.  However, since some channels fall very near the thresholds of certain status tests (for instance, channels whose pedestals sit at 2.9 ADC counts), I make the requirement that the channel's status must not have changed more than ten percent of the time over all runs sets, excluding runs in which all channels were bad (for nominal production running, this needs to be done, of course!).  If it has, it is marked bad once at the beginning, and then does not appear in any of the differential files.


************************************************************************
Running:
To run CSMSU, the first step is to use the FileCatalog to create a list of all the files you wish to analyze.  The command I use is typically something like:

get_file_list.pl -keys 'path,filename' -cond 'production=P04ik,tpc=1,emc=1, trgsetupname=productionPP||productionPPnoEndcap||pp||PP,filename~st_physics,filetype=daq_reco_mudst' -onefile -limit 100000 -distinct > allthephysicsfiles

Note that the output format I use is just 'path,filename', and I keep the :: delimiter that the FileCatalog uses.  My next step is to call

CSMSU/scripts/analysis0 allthephysicsfiles

(YOU NEED TO CHANGE THE HEADER IN THIS FILE TO YOUR OWN OUTPUT DIRECTORY)

which takes the "allthephysicsfiles" file from FileCatalog, splits it up into groups of 20 miniruns, and submits the entire processing job to batch.  Note - if I knew how to use the XML submission scripts, I would, but the online documentation for them doesn't mention how to code up your macro (.C) file such that the XML header file will work.  No matter.

PLEASE NOTE: Each minirun will generate about a 200k file.  This adds up to ENORMOUS disk space for large runs.  The 2004 pp run takes up about 1.4 Gig.  The 2004 Au-Au run would be even larger.  Thus, I really need to learn how to
use the XML submission scripts.

(FROM HERE ON, SCRIPT FILES CALL MACROS IN THE MACROS DIRECTORY.  YOU NEED TO CHANGE THE DEFAULT ARGUMENTS OF THE MACROS TO YOUR WORKING DIRECTORY.  YOU CAN DO THIS IN THE SCRIPT, OR JUST MAKE YOUR OWN SCRIPT, SINCE THEY'RE ALL TRIVIAL ONE LINE SCRIPTS ANYWAY.  SORRY ABOUT THE CAPS.)

After all miniruns have been processed, the next step is to combine them into runs.  The script "analysis1" does this.  

Next, you want to run the actual status code on the files.  The script "analysis2" does this.  PLEASE NOTE:  this macro requires an x window, as root needs to be able to Draw certain things.  I don't know how to do this in batch,
so I always run this interactively.  It's not a good solution, but for now, it's a solution.

Finally, you want to generate the ".root" status files and the concatenated status files (to alert you to changes in calorimeter tower status).  The script "analysis3" does this.

StBSMDStatusMaker

This page gives a brief overview of the code Frank Simon developed to create SMD Status Tables from MuDSTs.

Some features and limitiations of the code:

  • Create one status table per fill for each SMD plane (if enough statistics are available)
  • all triggers are used to maximize statistics (this can be a potential problem if there are hot trigger towers)
  • pedestals are taken from the data base (MuDST SMD data are zero-suppressed)
  • db-readable status tables can be created. Currently there are only to status flags implemented: good and bad. Adding more "variety" is straigth forward
  • can be used with the STAR scheduler, no specific ordering of the input files required (although some structure in the job submission is recommended, see below)

Basic ideas behind the code:

  • based on Daves tower status code, but: there are some very important differences
  • One job runs over several MuDST files, when a new fill number is encountered, a new output file is opened. That way, the jobs can be run with the STAR scheduler and they can use files on distributed storage, since no particular ordering of the input files is needed
  • for each fill, a file with 18000 channel TH2Fs storing amplitude information for each SMD channel is created (this method of dealing with random file order is a bit disk space hungry, so make sure enough space is available (~ 10 GB for 2005 pp); this can be deleted after the next step), other information such as time stamps and pedestals are stored in text files
  • As a next step, the large number of files created by jobs on MuDSTs is consolidated into one file per fill
  • Status tables are created from each of those files (one per fill, if statistics are sufficient, otherwise no status table for that fill is created)
  • db readable files are produced from these status tables

Running the code

  • Copy and compile the code in StRoot/StBSMDStatusMaker
  • Copy the macro that runs the code: RunStatus.C
  • Create scheduler scripts to submit your jobs. For pp2005, 50 jobs per job seems to give jobs with useful runtimes. In order to not get a totally randomized fill distribution in your jobs, submit them by day. A macro that creates a .csh that you can use to submit jobs by day is CreateSubmitScript.C, a template job describtion (you have to modify tha paths to suit your needs) is pp2005Template.xml
  • Submit your jobs
  • Once all jobs are done, create a list of all output files via ls * > FileList.list in the directory where your output ended up
  • Consolidate data using the file list: run macro DoAdding.C after compiling AddHistograms.C (via .L AddHistograms.C++), this macro takes the directory where the files are located and the file list as arguments. This creates three files per fill: Fill*.root containing the histograms, Fill*.ped containing pedestal db information and Fill*.time containing the (approximate) start time of the fill
  • Create a list of root files via ls Fill*.root > FileList.list and convert it into a list of fill numbers using the macro GetListOfFills.C. This maco takes the file list and a file name for the fill number list as argument
  • Perform the status table creation. For that, compile the shared library StatusTools.C (via .L StatusTools.C++), then run the macro ProcessList.C, with arguments RunList (created previously) and the directory where the Fill* files are located. The output of this is a number of files per fill (root file, flag file and time stamp file). The flag and the time stamp file are needed to create the db readable status table, the root file contains histograms created during the analysis process.
  • Create db readable status tables. This is done by running the macro WriteStatusFiles.C. This takes the directory where the flag and timestamp files are located as an argument. Two important notes:
    • This macro needs the full STAR environment (all other steps above except the running of jobs can be done on standalone machines)
    • The order in which the flag and time files are written (created) is crucial, since gSystem->GetDirEntry() is used to loop over all files. So care has to be taken if the files are copied from somewhere else
  • Copy the db readable files to the database location in StarDb, and test them! Use TestStatusFiles.C for example.

For questions, please don't hesitate to contact me at fsimon@mit.edu!

Simulation Timestamps

All 4800 perfect:
dbMaker->SetDateTime(20070101,000001);

Run 5 pp, selected by Spin PWG:
dbMaker->SetDateTime(20050506,214129);

some more info from Frank on detailed SMD status:
if (dbTime == 1) db1->SetDateTime(20050423,042518); //2005 stat1
else if (dbTime == 2) db1->SetDateTime(20050521,100745); //2005 stat2
else if (dbTime == 3) db1->SetDateTime(20050529,210408); //2005stat3
else db1->SetDateTime(20050610,120313); //2005, Jumbo
Run 6 pp:
dbMaker->SetDateTime(20060522,112810);

Table Insertion Timeline



This page keeps a log book of all the BEMC database modifications. Please use this information in order to make sure about the version of the tables you are grabbing from DATABASE. The table is sorted by EntryTime.

If you'd like to run an analysis using the database as it looked at some particular time, use the method
St_db_Maker *dbMaker = new St_db_Maker("StarDb", "MySQL:StarDb");
Int_t myDate = 20051231;
Int_t myTime = 235959;
dbMaker->SetMaxEntryTime(myDate,myTime);



You can use the BEMC DB Browser to look at all the tables in the database

row
number
EntryTime Tables Note
1 2005-11-03 pp2005 bemcCalib table
with timestamp = 2005-03-22 00:00:01
was uploaded to the database
Adam's calibration table
for pp2005. Click here for details
2 2005-12-07 pp2005 offline bemcStatus
with timestamp between
2005-04-19 11:36:11 and 2005-06-24 08:58:25
were uploaded to the database
Dave's status tables
for the pp2005 run
3 2006-02-08 pp2005 online bemcPed
with timestamp between
2005-04-19 05:37:10 and 2005-06-10 23:38:20
were deactivated
Corruption problems
reported by Dave
4 2006-02-09 pp2005 offline (Dave's) bemcPed
with timestamp between
2005-04-19 05:37:10 and 2005-06-10 23:38:20
were uploaded to the database
Replacement for
pp2005 bemcPed tables
5 2006-02-09 pp2004 online bemcPed
with timestamp between
2004-05-05 01:41:40 and 2004-05-14 23:21:19
were deactivated
Bad tables reported by Joanna
with large RMS values and
missing channels. Click here for details
6 2006-02-09 pp2004 offline (Dave's) bemcPed
with timestamp between
2004-05-05 01:41:40 and 2004-05-14 23:21:19
were uploaded to the database
Replacement for
pp2004 bemcPed tables
7 2006-02-22 AuAu and pp 2004 bemcCalib table
with timestamp 2004-01-01 00:04:00
was uploaded to database
Improvements in calibration by
Adam Kocoloski.
Click here for details
8 2006-02-22 CuCu 2005 bemcCalib table
with timestamp 2005-02-01 00:00:01
was uploaded to database
Improvements in calibration by
Adam Kocoloski.
Click here for details
9 2006-02-22 pp 2005 bemcCalib table
with timestamp 2005-03-22 00:00:02
was uploaded to database
Improvements in calibration by
Adam Kocoloski.
Click here for details
This is a copy of the table saved in row number 8.
This is necessary because there were calibration
tables saved for pp2005 run
10 2006-03-07 Saved perfect status tables
(bemc, bsmde, bsmdp and bprs)
for run 6 with timestamp
2006-01-01 00:00:00
First order status tables necessary for
fast production and pp2006 vertex finder
11 2006-03-30 Saved initial BTOW calibration for pp2006
with timestamp
2006-03-11 08:27:00
First calibration for pp2006 (online).
Based on eta-slices MIP peaks and
slopes equalization.
Click here for details
12 2006-04-19 A set of perfect status tables
(bemc, bsmde, bsmdp and bprs)
was saved in DB for the CuCu2005
with timestamp
2005-01-01 00:00:00
This makes sure that the 2004 status tables are not picked for any analysis/production
done with the 2005 CuCu data while
there is no detailed status tables
available
13 2006-04-20 A perfect status table for BTOW, including only the
west side of the EMC
was saved in DB for the
CuCu2005
with timestamp
2005-01-01 00:00:01
Added to replace previous perfect status
table that includes the full detector because
the east side was being commissioned
14 2006-06-16 Offline BSMD status tables for 2005 pp running. Event timestamps are between 2005-04-16 06:48:09 and 2005-06-23 19:38:42
Tables produced by Frank Simon.
Click here for details
15 2006-06-21 Offline BTOW status tables for 2005 pp running. Event timestamps are between 2005-04-19 11:36:11 and 2005-05-14 09:17:59
These tables should have been / were uploaded back in row 2. It's not clear what happened to them.
16 2006-06-21 Online BTOW pedestals for 2006 pp running. Event timestamps are between 2005-03-02 08:40:15 and 2005-06-19 04:41:18
BTOW pedestals were calculated and saved to the DB automatically during the run. Unfortunately the tables were corrupted during the upload, so we need to upload these tables again with +1 second timestamps.
17  2006-08-15
BSMD pedestals for Run 6.
Details
18 2006-08-16
BTOW status for Run 6.
~1 table/fill.  Should be good enough for vertex finding during production, but not necessarily the final set of tables.  Details
19 2006-10-17
Perfect BPRS status table for 2006 run
Begin time 2006-01-01
20 2006-11-10  BTOW status for Run 5 CuCu
Link needs to be updated with a summary page.  Details
21 2006-11-21
Fixed timestamps for Run 5 pp status
See starsoft post
22 2006-11-30
Fixed timestamps for Run 5 pp peds
See starsoft post
23
2006-12-07
Offline BTOW calibration for Run 6
Run 6 BTOW Calibration
24
2007-01-17
Final BTOW status tables for trans,long2
Details
25
2007-02-13
Corrected 3 Run6 tower peds in few runs
Hypernews discussion
26
2007-02-26
Final BSMD Run6 status tables
Details

Trigger Database

This database stores all BEMC trigger information such as trigger status, masks and pedestals used to obtain the high tower and patch sum information.  The database is updated online while taking data.  We have the following table formats:

  • St_emcTriggerStatus - this table contains status/mask information for the trigger
  • St_emcTriggerPed - this table contains the pedestal and bit conversion scheme used in the trigger
  • St_emcTriggerLUT - this table contains the lookup table information.  Because the LUT is very large it is encoded in simple formulae.  The FormulaTag entry specifies the formula used for each patch.
The tables are stored in the STAR database under the directory /Calibrations/emc/trigger and are called bemcTriggerStatus and bemcTriggerPed.  To access those tables from an analysis maker do:

TDataSet *DB = GetInputDB("Calibrations/emc/trigger");

St_emcTriggerStatus *table = (St_emcTriggerStatus*) DB->Find("bemcTriggerStatus");
emcTriggerStatus_st *struct = table->GetTable();

Important Information About Pedestal Tables

In order to save space and make the download fast, PEDESTALS and RMS are saved as SHORT.  So, the real pedestal value is PED/100.  Similarly, in order to save tables in the database you have to multiply the real pedestal by 100. The same goes for the RMS.

The pedestal table also includes the 6-bit conversion scheme used to generate the high tower and patch sum information.

Status Information

The St_emcTriggerStatus table contains the status information for each single tower, high tower and patch sum (patch sum is the sum in the 4x4 patches.  It is *not* the jet patch).  The status is a simple 0/1 that reflects the masks that are being applied to the electronicss where

  • 0 - masked out
  • 1 - included in trigger

Tables Structure

/*
*
* Table: emcCalib
*
* description: //: Table which contains the trigger masks
*/
struct emcTriggerStatus
{
octet PatchStatus[300]; // Patch sum masks. the index is the patch number
octet HighTowerStatus[300]; // High tower masks. the index is the patch number
octet TowerStatus[30][160]; // Single masks. the indexex are the crate number and position in crate
};
/*
*
* Table: emcTriggerPed
*
* description: * //: Table which contains pedestal information and 6 bits conversion used in trigger
*/
struct emcTriggerPed
{
unsigned long PedShift; // pedestal shift
unsigned long BitConversionMode[30][10]; // 6 bits conversion mode. the indexex are the crate number and position in crate
unsigned long Ped[30][160]; // pedestal value. the indexex are the crate number and position in crate
};
/*
*
* Table: emcTriggerLUT
*
* description: * //: Table which contains each patch LUT information
*/
struct emcTriggerLUT
{
unsigned long FormulaTag[30][10]; // formula tag for each [crate][patch]
unsigned long FormulaParameter0[30][10]; // Parameter 0 for the LUT formula in [crate][patch]
unsigned long FormulaParameter1[30][10]; // Parameter 1 for the LUT formula in [crate][patch]
unsigned long FormulaParameter2[30][10]; // Parameter 2 for the LUT formula in [crate][patch]
unsigned long FormulaParameter3[30][10]; // Parameter 3 for the LUT formula in [crate][patch]
unsigned long FormulaParameter4[30][10]; // Parameter 4 for the LUT formula in [crate][patch]
unsigned long FormulaParameter5[30][10]; // Parameter 5 for the LUT formula in [crate][patch]
};

BEMC Online Trigger Monitoring

During data taking the BEMC trigger information is monitored, and changes in the configuration (new pedestals, masks, etc.) are recorded.  The code relevant to this online trigger monitoring was developed by Oleksandr, and is checked into CVS here (usage instructions in the README file).  The scripts execute via a cronjob on the online machines on the starp network.  In particular, there exists directories with results from previous years at /ldaphome/onlmon/bemctrgdb20XX/ on onl08.starp.bnl.gov.

The final location for this information is in the offline DB, and the definitions for the tables are given here.  These DB tables are used by the StBemcTriggerSimu in the StTriggerUtilities package to replicate the BEMC trigger conditions for a particular timestamp. 

The DB tables can be uploaded while taking data or stored in ROOT files to be uploaded after data taking is complete.  To upload all the tables stored in ROOT files during data taking only a simple script is needed employing StBemcTablesWriter to read in a list of files and upload their information to the DB.  This script (uploadToDB.C) is checked into the macros directory of in CVS here.  


Yearly Timestamp Initialization

Yearly Timestamp Initialization

This page will document the yearly timestamp initialization requested by the S&C group (Run 12 for example).  The purpose is to set initial DB tables for "sim" and "ofl" flavor in sync with the geometry timeline for each year.  The geometry timeline is documented here.

 

The timestamps chosen for BEMC initialization are in the table below

  Simulation Real Data
Run 10 2009-12-12 2009-12-25
Run 11 2010-12-10 2010-12-20
Run 12 2011-12-10 2011-12-20

 

The "sim" tables used for initialization are ideal gains, pedestals and status tables.

The "ofl" tables used for initialization are the best known gains from previous years, and a reasonable se of pedestals and status tables from a previous year.  Obviously they will be updated once the run begins and better known values are available.

 

To simplify the initialization process from year to year, a macro (attached below) was written which copies DB tables from previous years to the current initialization timestamp.