mikesTrackCut.cxx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /***************************************************************************
  2. *
  3. * $Id:
  4. *
  5. * Author: Mike Lisa, Ohio State, lisa@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/mikesTrackCut.h"
  16. #include <cstdio>
  17. #ifdef __ROOT__
  18. ClassImp(mikesTrackCut)
  19. #endif
  20. mikesTrackCut::mikesTrackCut(){
  21. mNTracksPassed = mNTracksFailed = 0;
  22. }
  23. //------------------------------
  24. //mikesTrackCut::~mikesTrackCut(){
  25. // /* noop */
  26. //}
  27. //------------------------------
  28. bool mikesTrackCut::Pass(const StHbtTrack* track){
  29. /*
  30. cout << endl;
  31. cout << "#track " << trackCount++;
  32. cout << " * pion " << (track->NSigmaPion() > mNSigmaPion[0]) && (track->NSigmaPion() < mNSigmaPion[1]);
  33. cout << " * kaon " << (track->NSigmaKaon() > mNSigmaKaon[0]) && (track->NSigmaKaon() < mNSigmaKaon[1]);
  34. cout << " * proton " << (track->NSigmaProton() > mNSigmaProton[0]) && (track->NSigmaProton() < mNSigmaProton[1]);
  35. cout << " * charge " << (track->Charge() == mCharge);
  36. */
  37. bool goodPID = ((track->NSigmaPion() > mNSigmaPion[0]) &&
  38. (track->NSigmaPion() < mNSigmaPion[1]) &&
  39. (track->NSigmaKaon() > mNSigmaKaon[0]) &&
  40. (track->NSigmaKaon() < mNSigmaKaon[1]) &&
  41. (track->NSigmaProton() > mNSigmaProton[0]) &&
  42. (track->NSigmaProton() < mNSigmaProton[1]));
  43. if (mCharge !=0){ // if user requests "charge=0" then that means ignore charge
  44. goodPID = (goodPID&&(track->Charge() == mCharge));
  45. }
  46. if (goodPID){
  47. float TEnergy = ::sqrt(track->P().mag2()+mMass*mMass);
  48. float TRapidity = 0.5*::log((TEnergy+track->P().z())/
  49. (TEnergy-track->P().z()));
  50. float Pt = ::sqrt((track->P().x())*(track->P().x())+
  51. (track->P().y())*(track->P().y()));
  52. /*
  53. cout << " * DCAxy " << (track->DCAxy() > mDCA[0]) && (track->DCAxy() < mDCA[1]);
  54. cout << " * mDCA[0] " << mDCA[0];
  55. cout << " * mDCA[1] " << mDCA[1];
  56. cout << " * track->DCAxy " << track->DCAxy();
  57. cout << " * NHits " << (track->NHits() > mNHits[0]) && (track->NHits() < mNHits[1]);
  58. cout << " * Pt " << (Pt > mPt[0]) && (Pt < mPt[1]);
  59. cout << " * y " << (TRapidity > mRapidity[0]) && (TRapidity < mRapidity[1]);
  60. cout << endl;
  61. */
  62. bool goodTrack=
  63. ((track->DCAxy() > mDCA[0]) &&
  64. (track->DCAxy() < mDCA[1]) &&
  65. (track->NHits() > mNHits[0]) &&
  66. (track->NHits() < mNHits[1]) &&
  67. (Pt > mPt[0]) &&
  68. (Pt < mPt[1]) &&
  69. (TRapidity > mRapidity[0]) &&
  70. (TRapidity < mRapidity[1]));
  71. goodTrack ? mNTracksPassed++ : mNTracksFailed++;
  72. return (goodTrack);
  73. }
  74. else{
  75. mNTracksFailed++;
  76. return (goodPID);
  77. }
  78. }
  79. //------------------------------
  80. StHbtString mikesTrackCut::Report(){
  81. string Stemp;
  82. char Ctemp[100];
  83. sprintf(Ctemp,"Particle mass:\t%E\n",this->Mass());
  84. Stemp=Ctemp;
  85. sprintf(Ctemp,"Particle charge:\t%d\n",mCharge);
  86. Stemp=Ctemp;
  87. sprintf(Ctemp,"Particle Nsigma from pion:\t%E - %E\n",mNSigmaPion[0],mNSigmaPion[1]);
  88. Stemp+=Ctemp;
  89. sprintf(Ctemp,"Particle Nsigma from kaon:\t%E - %E\n",mNSigmaKaon[0],mNSigmaKaon[1]);
  90. Stemp+=Ctemp;
  91. sprintf(Ctemp,"Particle Nsigma from proton:\t%E - %E\n",mNSigmaProton[0],mNSigmaProton[1]);
  92. Stemp+=Ctemp;
  93. sprintf(Ctemp,"Particle #hits:\t%d - %d\n",mNHits[0],mNHits[1]);
  94. Stemp+=Ctemp;
  95. sprintf(Ctemp,"Particle pT:\t%E - %E\n",mPt[0],mPt[1]);
  96. Stemp+=Ctemp;
  97. sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",mRapidity[0],mRapidity[1]);
  98. Stemp+=Ctemp;
  99. sprintf(Ctemp,"Particle DCA:\t%E - %E\n",mDCA[0],mDCA[1]);
  100. Stemp+=Ctemp;
  101. sprintf(Ctemp,"Number of tracks which passed:\t%ld Number which failed:\t%ld\n",mNTracksPassed,mNTracksFailed);
  102. Stemp += Ctemp;
  103. StHbtString returnThis = Stemp;
  104. return returnThis;
  105. }