StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBTofSimMaker.h
1 /***************************************************************************
2  *
3  * $Id: StBTofSimMaker.h,v 1.10 2021/01/27 14:58:56 geurts Exp $
4  *
5  * Author: Frank Geurts
6  ***************************************************************************
7  *
8  * Description: StBTofSimMaker virtual base class for Barrel TOF Simulations
9  *
10  ***************************************************************************
11  *
12  * $Log: StBTofSimMaker.h,v $
13  * Revision 1.10 2021/01/27 14:58:56 geurts
14  * change path to StVpdSimConfig.h from StVpdSimMaker to StBTofUtil
15  *
16  * Revision 1.9 2018/03/28 02:01:50 jdb
17  * update to StBTofSimMaker to use cell-by-cell time resolution for FastSim
18  *
19  * Revision 1.8 2017/10/20 17:50:33 smirnovd
20  * Squashed commit of the following:
21  *
22  * StBTof: Remove outdated ClassImp macro
23  *
24  * Prefer explicit namespace for std:: names in header files
25  *
26  * Removed unnecessary specification of default std::allocator
27  *
28  * Frank signed-off
29  *
30  * Revision 1.7 2017/03/02 18:25:46 jeromel
31  * Updates to StBTofSimMaker after review
32  *
33  * Revision 1.6 2015/07/28 22:49:55 smirnovd
34  * Initialize static constants outside of class definition
35  *
36  * C++ forbids initialization of non-integral static const members within the class
37  * definition. The syntax is allowed only for integral type variables.
38  *
39  * Revision 1.5 2014/08/06 11:42:54 jeromel
40  * Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
41  *
42  * Revision 1.4 2011/02/03 19:01:01 geurts
43  * Introduce option to switch writing simulated hits to StEvent. Default behavior is OFF.
44  *
45  * Revision 1.3 2010/08/10 19:18:32 geurts
46  * Look for geant data in bfc ("geant") or geant.root ("geantBranch"); Protect storing BTofMcHitCollection in case McEvent is NULL. [Xin]
47  *
48  * Revision 1.2 2010/07/14 20:32:58 geurts
49  * remove geometry initialization (not used)
50  *
51  * Revision 1.1 2009/12/09 21:56:41 dthein
52  * First version of StBTofSimMaker
53  *
54  *
55  **************************************************************************/
56 #ifndef STBTOFSIMMAKER_HH
57 #define STBTOFSIMMAKER_HH
58 #include "StMaker.h"
59 
60 #include "St_DataSet.h"
61 class TH1F;
62 class TH2F;
63 class TNtuple;
64 
65 class StEvent;
66 class StBTofCollection;
67 class StTofSimParam;
68 class StBTofDaqMap;
69 struct g2t_ctf_hit_st;
70 class StBTofHeader;
71 
72 // g2t tables
73 #include "tables/St_g2t_ctf_hit_Table.h"
74 #include "tables/St_g2t_track_Table.h"
75 #include "tables/St_g2t_tpc_hit_Table.h"
76 #include "StBTofUtil/StVpdSimConfig.h"
77 
78 #include "StMcEvent/StMcEvent.hh"
79 #include "StMcEvent/StMcBTofHitCollection.hh"
80 #include "StMcEvent/StMcBTofHit.hh"
81 #include "StThreeVectorF.hh"
82 #include <vector>
83 
84 
85 
86 class StBTofSimResParams;
87 class StBTofSimMaker : public StMaker{
88 protected:
89 
90 
91  StTofSimParam* mSimDb;
92  StBTofSimResParams* mSimResDb;
95 
97  StEvent *mEvent;
98  StMcEvent *mMcEvent;
99  StBTofCollection *mBTofCollection = nullptr;
100  StBTofHeader* mBTofHeader;
101  StVpdSimConfig* mVpdSimConfig;
102 
103  //define some constants
104  enum {
105  mNTOF = 192,
106  mNTray = 120,
107  mNModule = 32,
108  mNCell = 6,
109  mAMP = 50000,
110  mADCBINWIDTH = 25,
111  mTDCBINWIDTH = 50
112  };
113  static const float mVHRBIN2PS;
114  static const float mHRBIN2PS;
115  static const float mBTofPadWidth;
116  static const bool kSimulation = kFALSE;
117  static const bool kEmbedding = kTRUE;
118 
119  bool mVpdSim;
122  bool mCellXtalk;
123  bool mSlow;
124  bool mBookHisto;
126 
128 
129  struct TrackHit{
130  int tray;
131  int module;
132  int cell;
133  int trkId;
134  double dE;
135  double dQ;
136  double dQdt[600];
137  double tof;
138  double s_track;
139  double t0;
140  StThreeVectorF position;
141  };
142 
143 
144  typedef std::vector<TrackHit> TrackVec;
145  typedef std::vector<int> IntVec;
146 
147 
148  string mHistoFile;
149  string mHistoFileName;
150 
151  TNtuple* ntuple;
152 
153  TH1F* mRawBetaHist;
154  TH1F* mBetaHist;
155  TH2F* mRawBetaVsMom;
156  TH2F* mCalcBetaVsMom;
157  TH2F* mBetaVsMom;
158 
159  TH2F* Electron_BetaVsMom;
160  TH2F* Muon_BetaVsMom;
161  TH2F* Pion_BetaVsMom;
162  TH2F* Kaon_BetaVsMom;
163  TH2F* Proton_BetaVsMom;
164 
165  TH1F* mPathLHist;
166  TH1F* mRawTofHist;
167  TH1F* mTofHist;
168  TH1F* mRecMass;
169 
170  TH1F* massHist;
171  TH2F* m2VsP;
172  TH1F* mTofCalculated;
173  TH2F* tof_RealVsCalc;
174 
175  TH1F* momBinRaw1;
176  TH1F* momBinRaw2;
177  TH1F* momBinRaw3;
178  TH1F* momBinRaw4;
179  TH1F* momBinRaw5;
180  TH1F* momBinRaw6;
181  TH1F* momBinRaw7;
182  TH1F* momBinRaw8;
183 
184  TH1F* momBin1;
185  TH1F* momBin2;
186  TH1F* momBin3;
187  TH1F* momBin4;
188  TH1F* momBin5;
189  TH1F* momBin6;
190  TH1F* momBin7;
191  TH1F* momBin8;
192 
193  TH2F* mCellGeant;
194  TH2F* mNCellGeant;
195  TH1F* mDeGeant;
196  TH1F* mTofGeant;
197 
198  TH2F* mCellSeen;
199  TH2F* mNCellSeen;
200  TH1F* mDeSeen;
201  TH1F* mT0Seen;
202  TH1F* mTofSeen;
203  TH1F* mTofResSeen;
204 
205  TH2F* mCellReco;
206  TH2F* mNCellReco;
207  TH1F* mTDCReco;
208  TH1F* mADCReco;
209  TH1F* mT0Reco;
210  TH1F* mTofResReco;
211  TH2F* mTACorr;
212  TH1F* mModHist;
213 
215  TH1F* mdE;
216  TH1F* mdS;
217  TH1F* mT;
218  TH1F* mTime;
219  TH1F* mTime1;
220  TH1F* mPMlength;
221  TH1F* mAdc;
222  TH1F* mTdc;
223 
224  TVolume *starHall;
225 
226  int CellResponse(g2t_ctf_hit_st* tof_hit,
227  TrackVec& trackVec);
228  int CellTimePassTh(TrackVec& trackVec);
229 
230  int FastCellResponse(g2t_ctf_hit_st* tof_hit, StBTofCollection* btofColl);
231 
232  IntVec CalcCellId(int volume_id, float ylocal);
233  int CellXtalk(int icell, float ylocal, float& wt, int& icellx);
234  int storeMcBTofHit(StMcBTofHit *mcCellHit);
235 
236  int fillRaw(void);
237  int electronicNoise(void);
238  float slatResponseExp(float&);
239  double GammaRandom();
240 
241 
242  int fillEvent();
243  int bookHistograms();
244  int ResetFlags();
245 
246 
247 public:
248  StBTofSimMaker(const char *name="TofSim");
249 
250 
251  virtual ~StBTofSimMaker();
252 
253  void Reset();
254  virtual int Init();
255  int InitRun(int);
256  int FinishRun(int);
257  virtual int Make();
258  virtual int Finish();
259 
260  bool getEmbeddingMode() { return mIsEmbedding; }
261  StTofSimParam* GetSimParam() const { return mSimDb; }
262  StBTofCollection* GetBTofCollection() const { return mBTofCollection; }
263  StMcBTofHitCollection* GetMcBTofHitCollection() const { return mMcBTofHitCollection; }
264 
265  void setEmbeddingMode(bool mode = kEmbedding) {
266  mIsEmbedding = mode;
267  }
268  void setCellXtalk(bool val) { mCellXtalk = val; }
269  string setHistFileName();
270  void setBookHist(bool val) { mBookHisto = val; }
271  Int_t writeHistograms();
272  void writeStEvent(bool val = kTRUE) {mWriteStEvent = val;}
273 
274  virtual const char *GetCVS() const
275  {static const char cvs[]="Tag $Name: $ $Id: StBTofSimMaker.h,v 1.10 2021/01/27 14:58:56 geurts Exp $ built " __DATE__ " " __TIME__ ; return cvs;}
276 
277  ClassDef(StBTofSimMaker,2)
278 };
279 #endif
TH2F * mCellReco
cellId after recon
static const float mBTofPadWidth
Pad Width.
TH2F * mCellSeen
cellId after DetectorResponse
double dQdt[600]
this 600 (nTimebins) comes from the /TofUtil/StTofParam file
IntVec CalcCellId(int volume_id, float ylocal)
TH2F * mCellGeant
cellId of geant hit
bool mWriteStEvent
switch to enable Maker to write out simulated hits to StEvent
TH1F * mDeSeen
deposited-energy after DetectorResponse
StMcBTofHitCollection * mMcBTofHitCollection
barrel tof hit
int CellXtalk(int icell, float ylocal, float &wt, int &icellx)
static const float mHRBIN2PS
High resolution mode, ps/bin.
int fillRaw(void)
digitize to ADC and TDC entries (empty)
bool mVpdSim
True when StVpdSimMaker has been run. False otherwise (default)
TH2F * mBetaVsMom
1/beta vs momentum
static const float mVHRBIN2PS
Very High resolution mode, ps/bin.
string mHistoFile
for QA histograms
TH1F * mModHist
T-A Slewing Correlation.
TH2F * m2VsP
Mass Squared versus momentum.
TH1F * mTofResReco
time resolution after recon
TH2F * mNCellReco
of cells after recon
TH1F * mBetaHist
speed of particles hitting tof
bool mSlow
If True, runs the slow Tof Simulation, including CellResponse and CellTimePassTh. ...
Definition: tof.h:15
TH1F * mRecMass
reconstructed mass of particle
TH1F * mTofGeant
tof in geant hit
bool mCellXtalk
switch for cell xtalk
32 modules per tray
TH1F * mTofSeen
smeared-tof after DetectorResponse
TH1F * mdE
TOFp histograms.
TH1F * mDeGeant
deposited-energy in geant hit
TH1F * mTofResSeen
time resolution after Detector Response
TH2F * mTACorr
T-A Slewing Correlation.
bool mIsEmbedding
True when embedding BTof data. False for pure simulation (default)
TH2F * mNCellSeen
of cells after DetectorResponse
TH1F * mADCReco
ADC recon – empty.
double t0
t0 (in ps) as the start of this tof hit – was ns - changed for consistency
int CellTimePassTh(TrackVec &trackVec)
Slow simulation step two.
TH2F * mNCellGeant
of cells of geant hit
StBTofDaqMap * mDaqMap
Tof Daq map.
TOF channels per tray.
St_DataSet * mGeantData
geant table
int electronicNoise(void)
simulate electronic noise (empty)
StBTofSimMaker(const char *name="TofSim")
Pad Width.
int storeMcBTofHit(StMcBTofHit *mcCellHit)
TH1F * mTDCReco
TDC recon.
virtual int Make()
TH1F * mRawTofHist
total time of flight of particle before resolution smearing
bool mUseVpdStart
switch for vpd start
virtual int Finish()
TH1F * mPathLHist
speed of particles hitting tof
int FastCellResponse(g2t_ctf_hit_st *tof_hit, StBTofCollection *btofColl)
6 cells per module
Event data structure to hold all information from a Monte Carlo simulation. This class is the interfa...
Definition: StMcEvent.hh:169
Time-of-Flight Simulation Utilities.
Definition: StTofSimParam.h:24
TH1F * mTofHist
total time of flight of partilce
int mTofHitFlag[mNTray][mNTOF]
hit flag for tof geant hits
int CellResponse(g2t_ctf_hit_st *tof_hit, TrackVec &trackVec)
Slow simulation step one.