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 #ifndef STBTOFCALIMAKER_H
00044 #define STBTOFCALIMAKER_H
00045
00046 #include "phys_constants.h"
00047 #include "TMath.h"
00048 #include "StMaker.h"
00049
00050 #include <string>
00051 #include <vector>
00052 #ifndef ST_NO_NAMESPACES
00053 using std::string;
00054 using std::vector;
00055 #endif
00056
00057 class StEvent;
00058 class StPrimaryVertex;
00059 class StBTofGeometry;
00060 class StBTofCollection;
00061 class StBTofHeader;
00062 class StBTofHitCollection;
00063 class StBTofPidTraits;
00064 class StMuDst;
00065 class StMuPrimaryVertex;
00066 class StMuBTofPidTraits;
00067 #include "StPhysicalHelixD.hh"
00068
00069 #if !defined(ST_NO_TEMPLATE_DEF_ARGS) || defined(__CINT__)
00070 typedef vector<Int_t> IntVec;
00071 typedef vector<Double_t> DoubleVec;
00072 #else
00073 typedef vector<Int_t, allocator<Int_t>> IntVec;
00074 typedef vector<Double_t, allocator<Double_t>> DoubleVec;
00075 #endif
00076
00077 class StBTofCalibMaker : public StMaker{
00078 public:
00079
00081 StBTofCalibMaker(const char* name="btofCalib");
00083 virtual ~StBTofCalibMaker();
00084
00085 virtual Int_t Init();
00086 virtual Int_t InitRun(int);
00087 virtual Int_t FinishRun(int);
00088 virtual Int_t Make();
00089 virtual Int_t Finish();
00090
00092 void setOuterGeometry(const bool val=kTRUE);
00094 void setSlewingCorr(const bool val=kTRUE);
00096 void setUseEventVertex(const bool);
00098 void setVPDHitsCut(const Int_t, const Int_t);
00100 void setMuDstIn(const bool val=kTRUE);
00101
00103 void setCreateHistoFlag(Bool_t histos=kTRUE);
00105 void setHistoFileName(const Char_t*);
00106
00108 void setInitFromFile(const Bool_t val = kTRUE);
00109 void setCalibFilePvpd(const Char_t*);
00110 void setCalibFileTot(const Char_t*);
00111 void setCalibFileZhit(const Char_t*);
00112 void setCalibFileT0(const Char_t*);
00113
00114 enum calibtype {NOTSET=0, BOARDCALIB=960, MODULECALIB=3840, CELLCALIB=23040};
00115 Int_t getZCalibType();
00116 Int_t getTotCalibType();
00117
00118 private:
00119
00121 calibtype mZCalibType, mTotCalibType;
00123 void resetPars();
00125 void initEvent();
00127 void resetVpd();
00129 void loadVpdData();
00131 void writeStartTime();
00133 Int_t initParameters(Int_t runnumber);
00134
00136 void processStEvent();
00138 void processMuDst();
00140 void cleanCalibMuDst();
00141 void cleanCalib(StMuBTofPidTraits&);
00142
00144 void tstart(const Double_t Vz, Double_t *tstart, Double_t *tdiff);
00145
00146 Double_t tofAllCorr(const Double_t tof, const Double_t tot, const Double_t zlocal, const Int_t iTray, const Int_t iModuleChan);
00147
00149 void tstart_NoVpd(const StBTofCollection *btofCollection, const StPrimaryVertex *pVtx, Double_t *tstart);
00150 void tstart_NoVpd(const StMuDst *muDst, const StMuPrimaryVertex *pVtx, Double_t *tstart);
00151
00152
00154 void bookHistograms();
00156 void writeHistograms();
00157
00158 private:
00159 enum{
00160 mNTOF = 192,
00161 mNTDIG = 8,
00162 mNModule = 32,
00163 mNVPD = 19,
00164 mNCell = 6,
00165 mNBinMax = 60,
00166
00167 mNTray = 120,
00168 mWestVpdTrayId = 121,
00169 mEastVpdTrayId = 122
00170 };
00171
00172 static const Double_t VHRBIN2PS;
00173
00174 static const Double_t HRBIN2PS;
00175
00176 static const Double_t TMAX;
00177 static const Double_t VZDIFFCUT;
00178 static const Double_t DCARCUT;
00179
00180 static const Double_t mC_Light;
00181
00182 Bool_t mValidCalibPar;
00183 Bool_t mValidStartTime;
00184
00185 Int_t mVPDEastHitsCut;
00186 Int_t mVPDWestHitsCut;
00187
00188 Float_t mTofTotEdge[mNTray][mNModule][mNCell][mNBinMax];
00189 Float_t mTofTotCorr[mNTray][mNModule][mNCell][mNBinMax];
00190 Float_t mTofZEdge[mNTray][mNModule][mNCell][mNBinMax];
00191 Float_t mTofZCorr[mNTray][mNModule][mNCell][mNBinMax];
00192 Double_t mTofTZero[mNTray][mNModule][mNCell];
00193
00194 Double_t mVPDLeTime[2*mNVPD];
00195
00196 Double_t mTSumEast;
00197 Double_t mTSumWest;
00198 UInt_t mVPDHitPatternEast;
00199 UInt_t mVPDHitPatternWest;
00200 Int_t mNEast;
00201 Int_t mNWest;
00202 Double_t mVPDVtxZ;
00203 Double_t mProjVtxZ;
00204 Double_t mEvtVtxZ;
00205 Double_t mTDiff;
00206 Double_t mTStart;
00207 Int_t mNTzero;
00208
00209 StPhysicalHelixD* mBeamHelix;
00210
00211 StEvent* mEvent;
00212 StBTofHeader* mBTofHeader;
00213 StMuDst* mMuDst;
00214 Bool_t mMuDstIn;
00215
00216 Bool_t mOuterGeometry;
00217 Bool_t mSlewingCorr;
00218 Bool_t mUseEventVertex;
00219 Bool_t mInitFromFile;
00220 Bool_t mUseVpdStart;
00221
00222 string mCalibFilePvpd;
00223 string mCalibFileTot;
00224 string mCalibFileZhit;
00225 string mCalibFileT0;
00226
00227 Bool_t mHisto;
00228 string mHistoFileName;
00229 TH1D* hEventCounter;
00230
00231 virtual const char *GetCVS() const
00232 {static const char cvs[]="Tag $Name: $ $Id: StBTofCalibMaker.h,v 1.7 2010/10/31 05:51:06 geurts Exp $ built "__DATE__" "__TIME__ ; return cvs;}
00233
00234 ClassDef(StBTofCalibMaker,3)
00235 };
00236
00237 inline void StBTofCalibMaker::setVPDHitsCut(const Int_t ieast, const Int_t iwest) { mVPDEastHitsCut=ieast ; mVPDWestHitsCut=iwest; }
00238 inline void StBTofCalibMaker::setOuterGeometry(const bool val) { mOuterGeometry=val; }
00239 inline void StBTofCalibMaker::setSlewingCorr(const bool val) { mSlewingCorr=val; }
00240 inline void StBTofCalibMaker::setUseEventVertex(const bool val) { mUseEventVertex=val; }
00241 inline void StBTofCalibMaker::setMuDstIn(const bool val) { mMuDstIn = val; }
00242 inline void StBTofCalibMaker::setHistoFileName(const Char_t* filename){ mHistoFileName=filename; }
00243 inline void StBTofCalibMaker::setCreateHistoFlag(Bool_t histos) { mHisto = histos; }
00244 inline void StBTofCalibMaker::setInitFromFile(const Bool_t val) {mInitFromFile = val; }
00245 inline void StBTofCalibMaker::setCalibFilePvpd(const Char_t* filename) {mCalibFilePvpd = filename;}
00246 inline void StBTofCalibMaker::setCalibFileTot(const Char_t* filename) {mCalibFileTot = filename;}
00247 inline void StBTofCalibMaker::setCalibFileZhit(const Char_t* filename) {mCalibFileZhit = filename;}
00248 inline void StBTofCalibMaker::setCalibFileT0(const Char_t* filename) {mCalibFileT0 = filename;}
00249 inline Int_t StBTofCalibMaker::getZCalibType() {return Int_t(mZCalibType);}
00250 inline Int_t StBTofCalibMaker::getTotCalibType() {return Int_t(mTotCalibType);}
00251
00252 #endif