FemtoDstMaker_CuAu200.C 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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_CuAu200_2012.root";
  9. class StFemtoDstMaker;
  10. StFemtoDstMaker *mFemtoDst = NULL;
  11. //_________________
  12. void FemtoDstMaker_CuAu200(const Char_t* inFileList = defaultInFile,
  13. const Char_t* outFileName = defaultOutFile,
  14. const Char_t* calibPath = "calib",
  15. const Bool_t isAA = true) {
  16. std::cout << "**************************" << std::endl
  17. << "* FemtoDstMaker *" << std::endl
  18. << "* Start *" << std::endl
  19. << "**************************" << std::endl << endl;
  20. //Constants, cut and initial parameters
  21. Float_t cVtxZ[2] = {-30., 30.};
  22. Float_t cVtxR[2] = {0., 3.};
  23. Float_t cVtxXShift = 0.;
  24. Float_t cVtxYShift = 0.;
  25. Float_t cVtxVpdVzDiff[2] = {-7., 7.};
  26. Float_t cParticleMom[2] = {0.15, 1.65};
  27. Float_t cTrackDcaGlobal[2] = {-0.01, 3.};
  28. Int_t cTrackNHits[2] = {15, 50};
  29. Int_t cTrackNHitsFit[2] = {15, 50};
  30. Float_t cTrackEta[2] = {-1., 1.};
  31. Int_t cTrackFlag[2] = {0, 1000};
  32. Bool_t cZdcRefmultCorrection = true; //Should be false for low energies
  33. //Load libraries
  34. std::cout << "Loading libraries..." << std::endl;
  35. gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  36. loadSharedLibraries();
  37. gSystem->Load("libMinuit");
  38. gSystem->Load("StRefMultCorr");
  39. gSystem->Load("StFlowMaker"); // should be placed before HBT
  40. gSystem->Load("StHbtMaker");
  41. gSystem->Load("StarClassLibrary");
  42. gSystem->Load("libgsl");
  43. gSystem->Load("libgslcblas");
  44. gSystem->Load("StPicoDstMakerRun12");
  45. gSystem->Load("StarClassLibrary");
  46. gSystem->Load("libgsl");
  47. gSystem->Load("libgslcblas");
  48. gSystem->Load("libVMC.so");
  49. gSystem->Load("libStDb_Tables.so");
  50. gSystem->Load("libgen_Tables.so");
  51. gSystem->Load("libgeometry_Tables.so");
  52. gSystem->Load("libsim_Tables.so");
  53. gSystem->Load("libStarMagField.so");
  54. gSystem->Load("libSt_db_Maker.so");
  55. gSystem->Load("libSt_g2t.so");
  56. gSystem->Load("libSt_geant_Maker.so");
  57. gSystem->Load("StarGeneratorUtil.so");
  58. gSystem->Load("StarGeneratorEvent.so");
  59. gSystem->Load("StarGeneratorBase.so");
  60. gSystem->Load("QVMaker");
  61. gSystem->Load("StFemtoDstMaker");
  62. //Create chain
  63. StChain *mChain = new StChain("StChain");
  64. mChain->SetDebug(0);
  65. StMuDebug::setLevel(0);
  66. //Create MuDst reader
  67. int nMaxFileToRead = 1e9;
  68. std::cout << Form("Try to read file: %s", inFileList) << std::endl;
  69. StMuDstMaker *muDstMaker =
  70. new StMuDstMaker(0, 0, "", inFileList, "MuDst", nMaxFileToRead);
  71. muDstMaker->SetStatus("*",0);
  72. muDstMaker->SetStatus("Event*",1);
  73. muDstMaker->SetStatus("MuEvent*",1);
  74. muDstMaker->SetStatus("PrimaryVertices*",1);
  75. muDstMaker->SetStatus("PrimaryTracks*",1);
  76. muDstMaker->SetStatus("GlobalTracks*",1);
  77. muDstMaker->SetStatus("BTofHeader*",1);
  78. TChain *mCurrentTree = muDstMaker->chain();
  79. Long64_t mNEvents = mCurrentTree->GetEntries();
  80. std::cout << Form("Number of events in TTree: %d", mNEvents) << std::endl;
  81. //Heavy ion related makers
  82. StRefMultCorr *mRefMult = new StRefMultCorr("refmult");
  83. //StFemtoDstMaker initialization
  84. mFemtoDst = new StFemtoDstMaker(muDstMaker,
  85. calibPath,
  86. outFileName);
  87. mFemtoDst->SetTriggerId(410008); // vpd-zdce-tac-protected
  88. mFemtoDst->SetTriggerId(410005); // vpd-zdc-mb-protected
  89. mFemtoDst->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  90. mFemtoDst->SetVtxRCut(cVtxR[0], cVtxR[1]);
  91. mFemtoDst->SetVtxShift(cVtxXShift, cVtxYShift);
  92. mFemtoDst->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  93. mFemtoDst->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  94. mFemtoDst->SetTrackDcaGlobal(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  95. mFemtoDst->SetTrackNHits(cTrackNHits[0], cTrackNHits[1]);
  96. mFemtoDst->SetTrackNHitsFit(cTrackNHitsFit[0], cTrackNHitsFit[1]);
  97. mFemtoDst->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  98. mFemtoDst->SetTrackFlag(cTrackFlag[0], cTrackFlag[1]);
  99. mFemtoDst->SetCollisionType(isAA);
  100. mFemtoDst->SetAuAuZdcCoincidenceEnergy(cZdcRefmultCorrection);
  101. mFemtoDst->SetMuDstMaker(muDstMaker);
  102. //Chain initialization and loop over events
  103. mChain->Init();
  104. Int_t iReturn = 0;
  105. Int_t mNEventsProcessed = 0;
  106. Float_t mPercentCounter = 0.05;
  107. Float_t mProgress = 0.;
  108. unsigned int mSubCounter = 1; // time
  109. time_t mStartTime, mStopTime, mDiffTime; // time
  110. float mFrac; // time
  111. mStartTime = time(0); // time
  112. for (Int_t iEvent=0; iEvent<mNEvents; iEvent++) {
  113. mProgress = (Float_t)iEvent / (Float_t)mNEvents;
  114. mNEventsProcessed++;
  115. if (mProgress >= mPercentCounter) {
  116. mPercentCounter += mPercentCounter;
  117. mStopTime = time(0);
  118. mDiffTime = difftime(mStopTime, mStartTime);
  119. mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
  120. mSubCounter++;
  121. std::cout << Form("Processing progress: %4.2f%%. Time left: %.1 sec", mProgress*100., mFrac)
  122. << std::endl;
  123. }
  124. mChain->Clear();
  125. iReturn = mChain->Make(iEvent);
  126. if(iReturn != 0) {
  127. std::cout << "Error has been occured. Event processing has been stopped"
  128. << std::endl;
  129. break;
  130. }
  131. } //for(Int_t iEvent=0; iEvent<mNEvents; iEvent++)
  132. mChain->Finish();
  133. delete mFemtoDst;
  134. delete mChain;
  135. std::cout << "**************************" << std::endl
  136. << "* FemtoDstMaker *" << std::endl
  137. << "* Finish *" << std::endl
  138. << "**************************" << std::endl << endl;
  139. }