FemtoDstMaker_pions_pp200_y2012.C 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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 = "";
  8. const Char_t *defaultOutFile = "oFemtoDst_pp200_2012.root";
  9. class StFemtoDstInclusiveSelector;
  10. StFemtoDstInclusiveSelector *mFemtoDstInclSelector = NULL;
  11. //_________________
  12. void FemtoDstMaker_pions_pp200_y2012(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(17); //Trigger selection for pp200 y2012 P12id VPDMB
  81. mFemtoDstInclSelector->AddTriggerId(37);
  82. mFemtoDstInclSelector->AddTriggerId(370001);
  83. mFemtoDstInclSelector->AddTriggerId(370011);
  84. mFemtoDstInclSelector->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  85. mFemtoDstInclSelector->SetVtxRCut(cVtxR[0], cVtxR[1]);
  86. mFemtoDstInclSelector->SetVtxShift(cVtxXShift, cVtxYShift);
  87. mFemtoDstInclSelector->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  88. mFemtoDstInclSelector->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  89. mFemtoDstInclSelector->SetTrackDcaGlobal(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  90. mFemtoDstInclSelector->SetTrackNHits(cTrackNHits[0], cTrackNHits[1]);
  91. mFemtoDstInclSelector->SetTrackNHitsFit(cTrackNHitsFit[0], cTrackNHitsFit[1]);
  92. mFemtoDstInclSelector->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  93. mFemtoDstInclSelector->SetTrackFlag(cTrackFlag[0], cTrackFlag[1]);
  94. mFemtoDstInclSelector->SetCollisionTypeAuAu(isAuAu);
  95. mFemtoDstInclSelector->SetAuAuZdcCoincidenceEnergy(cZdcRefmultCorrection);
  96. mFemtoDstInclSelector->SetMuDstMaker(muDstMaker);
  97. //Inclusive selection
  98. //Pions
  99. mFemtoDstInclSelector->SetSelectKaons(false);
  100. mFemtoDstInclSelector->SetSelectProtons(false);
  101. mFemtoDstInclSelector->SetSelectPions(cSelectPions);
  102. mFemtoDstInclSelector->SetSelectTpcPions(cSelectTpcPions);
  103. mFemtoDstInclSelector->SetPionTpcMom(cPionTpcMom[0], cPionTpcMom[1]);
  104. mFemtoDstInclSelector->SetPionTpcNSigmaElectron(cPionTpcNSigmaElectron[0],cPionTpcNSigmaElectron[1]);
  105. mFemtoDstInclSelector->SetPionTpcNSigmaPion(cPionTpcNSigmaPion[0],cPionTpcNSigmaPion[1]);
  106. mFemtoDstInclSelector->SetPionTpcNSigmaKaon(cPionTpcNSigmaKaon[0],cPionTpcNSigmaKaon[1]);
  107. mFemtoDstInclSelector->SetPionTpcNSigmaProton(cPionTpcNSigmaProton[0],cPionTpcNSigmaProton[1]);
  108. mFemtoDstInclSelector->SetSelectTofPions(cSelectTofPions);
  109. mFemtoDstInclSelector->SetPionTofMom(cPionTofMom[0],cPionTofMom[1]);
  110. mFemtoDstInclSelector->SetPionMassSqr(cPionMassSqr[0],cPionMassSqr[1]);
  111. //Chain initialization and loop over events
  112. mChain->Init();
  113. Int_t iReturn = 0;
  114. Int_t mNEventsProcessed = 0;
  115. Float_t mPercentCounter = 0.05;
  116. Float_t mProgress = 0.;
  117. unsigned int mSubCounter = 1; // time
  118. time_t mStartTime, mStopTime, mDiffTime; // time
  119. float mFrac; // time
  120. mStartTime = time(0); // time
  121. for(Int_t iEvent=0; iEvent<mNEvents; iEvent++) {
  122. mProgress = (Float_t)iEvent / (Float_t)mNEvents;
  123. mNEventsProcessed++;
  124. if(mProgress >= mPercentCounter) {
  125. mPercentCounter += mPercentCounter;
  126. mStopTime = time(0);
  127. mDiffTime = difftime(mStopTime, mStartTime);
  128. mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
  129. mSubCounter++;
  130. std::cout << Form("Processing progress: %4.2f%%. Time left: %.1 sec", mProgress*100., mFrac)
  131. << std::endl;
  132. }
  133. mChain->Clear();
  134. iReturn = mChain->Make(iEvent);
  135. if(iReturn != 0) {
  136. std::cout << "Error has been occured. Event processing has been stopped"
  137. << std::endl;
  138. break;
  139. }
  140. } //for(Int_t iEvent=0; iEvent<mNEvents; iEvent++)
  141. mChain->Finish();
  142. delete mFemtoDstMaker;
  143. delete mChain;
  144. std::cout << "**************************" << std::endl
  145. << "* FemtoDstMaker *" << std::endl
  146. << "* Finish *" << std::endl
  147. << "**************************" << std::endl << endl;
  148. }