FemtoDstMaker_mesons_pp200_y2015.C 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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 = "test.list";
  8. const Char_t *defaultOutFile = "oFemtoDstMesons_pp200_2015.root";
  9. class StFemtoDstInclusiveSelector;
  10. StFemtoDstInclusiveSelector *mFemtoDstInclSelector = NULL;
  11. //_________________
  12. void FemtoDstMaker_mesons_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. Bool_t cSelectPions = true;
  34. Bool_t cSelectKaons = true;
  35. Bool_t cSelectTpcPions = true;
  36. Bool_t cSelectTpcKaons = true;
  37. Bool_t cSelectTofKaons = true;
  38. Bool_t cSelectTofPions = true;
  39. Float_t cPionTpcNSigmaElectron[2] = {-2., 2.};
  40. Float_t cPionTpcNSigmaPion[2] = {-3., 3.};
  41. Float_t cPionTpcNSigmaKaon[2] = {-2., 2.};
  42. Float_t cPionTpcNSigmaProton[2] = {-3., 3.};
  43. Float_t cKaonTpcNSigmaElectron[2] = {-2., 2.};
  44. Float_t cKaonTpcNSigmaPion[2] = {-2., 2.};
  45. Float_t cKaonTpcNSigmaKaon[2] = {-3., 3.};
  46. Float_t cKaonTpcNSigmaProton[2] = {-2., 2.};
  47. Float_t cKaonTofMom[2] = {0.55, 1.65};
  48. Float_t cKaonMassSqr[2] = {0.16, 0.35};
  49. Float_t cKaonTpcMom[2] = {0.15, 0.75};
  50. Float_t cPionTofMom[2] = {0.55, 1.65};
  51. Float_t cPionMassSqr[2] = {-0.05, 0.09};
  52. Float_t cPionTpcMom[2] = {0.15, 0.75};
  53. //Load libraries
  54. std::cout << "Loading libraries..." << std::endl;
  55. gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  56. loadSharedLibraries();
  57. gSystem->Load("libMinuit");
  58. gSystem->Load("StChain");
  59. gSystem->Load("StRefMultCorr");
  60. gSystem->Load("StFlowMaker");
  61. gSystem->Load("StHbtMaker");
  62. gSystem->Load("StFemtoDstMaker");
  63. gSystem->Load("libStFemtoDstMaker.so");
  64. std::cout << "Libraries have been successfully loaded" << std::endl;
  65. //Create chain
  66. StChain *mChain = new StChain("StChain");
  67. mChain->SetDebug(0);
  68. StMuDebug::setLevel(0);
  69. //Create MuDst reader
  70. int nMaxFileToRead = 1e9;
  71. std::cout << Form("Try to read file: %s", inFileList) << std::endl;
  72. StMuDstMaker *muDstMaker =
  73. new StMuDstMaker(0, 0, "", inFileList, "MuDst", nMaxFileToRead);
  74. muDstMaker->SetStatus("*",0);
  75. muDstMaker->SetStatus("Event*",1);
  76. muDstMaker->SetStatus("MuEvent*",1);
  77. muDstMaker->SetStatus("PrimaryVertices*",1);
  78. muDstMaker->SetStatus("PrimaryTracks*",1);
  79. muDstMaker->SetStatus("GlobalTracks*",1);
  80. muDstMaker->SetStatus("BTofHeader*",1);
  81. muDstMaker->SetStatus("BTofHit*", 1);
  82. TChain *mCurrentTree = muDstMaker->chain();
  83. Long64_t mNEvents = mCurrentTree->GetEntries();
  84. std::cout << Form("Number of events in TTree: %d", mNEvents) << std::endl;
  85. //Heavy ion related makers
  86. StRefMultCorr *mRefMult = new StRefMultCorr("refmult");
  87. //StFemtoDstMaker initialization
  88. mFemtoDstInclSelector = new StFemtoDstInclusiveSelector(muDstMaker,
  89. outFileName);
  90. //
  91. // Trigger selection for pp200 y2015
  92. //
  93. mFemtoDstInclSelector->AddTriggerId(470001); // longitudinal
  94. mFemtoDstInclSelector->AddTriggerId(470004);
  95. mFemtoDstInclSelector->AddTriggerId(470007);
  96. mFemtoDstInclSelector->AddTriggerId(470014);
  97. mFemtoDstInclSelector->AddTriggerId(470017);
  98. mFemtoDstInclSelector->AddTriggerId(470904);
  99. mFemtoDstInclSelector->AddTriggerId(470914);
  100. mFemtoDstInclSelector->AddTriggerId(490004);
  101. mFemtoDstInclSelector->AddTriggerId(490007);
  102. mFemtoDstInclSelector->AddTriggerId(490904);
  103. mFemtoDstInclSelector->AddTriggerId(470401);
  104. mFemtoDstInclSelector->AddTriggerId(470404);
  105. mFemtoDstInclSelector->AddTriggerId(490401);
  106. mFemtoDstInclSelector->AddTriggerId(490404);
  107. mFemtoDstInclSelector->AddTriggerId(470201);
  108. mFemtoDstInclSelector->AddTriggerId(470202);
  109. mFemtoDstInclSelector->AddTriggerId(470206);
  110. mFemtoDstInclSelector->AddTriggerId(470211);
  111. mFemtoDstInclSelector->AddTriggerId(480004); // transverse
  112. mFemtoDstInclSelector->AddTriggerId(480007);
  113. mFemtoDstInclSelector->AddTriggerId(480904);
  114. mFemtoDstInclSelector->AddTriggerId(480401);
  115. mFemtoDstInclSelector->AddTriggerId(480404);
  116. mFemtoDstInclSelector->AddTriggerId(480411);
  117. mFemtoDstInclSelector->AddTriggerId(480414);
  118. mFemtoDstInclSelector->AddTriggerId(480201);
  119. mFemtoDstInclSelector->AddTriggerId(480202);
  120. mFemtoDstInclSelector->SetVtxZCut(cVtxZ[0], cVtxZ[1]);
  121. mFemtoDstInclSelector->SetVtxRCut(cVtxR[0], cVtxR[1]);
  122. mFemtoDstInclSelector->SetVtxShift(cVtxXShift, cVtxYShift);
  123. mFemtoDstInclSelector->SetVtxVpdVzDiffCut(cVtxVpdVzDiff[0], cVtxVpdVzDiff[1]);
  124. mFemtoDstInclSelector->SetParticleMomentum(cParticleMom[0], cParticleMom[1]);
  125. mFemtoDstInclSelector->SetTrackDcaGlobal(cTrackDcaGlobal[0], cTrackDcaGlobal[1]);
  126. mFemtoDstInclSelector->SetTrackNHits(cTrackNHits[0], cTrackNHits[1]);
  127. mFemtoDstInclSelector->SetTrackNHitsFit(cTrackNHitsFit[0], cTrackNHitsFit[1]);
  128. mFemtoDstInclSelector->SetTrackEta(cTrackEta[0], cTrackEta[1]);
  129. mFemtoDstInclSelector->SetTrackFlag(cTrackFlag[0], cTrackFlag[1]);
  130. mFemtoDstInclSelector->SetCollisionTypeAuAu(isAuAu);
  131. mFemtoDstInclSelector->SetAuAuZdcCoincidenceEnergy(cZdcRefmultCorrection);
  132. mFemtoDstInclSelector->SetMuDstMaker(muDstMaker);
  133. //Inclusive selection
  134. //Pions
  135. mFemtoDstInclSelector->SetSelectProtons(false);
  136. mFemtoDstInclSelector->SetSelectKaons(cSelectKaons);
  137. mFemtoDstInclSelector->SetSelectPions(cSelectPions);
  138. mFemtoDstInclSelector->SetSelectTpcPions(cSelectTpcPions);
  139. mFemtoDstInclSelector->SetSelectTpcKaons(cSelectTpcKaons);
  140. mFemtoDstInclSelector->SetSelectTofPions(cSelectTofPions);
  141. mFemtoDstInclSelector->SetSelectTofKaons(cSelectTofKaons);
  142. mFemtoDstInclSelector->SetPionTpcMom(cPionTpcMom[0], cPionTpcMom[1]);
  143. mFemtoDstInclSelector->SetPionTpcNSigmaElectron(cPionTpcNSigmaElectron[0],cPionTpcNSigmaElectron[1]);
  144. mFemtoDstInclSelector->SetPionTpcNSigmaPion(cPionTpcNSigmaPion[0],cPionTpcNSigmaPion[1]);
  145. mFemtoDstInclSelector->SetPionTpcNSigmaKaon(cPionTpcNSigmaKaon[0],cPionTpcNSigmaKaon[1]);
  146. mFemtoDstInclSelector->SetPionTpcNSigmaProton(cPionTpcNSigmaProton[0],cPionTpcNSigmaProton[1]);
  147. mFemtoDstInclSelector->SetPionTofMom(cPionTofMom[0],cPionTofMom[1]);
  148. mFemtoDstInclSelector->SetPionMassSqr(cPionMassSqr[0],cPionMassSqr[1]);
  149. mFemtoDstInclSelector->SetKaonTpcMom(cKaonTpcMom[0], cKaonTpcMom[1]);
  150. mFemtoDstInclSelector->SetKaonTpcNSigmaElectron(cKaonTpcNSigmaElectron[0],cKaonTpcNSigmaElectron[1]);
  151. mFemtoDstInclSelector->SetKaonTpcNSigmaPion(cKaonTpcNSigmaPion[0],cKaonTpcNSigmaPion[1]);
  152. mFemtoDstInclSelector->SetKaonTpcNSigmaKaon(cKaonTpcNSigmaKaon[0],cKaonTpcNSigmaKaon[1]);
  153. mFemtoDstInclSelector->SetKaonTpcNSigmaProton(cKaonTpcNSigmaProton[0],cKaonTpcNSigmaProton[1]);
  154. mFemtoDstInclSelector->SetKaonTofMom(cKaonTofMom[0],cKaonTofMom[1]);
  155. mFemtoDstInclSelector->SetKaonMassSqr(cKaonMassSqr[0],cKaonMassSqr[1]);
  156. //Chain initialization and loop over events
  157. mChain->Init();
  158. Int_t iReturn = 0;
  159. Int_t mNEventsProcessed = 0;
  160. Float_t mPercentStep = 0.05;
  161. Float_t mPercentCounter = mPercentStep;
  162. Float_t mProgress = 0.;
  163. time_t mStartTime, mStopTime, mDiffTime; // time
  164. float mFrac; // time
  165. mStartTime = time(0); // time
  166. for(Int_t iEvent=0; iEvent<mNEvents; iEvent++) {
  167. mProgress = (Float_t)iEvent/(Float_t)mNEvents;
  168. mNEventsProcessed++;
  169. if(mProgress >= mPercentCounter) {
  170. mPercentCounter += mPercentStep;
  171. mStopTime = time(0);
  172. mDiffTime = difftime(mStopTime, mStartTime);
  173. mFrac = (float)mDiffTime*(float)(mNEvents - iEvent)/(float)iEvent;
  174. std::cout << Form("Processing progress: %3.0f%%. ETA: %.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. }