franksPairCut.cxx 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. //#include "StHbtMaker/Infrastructure/StHbtPairResonanceInfo.hh"
  2. #include "StHbtMaker/Infrastructure/StHbtTypes.hh"
  3. #include "StHbtMaker/Cut/franksPairCut.h"
  4. #include "SystemOfUnits.h"
  5. #include <string>
  6. #include <cstdio>
  7. #ifdef __ROOT__
  8. ClassImp(franksPairCut)
  9. #endif
  10. #define __2POWER16__ 65536
  11. //__________________
  12. franksPairCut::franksPairCut() /* : mResonanceInfoOn(false) */ {
  13. mQuality[0] = -1.; mQuality[1] = +1.;
  14. mKt[0] = -1e9; mKt[1]= +1e9;
  15. mPt[0] = -1e9; mPt[1]= +1e9;
  16. mOpeningAngle[0] = -1e9; mOpeningAngle[1]= +1e9;
  17. mRapidity[0] = -1e9; mRapidity[1]= +1e9;
  18. mEta[0] = -1e9; mEta[1]= +1e9;
  19. mQinv[0] = -1e9; mQinv[1]= +1e9;
  20. mEntranceSeparation[0] = -1e9; mEntranceSeparation[1]= +1e9;
  21. mDecayLength[0] = -1e9; mDecayLength[1]= 1e9;
  22. mAngleToPrimaryVertex[0] = -1e9; mAngleToPrimaryVertex[1]= 1e9;
  23. mDcaToPrimaryVertex[0] = -1e9; mDcaToPrimaryVertex[1]= 1e9;
  24. mDcaOfDaughters[0] = -1e9; mDcaOfDaughters[1]= 1e9;
  25. mNPairsPassed = mNPairsFailed = 0;
  26. mIdenticalMother =0;
  27. }
  28. //__________________
  29. franksPairCut::franksPairCut(const franksPairCut& c) : StHbtPairCut(c) /* : , mResonanceInfoOn(false) */ {
  30. #ifdef STHBTDEBUG
  31. cout << " franksPairCut::franksPairCut(const franksPairCut& c) " << endl;
  32. #endif
  33. mNPairsPassed = mNPairsFailed = 0;
  34. mPrimaryVertex = c.mPrimaryVertex;
  35. mQuality[0] = c.mQuality[0];
  36. mQuality[1] = c.mQuality[1];
  37. mKt[0] = c.mKt[0];
  38. mKt[1] = c.mKt[1];
  39. mPt[0] = c.mPt[0];
  40. mPt[1] = c.mPt[1];
  41. mOpeningAngle[0] = c.mOpeningAngle[0];
  42. mOpeningAngle[1] = c.mOpeningAngle[1];
  43. mQinv[0] = c.mQinv[0];
  44. mQinv[1] = c.mQinv[1];
  45. mRapidity[0] = c.mRapidity[0];
  46. mRapidity[1] = c.mRapidity[1];
  47. mEta[0] = c.mEta[0];
  48. mEta[1] = c.mEta[1];
  49. mEntranceSeparation[0] = c.mEntranceSeparation[0];
  50. mEntranceSeparation[1] = c.mEntranceSeparation[1];
  51. mDecayLength[0] = c.mDecayLength[0];
  52. mDecayLength[1] = c.mDecayLength[1];
  53. mAngleToPrimaryVertex[0] = c.mAngleToPrimaryVertex[0];
  54. mAngleToPrimaryVertex[1] = c.mAngleToPrimaryVertex[1];
  55. mDcaToPrimaryVertex[0] = c.mDcaToPrimaryVertex[0];
  56. mDcaToPrimaryVertex[1] = c.mDcaToPrimaryVertex[1];
  57. mDcaOfDaughters[0] = c.mDcaOfDaughters[0];
  58. mDcaOfDaughters[1] = c.mDcaOfDaughters[1];
  59. mIdenticalMother = c.mIdenticalMother;
  60. }
  61. //__________________
  62. //franksPairCut::~franksPairCut(){
  63. // /* no-op */
  64. //}
  65. //__________________
  66. bool franksPairCut::Pass(const StHbtPair* pair){
  67. if ( !(pair->quality() >= mQuality[0] && pair->quality() <= mQuality[1] ) )
  68. return leave(false);
  69. if ( !(pair->kT() >= mKt[0] && pair->kT() <= mKt[1] ) )
  70. return leave(false);
  71. if ( !(pair->fourMomentumSum().perp() >= mPt[0] && pair->fourMomentumSum().perp() <= mPt[1] ) )
  72. return leave(false);
  73. if ( !(pair->OpeningAngle() >= mOpeningAngle[0] && pair->OpeningAngle() <= mOpeningAngle[1] ) )
  74. return leave(false);
  75. if ( !(pair->fourMomentumSum().rapidity() >= mRapidity[0] && pair->fourMomentumSum().rapidity() <= mRapidity[1]) )
  76. return leave(false);
  77. if ( !(pair->fourMomentumSum().pseudoRapidity() >= mEta[0] && pair->fourMomentumSum().pseudoRapidity() <= mEta[1] ) )
  78. return leave(false);
  79. if ( !(fabs(pair->qInv()) >= mQinv[0] && fabs(pair->qInv()) <= mQinv[1]) )
  80. return leave(false);
  81. if ( !(pair->NominalTpcEntranceSeparation() >= mEntranceSeparation[0] && pair->NominalTpcEntranceSeparation() <= mEntranceSeparation[1] )
  82. ) return leave(false);
  83. /*if (mResonanceInfoOn) {
  84. //cout << " fix this " << endl;
  85. pair->CalculateResonanceInfo(&mPrimaryVertex, 0.25*tesla);
  86. //cout << " mDecayLength " << pair->ResonanceInfo()->mDecayLength << endl;
  87. if ( !(pair->ResonanceInfo()->mDecayLength >= mDecayLength[0] &&
  88. pair->ResonanceInfo()->mDecayLength <= mDecayLength[1]) )
  89. return leave(false);
  90. //cout << " mDcaOfDaughters " << pair->ResonanceInfo()->mDcaOfDaughters << endl;
  91. if ( !(pair->ResonanceInfo()->mDcaOfDaughters >= mDcaOfDaughters[0] &&
  92. pair->ResonanceInfo()->mDcaOfDaughters <= mDcaOfDaughters[1]) )
  93. return leave(false);
  94. //cout << "mAngleToPrimaryVertex " << pair->ResonanceInfo()->mAngleToPrimaryVertex << endl;
  95. if ( !(pair->ResonanceInfo()->mAngleToPrimaryVertex >= mAngleToPrimaryVertex[0] &&
  96. pair->ResonanceInfo()->mAngleToPrimaryVertex <= mAngleToPrimaryVertex[1]) )
  97. return leave(false);
  98. //cout << "mDcaToPrimaryVertex " << pair->ResonanceInfo()->mDcaToPrimaryVertex << endl;
  99. if ( !(pair->ResonanceInfo()->mDcaToPrimaryVertex >= mDcaToPrimaryVertex[0] &&
  100. pair->ResonanceInfo()->mDcaToPrimaryVertex <= mDcaToPrimaryVertex[1]) )
  101. return leave(false);
  102. }*/
  103. if (mIdenticalMother)
  104. if( !((int)(pair->track1()->TrackId()/__2POWER16__) != (int)(pair->track2()->TrackId()/__2POWER16__) ) )
  105. return leave(false);
  106. return leave(true);
  107. }
  108. //__________________
  109. bool franksPairCut::leave(bool b){
  110. b ? mNPairsPassed++ : mNPairsFailed++;
  111. return b;
  112. }
  113. //__________________
  114. StHbtString franksPairCut::Report(){
  115. string Stemp = "Franks Pair Cut have to finish cut and report; this is just a test - \n";
  116. char Ctemp[100];
  117. sprintf(Ctemp,"Number of pairs which passed:\t%ld Number which failed:\t%ld\n",mNPairsPassed,mNPairsFailed);
  118. Stemp += Ctemp;
  119. sprintf(Ctemp,"quality: %f -- %f\n",mQuality[0],mQuality[1]);
  120. Stemp += Ctemp;
  121. sprintf(Ctemp,"kT: %f -- %f\n",mKt[0],mKt[1]);
  122. Stemp += Ctemp;
  123. sprintf(Ctemp,"pT: %f -- %f\n",mPt[0],mPt[1]);
  124. Stemp += Ctemp;
  125. sprintf(Ctemp,"opening angle: %f -- %f\n",mOpeningAngle[0],mOpeningAngle[1]);
  126. Stemp += Ctemp;
  127. sprintf(Ctemp,"pair qinv: %f -- %f\n",mQinv[0],mQinv[1]);
  128. Stemp += Ctemp;
  129. sprintf(Ctemp,"pair rapidity: %f -- %f\n",mRapidity[0],mRapidity[1]);
  130. Stemp += Ctemp;
  131. sprintf(Ctemp,"pair eta: %f -- %f\n",mEta[0],mEta[1]);
  132. Stemp += Ctemp;
  133. sprintf(Ctemp,"EntranceSeparation: %f -- %f\n",mEntranceSeparation[0],mEntranceSeparation[1]);
  134. Stemp += Ctemp;
  135. sprintf(Ctemp,"DecayLength: %f -- %f\n",mDecayLength[0],mDecayLength[1]);
  136. Stemp += Ctemp;
  137. sprintf(Ctemp,"AngleToPrimaryVertex: %f -- %f\n",mAngleToPrimaryVertex[0],mAngleToPrimaryVertex[1]);
  138. Stemp += Ctemp;
  139. sprintf(Ctemp,"DcaToPrimaryVertex: %f -- %f\n",mDcaToPrimaryVertex[0],mDcaToPrimaryVertex[1]);
  140. Stemp += Ctemp;
  141. StHbtString returnThis = Stemp;
  142. return returnThis;
  143. }