00001
00002
00003
00004
00005 #ifndef FROOT_TFndFeeMap
00006 #define FROOT_TFndFeeMap
00007
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019 #include <Riostream.h>
00020 #include "TObject.h"
00021 #include "TString.h"
00022
00023 #include "TFndDB.h"
00024
00025 #include "FROOT.h"
00026
00027 using namespace FROOT;
00028
00029 typedef struct {
00030 Char_t Module;
00031 Char_t P_Z;
00032 char Spy[K_N_Sil_AdcCha];
00033 char Noise[K_N_Sil_AdcCha];
00034 short Strip[K_N_Sil_AdcCha];
00035 short Chip[K_N_Sil_AdcCha];
00036 float Amp[K_N_Sil_AdcCha];
00037 } SILDBADC;
00038
00039
00040 class TFndFeeMap : public TObject {
00041
00042 private:
00043
00044 Int_t fDebug;
00045 UInt_t fRunTime;
00046
00047 Bool_t fIsThere;
00048 Int_t fMsqSock;
00049
00050 Int_t fTofNRows;
00051 Int_t fTofNFields;
00052
00053 Int_t fTofAdcSlab[K_N_Tof_AdcMod+1][K_N_Tof_AdcCha];
00054 Int_t fTofAdcSide[K_N_Tof_AdcMod+1][K_N_Tof_AdcCha];
00055 Int_t fTofTdcSlab[K_N_Tof_TdcMod+1][K_N_Tof_TdcCha];
00056 Int_t fTofTdcSide[K_N_Tof_TdcMod+1][K_N_Tof_TdcCha];
00057 Int_t fTofMtSlab[K_N_Tof_TdcMod+1][K_N_Tof_TdcCha];
00058
00059 Int_t fLmdNRows;
00060 Int_t fLmdNFields;
00061 Int_t fLmdAdcDCH[K_N_Lmd_AdcMod+1][K_N_Lmd_AdcCha];
00062 Int_t fLmdAdcWire[K_N_Lmd_AdcMod+1][K_N_Lmd_AdcCha];
00063 Int_t fLmdAdcSide[K_N_Lmd_AdcMod+1][K_N_Lmd_AdcCha];
00064
00065 Int_t fLmdTdcDCH[K_N_Lmd_TdcMod+1][K_N_Lmd_TdcCha];
00066 Int_t fLmdTdcWire[K_N_Lmd_TdcMod+1][K_N_Lmd_TdcCha];
00067 Int_t fLmdTdcSide[K_N_Lmd_TdcMod+1][K_N_Lmd_TdcCha];
00068
00069 Int_t fStbNRows;
00070 Int_t fStbNFields;
00071
00072 Int_t fStbTdcCrown[K_N_Stb_Crates+1][K_N_Stb_Mod+1][K_N_Stb_Cha+1];
00073 Int_t fStbTdcWire[K_N_Stb_Crates+1][K_N_Stb_Mod+1][K_N_Stb_Cha+1];
00074 Int_t fStbTdcPPan[K_N_Stb_Crates+1][K_N_Stb_Mod+1][K_N_Stb_Cha+1];
00075 TString fStbStatus[K_N_STB_CROWNS][K_N_STB_TUBES];
00076
00077 SILDBADC IsiDbAdc[0x60][2];
00078 SILDBADC OsiDbAdc[0x60][2];
00079
00080
00081
00082 Float_t fTofCal_Q0[E_FIN_OUTER_LAYER+1][K_N_TOFONE_SLABS+1][2];
00083 Float_t fTofCal_Q1[E_FIN_OUTER_LAYER+1][K_N_TOFONE_SLABS+1][2];
00084 Float_t fTofCal_T0_LowTh[E_FIN_OUTER_LAYER+1][K_N_TOFONE_SLABS+1][3];
00085 Float_t fTofCal_T1_LowTh[E_FIN_OUTER_LAYER+1][K_N_TOFONE_SLABS+1][3];
00086 Float_t fTofCal_T0_HighTh[E_FIN_OUTER_LAYER+1][K_N_TOFONE_SLABS+1][3];
00087 Float_t fTofCal_T1_HighTh[E_FIN_OUTER_LAYER+1][K_N_TOFONE_SLABS+1][3];
00088
00089 Float_t fLmdCal_Q0[E_FIN_OUTER_LAYER+1][K_N_LMD_CHAMS_PER_LAYER+1][K_N_LMD_OUTER_WIRES+1][2];
00090 Float_t fLmdCal_Q1[E_FIN_OUTER_LAYER+1][K_N_LMD_CHAMS_PER_LAYER+1][K_N_LMD_OUTER_WIRES+1][2];
00091 Float_t fLmdCal_T0[E_FIN_OUTER_LAYER+1][K_N_LMD_CHAMS_PER_LAYER+1][K_N_LMD_OUTER_WIRES+1][3];
00092 Float_t fLmdCal_T0C[E_FIN_OUTER_LAYER+1][K_N_LMD_CHAMS_PER_LAYER+1][K_N_LMD_OUTER_WIRES+1][3];
00093
00094 Float_t fStbCal_T0[K_N_STB_CROWNS+1][K_N_STB_TUBES+1];
00095 Float_t fStbCal_Tbar[K_N_STB_CROWNS+1][K_N_STB_TUBES+1];
00096
00097
00098 private:
00099 int extract(char *r, int c);
00100 void Reset();
00101 Int_t FetchTofInfo(const Bool_t &verbose);
00102 Int_t FetchSilInfo(const Bool_t &verbose);
00103 Int_t FetchLmdInfo(const Bool_t &verbose);
00104 Int_t FetchStbInfo(const Bool_t &verbose);
00105
00106 Int_t FetchTofCalibInfo(const Bool_t &verbose);
00107 Int_t FetchLmdCalibInfo(const Bool_t &verbose);
00108 Int_t FetchStbCalibInfo(const Bool_t &verbose);
00109
00110
00111 public:
00112
00113 TFndFeeMap();
00114 ~TFndFeeMap() { }
00115
00116 Int_t ConnectToHost(const TString &host,TString user="",TString passwd="");
00117 void DisconnectFromHost();
00118 Bool_t IsConnected(){ return (fMsqSock !=-1) ? kTRUE : kFALSE; }
00119 Int_t GetDBSockDesc() { return fMsqSock; }
00120 Int_t FetchRunInfo(const Bool_t &verbose,UInt_t run_time=0,Bool_t also_calib=kTRUE);
00121
00122 Bool_t IsThere() {return fIsThere;}
00123
00124 Int_t GetTofAdcSlb(Int_t brd,Int_t chan) { return fTofAdcSlab[brd][chan]; }
00125 Int_t GetTofAdcSide(Int_t brd,Int_t chan) { return fTofAdcSide[brd][chan]; }
00126 Int_t GetTofTdcSlb(Int_t brd,Int_t chan) { return fTofTdcSlab[brd][chan]; }
00127 Int_t GetTofTdcSide(Int_t brd,Int_t chan) { return fTofTdcSide[brd][chan]; }
00128 Int_t GetTofMTSlb(Int_t brd,Int_t chan) { return fTofMtSlab[brd][chan]; }
00129
00130 Int_t GetSilModule(Int_t lay,Int_t icram, Int_t isect)
00131 {
00132 if(lay== (Int_t) E_FIN_INNER_LAYER) return IsiDbAdc[icram][isect].Module;
00133 else if(lay== (Int_t) E_FIN_OUTER_LAYER) return OsiDbAdc[icram][isect].Module;
00134 else cout << "TFndFee BUG!" << endl; return 0;
00135 }
00136 Int_t GetSilSide(Int_t lay,Int_t icram, Int_t isect)
00137 {
00138 if(lay== (Int_t) E_FIN_INNER_LAYER) return IsiDbAdc[icram][isect].P_Z;
00139 else if(lay== (Int_t) E_FIN_OUTER_LAYER) return OsiDbAdc[icram][isect].P_Z;
00140 else cout << "TFndFee BUG!" << endl; return 0;
00141 }
00142
00143 Short_t GetSilStrip(Int_t lay,Int_t icram, Int_t isect, Int_t istrip)
00144 {
00145 if(lay== (Int_t) E_FIN_INNER_LAYER) return IsiDbAdc[icram][isect].Strip[istrip];
00146 else if(lay== (Int_t) E_FIN_OUTER_LAYER) return OsiDbAdc[icram][isect].Strip[istrip];
00147 else cout << "TFndFee BUG!" << endl; return 0;
00148 }
00149
00150
00151
00152 Float_t GetSilSgain(Int_t lay,Int_t icram, Int_t isect, Int_t istrip)
00153 {
00154 if(lay== (Int_t) E_FIN_INNER_LAYER) return IsiDbAdc[icram][isect].Amp[istrip];
00155 else if(lay== (Int_t) E_FIN_OUTER_LAYER) return OsiDbAdc[icram][isect].Amp[istrip];
00156 else cout << "TFndFee BUG!" << endl; return 0;
00157 }
00158
00159 Int_t GetLmdAdcDch(Int_t imodule, Int_t ichannel) { return fLmdAdcDCH[imodule][ichannel]; }
00160 Int_t GetLmdAdcWire(Int_t imodule, Int_t ichannel){ return fLmdAdcWire[imodule][ichannel]; }
00161 Int_t GetLmdAdcSide(Int_t imodule, Int_t ichannel) { return fLmdAdcSide[imodule][ichannel]; }
00162 Int_t GetLmdTdcDch(Int_t imodule, Int_t ichannel) { return fLmdTdcDCH[imodule][ichannel]; }
00163 Int_t GetLmdTdcWire(Int_t imodule, Int_t ichannel) { return fLmdTdcWire[imodule][ichannel]; }
00164 Int_t GetLmdTdcSide(Int_t imodule, Int_t ichannel) { return fLmdTdcSide[imodule][ichannel]; }
00165
00166 Int_t GetStbCrown (Int_t icrate, Int_t imodule, Int_t ichannel) { return fStbTdcCrown[icrate-10][imodule][ichannel]; }
00167 Int_t GetStbWire(Int_t icrate, Int_t imodule, Int_t ichannel) { return fStbTdcWire[icrate-10][imodule][ichannel]; }
00168 Int_t GetStbPatchPanel(Int_t icrate, Int_t imodule, Int_t ichannel) { return fStbTdcPPan[icrate-10][imodule][ichannel]; }
00169 TString GetStbStatus(Int_t icrow, Int_t itube) { return fStbStatus[icrow][itube]; }
00170
00171
00172
00173
00174 Float_t GetTofCal_Q0(Int_t lay,Int_t ch,Int_t side) { return fTofCal_Q0[lay][ch][side]; }
00175 Float_t GetTofCal_Q1(Int_t lay,Int_t ch,Int_t side) { return fTofCal_Q1[lay][ch][side]; }
00176 Float_t GetTofCal_T0_LowTh(Int_t lay,Int_t ch,Int_t side) { return fTofCal_T0_LowTh[lay][ch][side]; }
00177 Float_t GetTofCal_T1_LowTh(Int_t lay,Int_t ch,Int_t side) { return fTofCal_T1_LowTh[lay][ch][side]; }
00178 Float_t GetTofCal_T0_HighTh(Int_t lay,Int_t ch,Int_t side) { return fTofCal_T0_HighTh[lay][ch][side]; }
00179 Float_t GetTofCal_T1_HighTh(Int_t lay,Int_t ch,Int_t side) { return fTofCal_T1_HighTh[lay][ch][side]; }
00180
00181 Float_t GetTofCal_AdcPede(Int_t lay,Int_t ch,Int_t side) { return GetTofCal_Q0(lay,ch,side); }
00182 Float_t GetTofCal_AdcEqu (Int_t lay,Int_t ch,Int_t side) { return GetTofCal_Q1(lay,ch,side); }
00183 Float_t GetTofCal_Tzero_LowTh (Int_t lay,Int_t ch,Int_t side) { return GetTofCal_T0_LowTh(lay,ch,side); }
00184 Float_t GetTofCal_Tconv_LowTh (Int_t lay,Int_t ch,Int_t side) { return GetTofCal_T1_LowTh(lay,ch,side); }
00185 Float_t GetTofCal_Tzero_HighTh (Int_t lay,Int_t ch,Int_t side) { return GetTofCal_T0_HighTh(lay,ch,side); }
00186 Float_t GetTofCal_Tconv_HighTh (Int_t lay,Int_t ch,Int_t side) { return GetTofCal_T1_HighTh(lay,ch,side); }
00187
00188
00189
00190 Float_t GetLmdCal_Q0 (Int_t lay,Int_t ch,Int_t wir,Int_t side) { return fLmdCal_Q0[lay][ch][wir][side]; }
00191 Float_t GetLmdCal_Q1 (Int_t lay,Int_t ch,Int_t wir,Int_t side) { return fLmdCal_Q1[lay][ch][wir][side]; }
00192 Float_t GetLmdCal_T0 (Int_t lay,Int_t ch,Int_t wir,Int_t side) { return fLmdCal_T0[lay][ch][wir][side]; }
00193 Float_t GetLmdCal_T0C(Int_t lay,Int_t ch,Int_t wir,Int_t side) { return fLmdCal_T0C[lay][ch][wir][side]; }
00194
00195 Float_t GetLmdCal_AdcPede(Int_t lay,Int_t ch,Int_t wir,Int_t side) { return GetLmdCal_Q0(lay,ch,wir,side); }
00196 Float_t GetLmdCal_AdcEqu(Int_t lay,Int_t ch,Int_t wir,Int_t side) { return GetLmdCal_Q1(lay,ch,wir,side); }
00197 Float_t GetLmdCal_TzeroHype(Int_t lay,Int_t ch,Int_t wir,Int_t side) { return GetLmdCal_T0(lay,ch,wir,side); }
00198 Float_t GetLmdCal_TzeroCentral(Int_t lay,Int_t ch,Int_t wir,Int_t side) { return GetLmdCal_T0C(lay,ch,wir,side); }
00199
00200 Float_t GetStbCal_T0(Int_t lay,Int_t tub) { return fStbCal_T0[lay][tub]; }
00201 Float_t GetStbCal_Tbar(Int_t lay,Int_t tub) { return fStbCal_Tbar[lay][tub]; }
00202
00204
00205
00206 void PrintTofCalibInfo();
00207 void PrintLmdCalibInfo();
00208 void PrintStbCalibInfo();
00209
00210 void Print(Option_t * = 0) const;
00211
00212 ClassDef(TFndFeeMap,1)
00213
00214 };
00215
00216 #endif // FROOT_TFndFeeMap
00217
00218
00219