FemtoDstMaker_pAu200_y2015.C 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #include "TROOT.h"
  2. #include "TSystem.h"
  3. #include "TChain.h"
  4. #include "TFile.h"
  5. #include "TString.h"
  6. #include <iostream>
  7. const Char_t* defaultInFile = "test.list";
  8. const Char_t *defaultOutFile = "oFemtoDst_pp200_2015.root";
  9. using namespace std;
  10. class StFemtoDstMaker_HFT;
  11. StFemtoDstMaker_HFT *femtoMaker = NULL;
  12. //_________________
  13. void FemtoDstMaker_pAu200_y2015(const Char_t* inFileList = defaultInFile,
  14. const Char_t* outFileName = defaultOutFile)
  15. {
  16. cout << "****************************************************" << endl
  17. << "* FemtoDstMaker for p+Au 200 GeV year 2015 (HFT) *" << endl
  18. << "* Start *" << endl
  19. << "****************************************************" << endl
  20. << endl;
  21. //Constants, cut and initial parameters
  22. Float_t cVtxZ[2] = {-30., 30.};
  23. Float_t cVtxR[2] = {0., 3.};
  24. Float_t cVtxXShift = 0.;
  25. Float_t cVtxYShift = 0.;
  26. Float_t cVtxVpdVzDiff[2] = {-30., 30.};
  27. Float_t cParticleMom[2] = {0.15, 5.0};
  28. Float_t cTrackDca[2] = {0., 3.};
  29. Int_t cTrackNHits[2] = {10, 50};
  30. Float_t cTrackEta[2] = {-1., 1.};
  31. Int_t cTrackFlag[2] = {1, 999};
  32. //Load libraries
  33. cout << "Loading libraries..." << endl;
  34. gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  35. loadSharedLibraries();
  36. gSystem->Load("libMinuit");
  37. gSystem->Load("StChain");
  38. gSystem->Load("StRefMultCorr");
  39. gSystem->Load("StFlowMaker");
  40. gSystem->Load("StHbtMaker");
  41. gSystem->Load("StPicoDstMakerRun11");
  42. gSystem->Load("StFemtoDstMaker");
  43. cout << "Libraries have been successfully loaded" << endl;
  44. //Create chain
  45. StChain *mChain = new StChain("StChain");
  46. mChain->SetDebug(0);
  47. StMuDebug::setLevel(0);
  48. //Create MuDst reader
  49. int nMaxFileToRead = 1e9;
  50. cout << Form("Try to read file: %s", inFileList) << endl;
  51. StMuDstMaker *muDstMaker =
  52. new StMuDstMaker(0, 0, "", inFileList, "MuDst", nMaxFileToRead);
  53. muDstMaker->SetStatus("*",0);
  54. muDstMaker->SetStatus("Event*",1);
  55. muDstMaker->SetStatus("MuEvent*",1);
  56. muDstMaker->SetStatus("PrimaryVertices*",1);
  57. muDstMaker->SetStatus("PrimaryTracks*",1);
  58. muDstMaker->SetStatus("GlobalTracks*",1);
  59. muDstMaker->SetStatus("BTofHeader*",1);
  60. muDstMaker->SetStatus("BTofHit*",1);
  61. TChain *mCurrentTree = muDstMaker->chain();
  62. Long64_t mNEvents = mCurrentTree->GetEntries();
  63. cout << Form("Number of events in TTree: %d", mNEvents) << endl;
  64. //StFemtoDstMaker initialization
  65. femtoMaker = new StFemtoDstMaker_HFT(muDstMaker, outFileName);
  66. femtoMaker->SetTriggerId(500003); // VPDMB-5-trgonly (~24 M)
  67. femtoMaker->SetTriggerId(500004); // VPDMB-novtx (~23 M)
  68. femtoMaker->SetTriggerId(500904); // VPDMB-30 (~58 M)
  69. femtoMaker->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  70. femtoMaker->SetVtxRCut(cVtxR[0], cVtxR[1]);
  71. femtoMaker->SetVtxShift(cVtxXShift, cVtxYShift);
  72. femtoMaker->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  73. femtoMaker->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  74. femtoMaker->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  75. femtoMaker->SetVtxRCut(cVtxR[0], cVtxR[1]);
  76. femtoMaker->SetVtxShift(cVtxXShift, cVtxYShift);
  77. femtoMaker->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  78. femtoMaker->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  79. femtoMaker->SetTrackDca(cTrackDca[0], cTrackDca[1]);
  80. femtoMaker->SetTrackNHits(cTrackNHits[0], cTrackNHits[1]);
  81. femtoMaker->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  82. femtoMaker->SetTrackFlag(cTrackFlag[0], cTrackFlag[1]);
  83. femtoMaker->SetCollisionType(false);
  84. femtoMaker->SetAuAuZdcCoincidenceEnergy(false);
  85. femtoMaker->SetMuDstMaker(muDstMaker);
  86. //Chain initialization and loop over events
  87. mChain->Init();
  88. Int_t iReturn = 0;
  89. Int_t mNEventsProcessed = 0;
  90. Float_t mPerConst = 0.05;
  91. Float_t mPercentCounter = 0.0;
  92. Float_t mProgress = 0.;
  93. unsigned int mSubCounter = 1; // time
  94. time_t mStartTime, mStopTime, mDiffTime; // time
  95. float mFrac; // time
  96. mStartTime = time(0); // time
  97. for(Int_t iEvent=0; iEvent<mNEvents; iEvent++) {
  98. mProgress = (Float_t)iEvent / (Float_t)mNEvents;
  99. mNEventsProcessed++;
  100. if(mProgress >= mPercentCounter) {
  101. mPercentCounter += mPerConst;
  102. mStopTime = time(0);
  103. mDiffTime = difftime(mStopTime, mStartTime);
  104. mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
  105. mSubCounter++;
  106. cout << Form("Processing progress: %4.2f%%. Time left: %.1f sec", mProgress*100., mFrac)
  107. << endl;
  108. }
  109. mChain->Clear();
  110. iReturn = mChain->Make(iEvent);
  111. if(iReturn != 0) {
  112. cout << "Error has been occured. Event processing has been stopped"
  113. << endl;
  114. break;
  115. }
  116. } //for(Int_t iEvent=0; iEvent<mNEvents; iEvent++)
  117. mChain->Finish();
  118. delete femtoMaker;
  119. delete mChain;
  120. cout << "****************************************************" << endl
  121. << "* FemtoDstMaker for p+Au 200 GeV year 2015 (HFT) *" << endl
  122. << "* End *" << endl
  123. << "****************************************************" << endl
  124. << endl;
  125. }