FemtoDstMaker_pions_pp500_y2011.C 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 = "/star/data01/pwg/gnigmat/dataFiles/kk/pp500/2011/kaon_pp500_2011.MuDst.root";
  8. const Char_t *defaultOutFile = "oFemtoDst_pp500_2011.root";
  9. class StFemtoDstInclusiveSelector;
  10. StFemtoDstInclusiveSelector *mFemtoDstInclSelector = NULL;
  11. //_________________
  12. void FemtoDstMaker_pions_pp500_y2011(const Char_t* inFileList = defaultInFile,
  13. const Char_t* outFileName = defaultOutFile,
  14. const Bool_t isAuAu = false) {
  15. std::cout << "**************************" << std::endl
  16. << "* FemtoDstMaker *" << std::endl
  17. << "* Start *" << std::endl
  18. << "**************************" << std::endl << endl;
  19. //Constants, cut and initial parameters
  20. Float_t cVtxZ[2] = {-70., 70.};
  21. Float_t cVtxR[2] = {0., 3.};
  22. Float_t cVtxXShift = 0.;
  23. Float_t cVtxYShift = 0.;
  24. Float_t cVtxVpdVzDiff[2] = {-7., 7.};
  25. Float_t cParticleMom[2] = {0.15, 1.65};
  26. Float_t cTrackDcaGlobal[2] = {-0.01, 3.};
  27. Int_t cTrackNHits[2] = {15, 50};
  28. Int_t cTrackNHitsFit[2] = {5, 50};
  29. Float_t cTrackEta[2] = {-1., 1.};
  30. Int_t cTrackFlag[2] = {0, 1000};
  31. Bool_t cZdcRefmultCorrection = true; //Should be false for low energies
  32. //Inclusive cuts
  33. //Pions
  34. Bool_t cSelectPions = true;
  35. Bool_t cSelectTpcPions = true;
  36. Float_t cPionTpcMom[2] = {0.15, 0.75};
  37. Float_t cPionTpcNSigmaElectron[2] = {-2., 2.};
  38. Float_t cPionTpcNSigmaPion[2] = {-3., 3.};
  39. Float_t cPionTpcNSigmaKaon[2] = {-2., 2.};
  40. Float_t cPionTpcNSigmaProton[2] = {-3., 3.};
  41. Bool_t cSelectTofPions = true;
  42. Float_t cPionTofMom[2] = {0.55, 1.65};
  43. Float_t cPionMassSqr[2] = {-0.05, 0.09};
  44. //Load libraries
  45. std::cout << "Loading libraries..." << std::endl;
  46. gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  47. loadSharedLibraries();
  48. gSystem->Load("libMinuit");
  49. gSystem->Load("StChain");
  50. gSystem->Load("StRefMultCorr");
  51. gSystem->Load("StFlowMaker");
  52. gSystem->Load("StHbtMaker");
  53. gSystem->Load("StFemtoDstMaker");
  54. gSystem->Load("libStFemtoDstMaker.so");
  55. std::cout << "Libraries have been successfully loaded" << std::endl;
  56. //Create chain
  57. StChain *mChain = new StChain("StChain");
  58. mChain->SetDebug(0);
  59. StMuDebug::setLevel(0);
  60. //Create MuDst reader
  61. int nMaxFileToRead = 1e9;
  62. std::cout << Form("Try to read file: %s", inFileList) << std::endl;
  63. StMuDstMaker *muDstMaker =
  64. new StMuDstMaker(0, 0, "", inFileList, "MuDst", nMaxFileToRead);
  65. muDstMaker->SetStatus("*",0);
  66. muDstMaker->SetStatus("Event*",1);
  67. muDstMaker->SetStatus("MuEvent*",1);
  68. muDstMaker->SetStatus("PrimaryVertices*",1);
  69. muDstMaker->SetStatus("PrimaryTracks*",1);
  70. muDstMaker->SetStatus("GlobalTracks*",1);
  71. muDstMaker->SetStatus("BTofHeader*",1);
  72. TChain *mCurrentTree = muDstMaker->chain();
  73. Long64_t mNEvents = mCurrentTree->GetEntries();
  74. std::cout << Form("Number of events in TTree: %d", mNEvents) << std::endl;
  75. //Heavy ion related makers
  76. StRefMultCorr *mRefMult = new StRefMultCorr("refmult");
  77. //StFemtoDstMaker initialization
  78. mFemtoDstInclSelector = new StFemtoDstInclusiveSelector(muDstMaker,
  79. outFileName);
  80. mFemtoDstInclSelector->AddTriggerId(320000); //Trigger selection for pp500 y2011
  81. mFemtoDstInclSelector->AddTriggerId(320001);
  82. mFemtoDstInclSelector->AddTriggerId(320011);
  83. mFemtoDstInclSelector->AddTriggerId(320021);
  84. mFemtoDstInclSelector->AddTriggerId(330021);
  85. mFemtoDstInclSelector->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  86. mFemtoDstInclSelector->SetVtxRCut(cVtxR[0], cVtxR[1]);
  87. mFemtoDstInclSelector->SetVtxShift(cVtxXShift, cVtxYShift);
  88. mFemtoDstInclSelector->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  89. mFemtoDstInclSelector->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  90. mFemtoDstInclSelector->SetTrackDcaGlobal(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  91. mFemtoDstInclSelector->SetTrackNHits(cTrackNHits[0], cTrackNHits[1]);
  92. mFemtoDstInclSelector->SetTrackNHitsFit(cTrackNHitsFit[0], cTrackNHitsFit[1]);
  93. mFemtoDstInclSelector->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  94. mFemtoDstInclSelector->SetTrackFlag(cTrackFlag[0], cTrackFlag[1]);
  95. mFemtoDstInclSelector->SetCollisionTypeAuAu(isAuAu);
  96. mFemtoDstInclSelector->SetAuAuZdcCoincidenceEnergy(cZdcRefmultCorrection);
  97. mFemtoDstInclSelector->SetMuDstMaker(muDstMaker);
  98. //Inclusive selection
  99. //Pions
  100. mFemtoDstInclSelector->SetSelectKaons(false);
  101. mFemtoDstInclSelector->SetSelectProtons(false);
  102. mFemtoDstInclSelector->SetSelectPions(cSelectPions);
  103. mFemtoDstInclSelector->SetSelectTpcPions(cSelectTpcPions);
  104. mFemtoDstInclSelector->SetPionTpcMom(cPionTpcMom[0], cPionTpcMom[1]);
  105. mFemtoDstInclSelector->SetPionTpcNSigmaElectron(cPionTpcNSigmaElectron[0],cPionTpcNSigmaElectron[1]);
  106. mFemtoDstInclSelector->SetPionTpcNSigmaPion(cPionTpcNSigmaPion[0],cPionTpcNSigmaPion[1]);
  107. mFemtoDstInclSelector->SetPionTpcNSigmaKaon(cPionTpcNSigmaKaon[0],cPionTpcNSigmaKaon[1]);
  108. mFemtoDstInclSelector->SetPionTpcNSigmaProton(cPionTpcNSigmaProton[0],cPionTpcNSigmaProton[1]);
  109. mFemtoDstInclSelector->SetSelectTofPions(cSelectTofPions);
  110. mFemtoDstInclSelector->SetPionTofMom(cPionTofMom[0],cPionTofMom[1]);
  111. mFemtoDstInclSelector->SetPionMassSqr(cPionMassSqr[0],cPionMassSqr[1]);
  112. //Chain initialization and loop over events
  113. mChain->Init();
  114. Int_t iReturn = 0;
  115. Int_t mNEventsProcessed = 0;
  116. Float_t mPercentCounter = 0.05;
  117. Float_t mProgress = 0.;
  118. unsigned int mSubCounter = 1; // time
  119. time_t mStartTime, mStopTime, mDiffTime; // time
  120. float mFrac; // time
  121. mStartTime = time(0); // time
  122. for(Int_t iEvent=0; iEvent<mNEvents; iEvent++) {
  123. mProgress = (Float_t)iEvent / (Float_t)mNEvents;
  124. mNEventsProcessed++;
  125. if(mProgress >= mPercentCounter) {
  126. mPercentCounter += mPercentCounter;
  127. mStopTime = time(0);
  128. mDiffTime = difftime(mStopTime, mStartTime);
  129. mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
  130. mSubCounter++;
  131. std::cout << Form("Processing progress: %4.2f%%. Time left: %.1 sec", mProgress*100., mFrac)
  132. << std::endl;
  133. }
  134. mChain->Clear();
  135. iReturn = mChain->Make(iEvent);
  136. if(iReturn != 0) {
  137. std::cout << "Error has been occured. Event processing has been stopped"
  138. << std::endl;
  139. break;
  140. }
  141. } //for(Int_t iEvent=0; iEvent<mNEvents; iEvent++)
  142. mChain->Finish();
  143. delete mFemtoDstMaker;
  144. delete mChain;
  145. std::cout << "**************************" << std::endl
  146. << "* FemtoDstMaker *" << std::endl
  147. << "* Finish *" << std::endl
  148. << "**************************" << std::endl << endl;
  149. }