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 #ifndef STBTOFSIMMAKER_HH
00028 #define STBTOFSIMMAKER_HH
00029 #include "StMaker.h"
00030
00031 #include "St_DataSet.h"
00032 class TH1F;
00033 class TH2F;
00034 class TNtuple;
00035 class TNtuple;
00036 class TProfile;
00037
00038 class StEvent;
00039 class StBTofCollection;
00040 class StTofSimParam;
00041 class StBTofDaqMap;
00042 struct g2t_ctf_hit_st;
00043
00044
00045 #include "tables/St_g2t_ctf_hit_Table.h"
00046 #include "tables/St_g2t_vpd_hit_Table.h"
00047 #include "tables/St_g2t_track_Table.h"
00048 #include "tables/St_g2t_tpc_hit_Table.h"
00049
00050 #include "StMcEvent/StMcEvent.hh"
00051 #include "StMcEvent/StMcBTofHitCollection.hh"
00052 #include "StMcEvent/StMcBTofHit.hh"
00053 #include "StThreeVectorF.hh"
00054 #include <vector>
00055 #ifndef ST_NO_NAMESPACES
00056 using std::vector;
00057 #endif
00058
00059 class StBTofSimMaker : public StMaker{
00060 protected:
00061
00062
00063 StTofSimParam* mSimDb;
00064 StBTofDaqMap* mDaqMap;
00065 StMcBTofHitCollection *mMcBTofHitCollection;
00066
00067 St_DataSet *mGeantData;
00068 StEvent *mEvent;
00069 StMcEvent *mMcEvent;
00070 StBTofCollection *mBTofCollection;
00071
00072
00073 enum {
00074 mNTOF = 192,
00075 mNVPD = 19,
00076 mNTray = 120,
00077 mNModule = 32,
00078 mNCell = 6,
00079 mAMP = 50000,
00080 mADCBINWIDTH = 25,
00081 mTDCBINWIDTH = 50
00082 };
00083 const static float mVHRBIN2PS = 24.4;
00084 const static float mHRBIN2PS = 97.7;
00085 const static float mBTofPadWidth = 3.45;
00086
00087
00088 Bool_t mCellXtalk;
00089 Bool_t mSlow;
00090 Bool_t mBookHisto;
00091 Bool_t mWriteStEvent;
00092
00093 Int_t mTofHitFlag[mNTray][mNTOF];
00094 Int_t mVpdHitFlag[2*mNVPD];
00095
00096 struct TrackHit{
00097 Int_t tray;
00098 Int_t module;
00099 Int_t cell;
00100 Int_t trkId;
00101 Double_t dE;
00102 Double_t dQ;
00103 Double_t dQdt[600];
00104 Double_t tof;
00105 Double_t s_track;
00106 Double_t t0;
00107 StThreeVectorF position;
00108 };
00109
00110
00111 typedef vector<TrackHit, allocator<TrackHit> > TrackVec;
00112 typedef vector<Int_t> IntVec;
00113
00114
00115 string mHistFile;
00116 TH1F* mBetaHist;
00117 TH1F* mPathLHist;
00118 TH1F* mTofHist;
00119 TH1F* mRecMass;
00120
00121 TH2F* mCellGeant;
00122 TH1F* mVpdGeant;
00123 TH2F* mNCellGeant;
00124 TH2F* mNVpdGeant;
00125 TH1F* mDeGeant;
00126 TH1F* mTofGeant;
00127
00128 TH2F* mCellSeen;
00129 TH1F* mVpdSeen;
00130 TH2F* mNCellSeen;
00131 TH2F* mNVpdSeen;
00132 TH1F* mDeSeen;
00133 TH1F* mT0Seen;
00134 TH1F* mTofSeen;
00135 TH1F* mTofResSeen;
00136 TH1F* mVpdResSeen;
00137
00138 TH2F* mCellReco;
00139 TH1F* mVpdReco;
00140 TH2F* mNCellReco;
00141 TH2F* mNVpdReco;
00142 TH1F* mTDCReco;
00143 TH1F* mADCReco;
00144 TH1F* mT0Reco;
00145 TH1F* mTofResReco;
00146 TH1F* mVpdResReco;
00147 TH2F* mTACorr;
00148 TH1F* mModHist;
00149
00151 TH1F* mdE;
00152 TH1F* mdS;
00153 TH1F* mNumberOfPhotoelectrons;
00154 TH1F* mT;
00155 TH1F* mTime;
00156 TH1F* mTime1;
00157 TH1F* mPMlength;
00158 TH1F* mAdc;
00159 TH1F* mTdc;
00160
00161 TVolume *starHall;
00162
00163 Int_t CellResponse(g2t_ctf_hit_st* tof_hit,
00164 TrackVec& trackVec);
00165 Int_t CellTimePassTh(TrackVec& trackVec);
00166
00167 Int_t FastCellResponse(g2t_ctf_hit_st* tof_hit);
00168 Int_t VpdResponse(g2t_vpd_hit_st* vpd_hit);
00169
00170 IntVec CalcCellId(Int_t volume_id, Float_t ylocal);
00171 Int_t CellXtalk(Int_t icell, Float_t ylocal, Float_t& wt, Int_t& icellx);
00172 Int_t storeMcBTofHit(StMcBTofHit *mcCellHit);
00173
00174 Int_t fillRaw(void);
00175 Int_t electronicNoise(void);
00176 Float_t slatResponseExp(Float_t&);
00177 Double_t GammaRandom();
00178
00179
00180 Int_t fillEvent();
00181 Int_t bookHistograms();
00182 Int_t writeHistograms();
00183 Int_t ResetFlags();
00184
00185
00186 public:
00187 StBTofSimMaker(const char *name="TofSim");
00188
00189
00190 virtual ~StBTofSimMaker();
00191
00192 void Reset();
00193 virtual Int_t Init();
00194 Int_t InitRun(Int_t);
00195 Int_t FinishRun(Int_t);
00196 virtual Int_t Make();
00197 virtual Int_t Finish();
00198
00199 StTofSimParam* GetSimParam() const { return mSimDb; }
00200 StBTofCollection* GetBTofCollection() const { return mBTofCollection; }
00201 StMcBTofHitCollection* GetMcBTofHitCollection() const { return mMcBTofHitCollection; }
00202
00203 void setCellXtalk(Bool_t val) { mCellXtalk = val; }
00204 void setHistFileName(string s);
00205 void setBookHist(Bool_t val) { mBookHisto = val; }
00206 void writeStEvent(Bool_t val = kTRUE) {mWriteStEvent = val;}
00207
00208 virtual const char *GetCVS() const
00209 {static const char cvs[]="Tag $Name: $ $Id: StBTofSimMaker.h,v 1.4 2011/02/03 19:01:01 geurts Exp $ built "__DATE__" "__TIME__ ; return cvs;}
00210
00211 ClassDef(StBTofSimMaker,1)
00212 };
00213 #endif