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.
- Printer-friendly version
- Login or register to post comments