FemtoDstInclusiveSelectorTest.C 5.1 KB

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