00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef STTOFCALIMAKER_H
00048 #define STTOFCALIMAKER_H
00049
00050 #include "TMath.h"
00051 #include "TF1.h"
00052 #include "StMaker.h"
00053
00054 #define VHRBIN2PS 24.4140625 // Very High resolution mode, pico-second per bin
00055
00056 #define HRBIN2PS 97.65625 // High resolution mode, pico-second per bin
00057
00058 #define TMAX 51200. // tdc limit
00059
00060 #include <string>
00061 #include <vector>
00062 #ifndef ST_NO_NAMESPACES
00063 using std::string;
00064 using std::vector;
00065 #endif
00066
00067 class StEvent;
00068 class StTofGeometry;
00069 class StTofCollection;
00070 class StTofDataCollection;
00071 class StTofCellCollection;
00072 class StTofSlatCollection;
00073 class StTofHitCollection;
00074 #include "StPhysicalHelixD.hh"
00075 #include "StTofUtil/StSortTofRawData.h"
00076
00077 #if !defined(ST_NO_TEMPLATE_DEF_ARGS) || defined(__CINT__)
00078 typedef vector<Int_t> IntVec;
00079 typedef vector<Double_t> DoubleVec;
00080 #else
00081 typedef vector<Int_t, allocator<Int_t>> IntVec;
00082 typedef vector<Double_t, allocator<Double_t>> DoubleVec;
00083 #endif
00084
00085 class StTofCalibMaker : public StMaker{
00086 public:
00087
00089 StTofCalibMaker(const char* name="tofCalib");
00091 ~StTofCalibMaker();
00092
00093 Int_t Init();
00094 Int_t InitRun(int);
00095 Int_t FinishRun(int);
00096 Int_t Make();
00097 Int_t Finish();
00098
00099 Int_t processEventYear2to4();
00100 Int_t processEventYear5();
00101 Int_t processEventYear8();
00102
00104 void resetPars();
00106 Int_t initParameters(int);
00108 void initFormulas();
00110 void clearFormulars();
00111
00112 void setTDCLimits(const Double_t, const Double_t);
00113 void setADCCut(const Double_t);
00114 void setTDCWidth(const Double_t);
00115
00116 void setPVPDADCLimits(const Double_t, const Double_t);
00117 void setPVPDTDCLimits(const Double_t, const Double_t);
00118 void setPVPDHitsCut(const Int_t, const Int_t);
00119
00120 Bool_t validPVPDADC(const Double_t);
00121 Bool_t validPVPDTDC(const Double_t);
00122
00124 void setOuterGeometry(const bool);
00125
00127 void setSlewingCorr(const bool);
00128
00130 Double_t tofrT0Corr(const Double_t tof, const Double_t Tstart, const Int_t iDaqChan);
00132 Double_t tofrSlewingCorr(const Double_t tof, const Double_t adc, const Int_t iDaqChan);
00134 Double_t tofrZCorr(const Double_t tof, const Double_t zlocal);
00136 Double_t tofrAllCorr(const Double_t tof, const Double_t Tstart, const Double_t adc, const Double_t zlocal, const Int_t iDaqChan);
00137
00139 Double_t tofpT0Corr(const Double_t tof, const Double_t Tstart, const Int_t iDaqChan);
00141 Double_t tofpSlewingCorr(const Double_t tof, const Double_t adc, const Int_t iDaqChan);
00143 Double_t tofpZCorr(const Double_t tof, const Double_t zlocal);
00145 Double_t tofpAllCorr(const Double_t tof, const Double_t Tstart, const Double_t adc, const Double_t zlocal, const Int_t iDaqChan);
00146
00148 Double_t tstart(const Double_t *adc, const Double_t *tdc, const Double_t Vz);
00149
00151 Double_t GetINLcorr(const int edgeid,const int tempchan,const int bin);
00152 Double_t tstart5(const Double_t *tot, const Double_t *time, const Double_t Vz);
00153 Double_t tofr5AllCorr(const Double_t tof, const Double_t tot, const Double_t zlocal, const Int_t iModuleChan);
00154
00156 void tsum8(const Double_t *tot, const Double_t *time);
00157 Double_t tstart8(const Double_t Vz);
00158 Double_t tofr8AllCorr(const Double_t tof, const Double_t tot, const Double_t zlocal, const Int_t iTray, const Int_t iModuleChan);
00159 Double_t vpdVertexZ();
00160
00161 private:
00163 static Int_t const mNCell = 6;
00164 static Int_t const mNTOFr = 120;
00165 static Int_t const mNTOFp = 41;
00166 static Int_t const mNPVPD = 6;
00167 static Int_t const mNMax = 200;
00168 static Int_t const mNPar = 10;
00170 static Int_t const mNTOFr5 = 192;
00171 static Int_t const mTdigBoard = 10;
00172 static Int_t const mTdcOnBoard = 4;
00173 static Int_t const mTdcChannel = 1024;
00174 static Int_t const mNBinMax = 60;
00176 static const Int_t mNTOF = 192;
00177 static const Int_t mNTDIG = 8;
00178 static const Int_t mNTray8 = 5;
00179 static const Int_t mNModule = 32;
00180 static const Int_t mNVPD = 19;
00181
00182
00183 static const Int_t mNTray = 120;
00184 static const Int_t mWestVpdTrayId = 121;
00185 static const Int_t mEastVpdTrayId = 122;
00186
00187 Double_t mTDCBinWidth;
00188 Double_t mTDCLowLimit;
00189 Double_t mTDCHighLimit;
00190 Double_t mADCCut;
00191 Double_t mTDCWidth;
00192
00193 Double_t mPVPDADCLowLimit;
00194 Double_t mPVPDADCHighLimit;
00195 Double_t mPVPDTDCLowLimit;
00196 Double_t mPVPDTDCHighLimit;
00197
00199 Double_t mTofrADCMin[mNTOFr];
00200 Double_t mTofrADCMax[mNTOFr];
00201 Double_t mTofpADCMin[mNTOFp];
00202 Double_t mTofpADCMax[mNTOFp];
00203
00204 Bool_t mYear2;
00205 Bool_t mYear3;
00206 Bool_t mYear4;
00207 Bool_t mYear5;
00208 Bool_t mYear8;
00209
00210 Bool_t mEastPVPDValid;
00211
00212 Bool_t mValidCalibPar;
00213 Bool_t mValidStartTime;
00214
00215 Double_t mTofrT0[mNTOFr];
00216 Double_t mTofrTAPar[mNTOFr*mNPar];
00217 Double_t mTofrZPar[mNPar];
00218 Double_t mTofpT0[mNTOFp];
00219 Double_t mTofpTAPar[mNTOFp*mNPar];
00220 Double_t mTofpZPar[mNPar];
00221 Double_t mPVPDTAPar[mNPVPD*mNPar];
00222
00223 Double_t mPVPDTdc[mNPVPD];
00224 Double_t mPVPDAdc[mNPVPD];
00225
00226 Int_t mPVPDEastHitsCut;
00227 Int_t mPVPDWestHitsCut;
00228
00229 Double_t mTofrRes[mNTOFr];
00230 Double_t mTofpRes[mNTOFp];
00231 Double_t mPVPDRes[mNPVPD];
00232
00233 TF1* mTofrSlewing;
00234 TF1* mTofpSlewing;
00235 TF1* mTofrZCorr;
00236 TF1* mTofpZCorr;
00237 TF1* mPVPDSlewing;
00238
00240 StSortTofRawData* mSortTofRawData;
00241 Double_t mINLtable[mTdigBoard][mTdcOnBoard][mTdcChannel];
00242
00243 Double_t mTofr5TotEdge[mNTOFr5][mNBinMax];
00244 Double_t mTofr5TotCorr[mNTOFr5][mNBinMax];
00245 Double_t mTofr5ZEdge[mNTOFr5][mNBinMax];
00246 Double_t mTofr5ZCorr[mNTOFr5][mNBinMax];
00247
00248 Double_t mPVPDTotEdge[mNPVPD][mNBinMax];
00249 Double_t mPVPDTotCorr[mNPVPD][mNBinMax];
00250
00251 Double_t mPVPDLeTime[mNPVPD];
00252 Double_t mPVPDTot[mNPVPD];
00253
00255 Double_t mTofTotEdge[mNTray][mNTDIG][mNBinMax];
00256 Double_t mTofTotCorr[mNTray][mNTDIG][mNBinMax];
00257 Double_t mTofZEdge[mNTray][mNTDIG][mNBinMax];
00258 Double_t mTofZCorr[mNTray][mNTDIG][mNBinMax];
00259 Double_t mTofTZero[mNTray][mNModule][mNCell];
00260
00261 Double_t mVPDTotEdge[2*mNVPD][mNBinMax];
00262 Double_t mVPDTotCorr[2*mNVPD][mNBinMax];
00263 Double_t mVPDTZero[2*mNVPD];
00264
00265 Double_t mVPDLeTime[2*mNVPD];
00266 Double_t mVPDTot[2*mNVPD];
00267
00268 Double_t mTSumEast;
00269 Double_t mTSumWest;
00270 UInt_t mVPDHitPatternEast;
00271 UInt_t mVPDHitPatternWest;
00272 Int_t mNEast;
00273 Int_t mNWest;
00274 Double_t mVPDVtxZ;
00275 Double_t mProjVtxZ;
00276 Double_t mTDiff;
00277 Double_t mTStart;
00278
00279 Double_t mPhaseOffset8;
00280 StPhysicalHelixD* mBeamHelix;
00281
00282 StTofGeometry* mTofpGeom;
00283 StEvent* mEvent;
00284 Bool_t mOuterGeometry;
00285
00286 Bool_t mSlewingCorr;
00287
00288 virtual const char *GetCVS() const
00289 {static const char cvs[]="Tag $Name: $ $Id: StTofCalibMaker.h,v 1.8 2008/09/03 22:30:43 dongx Exp $ built "__DATE__" "__TIME__ ; return cvs;}
00290
00291 ClassDef(StTofCalibMaker,5)
00292 };
00293
00294 inline void StTofCalibMaker::setTDCLimits(const Double_t tmin, const Double_t tmax) { mTDCLowLimit = tmin; mTDCHighLimit = tmax; }
00295
00296 inline void StTofCalibMaker::setADCCut(const Double_t cut) { mADCCut = cut; }
00297
00298 inline void StTofCalibMaker::setTDCWidth(const Double_t tdcwid) { mTDCWidth = tdcwid; }
00299
00300 inline void StTofCalibMaker::setPVPDTDCLimits(const Double_t tmin, const Double_t tmax) { mPVPDTDCLowLimit = tmin; mPVPDTDCHighLimit = tmax; }
00301
00302 inline void StTofCalibMaker::setPVPDADCLimits(const Double_t amin, const Double_t amax) { mPVPDADCLowLimit = amin; mPVPDADCHighLimit = amax; }
00303
00304 inline Bool_t StTofCalibMaker::validPVPDADC(const Double_t adc) { return (adc>=mPVPDADCLowLimit&&adc<mPVPDADCHighLimit); }
00305
00306 inline Bool_t StTofCalibMaker::validPVPDTDC(const Double_t tdc) { return (tdc>=mPVPDTDCLowLimit&&tdc<mPVPDTDCHighLimit); }
00307
00308 inline void StTofCalibMaker::setPVPDHitsCut(const Int_t ieast, const Int_t iwest) { mPVPDEastHitsCut=ieast ; mPVPDWestHitsCut=iwest; }
00309
00310 inline void StTofCalibMaker::setOuterGeometry(const bool val) { mOuterGeometry=val; }
00311
00312 inline void StTofCalibMaker::setSlewingCorr(const bool val) { mSlewingCorr=val; }
00313
00314 inline Double_t StTofCalibMaker::vpdVertexZ() { return mVPDVtxZ; }
00315 #endif