FemtoDstPionTest.C 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 = "st_physics.list";
  8. const Char_t *defaultOutFile = "oFemtoPionTest.root";
  9. class StFemtoDstPionTnT;
  10. StFemtoDstPionTnT *femtoDstIncSel;
  11. void FemtoDstPionTest(const Char_t *inFileList = defaultInFile,
  12. const Char_t *outFileName = defaultOutFile,
  13. const Bool_t isAuAu = true) {
  14. std::cout << "***********************" << std::endl
  15. << "* FemtoDstPionTest *" << std::endl
  16. << "* Start *" << std::endl
  17. << "***********************" << std::endl;
  18. Float_t vtxZ[2] = {-70., 70.};
  19. Float_t vtxR[2] = {0., 3.};
  20. Float_t vtxVpdVz[2] = {-7.,7.};
  21. Float_t vtxShift[2] = {0., 0.};
  22. Float_t particleMom[2] = {0.1, 2.1};
  23. Float_t trackDcaGlobal[2] = {-0.01, 5.};
  24. Int_t trackNHits[2] = {14, 50};
  25. Int_t trackNHitsFit[2] = {14, 50};
  26. Float_t trackEta[2] = {-1.1, 1.1};
  27. Float_t tpcPionNSigma[2] = {-3., 3.};
  28. Float_t tofPionMSqr[2] = {-0.05, 0.07};
  29. Float_t pionMom[2] = {0.1, 1.75};
  30. Bool_t zdcRefmultCorrection = true;
  31. Float_t vtxRCenter[2] = {0., 0.}; //Center collision center (for low AuAu)
  32. //
  33. // Load libraries
  34. //
  35. std::cout << "Loading libraries..." << std::endl;
  36. gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
  37. loadSharedLibraries();
  38. gSystem->Load("libMinuit");
  39. gSystem->Load("StMuDSTMaker");
  40. gSystem->Load("StChain");
  41. gSystem->Load("StRefMultCorr");
  42. gSystem->Load("StFlowMaker");
  43. gSystem->Load("StFlowAnalysisMaker");
  44. gSystem->Load("StHbtMaker");
  45. gSystem->Load("StarClassLibrary");
  46. gSystem->Load("StFemtoDstMaker");
  47. std::cout << "Libraries have been successfully loaded" << std::endl;
  48. //
  49. // Create chain
  50. //
  51. StChain *chain = new StChain("StChain");
  52. chain->SetDebug(0);
  53. StMuDebug::setLevel(0);
  54. //
  55. // Create MuDst reader
  56. //
  57. int nMaxFileToRead = 1e9;
  58. std::cout << Form("Try to read file: %s", inFileList) << std::endl;
  59. StMuDstMaker *muDstMaker = new StMuDstMaker(0, 0, "", inFileList, "MuDst", nMaxFileToRead);
  60. muDstMaker->SetStatus("*",0);
  61. muDstMaker->SetStatus("Event*",1);
  62. muDstMaker->SetStatus("MuEvent*",1);
  63. muDstMaker->SetStatus("PrimaryVertices*",1);
  64. muDstMaker->SetStatus("PrimaryTracks*",1);
  65. muDstMaker->SetStatus("GlobalTracks*",1);
  66. muDstMaker->SetStatus("BTofHeader*",1);
  67. TChain *currentTree = muDstMaker->chain();
  68. Long64_t nEvents = currentTree->GetEntries();
  69. std::cout << Form("Number of events in TTree: %d", nEvents) << std::endl;
  70. //
  71. // Create StRefMultCorr and StFemtoDstInclusiveSelector
  72. //
  73. StRefMultCorr *refMult = new StRefMultCorr("refmult");
  74. femtoDstIncSel = new StFemtoDstPionTnT(muDstMaker, outFileName);
  75. //
  76. // Global
  77. //
  78. femtoDstIncSel->SetCollisionTypeAuAu(isAuAu);
  79. femtoDstIncSel->SetRefmultCorrUtil(refMult);
  80. femtoDstIncSel->SetAuAuZdcCoincidenceEnergy(zdcRefmultCorrection);
  81. //
  82. // Event
  83. //
  84. femtoDstIncSel->SetVtxZCut(vtxZ[0], vtxZ[1]);
  85. femtoDstIncSel->SetVtxRCut(vtxR[0], vtxR[1]);
  86. femtoDstIncSel->SetVtxVpdVzDiffCut(vtxVpdVz[0], vtxVpdVz[1]);
  87. femtoDstIncSel->SetVtxShift(vtxShift[0], vtxShift[1]);
  88. femtoDstIncSel->AddTriggerId(350003); // mb-protected
  89. femtoDstIncSel->AddTriggerId(350013); // mb-protected
  90. femtoDstIncSel->AddTriggerId(350023); // mb-protected
  91. femtoDstIncSel->AddTriggerId(350033); // mb-protected
  92. femtoDstIncSel->AddTriggerId(350043); // mb-protected
  93. //
  94. // Track
  95. //
  96. femtoDstIncSel->SetParticleMomentum(particleMom[0], particleMom[1]);
  97. femtoDstIncSel->SetTrackDcaGlobal(trackDcaGlobal[0], trackDcaGlobal[1]);
  98. femtoDstIncSel->SetTrackNHits(trackNHits[0], trackNHits[1]);
  99. femtoDstIncSel->SetTrackNHitsFit(trackNHitsFit[0], trackNHitsFit[1]);
  100. femtoDstIncSel->SetTrackEta(trackEta[0], trackEta[1]);
  101. //
  102. // Parameters for pion identification
  103. //
  104. femtoDstIncSel->SetPionTpcMom(pionMom[0], pionMom[1]);
  105. femtoDstIncSel->SetPionTofMom(pionMom[0], pionMom[1]);
  106. femtoDstIncSel->SetPionTpcNSigmaPion(tpcPionNSigma[0], tpcPionNSigma[1]);
  107. femtoDstIncSel->SetPionMassSqr(tofPionMSqr[0], tofPionMSqr[1]);
  108. chain->Init();
  109. Int_t iReturn = 0;
  110. Int_t nEventsProcessed = 0;
  111. Float_t percentCounter = 0.01;
  112. Float_t progress = 0.;
  113. for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
  114. progress = (Float_t)iEvent/(Float_t)nEvents;
  115. nEventsProcessed++;
  116. if(progress >= percentCounter) {
  117. percentCounter += 0.01;
  118. std::cout << Form("Processing progress: %4.2f%%", percentCounter*100.)
  119. << std::endl;
  120. }
  121. chain->Clear();
  122. iReturn = chain->Make(iEvent);
  123. if (iReturn != 0) {
  124. std::cout << "Error has been occured. Event processing has been stopped"
  125. << std::endl;
  126. break;
  127. }
  128. }
  129. chain->Finish();
  130. delete chain;
  131. std::cout << "*************************" << std::endl
  132. << "* FemtoDstPionTest *" << std::endl
  133. << "* Finish *" << std::endl
  134. << "*************************" << std::endl;
  135. }