FemtoDstMaker_kaons_pp200_y2015.C 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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_2015.root";
  9. class StFemtoDstInclusiveSelector;
  10. StFemtoDstInclusiveSelector *mFemtoDstInclSelector = NULL;
  11. //_________________
  12. void FemtoDstMaker_kaons_pp200_y2015(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. //Kaons
  34. Bool_t cSelectKaons = true;
  35. Bool_t cSelectTpcKaons = true;
  36. Float_t cKaonTpcMom[2] = {0.15, 0.75};
  37. Float_t cKaonTpcNSigmaElectron[2] = {-1., 1.};
  38. Float_t cKaonTpcNSigmaPion[2] = {-1., 1.};
  39. Float_t cKaonTpcNSigmaKaon[2] = {-3., 3.};
  40. Float_t cKaonTpcNSigmaProton[2] = {-3., 3.};
  41. Bool_t cSelectTofKaons = true;
  42. Float_t cKaonTofMom[2] = {0.5, 1.65};
  43. Float_t cKaonMassSqr[2] = {0.16, 0.35};
  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(480004); //Trigger selection for pp200 y2015 P16id VPDMB
  81. mFemtoDstInclSelector->AddTriggerId(480007);
  82. mFemtoDstInclSelector->AddTriggerId(480904);
  83. mFemtoDstInclSelector->AddTriggerId(470001);
  84. mFemtoDstInclSelector->AddTriggerId(470004);
  85. mFemtoDstInclSelector->AddTriggerId(470007);
  86. mFemtoDstInclSelector->AddTriggerId(470014);
  87. mFemtoDstInclSelector->AddTriggerId(470017);
  88. mFemtoDstInclSelector->AddTriggerId(470904);
  89. mFemtoDstInclSelector->AddTriggerId(470914);
  90. mFemtoDstInclSelector->AddTriggerId(490004);
  91. mFemtoDstInclSelector->AddTriggerId(490007);
  92. mFemtoDstInclSelector->AddTriggerId(490904);
  93. mFemtoDstInclSelector->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  94. mFemtoDstInclSelector->SetVtxRCut(cVtxR[0], cVtxR[1]);
  95. mFemtoDstInclSelector->SetVtxShift(cVtxXShift, cVtxYShift);
  96. mFemtoDstInclSelector->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  97. mFemtoDstInclSelector->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  98. mFemtoDstInclSelector->SetTrackDcaGlobal(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  99. mFemtoDstInclSelector->SetTrackNHits(cTrackNHits[0], cTrackNHits[1]);
  100. mFemtoDstInclSelector->SetTrackNHitsFit(cTrackNHitsFit[0], cTrackNHitsFit[1]);
  101. mFemtoDstInclSelector->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  102. mFemtoDstInclSelector->SetTrackFlag(cTrackFlag[0], cTrackFlag[1]);
  103. mFemtoDstInclSelector->SetCollisionTypeAuAu(isAuAu);
  104. mFemtoDstInclSelector->SetAuAuZdcCoincidenceEnergy(cZdcRefmultCorrection);
  105. mFemtoDstInclSelector->SetMuDstMaker(muDstMaker);
  106. //Inclusive selection
  107. //Kaons
  108. mFemtoDstInclSelector->SetSelectPions(false);
  109. mFemtoDstInclSelector->SetSelectProtons(false);
  110. mFemtoDstInclSelector->SetSelectKaons(cSelectKaons);
  111. mFemtoDstInclSelector->SetSelectTpcKaons(cSelectTpcKaons);
  112. mFemtoDstInclSelector->SetKaonTpcMom(cKaonTpcMom[0], cKaonTpcMom[1]);
  113. mFemtoDstInclSelector->SetKaonTpcNSigmaElectron(cKaonTpcNSigmaElectron[0],cKaonTpcNSigmaElectron[1]);
  114. mFemtoDstInclSelector->SetKaonTpcNSigmaPion(cKaonTpcNSigmaPion[0],cKaonTpcNSigmaPion[1]);
  115. mFemtoDstInclSelector->SetKaonTpcNSigmaKaon(cKaonTpcNSigmaKaon[0],cKaonTpcNSigmaKaon[1]);
  116. mFemtoDstInclSelector->SetKaonTpcNSigmaProton(cKaonTpcNSigmaProton[0],cKaonTpcNSigmaProton[1]);
  117. mFemtoDstInclSelector->SetSelectTofKaons(cSelectTofKaons);
  118. mFemtoDstInclSelector->SetKaonTofMom(cKaonTofMom[0],cKaonTofMom[1]);
  119. mFemtoDstInclSelector->SetKaonMassSqr(cKaonMassSqr[0],cKaonMassSqr[1]);
  120. //Chain initialization and loop over events
  121. mChain->Init();
  122. Int_t iReturn = 0;
  123. Int_t mNEventsProcessed = 0;
  124. Float_t mPercentCounter = 0.05;
  125. Float_t mProgress = 0.;
  126. unsigned int mSubCounter = 1; // time
  127. time_t mStartTime, mStopTime, mDiffTime; // time
  128. float mFrac; // time
  129. mStartTime = time(0); // time
  130. for(Int_t iEvent=0; iEvent<mNEvents; iEvent++) {
  131. mProgress = (Float_t)iEvent / (Float_t)mNEvents;
  132. mNEventsProcessed++;
  133. if(mProgress >= mPercentCounter) {
  134. mPercentCounter += mPercentCounter;
  135. mStopTime = time(0);
  136. mDiffTime = difftime(mStopTime, mStartTime);
  137. mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
  138. mSubCounter++;
  139. std::cout << Form("Processing progress: %4.2f%%. Time left: %.1 sec", mProgress*100., mFrac)
  140. << std::endl;
  141. }
  142. mChain->Clear();
  143. iReturn = mChain->Make(iEvent);
  144. if(iReturn != 0) {
  145. std::cout << "Error has been occured. Event processing has been stopped"
  146. << std::endl;
  147. break;
  148. }
  149. } //for(Int_t iEvent=0; iEvent<mNEvents; iEvent++)
  150. mChain->Finish();
  151. delete mFemtoDstInclSelector
  152. delete mChain;
  153. std::cout << "**************************" << std::endl
  154. << "* FemtoDstMaker *" << std::endl
  155. << "* Finish *" << std::endl
  156. << "**************************" << std::endl << endl;
  157. }