franksXiCut.cxx 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #include "StHbtMaker/Cut/franksXiCut.h"
  2. #include <cstdio>
  3. #ifdef __ROOT__
  4. ClassImp(franksXiCut)
  5. #endif
  6. franksXiCut::franksXiCut(){
  7. mNXisPassed = mNXisFailed = 0;
  8. mXiMassRange[0] =0;
  9. mXiMassRange[1]=10000;
  10. mOmegaMassRange[0] =0;
  11. mOmegaMassRange[1]=10000;
  12. mdcaXidaughters[0]=0;
  13. mdcaXidaughters[1]=1000;
  14. mdcaXiToPrimVertex[0]=0;
  15. mdcaXiToPrimVertex[1]=1000;
  16. mdecayLengthXi[0]=0;
  17. mdecayLengthXi[1]=10000;
  18. mtpcHitsBac[0]=0;
  19. mtpcHitsBac[1]=1000;
  20. mdcaBacToPrimVertex[0]=0;
  21. mdcaBacToPrimVertex[1]=10000;
  22. mptArmXi[0]=0;
  23. mptArmXi[1]=100;
  24. malphaXi[0]=-10;
  25. malphaXi[1]=10;
  26. mChargedEdx=0;
  27. mdEdx[0]=0;
  28. mdEdx[1]=-10;
  29. mdEdx[0]=0;
  30. mdEdx[1]=-10;
  31. mPt[0]=0;
  32. mPt[1]=100000;
  33. mRapidity[0]=-100000;
  34. mRapidity[1]=100000;
  35. mMass = 1.32131;
  36. }
  37. //------------------------------
  38. //franksXiCut::~franksXiCut(){
  39. // /* noop */
  40. //}
  41. //------------------------------
  42. bool franksXiCut::Pass(const StHbtXi* Xi){
  43. int inMassRange;
  44. #ifdef STHBTDEBUG
  45. cout << endl;
  46. cout << " * dcaXiDaughters " << Xi->dcaXiDaughters();
  47. cout << " * dcaXiToPrimVertex " << Xi->dcaXiToPrimVertex();
  48. cout << " * decayLengthXi " << Xi->decayLengthXi();
  49. cout << " * tpcHitsBac " << Xi->tpcHitsBac();
  50. cout << " * dcaNegToPrimVertex " << Xi->dcaBacToPrimVertex();
  51. cout << " * ptArmXi " << Xi->ptArmXi();
  52. cout << " * alphaXi " << Xi->alphaXi();
  53. cout << " * dEdxBac " << Xi->dedxBac();
  54. cout << endl;
  55. #endif
  56. inMassRange=0;
  57. // Find out what particle is desired
  58. if ( (Xi->massXi() > mXiMassRange[0]) && (Xi->massXi() < mXiMassRange[1]) ) inMassRange=1;
  59. if ( (Xi->massOmega() > mOmegaMassRange[0]) && (Xi->massOmega() < mOmegaMassRange[1]) ) inMassRange=1;
  60. bool goodPID = ( inMassRange &&
  61. (Xi->dcaXiDaughters() > mdcaXidaughters[0]) &&
  62. (Xi->dcaXiDaughters() < mdcaXidaughters[1]) &&
  63. (Xi->dcaXiToPrimVertex() > mdcaXiToPrimVertex[0]) &&
  64. (Xi->dcaXiToPrimVertex() < mdcaXiToPrimVertex[1]) &&
  65. (Xi->decayLengthXi() > mdecayLengthXi[0]) &&
  66. (Xi->decayLengthXi() < mdecayLengthXi[1]) &&
  67. (Xi->tpcHitsBac() > mtpcHitsBac[0]) &&
  68. (Xi->tpcHitsBac() < mtpcHitsBac[1]) &&
  69. (Xi->dcaBacToPrimVertex() > mdcaBacToPrimVertex[0]) &&
  70. (Xi->dcaBacToPrimVertex() < mdcaBacToPrimVertex[1]) &&
  71. (Xi->ptArmXi() > mptArmXi[0]) &&
  72. (Xi->ptArmXi() < mptArmXi[1]) &&
  73. (Xi->alphaXi() > malphaXi[0]) &&
  74. (Xi->alphaXi() < malphaXi[1]));
  75. if(goodPID){
  76. if( mChargedEdx <0){
  77. goodPID = (Xi->dedxNeg() > (mdEdx[0]*Xi->ptNeg()+mdEdx[1]));
  78. }
  79. if( mChargedEdx > 0){
  80. goodPID = (Xi->dedxPos() > (mdEdx[0]*Xi->ptPos()+mdEdx[1]));
  81. }
  82. }
  83. if (goodPID){
  84. float TEnergy = ::sqrt((Xi->ptotXi())*(Xi->ptotXi())+mMass*mMass);
  85. float TRapidity = 0.5*::log((TEnergy+Xi->momXi().z())/
  86. (TEnergy-Xi->momXi().z()));
  87. float Pt = Xi->ptXi();
  88. #ifdef STHBTDEBUG
  89. cout << " * Pt " << Pt;
  90. cout << " * mPt[0] " << mPt[0];
  91. cout << " * mPt[1] " << mPt[1];
  92. cout << " * TRapidity " << TRapidity;
  93. cout << " * mRapidity[0] " << mRapidity[0];
  94. cout << " * mRapidity[1] " << mRapidity[1];
  95. cout << " * Pt " << (Pt > mPt[0]) && (Pt < mPt[1]);
  96. cout << " * y " << (TRapidity > mRapidity[0]) && (TRapidity < mRapidity[1]);
  97. cout << endl;
  98. #endif
  99. bool goodXi=
  100. ((Pt > mPt[0]) &&
  101. (Pt < mPt[1]) &&
  102. (TRapidity > mRapidity[0]) &&
  103. (TRapidity < mRapidity[1]));
  104. goodXi ? mNXisPassed++ : mNXisFailed++;
  105. return (goodXi);
  106. }
  107. else{
  108. mNXisFailed++;
  109. return (goodPID);
  110. }
  111. }
  112. //------------------------------
  113. StHbtString franksXiCut::Report(){
  114. string Stemp;
  115. char Ctemp[100];
  116. sprintf(Ctemp,"--franksXiCut--\n Particle mass:\t%E\n",this->Mass());
  117. Stemp=Ctemp;
  118. sprintf(Ctemp,"Xi mass range:\t%E - %E\n",mXiMassRange[0],
  119. mXiMassRange[1]);
  120. Stemp+=Ctemp;
  121. sprintf(Ctemp,"dcaXidaughters:\t%E - %E\n",mdcaXidaughters[0],
  122. mdcaXidaughters[1]);
  123. Stemp+=Ctemp;
  124. sprintf(Ctemp,"dcaXiToPrimVertex:\t%E - %E\n",mdcaXiToPrimVertex[0],
  125. mdcaXiToPrimVertex[1]);
  126. Stemp+=Ctemp;
  127. sprintf(Ctemp,"decayLengthXi:\t%E - %E\n",mdecayLengthXi[0],
  128. mdecayLengthXi[1]);
  129. Stemp+=Ctemp;
  130. sprintf(Ctemp,"tpcHitsBac:\t%d - %d\n",mtpcHitsBac[0],mtpcHitsBac[1]);
  131. Stemp+=Ctemp;
  132. sprintf(Ctemp,"dcaBacToPrimVertex:\t%E - %E\n",mdcaBacToPrimVertex[0],
  133. mdcaBacToPrimVertex[1]);
  134. Stemp+=Ctemp;
  135. sprintf(Ctemp,"dedx>:\t%E pt+%E for Charge %E\n ",mdEdx[0],mdEdx[1],mChargedEdx);
  136. Stemp+=Ctemp;
  137. sprintf(Ctemp,"ptArmXi:\t%E - %E\n",mptArmXi[0],mptArmXi[1]);
  138. Stemp+=Ctemp;
  139. sprintf(Ctemp,"alphaXi:\t%E - %E\n",malphaXi[0],malphaXi[1]);
  140. Stemp+=Ctemp;
  141. sprintf(Ctemp,"Particle pT:\t%E - %E\n",mPt[0],mPt[1]);
  142. Stemp+=Ctemp;
  143. sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",mRapidity[0],mRapidity[1]);
  144. Stemp+=Ctemp;
  145. sprintf(Ctemp,"Number of Xis which passed:\t%ld Number which failed:\t%ld\n",mNXisPassed,mNXisFailed);
  146. Stemp += Ctemp;
  147. StHbtString returnThis = Stemp;
  148. return returnThis;
  149. }