helensLaPTrackCut.cxx 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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/helensLaPTrackCut.h"
  16. #include "StHbtMaker/Cut/helensEventCut.h"
  17. #include "StHbtMaker/Infrastructure/StHbtAnalysis.h"
  18. #include <cstdio>
  19. #ifdef __ROOT__
  20. ClassImp(helensLaPTrackCut)
  21. #endif
  22. helensLaPTrackCut::helensLaPTrackCut(){
  23. mNTracksPassed = mNTracksFailed = 0;
  24. mNSigmaElectron[0] = -1e9; mNSigmaElectron[1] = +1e9;
  25. mNSigmaPion[0] = -1e9; mNSigmaPion[1] = +1e9;
  26. mNSigmaKaon[0] = -1e9; mNSigmaKaon[1] = +1e9;
  27. mNSigmaProton[0] = -1e9; mNSigmaProton[1] = +1e9;
  28. mNSigmaAntiElectron[0] = 0.; mNSigmaAntiElectron[1] = 0.;
  29. mNSigmaAntiPion[0] = 0.; mNSigmaAntiPion[1] = 0.;
  30. mNSigmaAntiKaon[0] = 0.; mNSigmaAntiKaon[1] = 0.;
  31. mNSigmaAntiProton[0] = 0.; mNSigmaAntiProton[1] = 0.;
  32. mPt[0] = -1e9; mPt[1] = +1e9;
  33. mPx[0] = -1e9; mPx[1] = +1e9;
  34. mPy[0] = -1e9; mPy[1] = +1e9;
  35. mPz[0] = -1e9; mPz[1] = +1e9;
  36. }
  37. //------------------------------
  38. helensLaPTrackCut::helensLaPTrackCut(helensLaPTrackCut& c) : StHbtTrackCut(c) {
  39. mNTracksPassed = mNTracksFailed = 0;
  40. mCharge = c.mCharge;
  41. mNSigmaElectron[0] = c.mNSigmaElectron[0];
  42. mNSigmaElectron[1] = c.mNSigmaElectron[1];
  43. mNSigmaPion[0] = c.mNSigmaPion[0];
  44. mNSigmaPion[1] = c.mNSigmaPion[1];
  45. mNSigmaKaon[0] = c.mNSigmaKaon[0];
  46. mNSigmaKaon[1] = c.mNSigmaKaon[1];
  47. mNSigmaProton[0] = c.mNSigmaProton[0];
  48. mNSigmaProton[1] = c.mNSigmaProton[1];
  49. mNSigmaAntiElectron[0] = c.mNSigmaAntiElectron[0];
  50. mNSigmaAntiElectron[1] = c.mNSigmaAntiElectron[1];
  51. mNSigmaAntiPion[0] = c.mNSigmaAntiPion[0];
  52. mNSigmaAntiPion[1] = c.mNSigmaAntiPion[1];
  53. mNSigmaAntiKaon[0] = c.mNSigmaAntiKaon[0];
  54. mNSigmaAntiKaon[1] = c.mNSigmaAntiKaon[1];
  55. mNSigmaAntiProton[0] = c.mNSigmaAntiProton[0];
  56. mNSigmaAntiProton[1] = c.mNSigmaAntiProton[1];
  57. mNHits[0] = c.mNHits[0];
  58. mNHits[1] = c.mNHits[1];
  59. mP[0] = c.mP[0]; mP[1] = c.mP[1];
  60. mPt[0] = c.mPt[0]; mPt[1] = c.mPt[1];
  61. mPx[0] = c.mPx[0]; mPx[1] = c.mPx[1];
  62. mPy[0] = c.mPy[0]; mPy[1] = c.mPy[1];
  63. mPz[0] = c.mPz[0]; mPz[1] = c.mPz[1];
  64. mRapidity[0] = c.mRapidity[0];
  65. mRapidity[1] = c.mRapidity[1];
  66. mDCA[0] = c.mDCA[0];
  67. mDCA[1] = c.mDCA[1];
  68. mNTracksPassed=0;
  69. mNTracksFailed=0;
  70. #ifdef STHBTDEBUG
  71. cout << " helensLaPTrackCut::helensLaPTrackCut(helensLaPTrackCut& c) " << endl;
  72. #endif
  73. }
  74. //------------------------------
  75. helensLaPTrackCut::~helensLaPTrackCut(){
  76. }
  77. //------------------------------
  78. bool helensLaPTrackCut::Pass(const StHbtTrack* track){
  79. // cout << " *** helensLaPTrackCut::Pass(const StHbtTrack* track) " << endl;
  80. float TEnergy = ::sqrt(track->P().mag2()+mMass*mMass);
  81. float TRapidity = 0.5*::log((TEnergy+track->P().z())/
  82. (TEnergy-track->P().z()));
  83. #ifdef STHBTDEBUG
  84. cout <<
  85. track->NSigmaElectron() << " " <<
  86. track->NSigmaPion() << " " <<
  87. track->NSigmaKaon() << " " <<
  88. track->NSigmaProton() << " " <<
  89. track->DCAxy() << " " <<
  90. track->NHits() << " " <<
  91. track->P().mag() << " " <<
  92. track->Pt() << " " <<
  93. TRapidity << " " <<
  94. track->Charge() << " ";
  95. #endif
  96. bool goodPID = (
  97. (track->NSigmaElectron() >= mNSigmaElectron[0]) &&
  98. (track->NSigmaElectron() <= mNSigmaElectron[1]) &&
  99. (track->NSigmaPion() >= mNSigmaPion[0]) &&
  100. (track->NSigmaPion() <= mNSigmaPion[1]) &&
  101. (track->NSigmaKaon() >= mNSigmaKaon[0]) &&
  102. (track->NSigmaKaon() <= mNSigmaKaon[1]) &&
  103. (track->NSigmaProton() >= mNSigmaProton[0]) &&
  104. (track->NSigmaProton() <= mNSigmaProton[1]) &&
  105. !( (track->NSigmaElectron() >= mNSigmaAntiElectron[0]) &&
  106. (track->NSigmaElectron() <= mNSigmaAntiElectron[1]) ) &&
  107. !( (track->NSigmaPion() >= mNSigmaAntiPion[0]) &&
  108. (track->NSigmaPion() <= mNSigmaAntiPion[1]) ) &&
  109. !( (track->NSigmaKaon() >= mNSigmaAntiKaon[0]) &&
  110. (track->NSigmaKaon() <= mNSigmaAntiKaon[1]) ) &&
  111. !( (track->NSigmaProton() >= mNSigmaAntiProton[0]) &&
  112. (track->NSigmaProton() <= mNSigmaAntiProton[1]) ) &&
  113. (track->Charge() == mCharge || mCharge==0 )
  114. );
  115. #ifdef STHBTDEBUG
  116. cout << mNSigmaElectron[0] << " << " << track->NSigmaElectron() << " << " << mNSigmaElectron[1] << " ";
  117. cout << (track->NSigmaElectron() >= mNSigmaElectron[0]) << (track->NSigmaElectron() <= mNSigmaElectron[1]) << endl;
  118. #endif
  119. bool goodTrack=( true &&
  120. (track->DCAxy() >= mDCA[0]) &&
  121. (track->DCAxy() <= mDCA[1]) &&
  122. (track->NHits() >= mNHits[0]) &&
  123. (track->NHits() <= mNHits[1]) &&
  124. (track->P().mag() >= mP[0]) &&
  125. (track->P().mag() <= mP[1]) &&
  126. (track->Pt() >= mPt[0]) &&
  127. (track->Pt() <= mPt[1]) &&
  128. (track->P().x() >= mPx[0]) &&
  129. (track->P().x() <= mPx[1]) &&
  130. (track->P().y() >= mPy[0]) &&
  131. (track->P().y() <= mPy[1]) &&
  132. (track->P().z() >= mPz[0]) &&
  133. (track->P().z() <= mPz[1]) &&
  134. (TRapidity >= mRapidity[0]) &&
  135. (TRapidity <= mRapidity[1])
  136. );
  137. #ifdef STHBTDEBUG
  138. cout << " goodPID=" << goodPID << " ";
  139. cout << " goodTrack=" << goodTrack << " ";
  140. cout << endl;
  141. #endif
  142. if( goodTrack){
  143. // Go get event cut to get my list
  144. StHbtAnalysis* Anal = (StHbtAnalysis*) myAnalysis;
  145. helensEventCut* EventCut = (helensEventCut*)Anal->EventCut();
  146. StHbtTrkV0Iterator pIter;
  147. StHbtTrkV0Match* TheMatch;
  148. for( pIter= EventCut->TrkV0MatchCollection()->begin(); pIter!= EventCut->TrkV0MatchCollection()->end(); pIter++){
  149. TheMatch = *pIter;
  150. if( TheMatch->TrkId() == track->TrackId()){
  151. goodTrack = !(TheMatch->Used());
  152. break;
  153. }
  154. }
  155. }
  156. (goodTrack && goodPID) ? mNTracksPassed++ : mNTracksFailed++;
  157. return (goodPID && goodTrack);
  158. }
  159. //------------------------------
  160. StHbtString helensLaPTrackCut::Report(){
  161. string Stemp;
  162. char Ctemp[100];
  163. sprintf(Ctemp,"\nParticle mass:\t%E",mMass);
  164. Stemp+=Ctemp;
  165. sprintf(Ctemp,"\nParticle charge:\t%d",mCharge);
  166. Stemp+=Ctemp;
  167. sprintf(Ctemp,"\nParticle Nsigma from pion:\t%E - %E",mNSigmaPion[0],mNSigmaPion[1]);
  168. Stemp+=Ctemp;
  169. sprintf(Ctemp,"\nParticle Nsigma from kaon:\t%E - %E",mNSigmaKaon[0],mNSigmaKaon[1]);
  170. Stemp+=Ctemp;
  171. sprintf(Ctemp,"\nParticle Nsigma from proton:\t%E - %E",mNSigmaProton[0],mNSigmaProton[1]);
  172. Stemp+=Ctemp;
  173. sprintf(Ctemp,"\nParticle Nsigma from electron:\t%E - %E",mNSigmaElectron[0],mNSigmaElectron[1]);
  174. Stemp+=Ctemp;
  175. sprintf(Ctemp,"\nParticle #hits:\t%d - %d",mNHits[0],mNHits[1]);
  176. Stemp+=Ctemp;
  177. sprintf(Ctemp,"\nParticle p:\t%E - %E",mP[0],mP[1]);
  178. Stemp+=Ctemp;
  179. sprintf(Ctemp,"\nParticle pT:\t%E - %E",mPt[0],mPt[1]);
  180. Stemp+=Ctemp;
  181. sprintf(Ctemp,"\nParticle rapidity:\t%E - %E",mRapidity[0],mRapidity[1]);
  182. Stemp+=Ctemp;
  183. sprintf(Ctemp,"\nParticle DCA:\t%E - %E",mDCA[0],mDCA[1]);
  184. Stemp+=Ctemp;
  185. sprintf(Ctemp,"\nNumber of tracks which passed:\t%ld Number which failed:\t%ld",mNTracksPassed,mNTracksFailed);
  186. Stemp += Ctemp;
  187. StHbtString returnThis = Stemp;
  188. return returnThis;
  189. }