00001
00002 #ifndef STAR_StTpcdEdxCorrection
00003 #define STAR_StTpcdEdxCorrection
00004
00005 #include "TObject.h"
00006 #include "Stiostream.h"
00007 #include "StDetectorDbMaker/St_tpcCorrectionC.h"
00008 #include "tables/St_tpcGas_Table.h"
00009 #include "tables/St_TpcSecRowCor_Table.h"
00010 #include "tables/St_tpcGas_Table.h"
00011
00012 #include "StTrackPidTraits.h"
00013
00014
00015
00016 struct dE_t {
00017 public:
00018 Double_t dE;
00019 Double_t dEdx;
00020 Double_t dEdxL;
00021 Double_t dEdxN;
00022 };
00023
00024 struct dEdxCorrection_t {
00025 dEdxCorrection_t(const Char_t *name = 0,const Char_t *title = 0, St_tpcCorrectionC *chair=0, Int_t n=0)
00026 {Name = name, Chair = chair; Title = title; nrows = n; dE = 0;}
00027 const Char_t *Name;
00028 const Char_t *Title;
00029 St_tpcCorrectionC *Chair;
00030 Int_t nrows;
00031 Double_t dE;
00032 };
00033 class dEdxY2_t;
00034
00035 class StTpcdEdxCorrection : public TObject {
00036 public:
00037 enum ESector {kTpcOuter = 0, kTpcInner = 1};
00038 enum EOptions {
00039 kUncorrected = 0,
00040 kEdge ,
00041 kAdcCorrection ,
00042 kTpcdCharge ,
00043 kTpcrCharge ,
00044 kTpcCurrentCorrection,
00045 kTpcRowQ ,
00046 kTpcSecRowB ,
00047 kTpcSecRowC ,
00048 ktpcPressure ,
00049 ktpcTime ,
00050 kDrift ,
00051 kMultiplicity ,
00052 kzCorrection ,
00053 ktpcMethaneIn ,
00054 ktpcGasTemperature,
00055 ktpcWaterOut ,
00056 kSpaceCharge ,
00057 kPhiDirection ,
00058 kdXCorrection ,
00059 kTpcPadTBins ,
00060 kTpcZDC ,
00061 kTpcLast ,
00062 kTpcLengthCorrection,
00063 kTpcdEdxCor ,
00064 kTpcAllCorrections
00065 };
00066 StTpcdEdxCorrection(Int_t Option=0, Int_t debug=0);
00067 ~StTpcdEdxCorrection();
00068 Int_t dEdxCorrection(dEdxY2_t &dEdx, Bool_t doIT=kTRUE);
00069 Int_t dEdxTrackCorrection(EOptions k, Int_t type, dst_dedx_st &dedx);
00070 void SettpcGas (St_tpcGas *m = 0);
00071
00072 void SetTpcSecRowB (St_TpcSecRowCor *m = 0);
00073 void SetTpcSecRowC (St_TpcSecRowCor *m = 0);
00074 void SetCorrection (Int_t k = 0, St_tpcCorrection *m = 0);
00075 void Setdrift (St_tpcCorrection *m = 0) {SetCorrection (kDrift , m);}
00076 void SetMultiplicity (St_tpcCorrection *m = 0) {SetCorrection (kMultiplicity , m);}
00077 void SetAdcCorrection (St_tpcCorrection *m = 0) {SetCorrection (kAdcCorrection , m);}
00078 void SetzCorrection (St_tpcCorrection *m = 0) {SetCorrection (kzCorrection , m);}
00079 void SetdXCorrection (St_tpcCorrection *m = 0) {SetCorrection (kdXCorrection , m);}
00080 void SetTpcdEdxCor (St_tpcCorrection *m = 0) {SetCorrection (kTpcdEdxCor , m);}
00081 void SetTpcLengthCorrection (St_tpcCorrection *m = 0) {SetCorrection (kTpcLengthCorrection , m);}
00082 void SettpcPressure (St_tpcCorrection *m = 0) {SetCorrection (ktpcPressure , m);}
00083 void SettpcMethaneIn (St_tpcCorrection *m = 0) {SetCorrection (ktpcMethaneIn , m);}
00084 void SettpcGasTemperature (St_tpcCorrection *m = 0) {SetCorrection (ktpcGasTemperature , m);}
00085 void SettpcWaterOut (St_tpcCorrection *m = 0) {SetCorrection (ktpcWaterOut , m);}
00086 void SetTpcPadTBins (St_tpcCorrection *m = 0) {SetCorrection (kTpcPadTBins , m);}
00087
00088 void SetDebug(Int_t m=0) {m_Debug = m;}
00089 void SetMask (Int_t m=0) {m_Mask = m;}
00090 void ReSetCorrections();
00091
00092 St_tpcGas *tpcGas() {return m_tpcGas;}
00093
00094
00095 St_TpcSecRowCor *TpcSecRowB() {return m_TpcSecRowB;}
00096 St_TpcSecRowCor *TpcSecRowC() {return m_TpcSecRowC;}
00097
00098 St_tpcCorrectionC *Correction(Int_t k = 0) {
00099 return (k > kTpcSecRowC && k < kTpcAllCorrections && m_Corrections[k].Chair) ? m_Corrections[k].Chair : 0;
00100 }
00101 St_tpcCorrectionC *drift() {return Correction(kDrift);}
00102 St_tpcCorrectionC *Multiplicity() {return Correction(kMultiplicity);}
00103 St_tpcCorrectionC *AdcCorrection() {return Correction(kAdcCorrection);}
00104 St_tpcCorrectionC *zCorrection() {return Correction(kzCorrection);}
00105 St_tpcCorrectionC *dXCorrection() {return Correction(kdXCorrection);}
00106 St_tpcCorrectionC *TpcdEdxCor() {return Correction(kTpcdEdxCor);}
00107 St_tpcCorrectionC *TpcLengthCorrection() {return Correction(kTpcLengthCorrection);}
00108 St_tpcCorrectionC *tpcPressure() {return Correction(ktpcPressure);}
00109 St_tpcCorrectionC *tpcMethaneIn() {return Correction(ktpcMethaneIn);}
00110 St_tpcCorrectionC *tpcGasTemperature() {return Correction(ktpcGasTemperature);}
00111 St_tpcCorrectionC *tpcWaterOut() {return Correction(ktpcWaterOut);}
00112 St_tpcCorrectionC *TpcPadTBins() {return Correction(kTpcPadTBins);}
00113 Int_t Debug() {return m_Debug;}
00114 Int_t Mask() {return m_Mask;}
00115 Double_t Adc2GeV() {return mAdc2GeV;}
00116 void Print(Option_t *opt = "") const;
00117 private:
00118 Int_t m_Mask;
00119 St_tpcGas *m_tpcGas;
00120 dEdxY2_t *mdEdx;
00121
00122
00123
00124 St_TpcSecRowCor *m_TpcSecRowB;
00125 St_TpcSecRowCor *m_TpcSecRowC;
00126 Double_t mAdc2GeV;
00127 dEdxCorrection_t m_Corrections[kTpcAllCorrections];
00128 Int_t m_Debug;
00129 ClassDef(StTpcdEdxCorrection,0)
00130 };
00131
00132 class dEdxY2_t : public TObject {
00133 public:
00134 dEdxY2_t() {}
00135 virtual ~dEdxY2_t() {}
00136
00137
00138
00139
00140 Char_t first[1];
00141 Int_t sector;
00142 Int_t row;
00143 Float_t pad;
00144 Int_t Npads;
00145 Int_t Ntbins;
00146 Double_t ZdriftDistance;
00147 Double_t ZdriftDistanceO2;
00148 Double_t ZdriftDistanceO2W;
00149 Double_t DeltaZ;
00150 Double_t QRatio;
00151 Double_t QRatioA;
00152 Double_t QSumA;
00153 Double_t dx;
00154 Double_t dxH;
00155 Double_t dE;
00156 Double_t dEdx;
00157 Double_t dEdxL;
00158 Double_t dEdxN;
00159 Double_t xyz[3];
00160 Double_t xyzD[3];
00161 Double_t edge;
00162 Double_t PhiR;
00163 Double_t resXYZ[3];
00164 Double_t Prob;
00165 Double_t zdev;
00166 Double_t zP;
00167 Double_t zG;
00168 Double_t sigmaP;
00169 Double_t dCharge;
00170 Double_t rCharge;
00171 Int_t lSimulated;
00172 Double_t Qcm;
00173 Double_t Crow;
00174 Double_t Zdc;
00175 Double_t Weight;
00176 Double_t adc;
00177 dE_t C[StTpcdEdxCorrection::kTpcAllCorrections];
00178 Char_t last[1];
00179 void Reset() {memset(first, 0, last - first);}
00180 ClassDef(dEdxY2_t,1)
00181 };
00182
00183 #endif