FemtoDstMaker_mesons_pp200_pythia6.C 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. int status1 = gSystem->Load("/star/data01/pwg/pusheax/lib/libLHAPDF.so");
  2. int status = gSystem->Load("/star/data01/pwg/pusheax/simulation/pythia6/libPythia6.so");
  3. /*********************************************************
  4. * *
  5. * Macros for p+p 200 GeV simulation on Pythia 6.4.28. *
  6. * *
  7. * first argument is an output file *
  8. * second argument is a tune id see (arxiv:1005.3457v5) *
  9. * if mTuneId = -1 then vanilla pythia 6.4.28 are used *
  10. * *
  11. * Some useful tune id's: *
  12. * TUNE | ID *
  13. * -------------------------------- *
  14. * Perugia 2011 | 350 *
  15. * Perugia 2011 noCR | 354 *
  16. * Perugia 0 | 320 *
  17. * Tune A (used by Zibi) | 100 *
  18. * *
  19. *********************************************************/
  20. #include "TROOT.h"
  21. #include "TSystem.h"
  22. #include "TChain.h"
  23. #include "TFile.h"
  24. #include "TString.h"
  25. #include "TPythia6.h"
  26. #include "TRandom3.h"
  27. #include <iostream>
  28. //
  29. // Uncomment line below to turn on verbose output
  30. //
  31. // #define MY_DEBUG
  32. const Char_t *defaultOutFile = "oFemtoDst_pp200_pythia6.root";
  33. void FemtoDstMaker_mesons_pp200_pythia6(const Char_t* outFileName = defaultOutFile,
  34. Int_t mTuneId = -1)
  35. {
  36. std::cout << "**************************" << std::endl
  37. << "* FemtoDstMaker *" << std::endl
  38. << "* PYTHIA6 *" << std::endl
  39. << "* p+p 200 GeV mesons *" << std::endl
  40. << "* Start *" << std::endl
  41. << "**************************" << std::endl << endl;
  42. //Constants, cut and initial parameters
  43. Int_t mNEvents2Gen = 50000;
  44. Double_t mCollisionEnergy = 200.;
  45. Bool_t mIsFullField = false;
  46. Float_t cParticleMom[2] = {0.15, 1.55};
  47. Float_t cTrackDcaGlobal[2] = {-0.01, 2.};
  48. Float_t cTrackEta[2] = {-1., 1.};
  49. Bool_t cRemoveProtons = true;
  50. //
  51. // Load libraries
  52. //
  53. std::cout << "Loading libraries..." << std::endl;
  54. gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  55. loadSharedLibraries();
  56. gSystem->Load("libMinuit");
  57. gSystem->Load("StRefMultCorr");
  58. gSystem->Load("StFlowMaker"); // should be placed before HBT
  59. gSystem->Load("StHbtMaker");
  60. gSystem->Load("StarClassLibrary");
  61. gSystem->Load("libgsl");
  62. gSystem->Load("libgslcblas");
  63. gSystem->Load("StPicoDstMakerRun11");
  64. gSystem->Load("StFemtoDstMaker");
  65. std::cout << "Libraries have been successfully loaded" << std::endl;
  66. //
  67. // Create chain
  68. //
  69. StChain *mChain = new StChain("StChain");
  70. mChain->SetDebug(0);
  71. StMuDebug::setLevel(0);
  72. //
  73. // Random initialization
  74. //
  75. TRandom3 randy(0);
  76. Int_t mSeed = floor(randy.Uniform(1., 100000.));
  77. std::cout << "Random seed: " << mSeed << std::endl;
  78. //
  79. // TPythia6 initialization
  80. //
  81. TPythia6* mTPythia = new TPythia6();
  82. mTPythia->SetMSEL(1); //mbias
  83. mTPythia->SetMRPY(1, mSeed);
  84. if (mTuneId != -1) mTPythia->SetMSTP(5, mTuneId);
  85. mTPythia->Initialize("CMS", "p", "p", mCollisionEnergy);
  86. mTPythia->Pyexec();
  87. //
  88. // StFemtoDstPythia6Maker initialization
  89. //
  90. StFemtoDstPythia6Maker *mFemtoDstMaker =
  91. new StFemtoDstPythia6Maker(mTPythia, outFileName);
  92. mFemtoDstMaker->SetIsFullField(mIsFullField);
  93. mFemtoDstMaker->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  94. mFemtoDstMaker->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  95. mFemtoDstMaker->SetTrackDca(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  96. mFemtoDstMaker->SetTrackDcaGlobal(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  97. mFemtoDstMaker->SetRemoveProtons(cRemoveProtons);
  98. //
  99. // Chain initialization and loop over events
  100. //
  101. mChain->Init();
  102. Int_t iReturn = 0;
  103. Int_t mNEventsProcessed = 0;
  104. Float_t mPercentCounter = 0.05;
  105. Float_t mProgress = 0.;
  106. unsigned int mSubCounter = 1; // time
  107. time_t mStartTime, mStopTime, mDiffTime; // time
  108. float mFrac; // time
  109. mStartTime = time(0); // time
  110. for(Int_t iEvent = 0; iEvent < mNEvents2Gen; iEvent++)
  111. {
  112. mProgress = (Float_t)iEvent/(Float_t)mNEvents2Gen;
  113. mNEventsProcessed++;
  114. if(mProgress >= mPercentCounter)
  115. {
  116. mPercentCounter += 0.05;
  117. mStopTime = time(0);
  118. mDiffTime = difftime(mStopTime, mStartTime);
  119. mFrac = (float)mDiffTime*(float)(mNEvents2Gen - iEvent)/(float)iEvent;
  120. mSubCounter++;
  121. std::cout << Form("Processing progress: %4.2f%%. Time left: %.1f sec", mProgress*100., mFrac)
  122. << std::endl;
  123. }
  124. mChain->Clear();
  125. iReturn = mChain->Make(iEvent);
  126. #ifdef MY_DEBUG
  127. mTPythia->Pylist(2);
  128. #endif
  129. if(iReturn != 0)
  130. {
  131. std::cout << "Error has been occured. Event processing has been stopped"
  132. << std::endl;
  133. break;
  134. }
  135. }
  136. mChain->Finish();
  137. delete mFemtoDstMaker;
  138. delete mChain;
  139. std::cout << "***********************" << std::endl
  140. << "* Finish *" << std::endl
  141. << "***********************" << std::endl << std::endl;
  142. }