FemtoDstMaker_kaons_pau200.C 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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_kaons_pau200.root";
  9. class StFemtoDstInclusiveSelector;
  10. StFemtoDstInclusiveSelector *mFemtoDstInclSelector = NULL;
  11. //_________________
  12. void FemtoDstMaker_kaons_auau27(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., 2.};
  22. Float_t cVtxXShift = 0.;
  23. Float_t cVtxYShift = 0.;
  24. Float_t cVtxVpdVzDiff[2] = {-7., 7.};
  25. Float_t cParticleMom[2] = {0.14, 1.6};
  26. Float_t cTrackDcaGlobal[2] = {-0.01, 5.};
  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 = false;
  35. Bool_t cSelectTpcPions = false;
  36. Float_t cPionTpcMom[2] = {0.15, 0.75};
  37. Float_t cPionTpcNSigmaElectron[2] = {-1., 1.};
  38. Float_t cPionTpcNSigmaPion[2] = {-1., 1.};
  39. Float_t cPionTpcNSigmaKaon[2] = {-1., 1.};
  40. Float_t cPionTpcNSigmaProton[2] = {-1., 1.};
  41. Bool_t cSelectTofPions = false;
  42. Float_t cPionTofMom[2] = {0.2, 1.55};
  43. Float_t cPionMassSqr[2] = {-0.05, 0.09};
  44. //Kaons
  45. Bool_t cSelectKaons = true;
  46. Bool_t cSelectTpcKaons = true;
  47. Float_t cKaonTpcMom[2] = {0.15, 0.75};
  48. Float_t cKaonTpcNSigmaElectron[2] = {-1., 1.};
  49. Float_t cKaonTpcNSigmaPion[2] = {-1., 1.};
  50. Float_t cKaonTpcNSigmaKaon[2] = {-2., 2.};
  51. Float_t cKaonTpcNSigmaProton[2] = {-1., 1.};
  52. Bool_t cSelectTofKaons = true;
  53. Float_t cKaonTofMom[2] = {0.2, 1.55};
  54. Float_t cKaonMassSqr[2] = {0.16, 0.35};
  55. //Protons
  56. Bool_t cSelectProtons = false;
  57. Bool_t cSelectTpcProtons = false;
  58. Float_t cProtonTpcMom[2] = {0.15, 1.05};
  59. Float_t cProtonTpcNSigmaElectron[2] = {-2., 2.};
  60. Float_t cProtonTpcNSigmaPion[2] = {-2., 2.};
  61. Float_t cProtonTpcNSigmaKaon[2] = {-2., 2.};
  62. Float_t cProtonTpcNSigmaProton[2] = {-3., 3.};
  63. Bool_t cSelectTofProtons = false;
  64. Float_t cProtonTofMom[2] = {0.15, 1.7};
  65. Float_t cProtonMassSqr[2] = {0.75, 1.05};
  66. //Load libraries
  67. std::cout << "Loading libraries..." << std::endl;
  68. gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  69. loadSharedLibraries();
  70. gSystem->Load("libMinuit");
  71. gSystem->Load("StChain");
  72. gSystem->Load("StRefMultCorr");
  73. gSystem->Load("StFlowMaker");
  74. gSystem->Load("StHbtMaker");
  75. gSystem->Load("StFemtoDstMaker");
  76. gSystem->Load("libStFemtoDstMaker.so");
  77. std::cout << "Libraries have been successfully loaded" << std::endl;
  78. //Create chain
  79. StChain *mChain = new StChain("StChain");
  80. mChain->SetDebug(0);
  81. StMuDebug::setLevel(0);
  82. //Create MuDst reader
  83. int nMaxFileToRead = 1e9;
  84. std::cout << Form("Try to read file: %s", inFileList) << std::endl;
  85. StMuDstMaker *muDstMaker =
  86. new StMuDstMaker(0, 0, "", inFileList, "MuDst", nMaxFileToRead);
  87. muDstMaker->SetStatus("*",0);
  88. muDstMaker->SetStatus("Event*",1);
  89. muDstMaker->SetStatus("MuEvent*",1);
  90. muDstMaker->SetStatus("PrimaryVertices*",1);
  91. muDstMaker->SetStatus("PrimaryTracks*",1);
  92. muDstMaker->SetStatus("GlobalTracks*",1);
  93. muDstMaker->SetStatus("BTofHeader*",1);
  94. TChain *mCurrentTree = muDstMaker->chain();
  95. Long64_t mNEvents = mCurrentTree->GetEntries();
  96. std::cout << Form("Number of events in TTree: %d", mNEvents) << std::endl;
  97. //Heavy ion related makers
  98. StRefMultCorr *mRefMult = new StRefMultCorr("refmult");
  99. if(isAuAu) {
  100. //Event plane analysis and psi determination should be here
  101. } //if(isAuAu)
  102. //StFemtoDstMaker initialization
  103. mFemtoDstInclSelector = new StFemtoDstInclusiveSelector(muDstMaker,
  104. outFileName);
  105. //
  106. // Trigger selection for pAu 200
  107. // P16id
  108. // // trg -- number of events
  109. mFemtoDstInclSelector->AddTriggerId(57); // VPDMB-30 -- 647054
  110. mFemtoDstInclSelector->AddTriggerId(55); // VPDMB-novtx -- 269642
  111. mFemtoDstInclSelector->AddTriggerId(26); // VPDMB-5-trgonly -- 632277
  112. // total events == 1548973
  113. mFemtoDstInclSelector->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  114. mFemtoDstInclSelector->SetVtxRCut(cVtxR[0], cVtxR[1]);
  115. mFemtoDstInclSelector->SetVtxShift(cVtxXShift, cVtxYShift);
  116. mFemtoDstInclSelector->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  117. mFemtoDstInclSelector->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  118. mFemtoDstInclSelector->SetTrackDcaGlobal(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  119. mFemtoDstInclSelector->SetTrackNHits(cTrackNHits[0], cTrackNHits[1]);
  120. mFemtoDstInclSelector->SetTrackNHitsFit(cTrackNHitsFit[0], cTrackNHitsFit[1]);
  121. mFemtoDstInclSelector->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  122. mFemtoDstInclSelector->SetTrackFlag(cTrackFlag[0], cTrackFlag[1]);
  123. mFemtoDstInclSelector->SetCollisionTypeAuAu(isAuAu);
  124. mFemtoDstInclSelector->SetAuAuZdcCoincidenceEnergy(cZdcRefmultCorrection);
  125. mFemtoDstInclSelector->SetMuDstMaker(muDstMaker);
  126. //Inclusive selection
  127. //Pions
  128. mFemtoDstInclSelector->SetSelectPions(cSelectPions);
  129. mFemtoDstInclSelector->SetSelectTpcPions(cSelectTpcPions);
  130. mFemtoDstInclSelector->SetPionTpcMom(cPionTpcMom[0], cPionTpcMom[1]);
  131. mFemtoDstInclSelector->SetPionTpcNSigmaElectron(cPionTpcNSigmaElectron[0],cPionTpcNSigmaElectron[1]);
  132. mFemtoDstInclSelector->SetPionTpcNSigmaPion(cPionTpcNSigmaPion[0],cPionTpcNSigmaPion[1]);
  133. mFemtoDstInclSelector->SetPionTpcNSigmaKaon(cPionTpcNSigmaKaon[0],cPionTpcNSigmaKaon[1]);
  134. mFemtoDstInclSelector->SetPionTpcNSigmaProton(cPionTpcNSigmaProton[0],cPionTpcNSigmaProton[1]);
  135. mFemtoDstInclSelector->SetSelectTofPions(cSelectTofPions);
  136. mFemtoDstInclSelector->SetPionTofMom(cPionTofMom[0],cPionTofMom[1]);
  137. mFemtoDstInclSelector->SetPionMassSqr(cPionMassSqr[0],cPionMassSqr[1]);
  138. //Kaons
  139. mFemtoDstInclSelector->SetSelectKaons(cSelectKaons);
  140. mFemtoDstInclSelector->SetSelectTpcKaons(cSelectTpcKaons);
  141. mFemtoDstInclSelector->SetKaonTpcMom(cKaonTpcMom[0], cKaonTpcMom[1]);
  142. mFemtoDstInclSelector->SetKaonTpcNSigmaElectron(cKaonTpcNSigmaElectron[0],cKaonTpcNSigmaElectron[1]);
  143. mFemtoDstInclSelector->SetKaonTpcNSigmaPion(cKaonTpcNSigmaPion[0],cKaonTpcNSigmaPion[1]);
  144. mFemtoDstInclSelector->SetKaonTpcNSigmaKaon(cKaonTpcNSigmaKaon[0],cKaonTpcNSigmaKaon[1]);
  145. mFemtoDstInclSelector->SetKaonTpcNSigmaProton(cKaonTpcNSigmaProton[0],cKaonTpcNSigmaProton[1]);
  146. mFemtoDstInclSelector->SetSelectTofKaons(cSelectTofKaons);
  147. mFemtoDstInclSelector->SetKaonTofMom(cKaonTofMom[0],cKaonTofMom[1]);
  148. mFemtoDstInclSelector->SetKaonMassSqr(cKaonMassSqr[0],cKaonMassSqr[1]);
  149. //Protons
  150. mFemtoDstInclSelector->SetSelectProtons(cSelectProtons);
  151. mFemtoDstInclSelector->SetSelectTpcProtons(cSelectTpcProtons);
  152. mFemtoDstInclSelector->SetProtonTpcMom(cProtonTpcMom[0], cProtonTpcMom[1]);
  153. mFemtoDstInclSelector->SetProtonTpcNSigmaElectron(cProtonTpcNSigmaElectron[0],cProtonTpcNSigmaElectron[1]);
  154. mFemtoDstInclSelector->SetProtonTpcNSigmaPion(cProtonTpcNSigmaPion[0],cProtonTpcNSigmaPion[1]);
  155. mFemtoDstInclSelector->SetProtonTpcNSigmaKaon(cProtonTpcNSigmaKaon[0],cProtonTpcNSigmaKaon[1]);
  156. mFemtoDstInclSelector->SetProtonTpcNSigmaProton(cProtonTpcNSigmaProton[0],cProtonTpcNSigmaProton[1]);
  157. mFemtoDstInclSelector->SetSelectTofProtons(cSelectTofProtons);
  158. mFemtoDstInclSelector->SetProtonTofMom(cProtonTofMom[0],cProtonTofMom[1]);
  159. mFemtoDstInclSelector->SetProtonMassSqr(cProtonMassSqr[0],cProtonMassSqr[1]);
  160. //Chain initialization and loop over events
  161. mChain->Init();
  162. Int_t iReturn = 0;
  163. Int_t mNEventsProcessed = 0;
  164. Float_t mPercentCounter = 0.01;
  165. Float_t mProgress = 0.;
  166. unsigned int mSubCounter = 1; // time
  167. time_t mStartTime, mStopTime, mDiffTime; // time
  168. float mFrac; // time
  169. mStartTime = time(0); // time
  170. for(Int_t iEvent=0; iEvent<mNEvents; iEvent++) {
  171. mProgress = (Float_t)iEvent / (Float_t)mNEvents;
  172. mNEventsProcessed++;
  173. if(mProgress >= mPercentCounter) {
  174. mPercentCounter += mPercentCounter;
  175. mStopTime = time(0);
  176. mDiffTime = difftime(mStopTime, mStartTime);
  177. mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
  178. mSubCounter++;
  179. std::cout << Form("Processing progress: %4.2f%%. Time left: %.1 sec", mProgress*100., mFrac)
  180. << std::endl;
  181. }
  182. mChain->Clear();
  183. iReturn = mChain->Make(iEvent);
  184. if(iReturn != 0) {
  185. std::cout << "Error has been occured. Event processing has been stopped"
  186. << std::endl;
  187. break;
  188. }
  189. } //for(Int_t iEvent=0; iEvent<mNEvents; iEvent++)
  190. mChain->Finish();
  191. delete mFemtoDstInclSelector;
  192. delete mChain;
  193. std::cout << "**************************" << std::endl
  194. << "* FemtoDstMaker *" << std::endl
  195. << "* Finish *" << std::endl
  196. << "**************************" << std::endl << endl;
  197. }