FemtoDstMaker_mesons_pau200.C 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 = "sample.list";
  8. const Char_t *defaultOutFile = "oFemtoDst_mesons_pau200.root";
  9. class StFemtoDstInclusiveSelector;
  10. StFemtoDstInclusiveSelector *mFemtoDstInclSelector = NULL;
  11. //_________________
  12. void FemtoDstMaker_mesons_pau200(const Char_t* inFileList = defaultInFile,
  13. const Char_t* outFileName = defaultOutFile)
  14. {
  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 = true;
  35. Bool_t cSelectTpcPions = true;
  36. Float_t cPionTpcMom[2] = {0.15, 0.75};
  37. Float_t cPionTpcNSigmaElectron[2] = {-1., 1.};
  38. Float_t cPionTpcNSigmaPion[2] = {-2., 2.};
  39. Float_t cPionTpcNSigmaKaon[2] = {-1., 1.};
  40. Float_t cPionTpcNSigmaProton[2] = {-1., 1.};
  41. Bool_t cSelectTofPions = true;
  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. //StFemtoDstMaker initialization
  98. mFemtoDstInclSelector = new StFemtoDstInclusiveSelector(muDstMaker,
  99. outFileName);
  100. //
  101. // Trigger selection for pAu 200
  102. // P16id
  103. // // trg -- number of events
  104. mFemtoDstInclSelector->AddTriggerId(500003); // VPDMB-5-trgonly -- 24901523
  105. mFemtoDstInclSelector->AddTriggerId(500004); // VPDMB-novtx -- 23532384
  106. mFemtoDstInclSelector->AddTriggerId(500904); // VPDMB-30 -- 58381649
  107. // total events == 106815556
  108. mFemtoDstInclSelector->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  109. mFemtoDstInclSelector->SetVtxRCut(cVtxR[0], cVtxR[1]);
  110. mFemtoDstInclSelector->SetVtxShift(cVtxXShift, cVtxYShift);
  111. mFemtoDstInclSelector->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  112. mFemtoDstInclSelector->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  113. mFemtoDstInclSelector->SetTrackDcaGlobal(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  114. mFemtoDstInclSelector->SetTrackNHits(cTrackNHits[0], cTrackNHits[1]);
  115. mFemtoDstInclSelector->SetTrackNHitsFit(cTrackNHitsFit[0], cTrackNHitsFit[1]);
  116. mFemtoDstInclSelector->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  117. mFemtoDstInclSelector->SetTrackFlag(cTrackFlag[0], cTrackFlag[1]);
  118. mFemtoDstInclSelector->SetCollisionTypeAuAu(false);
  119. mFemtoDstInclSelector->SetAuAuZdcCoincidenceEnergy(cZdcRefmultCorrection);
  120. mFemtoDstInclSelector->SetMuDstMaker(muDstMaker);
  121. //Inclusive selection
  122. //Pions
  123. mFemtoDstInclSelector->SetSelectPions(cSelectPions);
  124. mFemtoDstInclSelector->SetSelectTpcPions(cSelectTpcPions);
  125. mFemtoDstInclSelector->SetPionTpcMom(cPionTpcMom[0], cPionTpcMom[1]);
  126. mFemtoDstInclSelector->SetPionTpcNSigmaElectron(cPionTpcNSigmaElectron[0],cPionTpcNSigmaElectron[1]);
  127. mFemtoDstInclSelector->SetPionTpcNSigmaPion(cPionTpcNSigmaPion[0],cPionTpcNSigmaPion[1]);
  128. mFemtoDstInclSelector->SetPionTpcNSigmaKaon(cPionTpcNSigmaKaon[0],cPionTpcNSigmaKaon[1]);
  129. mFemtoDstInclSelector->SetPionTpcNSigmaProton(cPionTpcNSigmaProton[0],cPionTpcNSigmaProton[1]);
  130. mFemtoDstInclSelector->SetSelectTofPions(cSelectTofPions);
  131. mFemtoDstInclSelector->SetPionTofMom(cPionTofMom[0],cPionTofMom[1]);
  132. mFemtoDstInclSelector->SetPionMassSqr(cPionMassSqr[0],cPionMassSqr[1]);
  133. //Kaons
  134. mFemtoDstInclSelector->SetSelectKaons(cSelectKaons);
  135. mFemtoDstInclSelector->SetSelectTpcKaons(cSelectTpcKaons);
  136. mFemtoDstInclSelector->SetKaonTpcMom(cKaonTpcMom[0], cKaonTpcMom[1]);
  137. mFemtoDstInclSelector->SetKaonTpcNSigmaElectron(cKaonTpcNSigmaElectron[0],cKaonTpcNSigmaElectron[1]);
  138. mFemtoDstInclSelector->SetKaonTpcNSigmaPion(cKaonTpcNSigmaPion[0],cKaonTpcNSigmaPion[1]);
  139. mFemtoDstInclSelector->SetKaonTpcNSigmaKaon(cKaonTpcNSigmaKaon[0],cKaonTpcNSigmaKaon[1]);
  140. mFemtoDstInclSelector->SetKaonTpcNSigmaProton(cKaonTpcNSigmaProton[0],cKaonTpcNSigmaProton[1]);
  141. mFemtoDstInclSelector->SetSelectTofKaons(cSelectTofKaons);
  142. mFemtoDstInclSelector->SetKaonTofMom(cKaonTofMom[0],cKaonTofMom[1]);
  143. mFemtoDstInclSelector->SetKaonMassSqr(cKaonMassSqr[0],cKaonMassSqr[1]);
  144. //Protons
  145. mFemtoDstInclSelector->SetSelectProtons(cSelectProtons);
  146. mFemtoDstInclSelector->SetSelectTpcProtons(cSelectTpcProtons);
  147. mFemtoDstInclSelector->SetProtonTpcMom(cProtonTpcMom[0], cProtonTpcMom[1]);
  148. mFemtoDstInclSelector->SetProtonTpcNSigmaElectron(cProtonTpcNSigmaElectron[0],cProtonTpcNSigmaElectron[1]);
  149. mFemtoDstInclSelector->SetProtonTpcNSigmaPion(cProtonTpcNSigmaPion[0],cProtonTpcNSigmaPion[1]);
  150. mFemtoDstInclSelector->SetProtonTpcNSigmaKaon(cProtonTpcNSigmaKaon[0],cProtonTpcNSigmaKaon[1]);
  151. mFemtoDstInclSelector->SetProtonTpcNSigmaProton(cProtonTpcNSigmaProton[0],cProtonTpcNSigmaProton[1]);
  152. mFemtoDstInclSelector->SetSelectTofProtons(cSelectTofProtons);
  153. mFemtoDstInclSelector->SetProtonTofMom(cProtonTofMom[0],cProtonTofMom[1]);
  154. mFemtoDstInclSelector->SetProtonMassSqr(cProtonMassSqr[0],cProtonMassSqr[1]);
  155. //Chain initialization and loop over events
  156. mChain->Init();
  157. Int_t iReturn = 0;
  158. Int_t mNEventsProcessed = 0;
  159. Float_t mPercentCounter = 0.01;
  160. Float_t mProgress = 0.;
  161. unsigned int mSubCounter = 1; // time
  162. time_t mStartTime, mStopTime, mDiffTime; // time
  163. float mFrac; // time
  164. mStartTime = time(0); // time
  165. for(Int_t iEvent=0; iEvent<mNEvents; iEvent++) {
  166. mProgress = (Float_t)iEvent / (Float_t)mNEvents;
  167. mNEventsProcessed++;
  168. if(mProgress >= mPercentCounter) {
  169. mPercentCounter += mPercentCounter;
  170. mStopTime = time(0);
  171. mDiffTime = difftime(mStopTime, mStartTime);
  172. mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
  173. mSubCounter++;
  174. std::cout << Form("Processing progress: %4.2f%%. Time left: %.1f sec", mProgress*100., mFrac)
  175. << std::endl;
  176. }
  177. mChain->Clear();
  178. iReturn = mChain->Make(iEvent);
  179. if(iReturn != 0) {
  180. std::cout << "Error has been occured. Event processing has been stopped"
  181. << std::endl;
  182. break;
  183. }
  184. } //for(Int_t iEvent=0; iEvent<mNEvents; iEvent++)
  185. mChain->Finish();
  186. delete mFemtoDstInclSelector;
  187. delete mChain;
  188. std::cout << "**************************" << std::endl
  189. << "* FemtoDstMaker *" << std::endl
  190. << "* Finish *" << std::endl
  191. << "**************************" << std::endl << endl;
  192. }