00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef STFMSDBMAKER_H
00023 #define STFMSDBMAKER_H
00024
00025 #ifndef StMaker_H
00026 #include "StMaker.h"
00027 #endif
00028 #include "StThreeVectorF.hh"
00029
00030 struct fmsDetectorPosition_st;
00031 struct fmsChannelGeometry_st;
00032 struct fmsMap_st;
00033 struct fmsPatchPanelMap_st;
00034 struct fmsQTMap_st;
00035 struct fmsGain_st;
00036 struct fmsGainCorrection_st;
00037
00038 class StFmsDbMaker : public StMaker {
00039 public:
00040 StFmsDbMaker(const Char_t *name="FmsDb");
00041 virtual ~StFmsDbMaker();
00042 virtual Int_t Init();
00043 virtual Int_t InitRun(Int_t runNumber);
00044 virtual Int_t Make();
00045 virtual Int_t Finish();
00046 virtual void Clear(const Char_t *opt);
00047
00048 void setDebug(Int_t debug);
00049
00051 fmsChannelGeometry_st* ChannelGeometry();
00052 fmsDetectorPosition_st* DetectorPosition();
00053 fmsMap_st* Map();
00054 fmsPatchPanelMap_st* PatchPanelMap();
00055 fmsQTMap_st* QTMap();
00056 fmsGain_st* Gain();
00057 fmsGainCorrection_st* GainCorrection();
00058
00060 Int_t maxDetectorId();
00061 Int_t detectorId(Int_t ew, Int_t ns, Int_t type);
00062 Int_t eastWest(Int_t detectorId);
00063 Int_t northSouth(Int_t detectorId);
00064 Int_t type(Int_t detectorId);
00065 Int_t nRow(Int_t detectorId);
00066 Int_t nColumn(Int_t detectorId);
00067 Int_t maxChannel(Int_t detectorId);
00068 Int_t getRowNumber(Int_t detectorId, Int_t ch);
00069 Int_t getColumnNumber(Int_t detectorId, Int_t ch);
00070 Int_t getChannelNumber(Int_t detectorId, Int_t row, Int_t column);
00071
00073 StThreeVectorF getDetectorOffset(Int_t detectorId);
00074 Float_t getXWidth(Int_t detectorId);
00075 Float_t getYWidth(Int_t detectorId);
00076 StThreeVectorF getStarXYZ(Int_t detectorId,Float_t FmsX, Float_t FmsY);
00077 Float_t getPhi(Int_t detectorId,Float_t FmsX, Float_t FmsY);
00078 Float_t getEta(Int_t detectorId,Float_t FmsX, Float_t FmsY, Float_t Vertex);
00079
00081 Int_t maxMap();
00082 void getMap(Int_t detectorId, Int_t ch, Int_t* qtCrate, Int_t* qtSlot, Int_t* qtChannel);
00083 void getReverseMap(Int_t qtCrate, Int_t qtSlot, Int_t qtChannel, Int_t* detectorId, Int_t* ch);
00084
00086 Int_t maxModule();
00087
00089 Int_t maxNS();
00090
00092 Int_t maxGain();
00093 Int_t maxGainCorrection();
00094 Float_t getGain(Int_t detectorId, Int_t ch);
00095 Float_t getGainCorrection(Int_t detectorId, Int_t ch);
00096
00098 void dumpFmsChannelGeometry(const Char_t* filename="dumpFmsChannelGeometry.txt");
00099 void dumpFmsDetectorPosition(const Char_t* filename="dumpFmsDetectorPosition.txt");
00100 void dumpFmsMap (const Char_t* filename="dumpFmsMap.txt");
00101 void dumpFmsPatchPanelMap (const Char_t* filename="dumpFmsPatchPanelMap.txt");
00102 void dumpFmsQTMap (const Char_t* filename="dumpFmsQTMap.txt");
00103 void dumpFmsGain (const Char_t* filename="dumpFmsGain.txt");
00104 void dumpFmsGainCorrection (const Char_t* filename="dumpFmsGainCorrection.txt");
00105
00106 private:
00107 void deleteArrays();
00108 Int_t mDebug;
00109
00110 fmsChannelGeometry_st *mChannelGeometry;
00111 Int_t mMaxDetectorId;
00112
00113 fmsDetectorPosition_st *mDetectorPosition;
00114
00115 fmsMap_st *mMap;
00116 fmsMap_st **mmMap;
00117 Int_t mMaxMap;
00118 enum {mMaxCrate=8, mMaxSlot=17, mMaxCh=32};
00119 Int_t mReverseMapDetectorId[mMaxCrate][mMaxSlot][mMaxCh];
00120 Int_t mReverseMapChannel[mMaxCrate][mMaxSlot][mMaxCh];
00121
00122 fmsPatchPanelMap_st *mPatchPanelMap;
00123 Int_t mMaxModule;
00124
00125 fmsQTMap_st *mQTMap;
00126 Int_t mMaxNS;
00127
00128 fmsGain_st *mGain;
00129 fmsGain_st **mmGain;
00130 Int_t mMaxGain;
00131
00132 fmsGainCorrection_st *mGainCorrection;
00133 fmsGainCorrection_st **mmGainCorrection;
00134 Int_t mMaxGainCorrection;
00135
00136
00137 virtual const Char_t *GetCVS() const {static const Char_t cvs[]="Tag $Name:"__DATE__" "__TIME__ ; return cvs;}
00138 ClassDef(StFmsDbMaker,1)
00139 };
00140
00142 R__EXTERN StFmsDbMaker* gStFmsDbMaker;
00143 #endif
00144
00145