MpdFemtoDummyTrackCut.cxx 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. ///
  2. /// \file MpdFemtoDummyTrackCut.cxx
  3. ///
  4. #include "MpdFemtoDummyTrackCut.h"
  5. #include <cstdio>
  6. ClassImp(MpdFemtoDummyTrackCut)
  7. //_________________
  8. MpdFemtoDummyTrackCut::MpdFemtoDummyTrackCut() :
  9. fCharge(0),
  10. fNTracksPassed(0),
  11. fNTracksFailed(0) {
  12. // Default constructor
  13. fCharge = 1; // takes both charges 0
  14. fNSigmaPion[0] = -100.0;
  15. fNSigmaPion[1] = 100.0;
  16. fNSigmaKaon[0] = -100.0;
  17. fNSigmaKaon[1] = 100.0;
  18. fNSigmaProton[0] = -100.0;
  19. fNSigmaProton[1] = 100.0;
  20. fNHits[0] = 10;
  21. fNHits[1] = 180;
  22. fPt[0] = 0.0;
  23. fPt[1] = 100.0; // 100
  24. fRapidity[0] = -2;
  25. fRapidity[1] = 2; //-2 2
  26. fDCA[0] = -1.0;
  27. fDCA[1] = 20.0;
  28. }
  29. //_________________
  30. bool MpdFemtoDummyTrackCut::pass(const MpdFemtoTrack* track) {
  31. // test the particle and return true if it meets all the criteria
  32. // false if it doesn't meet at least one of the criteria
  33. bool goodPID = true;
  34. /* ----- NOT DOING PID CUTS !!!! ------
  35. bool goodPID = ((track->NSigmaPion() > fNSigmaPion[0]) &&
  36. (track->NSigmaPion() < fNSigmaPion[1]) &&
  37. (track->NSigmaKaon() > fNSigmaKaon[0]) &&
  38. (track->NSigmaKaon() < fNSigmaKaon[1]) &&
  39. (track->NSigmaProton() > fNSigmaProton[0]) &&
  40. (track->NSigmaProton() < fNSigmaProton[1]));
  41. ----- NOT DOING PID CUTS !!!! ------ */
  42. // if user requests "charge=0" then that means ignore charge
  43. if (fCharge != 0) {
  44. goodPID = (goodPID && (track->charge() == fCharge));
  45. }
  46. if (!goodPID) {
  47. fNTracksFailed++;
  48. return goodPID;
  49. }
  50. const float tEnergy = ::sqrt(track->pMom().Mag2() + mMass * mMass),
  51. mom_z = track->pMom().z(),
  52. tRapidity = 0.5 * ::log((tEnergy + mom_z) / (tEnergy - mom_z)),
  53. pt = track->pt();
  54. // const int hits = track->NHits();
  55. // const float dca = track->DCAxy();
  56. bool goodTrack = (fPt[0] <= pt && pt < fPt[1])
  57. && (fRapidity[0] <= tRapidity && tRapidity <= fRapidity[1]);
  58. // && (fDCA[0] <= dca && dca <= fDCA[1])
  59. // && (fNHits[0] <= hits && hits < fNHits[1]);
  60. // (track->PidProbPion()>0.5) && //moje
  61. // (track->PidProbMuon()<0.47) && //moje
  62. // (track->Label()>0); //moje
  63. goodTrack ? fNTracksPassed++ : fNTracksFailed++;
  64. return goodTrack;
  65. }
  66. //_________________
  67. MpdFemtoString MpdFemtoDummyTrackCut::report() {
  68. // construct report
  69. TString report;
  70. report += TString::Format("Particle mass:\t%E\n", mass());
  71. report += TString::Format("Particle charge:\t%d\n", fCharge);
  72. report += TString::Format("Particle Nsigma from pion:\t%E - %E\n", fNSigmaPion[0], fNSigmaPion[1]);
  73. report += TString::Format("Particle Nsigma from kaon:\t%E - %E\n", fNSigmaKaon[0], fNSigmaKaon[1]);
  74. report += TString::Format("Particle Nsigma from proton:\t%E - %E\n", fNSigmaProton[0], fNSigmaProton[1]);
  75. report += TString::Format("Particle #hits:\t%d - %d\n", fNHits[0], fNHits[1]);
  76. report += TString::Format("Particle pT:\t%E - %E\n", fPt[0], fPt[1]);
  77. report += TString::Format("Particle rapidity:\t%E - %E\n", fRapidity[0], fRapidity[1]);
  78. report += TString::Format("Particle DCA:\t%E - %E\n", fDCA[0], fDCA[1]);
  79. report += TString::Format("Number of tracks which passed:\t%ld Number which failed:\t%ld\n", fNTracksPassed, fNTracksFailed);
  80. return MpdFemtoString((const char *) report);
  81. }
  82. //_________________
  83. TList *MpdFemtoDummyTrackCut::listSettings() {
  84. // return a list of settings in a writable form
  85. TList *settings_list = new TList();
  86. settings_list->Add(new TObjString(
  87. TString::Format("MpdFemtoDummyTrackCut.mass=%f", mass())
  88. ));
  89. settings_list->Add(new TObjString(
  90. TString::Format("MpdFemtoDummyTrackCut.charge=%i", fCharge)
  91. ));
  92. settings_list->Add(new TObjString(
  93. TString::Format("MpdFemtoDummyTrackCut.nsigmapion.minimum=%f", fNSigmaPion[0])
  94. ));
  95. settings_list->Add(new TObjString(
  96. TString::Format("MpdFemtoDummyTrackCut.nsigmapion.maximum=%f", fNSigmaPion[1])
  97. ));
  98. settings_list->Add(new TObjString(
  99. TString::Format("MpdFemtoDummyTrackCut.nsigmakaon.minimum=%f", fNSigmaKaon[0])
  100. ));
  101. settings_list->Add(new TObjString(
  102. TString::Format("MpdFemtoDummyTrackCut.nsigmakaon.maximum=%f", fNSigmaKaon[1])
  103. ));
  104. settings_list->Add(new TObjString(
  105. TString::Format("MpdFemtoDummyTrackCut.nsigmaproton.minimum=%f", fNSigmaProton[0])
  106. ));
  107. settings_list->Add(new TObjString(
  108. TString::Format("MpdFemtoDummyTrackCut.nsigmaproton.maximum=%f", fNSigmaProton[1])
  109. ));
  110. settings_list->Add(new TObjString(
  111. TString::Format("MpdFemtoDummyTrackCut.nhits.minimum=%i", fNHits[0])
  112. ));
  113. settings_list->Add(new TObjString(
  114. TString::Format("MpdFemtoDummyTrackCut.nhits.maximum=%i", fNHits[1])
  115. ));
  116. settings_list->Add(new TObjString(
  117. TString::Format("MpdFemtoDummyTrackCut.pt.minimum=%f", fPt[0])
  118. ));
  119. settings_list->Add(new TObjString(
  120. TString::Format("MpdFemtoDummyTrackCut.pt.maximum=%f", fPt[1])
  121. ));
  122. settings_list->Add(new TObjString(
  123. TString::Format("MpdFemtoDummyTrackCut.rapidity.minimum=%f", fRapidity[0])
  124. ));
  125. settings_list->Add(new TObjString(
  126. TString::Format("MpdFemtoDummyTrackCut.rapidity.maximum=%f", fRapidity[1])
  127. ));
  128. settings_list->Add(new TObjString(
  129. TString::Format("MpdFemtoDummyTrackCut.dca.minimum=%f", fDCA[0])
  130. ));
  131. settings_list->Add(new TObjString(
  132. TString::Format("MpdFemtoDummyTrackCut.dca.maximum=%f", fDCA[1])
  133. ));
  134. return settings_list;
  135. }