franksTrackCut.cxx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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/franksTrackCut.h"
  16. #include <cstdio>
  17. #ifdef __ROOT__
  18. ClassImp(franksTrackCut)
  19. #endif
  20. //#define STHBTDEBUG
  21. franksTrackCut::franksTrackCut(){
  22. mNTracksPassed = mNTracksFailed = 0;
  23. mPidProbElectron[0] = -1e9; mPidProbElectron[1] = +1e9;
  24. mPidProbPion[0] = -1e9; mPidProbPion[1] = +1e9;
  25. mPidProbKaon[0] = -1e9; mPidProbKaon[1] = +1e9;
  26. mPidProbProton[0] = -1e9; mPidProbProton[1] = +1e9;
  27. mNSigmaElectron[0] = -1e9; mNSigmaElectron[1] = +1e9;
  28. mNSigmaPion[0] = -1e9; mNSigmaPion[1] = +1e9;
  29. mNSigmaKaon[0] = -1e9; mNSigmaKaon[1] = +1e9;
  30. mNSigmaProton[0] = -1e9; mNSigmaProton[1] = +1e9;
  31. mNSigmaAntiElectron[0] = 0.; mNSigmaAntiElectron[1] = 0.;
  32. mNSigmaAntiPion[0] = 0.; mNSigmaAntiPion[1] = 0.;
  33. mNSigmaAntiKaon[0] = 0.; mNSigmaAntiKaon[1] = 0.;
  34. mNSigmaAntiProton[0] = 0.; mNSigmaAntiProton[1] = 0.;
  35. mEta[0] = -1e9; mEta[1] = +1e9;
  36. mRapidity[0] = -1e9; mRapidity[1] = +1e9;
  37. mP[0] = -1e9; mP[1] = +1e9;
  38. mPt[0] = -1e9; mPt[1] = +1e9;
  39. mPx[0] = -1e9; mPx[1] = +1e9;
  40. mPy[0] = -1e9; mPy[1] = +1e9;
  41. mPz[0] = -1e9; mPz[1] = +1e9;
  42. mDCA[0] = -1e9; mDCA[1] = +1e9;
  43. mDCAGlobal[0] = -1e9; mDCAGlobal[1] = +1e9;
  44. mNHits[0] = 0; mNHits[1] = 60;
  45. mNdEdxHits[0] = 0; mNdEdxHits[1] = 60;
  46. }
  47. //------------------------------
  48. franksTrackCut::franksTrackCut(franksTrackCut& c) : StHbtTrackCut(c) {
  49. mNTracksPassed = mNTracksFailed = 0;
  50. mCharge = c.mCharge;
  51. mPidProbElectron[0] = c.mPidProbElectron[0];
  52. mPidProbElectron[1] = c.mPidProbElectron[1];
  53. mPidProbPion[0] = c.mPidProbPion[0];
  54. mPidProbPion[1] = c.mPidProbPion[1];
  55. mPidProbKaon[0] = c.mPidProbKaon[0];
  56. mPidProbKaon[1] = c.mPidProbKaon[1];
  57. mPidProbProton[0] = c.mPidProbProton[0];
  58. mPidProbProton[1] = c.mPidProbProton[1];
  59. mNSigmaElectron[0] = c.mNSigmaElectron[0];
  60. mNSigmaElectron[1] = c.mNSigmaElectron[1];
  61. mNSigmaPion[0] = c.mNSigmaPion[0];
  62. mNSigmaPion[1] = c.mNSigmaPion[1];
  63. mNSigmaKaon[0] = c.mNSigmaKaon[0];
  64. mNSigmaKaon[1] = c.mNSigmaKaon[1];
  65. mNSigmaProton[0] = c.mNSigmaProton[0];
  66. mNSigmaProton[1] = c.mNSigmaProton[1];
  67. mNSigmaAntiElectron[0] = c.mNSigmaAntiElectron[0];
  68. mNSigmaAntiElectron[1] = c.mNSigmaAntiElectron[1];
  69. mNSigmaAntiPion[0] = c.mNSigmaAntiPion[0];
  70. mNSigmaAntiPion[1] = c.mNSigmaAntiPion[1];
  71. mNSigmaAntiKaon[0] = c.mNSigmaAntiKaon[0];
  72. mNSigmaAntiKaon[1] = c.mNSigmaAntiKaon[1];
  73. mNSigmaAntiProton[0] = c.mNSigmaAntiProton[0];
  74. mNSigmaAntiProton[1] = c.mNSigmaAntiProton[1];
  75. mNHits[0] = c.mNHits[0];
  76. mNHits[1] = c.mNHits[1];
  77. mNdEdxHits[0] = c.mNdEdxHits[0];
  78. mNdEdxHits[1] = c.mNdEdxHits[1];
  79. mP[0] = c.mP[0]; mP[1] = c.mP[1];
  80. mPt[0] = c.mPt[0]; mPt[1] = c.mPt[1];
  81. mPx[0] = c.mPx[0]; mPx[1] = c.mPx[1];
  82. mPy[0] = c.mPy[0]; mPy[1] = c.mPy[1];
  83. mPz[0] = c.mPz[0]; mPz[1] = c.mPz[1];
  84. mRapidity[0] = c.mRapidity[0];
  85. mRapidity[1] = c.mRapidity[1];
  86. mEta[0] = c.mEta[0];
  87. mEta[1] = c.mEta[1];
  88. mDCA[0] = c.mDCA[0];
  89. mDCA[1] = c.mDCA[1];
  90. mDCAGlobal[0] = c.mDCAGlobal[0];
  91. mDCAGlobal[1] = c.mDCAGlobal[1];
  92. mNTracksPassed=0;
  93. mNTracksFailed=0;
  94. #ifdef STHBTDEBUG
  95. cout << " franksTrackCut::franksTrackCut(franksTrackCut& c) " << endl;
  96. #endif
  97. }
  98. //------------------------------
  99. franksTrackCut::~franksTrackCut(){
  100. }
  101. //------------------------------
  102. bool franksTrackCut::Pass(const StHbtTrack* track){
  103. // cout << " *** franksTrackCut::Pass(const StHbtTrack* track) " << endl;
  104. float TEnergy = ::sqrt(track->P().mag2()+mMass*mMass);
  105. float TRapidity = 0.5*::log((TEnergy+track->P().z())/
  106. (TEnergy-track->P().z()));
  107. #ifdef STHBTDEBUG
  108. cout <<
  109. track->NSigmaElectron() << " " <<
  110. track->NSigmaPion() << " " <<
  111. track->NSigmaKaon() << " " <<
  112. track->NSigmaProton() << " " <<
  113. track->DCAxy() << " " <<
  114. track->DCAxyGlobal() << " " <<
  115. track->NHits() << " " <<
  116. track->NHitsDedx() << " " <<
  117. track->P().mag() << " " <<
  118. track->Pt() << " " <<
  119. TRapidity << " " <<
  120. track->Charge() << " ";
  121. #endif
  122. bool goodPID = (
  123. (track->PidProbElectron() >= mPidProbElectron[0]) &&
  124. (track->PidProbElectron() <= mPidProbElectron[1]) &&
  125. (track->PidProbPion() >= mPidProbPion[0]) &&
  126. (track->PidProbPion() <= mPidProbPion[1]) &&
  127. (track->PidProbKaon() >= mPidProbKaon[0]) &&
  128. (track->PidProbKaon() <= mPidProbKaon[1]) &&
  129. (track->PidProbProton() >= mPidProbProton[0]) &&
  130. (track->PidProbProton() <= mPidProbProton[1]) &&
  131. (track->NSigmaElectron() >= mNSigmaElectron[0]) &&
  132. (track->NSigmaElectron() <= mNSigmaElectron[1]) &&
  133. (track->NSigmaPion() >= mNSigmaPion[0]) &&
  134. (track->NSigmaPion() <= mNSigmaPion[1]) &&
  135. (track->NSigmaKaon() >= mNSigmaKaon[0]) &&
  136. (track->NSigmaKaon() <= mNSigmaKaon[1]) &&
  137. (track->NSigmaProton() >= mNSigmaProton[0]) &&
  138. (track->NSigmaProton() <= mNSigmaProton[1]) &&
  139. !( (track->NSigmaElectron() > mNSigmaAntiElectron[0]) &&
  140. (track->NSigmaElectron() < mNSigmaAntiElectron[1]) ) &&
  141. !( (track->NSigmaPion() > mNSigmaAntiPion[0]) &&
  142. (track->NSigmaPion() < mNSigmaAntiPion[1]) ) &&
  143. !( (track->NSigmaKaon() > mNSigmaAntiKaon[0]) &&
  144. (track->NSigmaKaon() < mNSigmaAntiKaon[1]) ) &&
  145. !( (track->NSigmaProton() > mNSigmaAntiProton[0]) &&
  146. (track->NSigmaProton() < mNSigmaAntiProton[1]) ) &&
  147. (track->Charge() == mCharge || mCharge==0 )
  148. );
  149. #ifdef STHBTDEBUG
  150. cout << mNSigmaElectron[0] << " << " << track->NSigmaElectron() << " << " << mNSigmaElectron[1] << " ";
  151. cout << (track->NSigmaElectron() >= mNSigmaElectron[0]) << (track->NSigmaElectron() <= mNSigmaElectron[1]) << endl;
  152. #endif
  153. bool goodTrack=( true &&
  154. (track->DCAxy() >= mDCA[0]) &&
  155. (track->DCAxy() <= mDCA[1]) &&
  156. (track->DCAxyGlobal() >= mDCAGlobal[0]) &&
  157. (track->DCAxyGlobal() <= mDCAGlobal[1]) &&
  158. (track->NHits() >= mNHits[0]) &&
  159. (track->NHits() <= mNHits[1]) &&
  160. (track->NHitsDedx() >= mNdEdxHits[0]) &&
  161. (track->NHitsDedx() <= mNdEdxHits[1]) &&
  162. (track->P().mag() >= mP[0]) &&
  163. (track->P().mag() <= mP[1]) &&
  164. (track->Pt() >= mPt[0]) &&
  165. (track->Pt() <= mPt[1]) &&
  166. (track->P().x() >= mPx[0]) &&
  167. (track->P().x() <= mPx[1]) &&
  168. (track->P().y() >= mPy[0]) &&
  169. (track->P().y() <= mPy[1]) &&
  170. (track->P().z() >= mPz[0]) &&
  171. (track->P().z() <= mPz[1]) &&
  172. (track->P().pseudoRapidity() >= mEta[0]) &&
  173. (track->P().pseudoRapidity() <= mEta[1]) &&
  174. (TRapidity >= mRapidity[0]) &&
  175. (TRapidity <= mRapidity[1])
  176. );
  177. #ifdef STHBTDEBUG
  178. cout << " goodPID=" << goodPID << " ";
  179. cout << " goodTrack=" << goodTrack << " ";
  180. cout << endl;
  181. #endif
  182. (goodTrack && goodPID) ? mNTracksPassed++ : mNTracksFailed++;
  183. return (goodPID && goodTrack);
  184. }
  185. //------------------------------
  186. StHbtString franksTrackCut::Report(){
  187. string Stemp;
  188. char Ctemp[100];
  189. sprintf(Ctemp,"\nParticle mass:\t%E",mMass);
  190. Stemp+=Ctemp;
  191. sprintf(Ctemp,"\nParticle charge:\t%d",mCharge);
  192. Stemp+=Ctemp;
  193. sprintf(Ctemp,"\nParticle Nsigma from pion:\t%E - %E",mNSigmaPion[0],mNSigmaPion[1]);
  194. Stemp+=Ctemp;
  195. sprintf(Ctemp,"\nParticle Nsigma from kaon:\t%E - %E",mNSigmaKaon[0],mNSigmaKaon[1]);
  196. Stemp+=Ctemp;
  197. sprintf(Ctemp,"\nParticle Nsigma from proton:\t%E - %E",mNSigmaProton[0],mNSigmaProton[1]);
  198. Stemp+=Ctemp;
  199. sprintf(Ctemp,"\nParticle PidProb from electron:\t%E - %E",mPidProbElectron[0],mPidProbElectron[1]);
  200. Stemp+=Ctemp;
  201. sprintf(Ctemp,"\nParticle PidProb from pion:\t%E - %E",mPidProbPion[0],mPidProbPion[1]);
  202. Stemp+=Ctemp;
  203. sprintf(Ctemp,"\nParticle PidProb from kaon:\t%E - %E",mPidProbKaon[0],mPidProbKaon[1]);
  204. Stemp+=Ctemp;
  205. sprintf(Ctemp,"\nParticle PidProb from proton:\t%E - %E",mPidProbProton[0],mPidProbProton[1]);
  206. Stemp+=Ctemp;
  207. sprintf(Ctemp,"\nParticle PidProb from electron:\t%E - %E",mPidProbElectron[0],mPidProbElectron[1]);
  208. Stemp+=Ctemp;
  209. sprintf(Ctemp,"\nParticle #hits:\t%d - %d",mNHits[0],mNHits[1]);
  210. Stemp+=Ctemp;
  211. sprintf(Ctemp,"\nParticle dEdx #hits:\t%d - %d",mNdEdxHits[0],mNdEdxHits[1]);
  212. Stemp+=Ctemp;
  213. sprintf(Ctemp,"\nParticle p:\t%E - %E",mP[0],mP[1]);
  214. Stemp+=Ctemp;
  215. sprintf(Ctemp,"\nParticle pT:\t%E - %E",mPt[0],mPt[1]);
  216. Stemp+=Ctemp;
  217. sprintf(Ctemp,"\nParticle rapidity:\t%E - %E",mRapidity[0],mRapidity[1]);
  218. Stemp+=Ctemp;
  219. sprintf(Ctemp,"\nParticle mEta:\t%E - %E",mEta[0],mEta[1]);
  220. Stemp+=Ctemp;
  221. sprintf(Ctemp,"\nParticle DCA:\t%E - %E",mDCA[0],mDCA[1]);
  222. Stemp+=Ctemp;
  223. sprintf(Ctemp,"\nParticle DCAGlobal:\t%E - %E",mDCAGlobal[0],mDCAGlobal[1]);
  224. Stemp+=Ctemp;
  225. sprintf(Ctemp,"\nNumber of tracks which passed:\t%ld Number which failed:\t%ld",mNTracksPassed,mNTracksFailed);
  226. Stemp += Ctemp;
  227. StHbtString returnThis = Stemp;
  228. return returnThis;
  229. }
  230. ostrstream* franksTrackCut::finalReport() const{
  231. ostrstream* tFinalReport = new ostrstream;
  232. (*tFinalReport) << "_____ Track Cut _____ " << endl
  233. << "Charge = " << mCharge << endl
  234. << mNSigmaPion[0] << " < Sigma pion < "
  235. << mNSigmaPion[1] << endl
  236. << mNSigmaKaon[0] << " < Sigma Kaon < "
  237. << mNSigmaKaon[1] << endl
  238. << mNSigmaProton[0] << " < Sigma proton < "
  239. << mNSigmaProton[1] << endl
  240. << mNHits[0] << " < NHits < " << mNHits[1] << endl
  241. << mNdEdxHits[0] << " < NHits < " << mNdEdxHits[1] << endl
  242. << mPt[0] << " < pT < " << mPt[1] << endl
  243. << mP[0] << " < p < " << mP[1] << endl
  244. << mRapidity[0] << " < Y < " << mRapidity[1] << endl
  245. << mDCA[0] << " < dca < " << mDCA[1] << endl
  246. << " >>> N Tracks passed " << mNTracksPassed << endl
  247. << " >>> N Tracks failed " << mNTracksFailed << endl
  248. << ends;
  249. return tFinalReport;
  250. }