24 #include "StBTofSimMaker.h"
30 #include "SystemOfUnits.h"
31 #include "phys_constants.h"
32 #include "StThreeVectorD.hh"
34 #include "RanluxEngine.h"
35 #include "RandGauss.h"
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"
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"
83 StBTofSimMaker::~StBTofSimMaker()
92 int StBTofSimMaker::Init()
99 return StMaker::Init();
103 void StBTofSimMaker::Reset()
136 if (Debug()) mSimDb->print();
155 int StBTofSimMaker::FinishRun(
int runnumber)
157 LOG_INFO <<
"StBTofSimMaker::FinishRun -- cleaning up BTOF DAQ map --" << endm;
159 if (mSimDb){
delete mSimDb; mSimDb = 0;}
160 if (mSimResDb){
delete mSimResDb; mSimResDb = 0;}
161 if (mVpdSimConfig){
delete mVpdSimConfig; mVpdSimConfig = 0;}
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";
176 LOG_INFO <<
"The Filename is: " << mHistoFileName.c_str() << endm;
178 TFile aFile(mHistoFileName.c_str(),
"RECREATE",
"tofsim");
195 LOG_INFO <<
"StBTofSimMaker Make() starts" << endm;
207 LOG_WARN <<
" No GEANT data loaded. Exit! " << endm;
210 LOG_INFO <<
" Found GEANT data -- loading VPD/TOF hits... " << endm;
213 mEvent = (
StEvent*)GetInputDS(
"StEvent");
215 LOG_ERROR <<
"No StEvent! Bailing out ..." << endm;
221 St_g2t_ctf_hit* g2t_tfr_hits = 0;
222 g2t_tfr_hits =
dynamic_cast<St_g2t_ctf_hit*
> (
mGeantData->
Find(
"g2t_tfr_hit"));
224 LOG_WARN <<
" No TOF hits in GEANT" << endm; }
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();
232 TrackVec tofResponseVec;
233 tofResponseVec.clear();
234 for (
int i=0; i<nhits; i++, tofHitsFromGeant++) {
242 for (
int i=0; i<nhits; i++, tofHitsFromGeant++)
FastCellResponse(tofHitsFromGeant, btofColl);
245 LOG_WARN <<
" No TOF simulator specified " << endm;
259 TrackVec& tofResponseVec)
271 if(tofHitsFromGeant->s_track<=0.0 || tofHitsFromGeant->de <=0.0) {
272 LOG_WARN <<
" No deposited energy in this TOF hit!" << endm;
276 IntVec cellId =
CalcCellId(tofHitsFromGeant->volume_id, tofHitsFromGeant->x[1]);
277 int icell, imodule, itray;
281 if (itray==-1 || imodule==-1 || icell==-1) {
282 LOG_WARN <<
" Not hit the sensitive MRPC volume!" << endm;
286 mDeGeant->Fill(tofHitsFromGeant->de / keV);
287 mTofGeant->Fill(tofHitsFromGeant->tof / nanosecond);
291 St_g2t_track *g2t_track =
static_cast<St_g2t_track *
>(
mGeantData->
Find(
"g2t_track"));
293 LOG_WARN <<
" No G2T track table!" << endm;
296 g2t_track_st *tof_track = g2t_track->GetTable();
297 int no_tracks= g2t_track->GetNRows();
304 for(
int j=0;j<no_tracks;j++){
305 if(tofHitsFromGeant->track_p==tof_track[j].id){
307 beta = tof_track[j].ptot/tof_track[j].e;
314 double t0 = tofHitsFromGeant->tof;
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);
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];
328 double chargeDepositedPerTimeBin[nTimeBins];
329 for(
int j=0;j<nTimeBins;j++) {chargeDepositedPerTimeBin[j] = 0.0;}
331 int nElectronClusters=-1;
332 while(nElectronClusters<1) {nElectronClusters=gRandom->Poisson(gapLength*clusterDensity);}
333 if(nElectronClusters>maxClusters) nElectronClusters = maxClusters;
335 for(
int m=0;m<nElectronClusters;m++) {
336 driftVelocity[m] = mSimDb->vd_mean()*(0.90+0.20*gRandom->Rndm(1));
338 int nElectrons_temp=-1;
339 while(nElectrons_temp<1){nElectrons_temp = gRandom->Poisson(mSimDb->nmeane());}
340 nElectrons[m] = double(nElectrons_temp);
342 startPositionOfCluster[m]=gapLength+1;
343 while(startPositionOfCluster[m]>gapLength) { startPositionOfCluster[m] = gRandom->Exp(1.0/clusterDensity); }
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();
352 qtot = ytmp*1.e+12*e_SI;
354 t0 = tofHitsFromGeant->tof*1000/nanosecond;
355 tof=tofHitsFromGeant->tof*1000/nanosecond;
358 for(
int j=0;j<nTimeBins;j++) {
359 double ts = t0+ mSimDb->dt()*double(j);
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(); }
370 ytmp1 += kaa*s[m][j];
372 chargeDepositedPerTimeBin[j] = ytmp1*1.e+12*e_SI;
378 StThreeVectorF local(tofHitsFromGeant->x[0], tofHitsFromGeant->x[1], tofHitsFromGeant->x[2]);
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;
391 trackhit.s_track = tofHitsFromGeant->s_track;
392 trackhit.position = local;
393 trackhit.
t0 = t0/1000.;
394 tofResponseVec.push_back(trackhit);
397 if(icellx>0 && icellx<=
mNCell){
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);
405 tofResponseVec.push_back(trackhitx);
419 TrackVec trackSumVec;
423 int nhits = tofResponseVec.size();
424 int nTimeBins = mSimDb->ndt();
425 for(
int i=0;i<nhits;i++) eraseId[i] = 0;
428 for(
int i=0;i<nhits;i++){
429 if(eraseId[i])
continue;
432 for(
int j=i+1;j<nhits;j++) {
433 if(eraseId[j])
continue;
435 if(tofResponseVec[j].tray != sumhit.tray ||
436 tofResponseVec[j].module != sumhit.module ||
437 tofResponseVec[j].cell != sumhit.cell)
continue;
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;
448 sumhit.dE += tofResponseVec[j].dE;
449 sumhit.dQ += tofResponseVec[j].dQ;
451 double dQdt[nTimeBins];
for(
int aa=0;aa<nTimeBins;aa++){dQdt[aa]=sumhit.
dQdt[aa];}
453 if(sumhit.
t0 == tofResponseVec[j].t0) {
454 for(
int m=0;m<nTimeBins;m++) { sumhit.
dQdt[m] += tofResponseVec[j].dQdt[m];}
456 else if(sumhit.
t0 > tofResponseVec[j].t0) {
457 int nbinoffset = (int)((sumhit.
t0 - tofResponseVec[j].t0) / 25.);
458 for(
int m=0;m<nTimeBins;m++) {
460 sumhit.
dQdt[m] = tofResponseVec[j].dQdt[m];
462 sumhit.
dQdt[m] = tofResponseVec[j].dQdt[m] + dQdt[m-nbinoffset];
465 sumhit.
t0 = tofResponseVec[j].t0;
467 int nbinoffset = (int)((tofResponseVec[j].t0 - sumhit.
t0) / 25.);
468 for(
int m=0;m<nTimeBins;m++) {
472 sumhit.
dQdt[m] = tofResponseVec[j].dQdt[m-nbinoffset] + dQdt[m];
479 trackSumVec.push_back(sumhit);
485 St_g2t_track *g2t_track =
static_cast<St_g2t_track *
>(
mGeantData->
Find(
"g2t_track"));
487 LOG_WARN <<
" No g2t track table !!! " << endm;
490 g2t_track_st *tof_track = g2t_track->GetTable();
491 for(
size_t i=0;i<trackSumVec.size();i++) {
494 for(
int m=0;m<nTimeBins;m++) {
495 if(trackSumVec[i].dQdt[m]>(mSimDb->adc_thre()*0.001) && !pass) {
496 tof = trackSumVec[i].tof;
503 float deltaMRPC=ranGauss.shoot()*85.;
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);
517 mcHit->setTime(trackSumVec[i].tof);
519 mcHit->setCharge(trackSumVec[i].dQ);
520 mcHit->setPosition(trackSumVec[i].position);
521 mcHit->setParentTrack(partnerTrk);
522 mcHit->setParentTrackId(truthId);
527 float beta=pathLength/tof/3e-2;
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.) );
545 LOG_DEBUG <<
"Filling McEvent and Event"<<endm;
549 for(
int i=0;i<
mNTray;i++) {
551 for(
int j=0;j<
mNTOF;j++) {
562 mMcEvent = (
StMcEvent*)GetInputDS(
"StMcEvent");
564 LOG_ERROR <<
"No StMcEvent! Bailing out ..." << endm;
568 LOG_INFO <<
" ... StMcBTofHitCollection stored in StMcEvent" << endm;
574 mBTofCollection = mEvent->btofCollection();
575 if(!mBTofCollection) {
576 LOG_INFO <<
"Creating new StBTofCollection" << endm;
578 mEvent->setBTofCollection(mBTofCollection);
583 LOG_INFO <<
"Creating new StBTofCollection locally" << endm;
591 if(!aMcBTofHit)
continue;
593 int trayid = aMcBTofHit->tray();
594 int moduleid = aMcBTofHit->module();
595 int cellid = aMcBTofHit->cell();
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; }
607 float mcTof=aMcBTofHit->
tof()/1000.;
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));
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));
635 LOG_INFO <<
" No StEvent/btofCollection, creating new... " << endm;
639 tofHeader = (
StBTofHeader *) mBTofCollection->tofHeader();
642 LOG_INFO <<
"... StBTofCollection Stored in StEvent! " << endm;
647 LOG_DEBUG <<
" ==== Test McBTofHitCollection ==== " << endm;
648 if (mMcEvent !=
nullptr) {
649 StSPtrVecMcBTofHit& mcBTofHits = mMcEvent->btofHitCollection()->hits();
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;
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();
664 LOG_DEBUG <<
"tray# "<<itray << endm;
667 if(itray>0&&itray<=120) {
670 mT0Seen->Fill( t0 /1000 );
681 LOG_INFO <<
" ==== Test TofRawDataCollection ==== " << endm;
682 for(
int i=0;i<
mNTray;i++) nCell[i] = 0;
685 StSPtrVecBTofHit& bTofHits=mEvent->btofCollection()->tofHits();
687 for(
int aa=0;aa<(int)bTofHits.size();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);}
702 if(Debug()) cout<<
"leaving fillevent"<<endl;
713 int ires = volume_id;
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;
724 if(itray<=0 || itray>
mNTray) itray = -1;
725 if(imodule<=0 || imodule>
mNModule) imodule = -1;
726 if(icell<=0 || icell>
mNCell) icell = -1;
728 cellId.push_back(itray);
729 cellId.push_back(imodule);
730 cellId.push_back(icell);
736 double StBTofSimMaker::GammaRandom()
738 double xmax,ymin,x,y,x1;
743 y = ymin+(1-ymin)*gRandom->Rndm();
745 x1 = sqrt(xmax)*gRandom->Rndm();
746 if(x1>sqrt(x))
goto back;
755 float dy = ylocal - yc;
759 float dyCut = mSimDb->dy_xtalk();
760 if(fabs(dy)<dyCut)
return kStOk;
764 if(dy>0) icellx = icell + 1;
765 else icellx = icell - 1;
767 if(icellx>
mNCell) icellx = -1;
768 if(icellx<=0) icellx = -1;
778 if((tofHitsFromGeant->s_track <= 0.0) || (tofHitsFromGeant->de / keV <= 0.0)) {
783 mDeGeant->Fill(tofHitsFromGeant->de / keV);
784 mTofGeant->Fill(tofHitsFromGeant->tof / nanosecond);
787 IntVec cellId =
CalcCellId(tofHitsFromGeant->volume_id, tofHitsFromGeant->x[1]);
789 int icell, imodule, itray;
793 if (itray==-1 || imodule==-1 || icell==-1) {
794 LOG_WARN <<
" Not hit the sensitive MRPC volume !!! " << endm;
798 StThreeVectorF local(tofHitsFromGeant->x[0], tofHitsFromGeant->x[1], tofHitsFromGeant->x[2]);
800 St_g2t_track *g2t_track =
static_cast<St_g2t_track *
>(
mGeantData->
Find(
"g2t_track"));
802 LOG_WARN <<
" No g2t track table !!! " << endm;
805 g2t_track_st *tof_track = g2t_track->GetTable();
806 int no_tracks= g2t_track->GetNRows();
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();
826 double de = tofHitsFromGeant->de * wt;
827 double pathL = tofHitsFromGeant->s_track;
830 double time_blur = ranGauss.shoot()*mSimResDb->
timeres_tof(itray, imodule, icell)*1e-9/nanosecond;
831 double tof = tofHitsFromGeant->tof*1000./nanosecond + time_blur;
833 tof += mVpdSimConfig->getMcClock()*1000;
837 mBTofHeader = btofColl->tofHeader();
839 if ( mBTofHeader != NULL ){
840 int mNWest = mBTofHeader->numberOfVpdHits(west);
841 int mNEast = mBTofHeader->numberOfVpdHits(east);
855 double t0 = tofHitsFromGeant->tof*1000./nanosecond;
859 mcBTofHit->setPosition(local);
860 mcBTofHit->setParentTrack(partnerTrk);
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);
877 mcBTofHitx->setPosition(local);
878 mcBTofHitx->setParentTrack(partnerTrk);
879 mcBTofHitx->setParentTrackId(partnerTrkId);
882 mTofHitFlag[itray-1][(imodule-1)*mNCell+(icellx-1)] = 1;
894 bool hitFound = kFALSE;
899 if(!tempHit)
continue;
900 if(mcBTofHit->sameCell(*tempHit)) {
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();
912 StMcTrack *trk1 = mcBTofHit->parentTrack();
916 tempHit->setTime(t1);
917 tempHit->setTof(tof1);
918 tempHit->setPathLength(s1);
919 tempHit->setPosition(x1);
920 tempHit->setParentTrack(trk1);
922 tempHit->setdE(dE1+dE2);
923 tempHit->setCharge(q1+q2);
950 string StBTofSimMaker::setHistFileName(){
952 string extension =
".BTofSim.root";
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;
964 return mHistoFileName;
970 AddHist( mRawBetaHist=
new TH1F(
"mRawBetaHist",
"mRawBetaHist", 400, -1, 1.5) );
971 AddHist(
mBetaHist=
new TH1F(
"mBetaHist",
"mBetaHist", 400, -2, 2) );
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) );
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) );
983 AddHist(
mPathLHist=
new TH1F(
"mPathLHist",
"mPathLHist", 500, -2, 500) );
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) );
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) );
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) );
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) );
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) );
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.) );
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.) );
1023 AddHist(
mTofResSeen =
new TH1F(
"TofResSeen",
"TofResSeen",1001,-500.,500.) );
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.) );
1033 Int_t StBTofSimMaker::writeHistograms()
1037 mRawBetaHist->Write();
1040 mRawBetaVsMom->Write();
1041 mCalcBetaVsMom->Write();
1044 Electron_BetaVsMom->Write();
1045 Muon_BetaVsMom->Write();
1046 Pion_BetaVsMom->Write();
1047 Kaon_BetaVsMom->Write();
1048 Proton_BetaVsMom->Write();
1057 mTofCalculated->Write();
1058 tof_RealVsCalc->Write();
1060 momBinRaw1->Write();
1061 momBinRaw2->Write();
1062 momBinRaw3->Write();
1063 momBinRaw4->Write();
1064 momBinRaw5->Write();
1065 momBinRaw6->Write();
1066 momBinRaw7->Write();
1067 momBinRaw8->Write();
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. ...
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...
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.
St_DataSet * mGeantData
geant table
virtual StThreeVectorF position() const
collected charge
virtual float charge() const
tof simulated
int electronicNoise(void)
simulate electronic noise (empty)
StBTofSimMaker(const char *name="TofSim")
Pad Width.
int storeMcBTofHit(StMcBTofHit *mcCellHit)
TH1F * mRawTofHist
total time of flight of particle before resolution smearing
bool mUseVpdStart
switch for vpd start
TH1F * mPathLHist
speed of particles hitting tof
virtual float tof() const
time of flight geant
int FastCellResponse(g2t_ctf_hit_st *tof_hit, StBTofCollection *btofColl)
Event data structure to hold all information from a Monte Carlo simulation. This class is the interfa...
Time-of-Flight Simulation Utilities.
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