adamsTrackCut.cxx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /***************************************************************************
  2. *
  3. * $Id:
  4. *
  5. * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
  6. ***************************************************************************
  7. *
  8. * Description: part of STAR HBT Framework: StHbtMaker package
  9. * a simple particle cut that selects on phasespace, #hits, DCA, and PID
  10. *
  11. ***************************************************************************
  12. *
  13. * $Log:
  14. **************************************************************************/
  15. #include "StHbtMaker/Cut/adamsTrackCut.h"
  16. #include <cstdio>
  17. #ifdef __ROOT__
  18. ClassImp(adamsTrackCut)
  19. #endif
  20. //#define STHBTDEBUG
  21. adamsTrackCut::adamsTrackCut(): franksTrackCut() {
  22. mPIDPThreshold = 0;
  23. }
  24. //------------------------------
  25. adamsTrackCut::adamsTrackCut(adamsTrackCut& c) : franksTrackCut(c) {
  26. mPIDPThreshold = c.mPIDPThreshold;
  27. #ifdef STHBTDEBUG
  28. cout << " adamsTrackCut::adamsTrackCut(adamsTrackCut& c) " << endl;
  29. #endif
  30. }
  31. //------------------------------
  32. adamsTrackCut::~adamsTrackCut(){
  33. }
  34. //------------------------------
  35. bool adamsTrackCut::Pass(const StHbtTrack* track){
  36. // cout << " *** adamsTrackCut::Pass(const StHbtTrack* track) " << endl;
  37. float TEnergy = ::sqrt(track->P().mag2()+mMass*mMass);
  38. float TRapidity = 0.5*::log((TEnergy+track->P().z())/
  39. (TEnergy-track->P().z()));
  40. #ifdef STHBTDEBUG
  41. cout <<
  42. track->NSigmaElectron() << " " <<
  43. track->NSigmaPion() << " " <<
  44. track->NSigmaKaon() << " " <<
  45. track->NSigmaProton() << " " <<
  46. track->DCAxy() << " " <<
  47. track->DCAxyGlobal() << " " <<
  48. track->NHits() << " " <<
  49. track->NHitsDedx() << " " <<
  50. track->P().mag() << " " <<
  51. track->Pt() << " " <<
  52. TRapidity << " " <<
  53. track->Charge() << " ";
  54. #endif
  55. bool goodPID;
  56. // Use different PIDs for P below and above threshold
  57. if (track->P().mag() < mPIDPThreshold)
  58. {
  59. // Use NSigma
  60. goodPID = (
  61. (track->NSigmaElectron() >= mNSigmaElectron[0]) &&
  62. (track->NSigmaElectron() <= mNSigmaElectron[1]) &&
  63. (track->NSigmaPion() >= mNSigmaPion[0]) &&
  64. (track->NSigmaPion() <= mNSigmaPion[1]) &&
  65. (track->NSigmaKaon() >= mNSigmaKaon[0]) &&
  66. (track->NSigmaKaon() <= mNSigmaKaon[1]) &&
  67. (track->NSigmaProton() >= mNSigmaProton[0]) &&
  68. (track->NSigmaProton() <= mNSigmaProton[1]) &&
  69. !( (track->NSigmaElectron() > mNSigmaAntiElectron[0]) &&
  70. (track->NSigmaElectron() < mNSigmaAntiElectron[1]) ) &&
  71. !( (track->NSigmaPion() > mNSigmaAntiPion[0]) &&
  72. (track->NSigmaPion() < mNSigmaAntiPion[1]) ) &&
  73. !( (track->NSigmaKaon() > mNSigmaAntiKaon[0]) &&
  74. (track->NSigmaKaon() < mNSigmaAntiKaon[1]) ) &&
  75. !( (track->NSigmaProton() > mNSigmaAntiProton[0]) &&
  76. (track->NSigmaProton() < mNSigmaAntiProton[1]) ) &&
  77. (track->Charge() == mCharge || mCharge==0 )
  78. );
  79. }
  80. else
  81. {
  82. // Use PID Probability
  83. goodPID = (
  84. (track->PidProbElectron() >= mPidProbElectron[0]) &&
  85. (track->PidProbElectron() <= mPidProbElectron[1]) &&
  86. (track->PidProbPion() >= mPidProbPion[0]) &&
  87. (track->PidProbPion() <= mPidProbPion[1]) &&
  88. (track->PidProbKaon() >= mPidProbKaon[0]) &&
  89. (track->PidProbKaon() <= mPidProbKaon[1]) &&
  90. (track->PidProbProton() >= mPidProbProton[0]) &&
  91. (track->PidProbProton() <= mPidProbProton[1]) &&
  92. (track->Charge() == mCharge || mCharge==0 )
  93. );
  94. }
  95. #ifdef STHBTDEBUG
  96. cout << mNSigmaElectron[0] << " << " << track->NSigmaElectron() << " << " << mNSigmaElectron[1] << " ";
  97. cout << (track->NSigmaElectron() >= mNSigmaElectron[0]) << (track->NSigmaElectron() <= mNSigmaElectron[1]) << endl;
  98. #endif
  99. bool goodTrack=( true &&
  100. (track->DCAxy() >= mDCA[0]) &&
  101. (track->DCAxy() <= mDCA[1]) &&
  102. (track->DCAxyGlobal() >= mDCAGlobal[0]) &&
  103. (track->DCAxyGlobal() <= mDCAGlobal[1]) &&
  104. (track->NHits() >= mNHits[0]) &&
  105. (track->NHits() <= mNHits[1]) &&
  106. (track->NHitsDedx() >= mNdEdxHits[0]) &&
  107. (track->NHitsDedx() <= mNdEdxHits[1]) &&
  108. (track->P().mag() >= mP[0]) &&
  109. (track->P().mag() <= mP[1]) &&
  110. (track->Pt() >= mPt[0]) &&
  111. (track->Pt() <= mPt[1]) &&
  112. (track->P().x() >= mPx[0]) &&
  113. (track->P().x() <= mPx[1]) &&
  114. (track->P().y() >= mPy[0]) &&
  115. (track->P().y() <= mPy[1]) &&
  116. (track->P().z() >= mPz[0]) &&
  117. (track->P().z() <= mPz[1]) &&
  118. (track->P().pseudoRapidity() >= mEta[0]) &&
  119. (track->P().pseudoRapidity() <= mEta[1]) &&
  120. (TRapidity >= mRapidity[0]) &&
  121. (TRapidity <= mRapidity[1])
  122. );
  123. #ifdef STHBTDEBUG
  124. cout << " goodPID=" << goodPID << " ";
  125. cout << " goodTrack=" << goodTrack << " ";
  126. cout << endl;
  127. #endif
  128. (goodTrack && goodPID) ? mNTracksPassed++ : mNTracksFailed++;
  129. return (goodPID && goodTrack);
  130. }
  131. //------------------------------
  132. StHbtString adamsTrackCut::Report() {
  133. return franksTrackCut::Report();
  134. }
  135. ostrstream* adamsTrackCut::finalReport() const{
  136. return franksTrackCut::finalReport();
  137. }