82 #ifndef STFMSDBMAKER_H
83 #define STFMSDBMAKER_H
88 #include "StThreeVectorF.hh"
89 #include "StLorentzVectorF.hh"
90 #include "StFmsUtil/StFmsDbConfig.h"
92 struct fmsDetectorPosition_st;
93 struct fmsChannelGeometry_st;
95 struct fmsPatchPanelMap_st;
98 struct fmsGainCorrection_st;
99 struct fmsBitShiftGain_st;
101 struct fmsGainCorrectionB_st;
102 struct fmsBitShiftGainB_st;
103 struct fmsTimeDepCorr_st;
106 struct fpsConstant_st;
107 struct fpsChannelGeometry_st;
109 struct fpsPosition_st;
114 struct fpostConstant_st;
115 struct fpostChannelGeometry_st;
116 struct fpostSlatId_st;
117 struct fpostPosition_st;
120 struct fpostStatus_st;
129 virtual Int_t Init();
130 virtual Int_t
InitRun(Int_t runNumber);
131 virtual Int_t
Make();
133 virtual void Clear(
const Char_t *opt);
141 fmsPatchPanelMap_st* PatchPanelMap();
142 fmsQTMap_st* QTMap();
144 fmsGainCorrection_st* GainCorrection();
146 fpsConstant_st* FpsConstant();
147 fpsChannelGeometry_st** FpsChannelGeometry();
148 fpsSlatId_st* FpsSlatId();
149 fpsPosition_st* FpsPosition();
151 fpsGain_st* FpsGain();
152 fpostConstant_st* FpostConstant();
153 fpostChannelGeometry_st** FpostChannelGeometry();
154 fpostSlatId_st* FpostSlatId();
155 fpostPosition_st* FpostPosition();
156 fpostMap_st* FpostMap();
157 fpostGain_st* FpostGain();
165 Int_t
type(Int_t detectorId);
166 Int_t
nRow(Int_t detectorId);
167 Int_t
nColumn(Int_t detectorId);
184 Float_t
getPhi(Int_t detectorId,Float_t FmsX, Float_t FmsY);
185 Float_t
getEta(Int_t detectorId,Float_t FmsX, Float_t FmsY, Float_t
Vertex);
198 Int_t nCellHole(Int_t det);
199 Int_t nCellCorner(Int_t det);
203 void getMap(Int_t detectorId, Int_t ch, Int_t* qtCrate, Int_t* qtSlot, Int_t* qtChannel);
204 void getReverseMap(Int_t qtCrate, Int_t qtSlot, Int_t qtChannel, Int_t* detectorId, Int_t* ch)
const;
214 Int_t maxGainCorrection();
215 Int_t maxBitShiftGain();
216 Float_t getGain(Int_t detectorId, Int_t ch)
const;
219 unsigned short getCorrectedAdc(
unsigned short detectorId,
unsigned short ch,
unsigned short adc)
const;
222 void forceUniformGain(
float v) {mForceUniformGain=v; }
235 void readRecParamFromFile(
int v=1){mReadRecParam=v;}
241 Int_t fpsMaxQTaddr();
243 Int_t fpsMaxSlatId();
244 Int_t fpsNSlat(
int quad,
int layer);
245 Int_t fpsSlatId(
int quad,
int layer,
int slat);
246 void fpsQLSfromSlatId(
int slatid,
int* quad,
int* layer,
int* slat);
247 void fpsPosition(
int slatid,
float xyz[3],
float dxyz[3]);
248 void fpsPosition(
int quad,
int layer,
int slat,
float xyz[3],
float dxyz[3]);
249 void fpsQTMap(
int slatid,
int* QTaddr,
int* QTch);
250 Int_t fpsSlatidFromQT(
int QTaddr,
int QTch);
251 void fpsQLSFromQT(
int QTaddr,
int QTch,
int* quad,
int* layer,
int* slat);
252 Float_t fpsGain(
int slatid);
253 Float_t fpsGain(
int quad,
int layer,
int slat);
254 Float_t fpsMipSigma(
int slatid);
255 Float_t fpsMipSigma(
int quad,
int layer,
int slat);
256 Float_t fpsValley(
int slatid);
257 Float_t fpsValley(
int quad,
int layer,
int slat);
258 UShort_t fpsStatus(
int slatid);
259 UShort_t fpsStatus(
int quad,
int layer,
int slat);
260 Int_t fpsSlatIdFromG2t(
int g2tvolid);
265 Int_t fpostMaxSlat();
266 Int_t fpostMaxQTaddr();
267 Int_t fpostMaxQTch();
268 Int_t fpostMaxSlatId();
269 Int_t fpostNSlat(
int quad,
int layer);
270 Int_t fpostSlatId(
int quad,
int layer,
int slat);
271 void fpostQLSfromSlatId(
int slatid,
int* quad,
int* layer,
int* slat);
272 void fpostPosition(
int slatid,
float xyz[3],
float dxyz[3],
float * angle);
273 void fpostPosition(
int quad,
int layer,
int slat,
float xyz[3],
float dxyz[3],
float* angle);
274 void fpostQTMap(
int slatid,
int* QTaddr,
int* QTch);
275 Int_t fpostSlatidFromQT(
int QTaddr,
int QTch);
276 void fpostQLSFromQT(
int QTaddr,
int QTch,
int* quad,
int* layer,
int* slat);
277 Float_t fpostGain(
int slatid);
278 Float_t fpostGain(
int quad,
int layer,
int slat);
279 Float_t fpostMipSigma(
int slatid);
280 Float_t fpostMipSigma(
int quad,
int layer,
int slat);
281 Float_t fpostValley(
int slatid);
282 Float_t fpostValley(
int quad,
int layer,
int slat);
283 UShort_t fpostStatus(
int slatid);
284 UShort_t fpostStatus(
int quad,
int layer,
int slat);
285 Int_t fpostSlatIdFromG2t(
int g2tvolid);
289 void dumpFmsDetectorPosition(
const Char_t* filename=
"dumpFmsDetectorPosition.txt");
290 void dumpFmsMap (
const Char_t* filename=
"dumpFmsMap.txt");
291 void dumpFmsPatchPanelMap (
const Char_t* filename=
"dumpFmsPatchPanelMap.txt");
292 void dumpFmsQTMap (
const Char_t* filename=
"dumpFmsQTMap.txt");
293 void dumpFmsGain (
const Char_t* filename=
"dumpFmsGain.txt");
294 void dumpFmsGainCorrection (
const Char_t* filename=
"dumpFmsGainCorrection.txt");
295 void dumpFmsBitShiftGain (
const Char_t* filename=
"dumpFmsBitShiftGain.txt");
296 void dumpFmsTimeDepCorr (
const Char_t* filename=
"dumpFmsTimeDepCorr.txt");
297 void dumpFmsRec (
const Char_t* filename=
"dumpFmsRec.txt");
298 void dumpFpsConstant (
const Char_t* filename=
"dumpFpsConstant.txt");
299 void dumpFpsChannelGeometry (
const Char_t* filename=
"dumpFpsChannelGeometry.txt");
300 void dumpFpsSlatId (
const Char_t* filename=
"dumpSlatId.txt");
301 void dumpFpsPosition (
const Char_t* filename=
"dumpFpsPosition.txt");
302 void dumpFpsMap (
const Char_t* filename=
"dumpFpsMap.txt");
303 void dumpFpsGain (
const Char_t* filename=
"dumpFpsGain.txt");
304 void dumpFpsStatus (
const Char_t* filename=
"dumpFpsStatus.txt");
305 void dumpFpostConstant (
const Char_t* filename=
"dumpFpostConstant.txt");
306 void dumpFpostChannelGeometry (
const Char_t* filename=
"dumpFpostChannelGeometry.txt");
307 void dumpFpostSlatId (
const Char_t* filename=
"dumpSlatId.txt");
308 void dumpFpostPosition (
const Char_t* filename=
"dumpFpostPosition.txt");
309 void dumpFpostMap (
const Char_t* filename=
"dumpFpostMap.txt");
310 void dumpFpostGain (
const Char_t* filename=
"dumpFpostGain.txt");
311 void dumpFpostStatus (
const Char_t* filename=
"dumpFpostStatus.txt");
317 fmsChannelGeometry_st *mChannelGeometry=0;
318 UShort_t mMaxDetectorId=0;
320 fmsDetectorPosition_st *mDetectorPosition=0;
322 unsigned int mPositionModel=0;
327 enum {mMaxCrate=8, mMaxSlot=17, mMaxCh=32};
328 Int_t mReverseMapDetectorId[mMaxCrate][mMaxSlot][mMaxCh];
329 Int_t mReverseMapChannel[mMaxCrate][mMaxSlot][mMaxCh];
331 fmsPatchPanelMap_st *mPatchPanelMap=0;
334 fmsQTMap_st *mQTMap=0;
338 fmsGainB_st *mGainB=0;
339 fmsGain_st **mmGain=0;
342 fmsGainCorrection_st *mGainCorrection=0;
343 fmsGainCorrectionB_st *mGainCorrectionB=0;
344 fmsGainCorrection_st **mmGainCorrection=0;
345 Int_t mMaxGainCorrection=0;
347 fmsBitShiftGain_st *mBitShiftGain=0;
348 fmsBitShiftGainB_st *mBitShiftGainB=0;
349 fmsBitShiftGain_st **mmBitShiftGain=0;
350 Int_t mMaxBitShiftGain=0;
352 enum {mFmsTimeDepMaxData=20000,mFmsTimeDepMaxTimeSlice=200,mFmsTimeDepMaxDet=4,mFmsTimeDepMaxCh=578};
353 fmsTimeDepCorr_st *mTimeDepCorr=0;
355 int mTimeDepEvt[mFmsTimeDepMaxTimeSlice];
356 float mTimeDep[mFmsTimeDepMaxTimeSlice][mFmsTimeDepMaxDet][mFmsTimeDepMaxCh];
358 fmsRec_st *mRecPar=0;
362 Float_t mForceUniformGain=0.0;
363 Float_t mForceUniformGainCorrection=0.0;
364 Short_t mForceUniformBitShiftGain=0;
365 Int_t mReadGainFile=0;
366 Int_t mReadGainCorrFile=0;
367 Int_t mReadBitShiftGainFile=0;
369 Int_t mReadRecParam=0;
371 fpsConstant_st* mFpsConstant=0;
372 Int_t mFpsMaxSlatId=0;
373 fpsChannelGeometry_st** mFpsChannelGeometry=0;
374 fpsSlatId_st* mFpsSlatId=0;
375 Int_t*** mFpsReverseSlatId=0;
376 fpsPosition_st* mFpsPosition=0;
377 fpsMap_st* mFpsMap=0;
378 Int_t** mFpsReverseMap=0;
379 fpsGain_st* mFpsGain=0;
380 fpsStatus_st* mFpsStatus=0;
382 fpostConstant_st* mFpostConstant=0;
383 Int_t mFpostMaxSlatId=0;
384 fpostChannelGeometry_st** mFpostChannelGeometry=0;
385 fpostSlatId_st* mFpostSlatId=0;
386 Int_t*** mFpostReverseSlatId=0;
387 fpostPosition_st* mFpostPosition=0;
388 fpostMap_st* mFpostMap=0;
389 Int_t** mFpostReverseMap=0;
390 fpostGain_st* mFpostGain=0;
391 fpostStatus_st* mFpostStatus=0;
393 virtual const Char_t *GetCVS()
const {
static const Char_t cvs[]=
"Tag " __DATE__
" " __TIME__ ;
return cvs;}
Int_t detectorId(Int_t ew, Int_t ns, Int_t type)
maximum value of detector Id
Float_t getGainCorrection(Int_t detectorId, Int_t ch) const
get the gain for the channel
Int_t maxMap()
fmsMap related
void readGainCorrFromText(int v=1)
force gain to be read from FmsGain.txt
UShort_t maxDetectorId()
Utility functions related to FMS ChannelGeometry.
Float_t getXWidth(Int_t detectorId)
get the offset of the detector
Int_t getChannelNumber(Int_t detectorId, Int_t row, Int_t column)
get the column number for the channel
Int_t maxNS()
fmsQTMap related
void setDebug(Int_t debug)
debug mode, 0 for minimal message, >0 for more debug messages
StThreeVectorF getStarXYZfromColumnRow(Int_t detectorId, Float_t column, Float_t row)
get the STAR frame coordinates from column/row
float getTimeDepCorr(int event, int det, int ch)
force bit shift to be read from FmsBitShiftGain.txt
StThreeVectorF getDetectorOffset(Int_t detectorId)
get the channel number
fmsDetectorPosition_st * DetectorPosition()
getting the whole table
Int_t type(Int_t detectorId)
large or small cells for FMS
StLorentzVectorF getLorentzVector(const StThreeVectorF &xyz, Float_t energy)
get the STAR frame pseudo rapidity from the vertex from local X/Y [cm]
void readBitShiftGainFromText(int v=1)
force gain corr to be read from FmsGainCorr.txt
void forceUniformBitShiftGain(short v)
force gaincorr to be specified value
Int_t largeSmall(Int_t detectorId)
north or south side
Int_t getRowNumber(Int_t detectorId, Int_t ch)
maximum number of channels
Int_t nRow(Int_t detectorId)
type of the detector
StThreeVectorF getStarXYZ(Int_t detectorId, Float_t FmsX, Float_t FmsY)
get the Y width of the cell
Int_t getColumnNumber(Int_t detectorId, Int_t ch)
get the row number for the channel
void dumpFmsChannelGeometry(const Char_t *filename="dumpFmsChannelGeometry.txt")
text dump for debugging
Float_t distanceFromEdge(Int_t det, Float_t x, Float_t y, int &edge)
get 4 vector assuing m=0 and taking beamline from DB
Int_t northSouth(Int_t detectorId)
east or west to the STAR IP
Int_t fpsNQuad()
FPS related.
Short_t getBitShiftGain(Int_t detectorId, Int_t ch) const
get the gain correction for the channel
unsigned short getCorrectedAdc(unsigned short detectorId, unsigned short ch, unsigned short adc) const
get the bit shift gain for the channel
UShort_t maxChannel(Int_t detectorId) const
number of column
Float_t getYWidth(Int_t detectorId)
get the X width of the cell
Int_t fpostNQuad()
FPost related.
Float_t getEta(Int_t detectorId, Float_t FmsX, Float_t FmsY, Float_t Vertex)
get the STAR frame phi angle from from local X/Y [cm]
Int_t eastWest(Int_t detectorId)
convert to detector Id
Int_t maxGain()
fmsGain/GainCorrection/Bitshift related
Float_t getPhi(Int_t detectorId, Float_t FmsX, Float_t FmsY)
get the STAR frame cooridnates for center of the cell
virtual Int_t InitRun(Int_t runNumber)
Int_t nColumn(Int_t detectorId)
number of rows
Int_t maxModule()
fmsPatchPanelMap related
void readGainFromText(int v=1)
force bits hift gain to be specified value
void forceUniformGainCorrection(float v)
force gain to be specified value
fmsChannelGeometry_st * ChannelGeometry()
getting the whole table