Database

Now the FPD/FMS data base tables have been created including geometry, mapping and calibration tables. These pages describe the data structure and how to use the FPD/FMS database. Please note the online database browser is a nice tool to get intuitive informaton of the tables stored. StFmsDbMaker, which acts as the interface between end user makers and the database is developed and described in more details in the corresponding subsection.

Calibration

Please refer to the mapping section for more information about detectorId definition and positions.
 



The following datasets (with names) are in the database:
St_fmsGain ("Calibrations/fms/fmsGain")
St_fmsGainCorrection ("Calibrations/fms/fmsGainCorrection")
St_fmsBitShiftGain ("Calibrations/fms/fmsBitShiftGain")
St_fmsLed ("Calibrations/fms/fmsLed")
St_fmsLedRef ("Calibrations/fms/fmsLedRef")
St_fmsPi0Mass ("Calibrations/fms/fmsPi0Mass")
St_fmsRec ("Calibrations/fms/fmsRec")


 


fmsGain and fmsGainCorrection are the original calibrations inherited from the FPD.
For the FMS:
Large cells, north -> detectorId=8
Large cells, south -> detectorId=9
Small cells, north -> detectorId=10
Small cells, south -> detectorId=11

The channels are counting from near-beam to outside and bottom up.
Large cells are arrays of 17x34, small cells are 12x24.
The corners and central holes are included in the channel count, i.e. these entries have gain=0.

$STAR/StDb/idl/fmsGain.idl

struct fmsGain
{
    octet detectorId;     /* DetectorId */
    unsigned short ch;     /* Ch 1-578 */
    float gain;     /* gain GeV/ch */
}; 

$STAR/StDb/idl/fmsGainCorrection.idl

struct fmsGainCorrection
{
    octet detectorId;     /* DetectorId */
    unsigned short ch;     /* Ch 1-578 */
    float corr;     /* gain correction factor */
}; 

$STAR/StDb/idl/fmsBitShiftGain.idl

*       description: // FMS & FPD detector bit shift gain                                                                                                    

*                     0 for no bit shift                                                                                                                     

*                     +1 for shifting up (adc=1,2,3,4... becomes 2,4,6,8...)                                                                                 

*                     -1 for shifting down (adc=1,2,3,4... becomes 0,1,1,2...)                                                                               

*                     up to +-5 

struct fmsBitShiftGain
{
    octet detectorId;     /* DetectorId */
    unsigned short ch;     /* Ch 1-578 */
    short bitshift;     /* bit shift gain */
}; 

 

 



The following datatables are not indexed. They are only used for the FMS.
The BLOB arrays follow the same order as the channels for the gains (starting with 0 instead of 1, obviously).

$STAR/StDb/idl/fmsLed.idl

struct fmsLed
{
    float adc_ln[578];     /* LED ADC value Large North */
    float err_ln[578];     /* LED uncertainty Large North */
    float adc_ls[578];     /* Large South */
    float err_ls[578];     /* */
    float adc_sn[288];     /* Small North */
    float err_sn[288];     /* */
    float adc_ss[288];     /* Small South */
    float err_ss[288];     /* */
};

$STAR/StDb/idl/fmsLedRef.idl

struct fmsLedRef
{
    float adc_ln[578];     /* LED ADC value Large North */
    float err_ln[578];     /* LED uncertainty Large North */
    float adc_ls[578];     /* Large South */
    float err_ls[578];     /* */
    float adc_sn[288];     /* Small North */
    float err_sn[288];     /* */
    float adc_ss[288];     /* Small South */
    float err_ss[288];     /* */
};

$STAR/StDb/idl/fmsPi0Mass.idl

struct fmsPi0Mass
{
    float mass_ln[578];     /* Reconstructed pi0 mass Large North */
    float err_ln[578];     /* Mass uncertainty Large North */
    float mass_ls[578];     /* Large South */
    float err_ls[578];     /* */
    float mass_sn[288];     /* Small North */
    float err_sn[288];     /* */
    float mass_ss[288];     /* Small South */
    float err_ss[288];     /* */
};

 



fmsRec contains parameters for the cluster and photon reconstruction, which have previously been hard coded or stored in local files. These parameters are not likely to change, but have been moved into the database for consistency and backwards compatibility.

$STAR/StDb/idl/fmsRec.idl

struct fmsRec
{
    unsigned short ROW_LOW_LIMIT;     /* */
    unsigned short COL_LOW_LIMIT;     /* */
    float CEN_ROW_LRG;     /* */
    unsigned short CEN_ROW_WIDTH_LRG;     /* */
    unsigned short CEN_UPPER_COL_LRG;     /* */
    float CEN_ROW_SML;     /* */
    unsigned short CEN_ROW_WIDTH_SML;     /* */
    unsigned short CEN_UPPER_COL_SML;     /* */
    float CORNER_ROW;     /* */
    float CORNER_LOW_COL;     /* */
    unsigned short CLUSTER_BASE;     /* */
    unsigned short CLUSTER_ID_FACTOR_DET;     /* */
    unsigned short TOTAL_TOWERS;     /* */
    float PEAK_TOWER_FACTOR;     /* */
    float TOWER_E_THRESHOLD;     /* */
    float BAD_2PH_CHI2;     /* */
    float BAD_MIN_E_LRG;     /* */
    float BAD_MAX_TOW_LRG;     /* */
    float BAD_MIN_E_SML;     /* */
    float BAD_MAX_TOW_SML;     /* */
    float VALID_FT;     /* */
    float VALID_2ND_FT;     /* */
    float VALID_E_OWN;     /* */
    float SS_C;     /* */
    float SS_A1;     /* */
    float SS_A2;     /* */
    float SS_A3;     /* */
    float SS_B1;     /* */
    float SS_B2;     /* */
    float SS_B3;     /* */
    unsigned short CAT_NTOWERS_PH1;     /* */
    float CAT_EP1_PH2;     /* */
    float CAT_EP0_PH2;     /* */
    float CAT_SIGMAMAX_MIN_PH2;     /* */
    float CAT_EP1_PH1;     /* */
    float CAT_EP0_PH1;     /* */
    float CAT_SIGMAMAX_MAX_PH1;     /* */
    float PH1_START_NPH;     /* */
    float PH1_DELTA_N;     /* */
    float PH1_DELTA_X;     /* */
    float PH1_DELTA_Y;     /* */
    float PH1_DELTA_E;     /* */
    unsigned short PH2_START_NPH;     /* */
    float PH2_START_FSIGMAMAX;     /* */
    float PH2_RAN_LOW;     /* */
    float PH2_RAN_HIGH;     /* */
    float PH2_STEP_0;     /* */
    float PH2_STEP_1;     /* */
    float PH2_STEP_2;     /* */
    float PH2_STEP_3;     /* */
    float PH2_STEP_4;     /* */
    float PH2_STEP_5;     /* */
    float PH2_STEP_6;     /* */
    float PH2_MAXTHETA_F;     /* */
    float PH2_LOWER_NPH;     /* */
    float PH2_LOWER_XF;     /* */
    float PH2_LOWER_YF;     /* */
    float PH2_LOWER_XMAX_F;     /* */
    float PH2_LOWER_XMAX_POW;     /* */
    float PH2_LOWER_XMAX_LIMIT;     /* */
    float PH2_LOWER_5_F;     /* */
    float PH2_LOWER_6_F;     /* */
    float PH2_UPPER_NPH;     /* */
    float PH2_UPPER_XF;     /* */
    float PH2_UPPER_YF;     /* */
    float PH2_UPPER_XMIN_F;     /* */
    float PH2_UPPER_XMIN_P0;     /* */
    float PH2_UPPER_XMIN_LIMIT;     /* */
    float PH2_UPPER_5_F;     /* */
    float PH2_UPPER_6_F;     /* */
    float PH2_3_LIMIT_LOWER;     /* */
    float PH2_3_LIMIT_UPPER;     /* */
    float GL_LOWER_1;     /* */
    float GL_UPPER_DELTA_MAXN;     /* */
    float GL_0_DLOWER;     /* */
    float GL_0_DUPPER;     /* */
    float GL_1_DLOWER;     /* */
    float GL_1_DUPPER;     /* */
    float GL_2_DLOWER;     /* */
    float GL_2_DUPPER;     /* */
};

FPS DB tables


Geometry related DB tables for FPS
  • fpsConstant.idl (1 row) : Basic constants
    struct fpsConstant {
    unsigned short nQuad; /* 4 */
    unsigned short nLayer; /* 3 */
    unsigned short maxSlat; /* 21 */
    unsigned short maxQTaddr; /* 8 */
    unsigned short maxQTch; /* 32 */
    };
  • fpsChannelGeometry.idl (12 rows) : Number of slats for each Quad & Layer
    struct fpsChannelGeometry {
    unsigned short quad; /* 1=Q1(South Top), 2=Q2(South Bottom),3=Q3(North Top), 4=Q4(North Bottom) */
    unsigned short layer; /* 1=layer1, 2=layer2, 3=layer3 */
    unsigned short nslat; /* # of slat (19,20 or 21) */
    };
  • fpsSlatId.idl (252 rows) : Slat Id to Quad & Layer & Slat#
    struct fpsSlatId {
    unsigned short slatid; /* 0-251: slat Id = (quad-1)*nLayer*maxSlat + (layer-1)*maxSlat + (Slat-1)*/
    unsigned short quad; /* 1-4, 0 for none-exsistant slat */
    unsigned short layer; /* 1-3, 0 for none-exsistant slat */
    unsigned short slat; /* 1-21, 0 for none-exsistant slat */
    };
  • fpsPosition.idl (252 rows) : Detector dimensions and positions
    struct fpsPosition {
    unsigned short slatid; /* 0-251: slat Id = (quad-1)*nLayer*maxSlat + (layer-1)*maxSlat + (slat-1)*/
    float xwidth; /* x width (cm) */
    float ywidth; /* y width (cm) */
    float zwidth; /* z width/thickness (cm) */
    float xoffset; /* xoffset from beam line to cetner of detector (cm) */
    float yoffset; /* yoffset from beam line to center of detector (cm) */
    float zoffset; /* z position from IR (cm) */
    };
  • fpsMap.idl : QT map (252 rows) :
    struct fpsMap {
    unsigned short slatid; /* 0-251: slat Id = (quad-1)*nLayer*maxSlat + (layer-1)*maxSlat + (slat-1)*/
    short QTaddr; /* 0-7 : QT Address */
    short QTch; /* 0-31 : QT channel */
    };

Calibration related DB tables for FPS
  • fpsGain.idl : Gain (252 rows) :
    struct fpsGain {
    unsigned short slatid; /* 0-251: slat Id = (quad-1)*nLayer*maxSlat + (layer-1)*maxSlat + (slat-1)*/
    float MIP; /* Single MIP peak ADC [ch] */
    float Sigma; /* MIP peak width [ch]*/
    float Valley; /* Valley location between noise and MIP peak [ch]*/
    };
  • fpsStatus.idl : Status (252 rows) :
    struct fpsStatus {
    unsigned short slatid; /* 0-251: slat Id = (quad-1)*nLayer*maxSlat + (layer-1)*maxSlat + (slat-1)*/
    unsigned short status; /* 0=Good, 1=bad, 9=Unused */
    };
  • fpsPed.idl : Pedestals(252 rows) :
    struct fpsPed {
    unsigned short slatid; /* 0-251: slat Id = (quad-1)*nLayer*maxSlat + (layer-1)*maxSlat + (slat-1) */
    float Mean; /* Mean of Gaussian Fit for ADC [ch] */
    float Sigma; /* Sigma of Guassian Fit for ADC [ch] */
    };

FPost DB tables

FMS Postshower detector DB tables (Geometry/fpost)
  • fpostConstant.idl (1 row) : Basic constants
    struct fpostConstant {
    unsigned short nQuad; /* 2 (South/North) */
    unsigned short nLayer; /* 6 */
    unsigned short maxSlat; /* 43 */
    unsigned short maxQTaddr; /* 8 */
    unsigned short maxQTch; /* 32 */
    };
  • fpostChannelGeometry.idl (12 rows) : Number of slats for each Quad & Layer
    struct fpostChannelGeometry {
    unsigned short quad; /* 1=Q1(South), 2=Q2(North) */
    unsigned short layer; /* 1=layer1, 2=layer2, 3=layer3 4=layer4 5=layer5 6=layer6 */
    unsigned short nslat; /* # of slat (9,14,25,43, or 34) */
    };
  • fpostSlatId.idl (241 rows) : Slat Id to Quad & Layer & Slat#
    struct fpostSlatId {
    unsigned short slatid; /* 0-240: slat Id */
    unsigned short quad; /* 1-2, 0 for none-exsistant slat */
    unsigned short layer; /* 1-6, 0 for none-exsistant slat */
    unsigned short slat; /* 1-43, 0 for none-exsistant slat */
    };
  • fpostPosition.idl (241 rows) : Detector dimensions and positions
    struct fpostPosition {
    unsigned short slatid; /* 0-240: slat Id */
    float length; /* length ( Depends on S1,S2,etc. cm) */
    float width; /* width (5 cm) */
    float thickness; /* thickness (1 cm) */
    float angle_xy /* angle in the xy plan measured with respect to the positive x-axis (45 South, 135 North)*/
    float xoffset; /* xoffset from beam line to center of detector (cm) */
    float yoffset; /* yoffset from beam line to center of detector (cm) */
    float zoffset; /* z position from IR (cm) */
    };
  • fpostMap.idl : QT map (241 rows) :
    struct fpostMap {
    unsigned short slatid; /* 0-240: slat Id */
    short QTaddr; /* 0-7 : QT Address */
    short QTch; /* 0-31 : QT channel */
    };

Calibration related DB tables for FPOST
  • fpostGain.idl : Gain (241 rows) :
    struct fpostGain {
    unsigned short slatid; /* 0-240: slat Id */
    float MIP; /* Single MIP ADC ch */
    };
  • fpostStatus.idl : Status (241 rows) :
    struct fpostStatus {
    unsigned short slatid; /* 0-240: slat Id */
    unsigned short status; /* 0=Good, 1=bad, 9=Unused */
    };
  • fpostPed.idl : Pedestals(241 rows) :
    struct fpostPed {
    unsigned short slatid; /* 0-240: slat Id */
    float Mean; /* Mean of Gaussian Fit for ADC [ch] */
    float Sigma; /* Sigma of Guassian Fit for ADC [ch] */
    };

Geometry & Mapping

 The following FMS database tables are defined for geometry and mapping.

 

 

  • Channel geometry

     $STAR/StDb/idl/fmsChannelGeometry.idl 

/* fmsGeometry.idl
*
* Table: fmsGeometry
*
* description: // FPD & FMS & FHC detector geometry
*/
/* Detector Name detectorId ew ns type nX nY */
/* FPD-North 0 0 0 0 7 7 */
/* FPD-South 1 0 1 0 7 7 */
/* FPD-North-Pres 2 0 0 1 7 1 */
/* FPD-South-Pres 3 0 1 1 7 1 */
/* FPD-North-SMDV 4 0 0 2 48 1 */
/* FPD-South-SMDV 5 0 1 2 48 1 */
/* FPD-North-SMDH 6 0 0 3 1 48 */
/* FPD-South-SMDH 7 0 1 3 1 48 */
/* FMS-North-Large 8 1 0 4 17 34 */
/* FMS-South-Large 9 1 1 4 17 34 */
/* FMS-North-Small 10 1 0 4 12 24 */
/* FMS-South-Small 11 1 1 4 12 24 */
/* FHC-North 12 1 0 5 9 12 */
/* FHC-South 13 1 1 5 9 12 */

struct fmsChannelGeometry {
octet detectorId; /* detector Id */
octet type; /* 0=SmallCell,1=Preshower,2=SMD-V,3=SMD-H,4=LargeCell,5=HadronCal */
octet ew; /* 0=east, 1=west */
octet ns; /* 0=north, 1=south */
octet nX; /* # of columns, max_channel is nX*nY */
octet nY; /* # of rows, max_channel is nX*nY */
};

  • Detector position

     $STAR/StDb/idl/fmsDetectorPosition.idl 

/* fmsPosition.idl
*
* Table: fmsPosition
*
* description: // FPD & FMS & FHC detector width and positions
*/

struct fmsDetectorPosition {
octet detectorId; /* detector Id */
float xwidth; /* x width */
float ywidth; /* y width */
float xoffset; /* xoffset from beam line to inner edge of detector */
float yoffset; /* yoffset from beam line to center of detector */
float zoffset; /* z position where we measure x,y */
};

  • Detector map

     $STAR/StDb/idl/fmsMap.idl 

/* fmsMap.idl
*
* Table: fmsMap
*
* description: // FMS & FPD detector map
*/

struct fmsMap {
octet detectorId; /* DetectorId */
unsigned short ch; /* Ch 1-578*/
octet qtCrate; /* QT crate# 1-4 & 7 */
octet qtSlot; /* QT slot# 1-16 */
octet qtChannel; /* QT channel# 0-31 */
};

  • PatchPanel to detector map

     $STAR/StDb/idl/fmsPatchPannelMap.idl 

/* fmsPatchPanelMap.idl
*
* Table: fmsPatchPanelMap
*
* description: // FMS detector to patch panel map
*/

/* module 1=North Large, 2=South Large, 3=North Small ,4=South Small => moduleIDs */

struct fmsPatchPanelMap {

/* channel# 1-548 for L and 1-288 for S*/
octet ppPanel[548]; /* panel# 1-2 */
octet ppRow[548]; /* row# 1-20 */
octet ppColumn[548]; /* column# 1-16 */
};

  • PatchPanel to QT map

     $STAR/StDb/idl/fmsQTMap.idl 

/* fmsQTMap.idl
*
* Table: fmsQTMap
*
* description: // FMS patch panel to QT map
*/

/* north=1/south=2 => sideIDs */

struct fmsQTMap {
/* panel# 1-2 */
/* row# 1-20 */
/* column# 1-16 */
octet qtCrate[2][20][16]; /* QT crate# 1-4 */
octet qtSlot[2][20][16]; /* QT slot# 1-16 */
octet qtChannel[2][20][16]; /* QT channel# 0-31 */
};

 

R/W DB

Below is mostly copied from Akio's page on how to read/write DB tables in a macro.

 FMS DB example

• Simple "how to Creating Offline DB Tables" from Dmitry 
    o Anyone in STAR should be able to read DB from RCAS machines
    o To write to DB, you need write permission to DB. Currently only Akio and Dmitry can write. Dmitry can add people as needed.
    o Only Dmitry can delete, or mark as de-activated DB entries.
    o For reading DB : unsetenv DB_ACCESS_MODE or setenv DB_ACCESS_MODE read
    o For writing DB : setenv DB_ACCESS_MODE write, and do not forget to unsetenv DB_ACCESS_MODE when done.

• STAR DB Broswer : Calibration DB , Geometry DB

• Look into other DB table definisions in $STAR/StDb/idl/*.idl 
    o Up to 3 dimensional array is supported 
    o Plus using one queue, DB can return array (ModuleID) of this table 
    o Thus 4 dimensional array (3 dim array in table + 1 module ID) used in fmsQTMap.idl (see below). 
    o Array is fixed length, but module ID can be variable length. 
    o For DB efficiencies, using big array block/blab is disfavored, and use small tables & moduleID is recomended.

• Edit Computing/Subsystem drupal page for documentation!

• To read/write into DB using macros 
       copy ~akio/dbServers.xml ~/
       unsetenv DB_SERVER_LOCAL_CONFIG

• For usual DB access through BFC/St_db_Maker 
      setenv DB_SERVER_LOCAL_CONFIG /afs/rhic.bnl.gov/star/packages/conf/dbLoadBalancerLocalConfig_BNL.xml

• Proposed tables and codes to read from and write into the database (examples are located at ~jgma/psudisk/fms/)
    o fmsPatchPanelMap.idl for FMS detector to patchpanel map
    Input file : qtmap2pp.txt
    Example root macro : fms_db_patchpanelmap.C 
       ** To read input file and write to DB
       root4star -q -b fms_db_patchpanelmap.C'("readtext writedb")'

      ** To read DB and write to text file
      root4star -q -b fms_db_patchpanelmap.C'("readdb writetext")'
      diff qtmap2pp.txt qtmap2pp.txt_dbout

    o fmsQTMap.idl for FMS patchpanel to QT map
    Input file for run8 : qtmap_run8.txt
    Input file for run9 : qtmap2009V1.txt
    Example root macro : fms_db_qtmap.C
       ** To read input file and write to DB for run8 (replace 2nd argument = 8 with 9 for run9)
       root4star -q -b fms_db_qtmap.C'("readtext writedb",8)'
       ** To read DB and write to text file for run8
       root4star -q -b fms_db_qtmap.C'("readdb writetext",8)'
       diff qtmap_run8.txt qtmap_run8.txt_dbout

    o fmsQTMap.idl for FPD,FMS,FHC detector to QT map
    For FMS, combine 2 DB tables (fmsPatchPanel & fmsQTMap) to create this table
    Root macro for FMS: fms_db_pp_qt_merge.C
       ** To read 2 maps from DB (fmsPatchPanel & fmsQTMap) and write fmsMap to DB for run8 (replace 2nd argument = 8 with 9 for run9)
       root4star -q -b fms_db_pp_qt_merge.C'("merge writedb",8)'
       ** To read fmsMap DB and write to text file for run8
       root4star -q -b fms_db_pp_qt_merge.C'("readdb writetext",8)'
       more fms_db_pp_qt_merge.txt

    Root macro For FPD : fpd_db_map.C

    o fmsChannelGeometry.idl for FPD,FMS,FHC detector basic numbers (id, type, Easr/West and North/south, # of row/column)
    Root macro : fms_db_ChannelGeometry.C

    o fmsDetectorPosition.idl for FPD,FMS,FHC detector position in STAR frame 
    Root macro : fms_db_detectorposition.C

    o fmsGain.idl/fmsGainCorrection.idl for FPD,FMS,FHC gain(detectorId, channel number, gain/gaincorr)
    Root macro : fms_db_fmsgain.C/fms_db_fmsgaincorr.C (they work in a similar way)        ** To read input gain file and write gain information to DB for run8 pp200 (the macro takes combined option of run8/run9 and dAu200/pp200)
       root4star -q -b fms_db_pp_fmsgain.C'("readtext writedb", "run8 pp200")'
       ** To read fmsGain DB and write to text file for run8 pp200
       root4star -q -b fms_db_fmsgain.C'("readdb writetext", "run8 pp200")'
 

StFmsDbMaker

StFmsDbMaker is the interface between the STAR FMS database and user makers. It provides access methods to all FPD/FMS related data in the STAR database such as mapping and calibration. (currently only at /star/u/jgma/psudisk/fms/StRoot/StFmsDbMaker) Small chain to test : root4star -q -b /star/u/jgma/psudisk/fms/mudst.C. The following is a list of functions provided by StFmsDbMaker. Please refer to the source code under CVS for details (will be checked in to CVS after peer review.).

List of functions

//! getting the whole table
fmsDetectorPosition_st* DetectorPosition();
fmsChannelGeometry_st* ChannelGeometry();
fmsMap_st* Map();
fmsPatchPanelMap_st* PatchPanelMap();
fmsQTMap_st* QTMap();
fmsGain_st* Gain();
fmsGainCorrection_st* GainCorrection();

//! utility functions related to FMS geometry and calibration
Int_t maxDetectorId(); //! maximum value of detector Id
Int_t detectorId(Int_t ew, Int_t ns, Int_t type); //! convert to detector Id
Int_t eastWest(Int_t detectorId); //! east or west to the STAR IP
Int_t northSouth(Int_t detectorId); //! north or south side
Int_t type(Int_t detectorId); //! type of the detector
Int_t nRow(Int_t detectorId); //! number of rows
Int_t nColumn(Int_t detectorId); //! number of column
Int_t maxChannel(Int_t detectorId); //! maximum number of channels
Int_t getRow(Int_t detectorId, Int_t ch); //! get the row number for the channel
Int_t getColumn(Int_t detectorId, Int_t ch); //! get the column number for the channel
Int_t getChannel(Int_t detectorId, Int_t row, Int_t column); //! get the channel number
StThreeVectorF detectorOffset(Int_t detectorId); //! get the offset of the detector
Float_t getXWidth(Int_t detectorId); //! get the X width of the cell
Float_t getYWidth(Int_t detectorId); //! get the Y width of the cell
Float_t getGain(Int_t detectorId, Int_t ch); //! get the gain for the channel
Float_t getGainCorrection(Int_t detectorId, Int_t ch); //! get the gain correction for the channel
StThreeVectorF getStarXYZ(Int_t detectorId,Float_t FmsX, Float_t FmsY); //! get the STAR frame coordinates
Float_t getPhi(Int_t detectorId,Float_t FmsX, Float_t FmsY); //! get the STAR frame phi angle
Float_t getEta(Int_t detectorId,Float_t FmsX, Float_t FmsY, Float_t Vertex); //! get the STAR frame pseudo rapidity

//! fmsMap related
Int_t maxMap();
void getMap(Int_t detectorId, Int_t ch, Int_t* qtCrate, Int_t* qtSlot, Int_t* qtChannel);

//! fmsPatchPanelMap related
Int_t maxModule();

//! fmsQTMap related
Int_t maxNS();

//! fmsGain/GainCorrection related
Int_t maxGain();
Int_t maxGainCorrection();

//! set time stamp
//void setDateTime(Int_t date, Int_t time);

//! text dump for debugging
void dumpFmsChannelGeometry(Char_t* filename="dumpFmsChannelGeometry.txt");
void dumpFmsDetectorPosition(Char_t* filename="dumpFmsDetectorPosition.txt");
void dumpFmsMap (Char_t* filename="dumpFmsMap.txt");
void dumpFmsPatchPanelMap (Char_t* filename="dumpFmsPatchPanelMap.txt");
void dumpFmsQTMap (Char_t* filename="dumpFmsQTMap.txt");
void dumpFmsGain (Char_t* filename="dumpFmsGain.txt");
void dumpFmsGainCorrection (Char_t* filename="dumpFmsGainCorrection.txt");

How to use it in user maker

#include "StFmsDbMaker/StFmsDbMaker.h"

Then use the global pointer to get access to all the FMS db table information by the methods above. For example to dump one table to a text file:

gStFmsDbMaker->dumpFmsChannelGeometry("ttest.txt");

To get a pointer to the channel geometry table:

fmsChannelGeometry_st *channelgeometry = gStFmsDbMaker->ChannelGeometry();

In your macro you'll need to load the .so files and create maker instances in the chain:

gSystem->Load("StDbBroker.so");
gSystem->Load("St_db_Maker.so");
gSystem->Load("StFmsDbMaker.so");

cout << "Setting up chain" << endl;
StChain* chain = new StChain;

cout << "Setting up St_db_Maker" << endl;
St_db_Maker* dbMaker = new St_db_Maker("db", "MySQL:StarDb", "$STAR/StarDb");
dbMaker->SetDEBUG();
dbMaker->SetDateTime(20090601, 0);

cout << "Setting up StFmsDbMaker" << endl;
StFmsDbMaker* fmsdb = new StFmsDbMaker("fmsdbmaker");
fmsdb->setDebug(1);

//Then your makers...

Please pay attention to the SetDateTime option, it sets the timestamp so the data extracted from the db will be corresponding to this time stamp. Please refer to Dmitry's page for more information about time stamp.

Timedep corrction for run 11 and tower masking

Since tower masking is  done with the same inputs in database by setting time dep. correction values negative  for bad towers, 1) how towers are masked 1) how time dep. correction files are written, 3) how they are loaded in datbase, and 4)  how the information can be fetched from database are explained below .

 

  • How towers are maseked

The xml file(Sub_L.xml) take run by run jobs and list towers for each run.

Channels are populated in different ADC & energy thresholds : 
/star/data01/pwg/mriganka/fms2015/jetData2011/new/hotCh/StRoot/StFmsHitMaker/StFmsHitMaker.cxx
SET-1
            h0->Fill(((d-8)*1000)+c);
            hh0->Fill(((d-8)*1000)+c,adc);
SET-2
            if(adc>10){
            h10->Fill(((d-8)*1000)+c);
            hh10->Fill(((d-8)*1000)+c,adc);
            }
SET-3
            if(adc>50){
            h50->Fill(((d-8)*1000)+c);
            hh50->Fill(((d-8)*1000)+c,adc);
            }
SET-4
            if(adc>100){
            h100->Fill(((d-8)*1000)+c);
            hh100->Fill(((d-8)*1000)+c,adc);
            }
SET-5
           he0->Fill(((d-8)*1000)+c);
            hhe0->Fill(((d-8)*1000)+c,e);
SET-6
           if(e>1){
            he1->Fill(((d-8)*1000)+c);
            hhe1->Fill(((d-8)*1000)+c,e);
            }
SET-7
           if(e>10){
            he10->Fill(((d-8)*1000)+c);
            hhe10->Fill(((d-8)*1000)+c,e);
            }
SET-8
            if(e>20){
            he20->Fill(((d-8)*1000)+c);
            hhe20->Fill(((d-8)*1000)+c,e);
            }

 
For each SET 4 top bincontent towers are being selected. A tower is being marked to be masked if belong in the 4*8 set. There are several common.
Generally the number is ,ess than 20.

Writes hot channels run by run  in "txt" directory with gif files in "gif"  : the inputs from the txt file will be used when writing in database. Each *.txt file for one run.
/star/data01/pwg/mriganka/fms2015/jetData2011/new/hotCh/test/run.C. The information from *.txt files will be used when database would be written run by run.

  • How time dependent files are prepared

Basic concept is to mark channels for which correction is significnat. It is such that with minum inputs in database, we can perfrom time dep. correction without overloading the database.
Some details are written  here : https://drupal.star.bnl.gov/STAR/blog/mriganka/fms-led-time

In starver SL14i from PSU TimeDepCorr.root was locally  generated.  We are listing the channels to be corrected for each time slot. Each time slot is a section of 10k data. Since the evnets nummber is unique in trigger file and microDst files there is one to one relation with time slots and MuDst event numbers.

/star/data01/pwg/mriganka/fms2015/jetData2011/old/led/test1

running the macro txt1/read.C lists : Run Number       #Events(fms_st)    time-slots    Entries in Database
taking f_runNumber.txt which is generated Sub_L.xml(RunFastJet.C)  take list(schedA96107FA7AD49F7008BAA3DE299BDEE7_$JOBINDEX.list) file which written for each run.

-- inputs in the file(f_runNumber.tx) written in  StRoot/StJetMaker/mudst/StjFMSMuDst.cxx
StjFMSMuDst::RCorrect(TMatrix* padc,TMatrix* pEmat,Int_t det,Int_t iEW,Int_t runnum,Int_t EvNum,Int_t SegNM)
/star/data02/pwg/mriganka/root12fms/fmstxt/RunDep.root (Steven Heppelmann run11 list)

fprintf(f,"%10d %6d  %6d\n", mCurrentRunNumber, nEnt, timeSlot);
fprintf(f," %hu %hu %lu  %f \n", detectorId, ch, 999000000, 1); -- for last time slot
fprintf(f," %hu %hu %lu  %f \n", detectorId, ch, endEvent, corr); -- for time slots where chages are required

 

  • Writing in database

 In couple with time dependent masked tower inputs are set into database (time dep. correction values are set to negative for mased towers).
/star/data01/pwg/mriganka/fms2015/jetData2011/old/led/test1/AKIO/writeFMSAll.C
Masked tower inputs : sprintf(fileTowers,"/star/data01/pwg/mriganka/fms2015/jetData2011/new/hotCh/test/txt/tower_rejected_%d.txt",iR);
Time dep. correction inputs : sprintf(fileTimeDep,"txt/f_%d.txt",iR);

  • Reading after implementation of time dep. and hot tower rejection in StFmsHitMaker

The macro is running for Jet recontruction with FMS towers using tower masking and tome dep. correction.
/star/data01/pwg/mriganka/fms2015/jetData2011/new/hotCh/t/mod/RunJetFinder2009pro.C
Two switches are set in StFmsHitMaker
fmshitMk->SetTimeDepCorr(1);   // does time dep, correction : default is "0"
fmshitMk->SetTowerRej (default = 1) // how tower rejection