StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBTofSimMaker.cxx
1 /***************************************************************************
2  *
3  * $Id: StBTofSimMaker.cxx,v 1.18 2021/01/27 16:24:27 geurts Exp $
4  *
5  * Author: Frank Geurts
6  ***************************************************************************
7  *
8  * Description: StBTofSimMaker class for Barrel TOF Simulations
9  *
10  ***************************************************************************
11  *
12  * VPD Removed by Nickolas Luttrell (Rice University)
13  *
14  **************************************************************************/
16 
23 #include <Stiostream.h>
24 #include "StBTofSimMaker.h"
25 
26 // SCL
27 #include <math.h>
28 #include <string>
29 #include "TRandom.h"
30 #include "SystemOfUnits.h"
31 #include "phys_constants.h"
32 #include "StThreeVectorD.hh"
33 #include "Random.h"
34 #include "RanluxEngine.h"
35 #include "RandGauss.h"
36 #include "TH1.h"
37 #include "TH2.h"
38 #include "TFile.h"
39 
40 // g2t tables and collections
41 #include "tables/St_g2t_ctf_hit_Table.h"
42 #include "tables/St_g2t_track_Table.h"
43 #include "StMcTrack.hh"
44 #include "StBTofUtil/StVpdSimConfig.h"
45 
46 #include "StBTofUtil/StBTofDaqMap.h"
47 #include "StTofUtil/tofPathLength.hh"
48 #include "StTofUtil/StTofSimParam.h"
49 #include "StBTofUtil/StBTofGeometry.h"
50 #include "StEventTypes.h"
51 #include "StEvent/StBTofCollection.h"
52 #include "StChain/StChainOpt.h"
53 #include "StVpdSimMaker/StVpdSimMaker.h"
54 #include "StVpdCalibMaker/StVpdCalibMaker.h"
55 #include "StBTofUtil/StBTofSimResParams.h"
56 
57 static RanluxEngine engine;
58 static RandGauss ranGauss(engine);
59 
60 
61 const float StBTofSimMaker::mVHRBIN2PS = 24.4;
62 const float StBTofSimMaker::mHRBIN2PS = 97.7;
63 const float StBTofSimMaker::mBTofPadWidth = 3.45;
64 
65  //_____________________________________________________________________________
66 StBTofSimMaker::StBTofSimMaker(const char *name):StMaker(name)
67 {
69  mBookHisto=kFALSE;
70  mSlow=kFALSE;
71  mCellXtalk=kTRUE;
72  mWriteStEvent=kTRUE;
73  mDaqMap=0;
75  mIsEmbedding = kSimulation;
76  mVpdSim = kFALSE;
77  mUseVpdStart = kTRUE;
78  Reset();
79 
80 }
81 
82 //_____________________________________________________________________________
83 StBTofSimMaker::~StBTofSimMaker()
84 {
85  delete mSimDb;
86  delete mDaqMap;
87 
88 }
89 
90 
91 //_____________________________________________________________________________
92 int StBTofSimMaker::Init()
93 {
94  Reset();
95  //mSimDb = new StTofSimParam(); // Moved to InitRun
96  //if (Debug()) mSimDb->print(); // Moved to InitRun
97  if(mBookHisto) bookHistograms();
98 
99  return StMaker::Init();
100 }
101 
102 //_____________________________________________________________________________
103 void StBTofSimMaker::Reset()
104 {
105  mBTofHeader = 0;
106  mGeantData = 0;
107  mEvent = 0;
108  mMcEvent = 0;
109  delete mMcBTofHitCollection;
110  mSimDb = 0;
111 
112  if(mDaqMap){delete mDaqMap; mDaqMap = 0;}
113 
114  ResetFlags();
115 }
116 
117 //_____________________________________________________________________________
119 {
121  memset(mTofHitFlag, 0, sizeof(mTofHitFlag));
122  return kStOk;
123 }
124 
125 //_____________________________________________________________________________
126 int StBTofSimMaker::InitRun(int runnumber)
127 {
128 
130  mDaqMap = new StBTofDaqMap();
131  mDaqMap->Init(this);
132  mSimDb = new StTofSimParam();
133  mSimResDb = new StBTofSimResParams();
134  mSimResDb->loadParams();
135  //mSimDb->init(); // Only enable to pull calibration values from db
136  if (Debug()) mSimDb->print();
137  StVpdSimMaker *vpdSim = (StVpdSimMaker *)GetMaker("VpdSim");
138 
140  if (vpdSim) {
141  mVpdSim = kTRUE;
142  }
143  mVpdSimConfig = new StVpdSimConfig;
144 
146  StVpdCalibMaker *vpdCalib = (StVpdCalibMaker *)GetMaker("vpdCalib");
147  if(vpdCalib) {
148  mUseVpdStart = vpdCalib->useVpdStart();
149  }
150 
151  return kStOK;
152 }
153 
154 //_____________________________________________________________________________
155 int StBTofSimMaker::FinishRun(int runnumber)
156 {
157  LOG_INFO << "StBTofSimMaker::FinishRun -- cleaning up BTOF DAQ map --" << endm;
158  if (mDaqMap){delete mDaqMap; mDaqMap = 0;}
159  if (mSimDb){delete mSimDb; mSimDb = 0;}
160  if (mSimResDb){delete mSimResDb; mSimResDb = 0;}
161  if (mVpdSimConfig){delete mVpdSimConfig; mVpdSimConfig = 0;}
162  return kStOk;
163 }
164 
165 //_____________________________________________________________________________
167 {
168  if(mBookHisto){
169  LOG_INFO << "StBTofSimMaker::Finish writing BTofSim.root ..." << endm;
170  mHistoFileName = setHistFileName();
171  if (mHistoFileName == "") {
172  LOG_INFO << "Nothing stored in mHistoFileName!" << endm;
173  mHistoFileName = "BTofSim.root";
174  }
175  else {
176  LOG_INFO << "The Filename is: " << mHistoFileName.c_str() << endm;
177  }
178  TFile aFile(mHistoFileName.c_str(),"RECREATE","tofsim");
179 
180  aFile.cd();
181  // if ( ntuple )
182  // ntuple->SetDirectory(aFile.CurrentDirectory());
183 
184  writeHistograms();
185  aFile.Write();
186  aFile.Close();
187  }
188  return kStOK;
189 }
190 
191 
192 //_____________________________________________________________________________
194 {
195  LOG_INFO << "StBTofSimMaker Make() starts" << endm;
196 
197  ResetFlags();
198 
200 
202  mGeantData = GetInputDS("geant");
203  if(!mGeantData) {
204  mGeantData = GetInputDS("geantBranch");
205  }
206  if(!mGeantData) {
207  LOG_WARN << " No GEANT data loaded. Exit! " << endm;
208  return kStWarn;
209  }
210  LOG_INFO << " Found GEANT data -- loading VPD/TOF hits... " << endm;
211 
213  mEvent = (StEvent*)GetInputDS("StEvent");
214  if (!mEvent) {
215  LOG_ERROR << "No StEvent! Bailing out ..." << endm;
216  }
217  StBTofCollection *btofColl = mEvent->btofCollection();
218 
219 
221  St_g2t_ctf_hit* g2t_tfr_hits = 0;
222  g2t_tfr_hits = dynamic_cast<St_g2t_ctf_hit*> (mGeantData->Find("g2t_tfr_hit"));
223  if(!g2t_tfr_hits) {
224  LOG_WARN << " No TOF hits in GEANT" << endm; }
225  else {
226  int nhits = g2t_tfr_hits->GetNRows();
227  LOG_INFO << " Found GEANT TOF hits: " << nhits << endm;
228  g2t_ctf_hit_st* tofHitsFromGeant = g2t_tfr_hits->begin();
229 
230  if(mSlow) {
232  TrackVec tofResponseVec;
233  tofResponseVec.clear();
234  for (int i=0; i<nhits; i++, tofHitsFromGeant++) {
236  CellResponse(tofHitsFromGeant,tofResponseVec);
237  }
239  CellTimePassTh(tofResponseVec);
240  }
241  else if(!mSlow) {
242  for (int i=0; i<nhits; i++, tofHitsFromGeant++) FastCellResponse(tofHitsFromGeant, btofColl);
243  }
244  else
245  LOG_WARN << " No TOF simulator specified " << endm;
246  }
247  LOG_INFO << " McBTofHit Size (TOF) = " << mMcBTofHitCollection->hits().size() << endm;
248 
249 
250  fillEvent();
251 
252  return kStOK;
253 }
254 
255 
256 //_____________________________________________________________________________
258 int StBTofSimMaker::CellResponse(g2t_ctf_hit_st* tofHitsFromGeant,
259  TrackVec& tofResponseVec)//slow sim part 1
260 {
269 
270  // accept TOF hit
271  if(tofHitsFromGeant->s_track<=0.0 || tofHitsFromGeant->de <=0.0) {
272  LOG_WARN << " No deposited energy in this TOF hit!" << endm;
273  return kStWarn;
274  }
275 
276  IntVec cellId = CalcCellId(tofHitsFromGeant->volume_id, tofHitsFromGeant->x[1]);
277  int icell, imodule, itray;
278  itray = cellId[0];
279  imodule = cellId[1];
280  icell = cellId[2];
281  if (itray==-1 || imodule==-1 || icell==-1) {
282  LOG_WARN << " Not hit the sensitive MRPC volume!" << endm;
283  return kStWarn;
284  }
285  if(mBookHisto) {
286  mDeGeant->Fill(tofHitsFromGeant->de / keV);
287  mTofGeant->Fill(tofHitsFromGeant->tof / nanosecond);
288  }
289 
290 
291  St_g2t_track *g2t_track = static_cast<St_g2t_track *>(mGeantData->Find("g2t_track"));
292  if (!g2t_track) {
293  LOG_WARN << " No G2T track table!" << endm;
294  return kStWarn;
295  };
296  g2t_track_st *tof_track = g2t_track->GetTable();
297  int no_tracks= g2t_track->GetNRows();
298 
299  // Initialize beta to be a large negative value. This is a flag in case the following if
300  // condition is not satisfied and meaning there is something wrong with the beta value.
301  //
302  double beta = -999.;
303  int trackId = -1;
304  for(int j=0;j<no_tracks;j++){
305  if(tofHitsFromGeant->track_p==tof_track[j].id){
306  trackId = j;//
307  beta = tof_track[j].ptot/tof_track[j].e;
308  break;
309  }
310  }
311 
312  double qtot=-1;
313  double tof=-1;
314  double t0 = tofHitsFromGeant->tof;
315  float wt=1.0;
316 
317  double clusterDensity = mSimDb->nclus(beta);
318  double gapLength = mSimDb->dg();
319  double alpha = mSimDb->alpha();
320  double ka = mSimDb->ka();
321  double kaa = ka/(alpha*gapLength);
322 
323  const int maxClusters=mSimDb->nmaxclus();
324  const int nTimeBins = mSimDb->ndt();
325  double driftVelocity[maxClusters],nElectrons[maxClusters],startPositionOfCluster[maxClusters],sa[maxClusters];
326  double s[maxClusters][nTimeBins];
327 
328  double chargeDepositedPerTimeBin[nTimeBins];
329  for(int j=0;j<nTimeBins;j++) {chargeDepositedPerTimeBin[j] = 0.0;}
330 
331  int nElectronClusters=-1;
332  while(nElectronClusters<1) {nElectronClusters=gRandom->Poisson(gapLength*clusterDensity);}
333  if(nElectronClusters>maxClusters) nElectronClusters = maxClusters;
334 
335  for(int m=0;m<nElectronClusters;m++) {
336  driftVelocity[m] = mSimDb->vd_mean()*(0.90+0.20*gRandom->Rndm(1));
337 
338  int nElectrons_temp=-1;
339  while(nElectrons_temp<1){nElectrons_temp = gRandom->Poisson(mSimDb->nmeane());}
340  nElectrons[m] = double(nElectrons_temp);
341 
342  startPositionOfCluster[m]=gapLength+1;
343  while(startPositionOfCluster[m]>gapLength) { startPositionOfCluster[m] = gRandom->Exp(1.0/clusterDensity); } //mm
344  }
345 
346  double ytmp=0.0;
347  for(int m=0;m<nElectronClusters;m++) {
348  sa[m] = (exp(alpha*(gapLength-startPositionOfCluster[m]))-1)*nElectrons[m]*GammaRandom();
349  if (sa[m]>mSimDb->nmaxe()) sa[m] = mSimDb->nmaxe();
350  ytmp += kaa*sa[m];
351  }
352  qtot = ytmp*1.e+12*e_SI; //pC
353 
354  t0 = tofHitsFromGeant->tof*1000/nanosecond; //ps
355  tof=tofHitsFromGeant->tof*1000/nanosecond; //ps
356 
357 
358  for(int j=0;j<nTimeBins;j++) {
359  double ts = t0+ mSimDb->dt()*double(j); //dt=25ps
360  double ytmp1 = 0.;
361  for(int m=0;m<nElectronClusters;m++) {
362  double tx = (startPositionOfCluster[m])/(C_C_LIGHT*1.e-3*nanosecond/millimeter);
363  double t_drift = (gapLength-startPositionOfCluster[m])/driftVelocity[m];
364  if( ts>=t0 + tx && ts<=t0+ tx+t_drift) {
365  s[m][j]=(exp(alpha*driftVelocity[m]*(ts-t0-tx))-1)*nElectrons[m]*GammaRandom();
366  if(s[m][j]>mSimDb->nmaxe()) { s[m][j] = mSimDb->nmaxe(); }
367  } else {
368  s[m][j]=0.0;
369  }
370  ytmp1 += kaa*s[m][j];
371  }
372  chargeDepositedPerTimeBin[j] = ytmp1*1.e+12*e_SI; // pico-Coulomb
373  }
374 
375 
376  int icellx = -1;
377  wt = 1.0;
378  StThreeVectorF local(tofHitsFromGeant->x[0], tofHitsFromGeant->x[1], tofHitsFromGeant->x[2]);
379  if(mCellXtalk){ CellXtalk(icell, local.y(), wt, icellx); }
380  TrackHit trackhit;
381  trackhit.tray = itray;
382  trackhit.module = imodule;
383  trackhit.cell = icell;
384  trackhit.trkId = trackId;
385  trackhit.dE = tofHitsFromGeant->de * wt;
386  trackhit.dQ = qtot * wt;
387  for(int j=0;j<nTimeBins;j++) {
388  trackhit.dQdt[j] = chargeDepositedPerTimeBin[j] * wt;
389  }
390  trackhit.tof = tof;//ps
391  trackhit.s_track = tofHitsFromGeant->s_track;// track length
392  trackhit.position = local;
393  trackhit.t0 = t0/1000.;//perfect simulation (ns)
394  tofResponseVec.push_back(trackhit);
395  mTofHitFlag[itray-1][(imodule-1)*mNCell+(icell-1)] = 1;
396 
397  if(icellx>0 && icellx<=mNCell){
398  TrackHit trackhitx=trackhit;
399  trackhitx.cell = icellx;
400  trackhitx.dE = tofHitsFromGeant->de * (1.-wt);
401  trackhitx.dQ = qtot * (1.-wt);
402  for(int j=0;j<nTimeBins;j++) {
403  trackhitx.dQdt[j] = chargeDepositedPerTimeBin[j] * (1.-wt);
404  }
405  tofResponseVec.push_back(trackhitx);
406  mTofHitFlag[itray-1][(imodule-1)*mNCell+(icellx-1)] = 1;
407  }
408 
409  return kStOk;
410 }
411 
412 //____________________________________________________________________________
413 int StBTofSimMaker::CellTimePassTh(TrackVec& tofResponseVec)
414  //only for SLOW simulation (i.e. slow simulator part2)
415  // Corrects response depending on which track is recorded (since electronics can only see first)
416  // Stores the output into StBTof container
417 
418 {
419  TrackVec trackSumVec;
420  trackSumVec.clear();
421 
422  int eraseId[500000];
423  int nhits = tofResponseVec.size();
424  int nTimeBins = mSimDb->ndt();
425  for(int i=0;i<nhits;i++) eraseId[i] = 0;
426 
427 
428  for(int i=0;i<nhits;i++){
429  if(eraseId[i]) continue;
430  TrackHit sumhit=tofResponseVec[i];
431 
432  for(int j=i+1;j<nhits;j++) {
433  if(eraseId[j]) continue;
434 
435  if(tofResponseVec[j].tray != sumhit.tray ||
436  tofResponseVec[j].module != sumhit.module ||
437  tofResponseVec[j].cell != sumhit.cell) continue;
438 
439  if(tofResponseVec[j].tof < sumhit.tof) {
440  sumhit.tof = tofResponseVec[j].tof;
441  sumhit.s_track = tofResponseVec[j].s_track;
442  sumhit.position = tofResponseVec[j].position;
443  if(tofResponseVec[j].trkId != sumhit.trkId) {
444  LOG_WARN << " Two tracks match to one cell." << endm;
445  sumhit.trkId = tofResponseVec[j].trkId;
446  }
447  }
448  sumhit.dE += tofResponseVec[j].dE;
449  sumhit.dQ += tofResponseVec[j].dQ;
450 
451  double dQdt[nTimeBins]; for(int aa=0;aa<nTimeBins;aa++){dQdt[aa]=sumhit.dQdt[aa];}
452 
453  if(sumhit.t0 == tofResponseVec[j].t0) {
454  for(int m=0;m<nTimeBins;m++) { sumhit.dQdt[m] += tofResponseVec[j].dQdt[m];}
455  }
456  else if(sumhit.t0 > tofResponseVec[j].t0) {
457  int nbinoffset = (int)((sumhit.t0 - tofResponseVec[j].t0) / 25.);//pico seconds
458  for(int m=0;m<nTimeBins;m++) {
459  if(m<nbinoffset) {
460  sumhit.dQdt[m] = tofResponseVec[j].dQdt[m];
461  } else{
462  sumhit.dQdt[m] = tofResponseVec[j].dQdt[m] + dQdt[m-nbinoffset];
463  }
464  }
465  sumhit.t0 = tofResponseVec[j].t0;
466  } else { //t0 < tofResponseVec[j].t0
467  int nbinoffset = (int)((tofResponseVec[j].t0 - sumhit.t0) / 25.);//pico seconds
468  for(int m=0;m<nTimeBins;m++) {
469  if(m<nbinoffset) {
470  //do nothing
471  } else{
472  sumhit.dQdt[m] = tofResponseVec[j].dQdt[m-nbinoffset] + dQdt[m];
473  }
474  }
475  }
476 
477  eraseId[j] = 1;
478  }
479  trackSumVec.push_back(sumhit);
480  }
481 
482 
483 
485  St_g2t_track *g2t_track = static_cast<St_g2t_track *>(mGeantData->Find("g2t_track"));
486  if (!g2t_track) {
487  LOG_WARN << " No g2t track table !!! " << endm;
488  return kStWarn;
489  }
490  g2t_track_st *tof_track = g2t_track->GetTable();
491  for(size_t i=0;i<trackSumVec.size();i++) {
492  float tof = 0.;
493  bool pass = kFALSE;
494  for(int m=0;m<nTimeBins;m++) {
495  if(trackSumVec[i].dQdt[m]>(mSimDb->adc_thre()*0.001) && !pass) {// pC
496  tof = trackSumVec[i].tof;// ps
497  pass = kTRUE;
498  break;
499  }
500  }
501 
502 
503  float deltaMRPC=ranGauss.shoot()*85.;
504  tof+=deltaMRPC;
505 
506 
507  if(pass) {
508  StMcBTofHit *mcHit = new StMcBTofHit();
509  StMcTrack *partnerTrk = new StMcTrack(&(tof_track[trackSumVec[i].trkId]));
510  int truthId=partnerTrk->key();
511  mcHit->setTray(trackSumVec[i].tray);
512  mcHit->setModule(trackSumVec[i].module);
513  mcHit->setCell(trackSumVec[i].cell);
514  mcHit->setdE(trackSumVec[i].dE);
515  float pathLength=trackSumVec[i].s_track;
516  mcHit->setPathLength(pathLength);//cm
517  mcHit->setTime(trackSumVec[i].tof);
518  mcHit->setTof(tof);//ps
519  mcHit->setCharge(trackSumVec[i].dQ);
520  mcHit->setPosition(trackSumVec[i].position);
521  mcHit->setParentTrack(partnerTrk);
522  mcHit->setParentTrackId(truthId);
523  mMcBTofHitCollection->addHit(mcHit);
524 
525 
526  if (mBookHisto){
527  float beta=pathLength/tof/3e-2;
528  mBetaHist->Fill(beta);
529  mPathLHist->Fill(pathLength);
530  mTofHist->Fill(tof);
531  double momentum=partnerTrk->momentum().mag();
532  double mass=sqrt(beta*beta*momentum*momentum/(1.-beta*beta));
533  if(beta!=1.0 && pathLength>150){ mRecMass->Fill(mass);}
534  mTofResReco->Fill( (tof - trackSumVec[i].t0*1000.) );//ps
535  }
536  }
537  }
538 
539  return kStOk;
540 }
541 
542 //___________________________________________________________________________
544 {
545  LOG_DEBUG << "Filling McEvent and Event"<<endm;
546 
547  // update histograms
548  if(mBookHisto) {
549  for(int i=0;i<mNTray;i++) {
550  int ncell = 0;
551  for(int j=0;j<mNTOF;j++) {
552  if(mTofHitFlag[i][j]) {
553  mCellGeant->Fill(j,i);
554  ncell++;
555  }
556  }
557  mNCellGeant->Fill(ncell,i);
558  }
559  }
560 
562  mMcEvent = (StMcEvent*)GetInputDS("StMcEvent");
563  if (!mMcEvent) {
564  LOG_ERROR << "No StMcEvent! Bailing out ..." << endm;
565  }
566  else {
567  mMcEvent->setBTofHitCollection(mMcBTofHitCollection);
568  LOG_INFO << " ... StMcBTofHitCollection stored in StMcEvent" << endm;
569  }
570 
571  if (!mIsEmbedding) {
572 
574  mBTofCollection = mEvent->btofCollection();
575  if(!mBTofCollection) {
576  LOG_INFO << "Creating new StBTofCollection" << endm;
577  mBTofCollection = new StBTofCollection();
578  mEvent->setBTofCollection(mBTofCollection);
579  }
580  }
581  else if (mIsEmbedding) {
582 
583  LOG_INFO << "Creating new StBTofCollection locally" << endm;
584  mBTofCollection = new StBTofCollection();
585  }
586 
588  for(int jj = 0; jj < (int)mMcBTofHitCollection->hits().size(); jj++) {
589  StMcBTofHit *aMcBTofHit = mMcBTofHitCollection->hits()[jj];
590 
591  if(!aMcBTofHit) continue;
592 
593  int trayid = aMcBTofHit->tray();
594  int moduleid = aMcBTofHit->module();
595  int cellid = aMcBTofHit->cell();
596 
598  float eff = 1.;
599  if(trayid>0&&trayid<=120) eff = mSimDb->eff_tof(trayid, moduleid, cellid);
600  if (gRandom->Uniform(1.0) > eff){LOG_DEBUG<<"Hit removed by inefficiency cut (at " << eff*100 << "%)"<<endm; continue; }
601 
602 
604  StBTofHit aBTofHit;
605  aBTofHit.Clear();
606 
607  float mcTof=aMcBTofHit->tof()/1000.;
608 
609  aBTofHit.setHardwarePosition(kBTofId);
610  aBTofHit.setTray((int)aMcBTofHit->tray());
611  aBTofHit.setModule((unsigned char)aMcBTofHit->module());
612  aBTofHit.setCell((int)aMcBTofHit->cell());
613  aBTofHit.setLeadingEdgeTime((double)mcTof);
614  aBTofHit.setTrailingEdgeTime((double)mcTof);
615  aBTofHit.setAssociatedTrack(NULL);
616  aBTofHit.setIdTruth(aMcBTofHit->parentTrackId(), 1);
617  mBTofCollection->addHit(new StBTofHit(aBTofHit));
618 
620  StBTofRawHit aBTofRawHit;
621  aBTofRawHit.Clear();
622  aBTofRawHit.setTray((int)aMcBTofHit->tray());
623  aBTofRawHit.setChannel(6*(aMcBTofHit->module() - 1) + (int)aMcBTofHit->cell());
624  aBTofRawHit.setFlag(1);
625  mBTofCollection->addRawHit(new StBTofRawHit(aBTofRawHit));
626  }
627 
628  if (!mIsEmbedding) {
630 
631  StBTofHeader *tofHeader = mBTofCollection->tofHeader();
632  StBTofHeader aHead;
633 
634  if(!tofHeader) {
635  LOG_INFO << " No StEvent/btofCollection, creating new... " << endm;
636  mBTofCollection->setHeader(new StBTofHeader(aHead));
637  }
638  else {
639  tofHeader = (StBTofHeader *) mBTofCollection->tofHeader();
640  }
641 
642  LOG_INFO << "... StBTofCollection Stored in StEvent! " << endm;
643  }
644 
646  if(Debug()) {
647  LOG_DEBUG << " ==== Test McBTofHitCollection ==== " << endm;
648  if (mMcEvent != nullptr) {
649  StSPtrVecMcBTofHit& mcBTofHits = mMcEvent->btofHitCollection()->hits();
650  int nCell[mNTray];
651  for(int i=0;i<mNTray;i++) nCell[i] = 0;
652  for(int i=0;i<(int)mcBTofHits.size();i++) {
653  LOG_DEBUG << (*mcBTofHits[i]) << endm;
654 
655  if(mBookHisto) {
656  int itray = mcBTofHits[i]->tray();
657  int imodule = mcBTofHits[i]->module();
658  int icell = mcBTofHits[i]->cell();
659  float t0 = mcBTofHits[i]->time();
660  float tof = mcBTofHits[i]->tof();
661  float de = mcBTofHits[i]->dE();
662 
663 
664  LOG_DEBUG << "tray# "<<itray << endm;
665 
667  if(itray>0&&itray<=120) {
668  mCellSeen->Fill((imodule-1)*mNCell+(icell-1),itray-1);
669  mDeSeen->Fill( de / keV );
670  mT0Seen->Fill( t0 /1000 ); // ns
671  mTofSeen->Fill( tof / 1000 ); // ns
672  mTofResSeen->Fill( (tof-t0) ); // ps
673  nCell[itray-1]++;
674  }
675  }
676  }
677  if(mBookHisto) {
678  for(int i=0;i<mNTray;i++) mNCellSeen->Fill(nCell[i],i);
679  }
680 
681  LOG_INFO << " ==== Test TofRawDataCollection ==== " << endm;
682  for(int i=0;i<mNTray;i++) nCell[i] = 0;
683 
684  if (mWriteStEvent){
685  StSPtrVecBTofHit& bTofHits=mEvent->btofCollection()->tofHits();
686  StBTofHit* bHit;
687  for(int aa=0;aa<(int)bTofHits.size();aa++){
688  bHit=bTofHits[aa];
689  int itray=bHit->tray();
690  int imodule=bHit->module();
691  int icell=bHit->cell();
692  if(mBookHisto) {mCellReco->Fill((imodule-1)*mNCell+(icell-1),itray-1);}
693  }
694 
695  if(mBookHisto) {
696  for(int i=0;i<mNTray;i++) mNCellReco->Fill(nCell[i],i);
697  }
698  }
699  }
700  }
701 
702  if(Debug()) cout<<"leaving fillevent"<<endl;
703 
704  return kStOk;
705 }
706 
707 
708 
709 //_____________________________________________________________________________
710 IntVec StBTofSimMaker::CalcCellId(int volume_id, float ylocal)
711 {
712  IntVec cellId;
713  int ires = volume_id;
714 
715  int rileft = int(ires/10/100/100);
716  ires = ires-rileft*100*100*10;
717  int itray = int(ires/10/100);
718  ires = ires-itray*100*10;
719  int imodule = int(ires/10);
720  itray = itray + (rileft-1)*mNTray/2;
721 
722  int icell = int((ylocal + mBTofPadWidth * mNCell/2) / mBTofPadWidth) + 1;
723 
724  if(itray<=0 || itray>mNTray) itray = -1;
725  if(imodule<=0 || imodule>mNModule) imodule = -1;
726  if(icell<=0 || icell>mNCell) icell = -1;
727 
728  cellId.push_back(itray);
729  cellId.push_back(imodule);
730  cellId.push_back(icell);
731 
732  return cellId;
733 }
734 
735 //_____________________________________________________________________________
736 double StBTofSimMaker::GammaRandom()
737 {
738  double xmax,ymin,x,y,x1;
739  xmax = 10.0;
740  ymin = exp(-xmax);
741 
742 back:
743  y = ymin+(1-ymin)*gRandom->Rndm();
744  x = -log(y);
745  x1 = sqrt(xmax)*gRandom->Rndm();
746  if(x1>sqrt(x)) goto back;
747  return x/1.5;
748 
749 }
750 
751 //_____________________________________________________________________________
752 int StBTofSimMaker::CellXtalk(int icell, float ylocal, float& wt, int& icellx)
753 {
754  float yc = (icell-1-2.5)*mBTofPadWidth;
755  float dy = ylocal - yc;
756 
757  wt = 1.;
758  icellx = -1;
759  float dyCut = mSimDb->dy_xtalk();
760  if(fabs(dy)<dyCut) return kStOk;
761 
762  wt = 1. - (fabs(dy) - dyCut)/(mBTofPadWidth - 2.0*dyCut);
763 
764  if(dy>0) icellx = icell + 1;
765  else icellx = icell - 1;
766 
767  if(icellx>mNCell) icellx = -1;
768  if(icellx<=0) icellx = -1;
769 
770  return kStOk;
771 }
772 
773 
774 //_____________________________________________________________________________
775 int StBTofSimMaker::FastCellResponse(g2t_ctf_hit_st* tofHitsFromGeant, StBTofCollection* btofColl)
776 {
778  if((tofHitsFromGeant->s_track <= 0.0) || (tofHitsFromGeant->de / keV <= 0.0)) {
779  return kStWarn;
780  }
781 
782  if(mBookHisto) {
783  mDeGeant->Fill(tofHitsFromGeant->de / keV);
784  mTofGeant->Fill(tofHitsFromGeant->tof / nanosecond);
785  }
786 
787  IntVec cellId = CalcCellId(tofHitsFromGeant->volume_id, tofHitsFromGeant->x[1]);
788 
789  int icell, imodule, itray;
790  itray = cellId[0];
791  imodule = cellId[1];
792  icell = cellId[2];
793  if (itray==-1 || imodule==-1 || icell==-1) {
794  LOG_WARN << " Not hit the sensitive MRPC volume !!! " << endm;
795  return kStWarn;
796  }
797 
798  StThreeVectorF local(tofHitsFromGeant->x[0], tofHitsFromGeant->x[1], tofHitsFromGeant->x[2]);
799 
800  St_g2t_track *g2t_track = static_cast<St_g2t_track *>(mGeantData->Find("g2t_track"));
801  if (!g2t_track) {
802  LOG_WARN << " No g2t track table !!! " << endm;
803  return kStWarn;
804  }
805  g2t_track_st *tof_track = g2t_track->GetTable();
806  int no_tracks= g2t_track->GetNRows();
807 
808  StMcTrack *partnerTrk = 0;
809 
810  // Initialize partnerTrkId to be a negative value. This is a flag in case the following if
811  // condition is not satisfied and meaning there is something wrong with the track ID.
812  //
813  int partnerTrkId = -1;
814  for(int j=0;j<no_tracks;j++){
815  if(tofHitsFromGeant->track_p==tof_track[j].id){
816  partnerTrk = new StMcTrack(&(tof_track[j]));
817  partnerTrkId=partnerTrk->key();
818  }
819  }
820 
822  int icellx = -1;
823  float wt = 1.0;
824  if(mCellXtalk) CellXtalk(icell, local.y(), wt, icellx);
825 
826  double de = tofHitsFromGeant->de * wt;
827  double pathL = tofHitsFromGeant->s_track;
828  double q = 0.;
829 
830  double time_blur = ranGauss.shoot()*mSimResDb->timeres_tof(itray, imodule, icell)*1e-9/nanosecond;
831  double tof = tofHitsFromGeant->tof*1000./nanosecond + time_blur;
832  if ( mVpdSim ) { // VpdSimMaker present, assume vpdstart
833  tof += mVpdSimConfig->getMcClock()*1000;
834  }
835  else {
836  if ( mUseVpdStart && btofColl ) {
837  mBTofHeader = btofColl->tofHeader();
838 
839  if ( mBTofHeader != NULL ){
840  int mNWest = mBTofHeader->numberOfVpdHits(west);
841  int mNEast = mBTofHeader->numberOfVpdHits(east);
842 
843  tof += mVpdSimConfig->getVpdResolution(mNWest, mNEast);
844  } else {
845  tof -= 999;
846  }
847 
848  }
849  else {
850  // do nothing
851  }
852  }
853 
854  // tof = tof - mSimDb->toffset(); // Apply offset correction.
855  double t0 = tofHitsFromGeant->tof*1000./nanosecond;
856  // float beta=pathL/tof/3e-2;
857 
858  StMcBTofHit *mcBTofHit = new StMcBTofHit(itray,imodule,icell,de,pathL,t0,tof,q);
859  mcBTofHit->setPosition(local);
860  mcBTofHit->setParentTrack(partnerTrk);
861 
862 
863  storeMcBTofHit(mcBTofHit);
864  mTofHitFlag[itray-1][(imodule-1)*mNCell+(icell-1)] = 1;
865 
866 
867  if(icellx <= 0 || icellx > mNCell) return kStOk;
868  time_blur = ranGauss.shoot()*mSimResDb->timeres_tof(itray, imodule, icell)*1e-9/nanosecond;
872  double tofx = tofHitsFromGeant->tof*1000./nanosecond + time_blur;
873  double dex = tofHitsFromGeant->de * (1. - wt);
874  double qx = 0.*(1.-wt);
875 
876  StMcBTofHit *mcBTofHitx = new StMcBTofHit(itray,imodule,icellx,dex,pathL,t0,tofx,qx);
877  mcBTofHitx->setPosition(local);
878  mcBTofHitx->setParentTrack(partnerTrk);
879  mcBTofHitx->setParentTrackId(partnerTrkId);
880 
881  storeMcBTofHit(mcBTofHitx);
882  mTofHitFlag[itray-1][(imodule-1)*mNCell+(icellx-1)] = 1;
883 
884 
885  return kStOk;
886 }
887 
888 //_____________________________________________________________________________
890 {
894  bool hitFound = kFALSE;
895 
897  for(size_t j=0;j<mMcBTofHitCollection->hits().size();j++) {
898  StMcBTofHit *tempHit = mMcBTofHitCollection->hits()[j];
899  if(!tempHit) continue;
900  if(mcBTofHit->sameCell(*tempHit)) {
901  hitFound = kTRUE;
902  float t1 = mcBTofHit->time();
903  float t2 = tempHit->time();
904  float tof1 = mcBTofHit->tof();
905  float dE1 = mcBTofHit->dE();
906  float dE2 = tempHit->dE();
907  float s1 = mcBTofHit->pathLength();
908  float q1 = mcBTofHit->charge();
909  float q2 = tempHit->charge();
910  StThreeVectorF x1 = mcBTofHit->position();
911  StThreeVectorF x2 = tempHit->position();
912  StMcTrack *trk1 = mcBTofHit->parentTrack();
913  if(t1>t2) {
914  //do nothing
915  } else {
916  tempHit->setTime(t1);
917  tempHit->setTof(tof1);
918  tempHit->setPathLength(s1);
919  tempHit->setPosition(x1);
920  tempHit->setParentTrack(trk1);
921  }
922  tempHit->setdE(dE1+dE2);
923  tempHit->setCharge(q1+q2);
924  }
925  }
926 
927  if(!hitFound) {
928  mMcBTofHitCollection->addHit(mcBTofHit);
929  } else {
930  delete mcBTofHit;
931  }
932  return kStOk;
933 }
934 //_____________________________________________________________________________
937  //not currently used
938  //fill the adc and tdc entries.
939  return kStOk;
940 
941 }
942 
943 //_____________________________________________________________________________
946  return kStOk;
947 }
948 
949 //_____________________________________________________________________________
950 string StBTofSimMaker::setHistFileName(){
951 
952  string extension = ".BTofSim.root";
953 
954  if (GetChainOpt()->GetFileOut() != NULL) {
955  TString outFile = GetChainOpt()->GetFileOut();
956  mHistoFileName = (string)outFile;
957  size_t lastindex = mHistoFileName.find_last_of(".");
958  mHistoFileName = mHistoFileName.substr(0, lastindex);
959  lastindex = mHistoFileName.find_last_of("/");
960  mHistoFileName = mHistoFileName.substr(lastindex+1, mHistoFileName.length());
961  mHistoFileName = mHistoFileName + extension;
962  }
963 
964  return mHistoFileName;
965 }
966 //_____________________________________________________________________________
968 {
970  AddHist( mRawBetaHist=new TH1F("mRawBetaHist","mRawBetaHist", 400, -1, 1.5) );
971  AddHist( mBetaHist=new TH1F("mBetaHist","mBetaHist", 400, -2, 2) );
972 
973  AddHist( mRawBetaVsMom=new TH2F("mRawBetaVsMom","mRawBetaVsMom; Momentum (GeV); 1/beta; counts", 1500, 0.1, 1.25, 1500, 0.6, 3) );
974  AddHist( mCalcBetaVsMom=new TH2F("mCalcBetaVsMom","mCalcBetaVsMom; Momentum (GeV); 1/beta; counts", 1500, 0.1, 1.25, 1500, 0.6, 3) );
975  AddHist( mBetaVsMom=new TH2F("mBetaVsMom","mBetaVsMom; Momentum (GeV); 1/beta; counts", 1500, 0.1, 1.25, 1500, 0.6, 3) );
976 
977  AddHist( Electron_BetaVsMom=new TH2F("Electron_BetaVsMom","Electron_BetaVsMom; Momentum (GeV); 1/beta; counts", 1500, 0.1, 1.25, 1500, 0.6, 3) );
978  AddHist( Muon_BetaVsMom=new TH2F("Muon_BetaVsMom","Muon_BetaVsMom; Momentum (GeV); 1/beta; counts", 1500, 0.1, 1.25, 1500, 0.6, 3) );
979  AddHist( Pion_BetaVsMom=new TH2F("Pion_BetaVsMom","Pion_BetaVsMom; Momentum (GeV); 1/beta; counts", 1500, 0.1, 1.25, 1500, 0.6, 3) );
980  AddHist( Kaon_BetaVsMom=new TH2F("Kaon_BetaVsMom","Kaon_BetaVsMom; Momentum (GeV); 1/beta; counts", 1500, 0.1, 1.25, 1500, 0.6, 3) );
981  AddHist( Proton_BetaVsMom=new TH2F("Proton_BetaVsMom","Proton_BetaVsMom; Momentum (GeV); 1/beta; counts", 1500, 0.1, 1.25, 1500, 0.6, 3) );
982 
983  AddHist( mPathLHist=new TH1F("mPathLHist","mPathLHist", 500, -2, 500) );//cm's
984  AddHist( mRawTofHist=new TH1F("mRawTofHist","mRawTofHist",2000, -10, 25000) );
985  AddHist( mTofHist=new TH1F("mTofHist","mTofHist; Tof (ps)", 2000, -10, 25000) );
986  AddHist( mRecMass=new TH1F("mRecMass","mRecMass", 1000, -2, 4) );
987 
988  AddHist( massHist=new TH1F("massHist","Mass; Mass (GeV); Counts",200, 0, 4) );
989  AddHist( m2VsP=new TH2F("m2VsP","Mass Sqared Vs Momentum; Momentum (P); Mass Squared (GeV^2)",2000, 0.1, 1.5, 100, 0, 4) );
990  AddHist( mTofCalculated=new TH1F("mTofCalculated","Calculated Tof using mass and momentum; Tof (ps); Counts", 2000, -10, 25000) );
991 
992  AddHist( tof_RealVsCalc=new TH2F("tof_RealVsCalc","Resolution-smeared Tof Vs. Calculated Tof; Calculated Tof (ps); Given Tof (ps)", 2000, -10, 25000, 2000, -10, 25000) );
993 
994  AddHist( momBinRaw1 = new TH1F("Raw_0.15<P<0.2","Raw (No resolution smearing) 1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
995  AddHist( momBinRaw2 = new TH1F("Raw_0.2<P<0.25","Raw (No resolution smearing) 1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
996  AddHist( momBinRaw3 = new TH1F("Raw_0.35<P<0.4","Raw (No resolution smearing) 1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
997  AddHist( momBinRaw4 = new TH1F("Raw_0.4<P<0.45","Raw (No resolution smearing) 1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
998  AddHist( momBinRaw5 = new TH1F("Raw_0.55<P<0.6","Raw (No resolution smearing) 1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
999  AddHist( momBinRaw6 = new TH1F("Raw_0.65<P<0.66","Raw (No resolution smearing) 1/beta in Momentum Bin; 1/beta; Counts", 400,0.5,2) );
1000  AddHist( momBinRaw7 = new TH1F("Raw_0.7<P<0.75","Raw (No resolution smearing) 1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
1001  AddHist( momBinRaw8 = new TH1F("Raw_0.23<P<0.24","Raw (No resolution smearing) 1/beta in Momentum Bin; 1/beta; Counts", 400,0.5,2) );
1002 
1003  AddHist( momBin1 = new TH1F("0.15<P<0.2","1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
1004  AddHist( momBin2 = new TH1F("0.2<P<0.25","1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
1005  AddHist( momBin3 = new TH1F("0.35<P<0.4","1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
1006  AddHist( momBin4 = new TH1F("0.4<P<0.45","1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
1007  AddHist( momBin5 = new TH1F("0.55<P<0.6","1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
1008  AddHist( momBin6 = new TH1F("0.65<P<0.66","1/beta in Momentum Bin; 1/beta; Counts", 400,0.5,2) );
1009  AddHist( momBin7 = new TH1F("0.7<P<0.75","1/beta in Momentum Bin; 1/beta; Counts", 600,0.5,2) );
1010  AddHist( momBin8 = new TH1F("0.23<P<0.24","1/beta in Momentum Bin; 1/beta; Counts", 400,0.5,2) );
1011 
1012  AddHist( mCellGeant = new TH2F("CellGeant","CellGeant",192,0.,192.,120,1.,120.) );
1013  AddHist( mNCellGeant = new TH2F("NCellGeant","NCellGeant",192,0.,192.,120,1.,120.) );
1014  AddHist( mDeGeant = new TH1F("DeGeant","DeGeant",1000,0.,10.) );
1015  AddHist( mTofGeant = new TH1F("TofGeant","TofGeant",1000,0.,20.) );
1016 
1017  AddHist( mCellSeen = new TH2F("CellSeen","CellSeen",192,0.,192.,120,1.,120.) );
1018  AddHist( mNCellSeen = new TH2F("NCellSeen","NCellSeen",192,0.,192.,120,1.,120.) );
1019  AddHist( mDeSeen = new TH1F("DeSeen","DeSeen",1000,0.,10.) );
1020  AddHist( mT0Seen = new TH1F("T0Seen","T0Seen",1000,0.,20.) );
1021  AddHist( mTofSeen = new TH1F("TofSeen","TofSeen",1000,0.,20.) );
1022 
1023  AddHist( mTofResSeen = new TH1F("TofResSeen","TofResSeen",1001,-500.,500.) );
1024 
1025  AddHist( mCellReco = new TH2F("CellReco","CellReco",192,0.,192.,120,1.,120.) );
1026  AddHist( mNCellReco = new TH2F("NCellReco","NCellReco",192,0.,192.,120,1.,120.) );
1027  AddHist( mTofResReco = new TH1F("TofResReco","TofResReco",1000,-300.,300.) );
1028 
1029  return kStOk;
1030 
1031 }
1032 
1033 Int_t StBTofSimMaker::writeHistograms()
1034 {
1035  //only done if Histogram setting is turned on
1036 
1037  mRawBetaHist->Write();
1038  mBetaHist->Write();
1039 
1040  mRawBetaVsMom->Write();
1041  mCalcBetaVsMom->Write();
1042  mBetaVsMom->Write();
1043 
1044  Electron_BetaVsMom->Write();
1045  Muon_BetaVsMom->Write();
1046  Pion_BetaVsMom->Write();
1047  Kaon_BetaVsMom->Write();
1048  Proton_BetaVsMom->Write();
1049 
1050  mPathLHist->Write();
1051  mRawTofHist->Write();
1052  mTofHist->Write();
1053  mRecMass->Write();
1054 
1055  massHist->Write();
1056  m2VsP->Write();
1057  mTofCalculated->Write();
1058  tof_RealVsCalc->Write();
1059 
1060  momBinRaw1->Write();
1061  momBinRaw2->Write();
1062  momBinRaw3->Write();
1063  momBinRaw4->Write();
1064  momBinRaw5->Write();
1065  momBinRaw6->Write();
1066  momBinRaw7->Write();
1067  momBinRaw8->Write();
1068 
1069  momBin1->Write();
1070  momBin2->Write();
1071  momBin3->Write();
1072  momBin4->Write();
1073  momBin5->Write();
1074  momBin6->Write();
1075  momBin7->Write();
1076  momBin8->Write();
1077 
1078  mCellGeant->Write();
1079  mNCellGeant->Write();
1080  mDeGeant->Write();
1081  mTofGeant->Write();
1082 
1083  mCellSeen->Write();
1084  mNCellSeen->Write();
1085  mDeSeen->Write();
1086  mT0Seen->Write();
1087  mTofSeen->Write();
1088  mTofResSeen->Write();
1089 
1090  mCellReco->Write();
1091  mNCellReco->Write();
1092  mTofResReco->Write();
1093 
1094  return kStOk;
1095 }
1096 
1097 // End StBTofSimMaker
double getVpdResolution(int nWest, int nEast)
void Init(StMaker *maker)
Initial function, need a maker to access the data base.
TH2F * mCellReco
cellId after recon
static const float mBTofPadWidth
Pad Width.
double timeres_tof(unsigned int itray, unsigned int imodule, unsigned int icell)
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.
TH2F * m2VsP
Mass Squared versus momentum.
TH1F * mTofResReco
time resolution after recon
TH2F * mNCellReco
of cells after recon
Bool_t useVpdStart() const
function for tofCalibMaker to know whether to use VPD as the start or not
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
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
Definition: StMcTrack.hh:144
32 modules per tray
TH1F * mTofSeen
smeared-tof after DetectorResponse
TH1F * mDeGeant
deposited-energy in geant hit
TH1F * mTofResSeen
time resolution after Detector Response
void loadParams(const int runNumber=20076002)
Loads BTOF Sim Params from database.
bool mIsEmbedding
True when embedding BTof data. False for pure simulation (default)
TH2F * mNCellSeen
of cells after DetectorResponse
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
Definition: Stypes.h:42
virtual StThreeVectorF position() const
collected charge
Definition: StMcBTofHit.hh:84
Definition: Stypes.h:40
virtual float charge() const
tof simulated
Definition: StMcBTofHit.hh:83
int electronicNoise(void)
simulate electronic noise (empty)
StBTofSimMaker(const char *name="TofSim")
Pad Width.
int storeMcBTofHit(StMcBTofHit *mcCellHit)
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
virtual float tof() const
time of flight geant
Definition: StMcBTofHit.hh:82
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
Definition: Stypes.h:41
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.
virtual TDataSet * Find(const char *path) const
Definition: TDataSet.cxx:362