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/
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);
Int_t myDate = 20051231;
Int_t myTime = 235959;
dbMaker->SetDateTime(myDate,myTime);
TDataSet *DB = GetInputDB("Calibrations/emc/y3bemc"); // for towers
St_emcCalib *table = (St_emcCalib*) DB->Find("bemcCalib");
emcCalib_st *struct = table->GetTable();
unsigned char cap = (char) rawHit->calibrationType();
if(cap > 127) mCap[i][did-1]-=128;
/* 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]; /* */
};
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
# 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
#
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.
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.
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.
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.
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.
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.
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
(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.This page gives a brief overview of the code Frank Simon developed to create SMD Status Tables from MuDSTs.
For questions, please don't hesitate to contact me at fsimon@mit.edu!
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
St_db_Maker *dbMaker = new St_db_Maker("StarDb", "MySQL:StarDb");
Int_t myDate = 20051231;
Int_t myTime = 235959;
dbMaker->SetMaxEntryTime(myDate,myTime);
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 |
TDataSet *DB = GetInputDB("Calibrations/emc/trigger");
St_emcTriggerStatus *table = (St_emcTriggerStatus*) DB->Find("bemcTriggerStatus");
emcTriggerStatus_st *struct = table->GetTable();
/*
*
* 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]
};
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
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.