FemtoDstMaker_pp510_y2011.C 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #include "TROOT.h"
  2. #include "TSystem.h"
  3. #include "TChain.h"
  4. #include "TFile.h"
  5. #include "TString.h"
  6. #include <iostream>
  7. using namespace std;
  8. const Char_t *defaultInFile = "test.list";
  9. const Char_t *defaultOutFile = "oFemtoDstMesons_pp510_2011.root";
  10. class StFemtoDstMaker;
  11. StFemtoDstMaker *femtoMaker = NULL;
  12. //_________________
  13. void FemtoDstMaker_pp510_y2011(const Char_t* inFileList = defaultInFile,
  14. const Char_t* outFileName = defaultOutFile)
  15. {
  16. cout
  17. << "**************************\n"
  18. << "* FemtoDstMaker *\n"
  19. << "* p+p 510 GeV, year 2011 *\n"
  20. << "* Start *\n"
  21. << "**************************\n\n";
  22. //Constants, cut and initial parameters
  23. Float_t cVtxZ[2] = {-100., 100.};
  24. Float_t cVtxR[2] = {0., 3.};
  25. Float_t cVtxXShift = 0.;
  26. Float_t cVtxYShift = 0.;
  27. Float_t cVtxVpdVzDiff[2] = {-10., 10.};
  28. Float_t cParticleMom[2] = {0.1, 2.0};
  29. Float_t cTrackDcaGlobal[2] = {-0.01, 3.};
  30. Int_t cTrackNHits[2] = {5, 50};
  31. Int_t cTrackNHitsFit[2] = {5, 50};
  32. Float_t cTrackEta[2] = {-1.1, 1.1};
  33. Int_t cTrackFlag[2] = {0, 1000};
  34. //Load libraries
  35. cout << "Loading libraries..." << endl;
  36. gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  37. loadSharedLibraries();
  38. gSystem->Load("libMinuit");
  39. gSystem->Load("StChain");
  40. gSystem->Load("StRefMultCorr");
  41. gSystem->Load("StFlowMaker");
  42. gSystem->Load("StHbtMaker");
  43. gSystem->Load("StPicoDstMakerRun11");
  44. gSystem->Load("StFemtoDstMaker");
  45. gSystem->Load("libStFemtoDstMaker.so");
  46. cout << "Libraries have been successfully loaded" << endl;
  47. //Create chain
  48. StChain *mChain = new StChain("StChain");
  49. mChain->SetDebug(0);
  50. StMuDebug::setLevel(0);
  51. //Create MuDst reader
  52. int nMaxFileToRead = 1e9;
  53. cout << Form("Try to read file: %s", inFileList) << endl;
  54. StMuDstMaker *muDstMaker = new StMuDstMaker(0, 0, "", inFileList, "MuDst", nMaxFileToRead);
  55. muDstMaker->SetStatus("*",0);
  56. muDstMaker->SetStatus("Event*",1);
  57. muDstMaker->SetStatus("MuEvent*",1);
  58. muDstMaker->SetStatus("PrimaryVertices*",1);
  59. muDstMaker->SetStatus("PrimaryTracks*",1);
  60. muDstMaker->SetStatus("GlobalTracks*",1);
  61. muDstMaker->SetStatus("BTofHeader*",1);
  62. muDstMaker->SetStatus("BTofHit*", 1);
  63. TChain *mCurrentTree = muDstMaker->chain();
  64. Long64_t mNEvents = mCurrentTree->GetEntries();
  65. cout << Form("Number of events in TTree: %d", mNEvents) << endl;
  66. //StFemtoDstMaker initialization
  67. femtoMaker = new StFemtoDstMaker(muDstMaker, outFileName);
  68. femtoMaker->SetTriggerId(320000); //Trigger selection for pp500 y2011
  69. femtoMaker->SetTriggerId(320001);
  70. femtoMaker->SetTriggerId(320011);
  71. femtoMaker->SetTriggerId(320021);
  72. femtoMaker->SetTriggerId(330021);
  73. femtoMaker->SetTriggerId(330600);
  74. femtoMaker->SetTriggerId(330601);
  75. femtoMaker->SetTriggerId(330501);
  76. femtoMaker->SetTriggerId(330503);
  77. femtoMaker->SetTriggerId(330524);
  78. femtoMaker->SetTriggerId(320501);
  79. femtoMaker->SetTriggerId(320503);
  80. femtoMaker->SetTriggerId(320504);
  81. femtoMaker->SetTriggerId(320514);
  82. femtoMaker->SetTriggerId(320524);
  83. femtoMaker->SetTriggerId(320600);
  84. femtoMaker->SetTriggerId(320601);
  85. femtoMaker->SetTriggerId(320500);
  86. femtoMaker->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  87. femtoMaker->SetVtxRCut(cVtxR[0], cVtxR[1]);
  88. femtoMaker->SetVtxShift(cVtxXShift, cVtxYShift);
  89. femtoMaker->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  90. femtoMaker->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  91. femtoMaker->SetTrackDcaGlobal(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  92. femtoMaker->SetTrackNHits(cTrackNHits[0], cTrackNHits[1]);
  93. femtoMaker->SetTrackNHitsFit(cTrackNHitsFit[0], cTrackNHitsFit[1]);
  94. femtoMaker->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  95. femtoMaker->SetTrackFlag(cTrackFlag[0], cTrackFlag[1]);
  96. femtoMaker->SetCollisionType(false);
  97. femtoMaker->SetAuAuZdcCoincidenceEnergy(false);
  98. femtoMaker->SetMuDstMaker(muDstMaker);
  99. //Chain initialization and loop over events
  100. mChain->Init();
  101. Int_t iReturn = 0;
  102. Int_t mNEventsProcessed = 0;
  103. Float_t mPercentStep = 0.05;
  104. Float_t mPercentCounter = mPercentStep;
  105. Float_t mProgress = 0.;
  106. time_t mStartTime, mStopTime, mDiffTime; // time
  107. float mFrac; // time
  108. mStartTime = time(0); // time
  109. for(Int_t iEvent=0; iEvent<mNEvents; iEvent++) {
  110. mProgress = (Float_t)iEvent/(Float_t)mNEvents;
  111. mNEventsProcessed++;
  112. if(mProgress >= mPercentCounter) {
  113. mPercentCounter += mPercentStep;
  114. mStopTime = time(0);
  115. mDiffTime = difftime(mStopTime, mStartTime);
  116. mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
  117. cout << Form("Processing progress: %3.0f%%. ETA: %.1f sec", mProgress*100., mFrac)
  118. << endl;
  119. }
  120. mChain->Clear();
  121. iReturn = mChain->Make(iEvent);
  122. if(iReturn != 0) {
  123. cout << "Error has been occured. Event processing has been stopped"
  124. << endl;
  125. break;
  126. }
  127. } //for(Int_t iEvent=0; iEvent<mNEvents; iEvent++)
  128. mChain->Finish();
  129. delete femtoMaker;
  130. delete mChain;
  131. cout
  132. << "**************************\n"
  133. << "* FemtoDstMaker *\n"
  134. << "* p+p 510 GeV, year 2011 *\n"
  135. << "* Finish *\n"
  136. << "**************************\n\n";
  137. }