gregsTrackPairCut.cxx 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. #include "StHbtMaker/Infrastructure/StHbtTypes.hh"
  2. #include "StHbtMaker/Cut/gregsTrackPairCut.h"
  3. #include "SystemOfUnits.h"
  4. #include <string>
  5. #include <cstdio>
  6. #ifdef __ROOT__
  7. ClassImp(gregsTrackPairCut)
  8. #endif
  9. //_________________
  10. gregsTrackPairCut::gregsTrackPairCut() {
  11. mQuality[0] = -1.; mQuality[1] = +1.;
  12. mKt[0] = -1e9; mKt[1]= +1e9;
  13. mPt[0] = -1e9; mPt[1]= +1e9;
  14. mOpeningAngle[0] = -1e9; mOpeningAngle[1]= +1e9;
  15. mRapidity[0] = -1e9; mRapidity[1]= +1e9;
  16. mEta[0] = -3.5; mEta[1]= 3.5;
  17. mQinv[0] = -0.01; mQinv[1]= 1e9;
  18. mMinv[0] = -1e9; mMinv[1]= +1e9;
  19. mEntranceSeparation[0] = -1e9; mEntranceSeparation[1]= +1e9;
  20. mAngleToPrimaryVertex[0] = -1e9; mAngleToPrimaryVertex[1]= 1e9;
  21. mFracOfMergedRow[0] = -1e9; mFracOfMergedRow[1]=+1e9;
  22. mClosestRowAtDCA[0] = -1e9; mClosestRowAtDCA[1]=+1e9;
  23. mWeightedAvSep[0] = -1e9; mWeightedAvSep[1]=+1e9;
  24. mAverageSeparation[0] = -1e9; mAverageSeparation[1]=+1e9;
  25. mRValueLo = 0.;
  26. mNPairsPassed = mNPairsFailed = 0;
  27. }
  28. //_________________
  29. gregsTrackPairCut::gregsTrackPairCut(const gregsTrackPairCut& c) : StHbtPairCut(c) {
  30. #ifdef STHBTDEBUG
  31. cout << " gregsTrackPairCut::gregsTrackPairCut(const gregsTrackPairCut& 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. mMinv[0] = c.mMinv[0];
  46. mMinv[1] = c.mMinv[1];
  47. mRapidity[0] = c.mRapidity[0];
  48. mRapidity[1] = c.mRapidity[1];
  49. mEta[0] = c.mEta[0];
  50. mEta[1] = c.mEta[1];
  51. mEntranceSeparation[0] = c.mEntranceSeparation[0];
  52. mEntranceSeparation[1] = c.mEntranceSeparation[1];
  53. mAngleToPrimaryVertex[0] = c.mAngleToPrimaryVertex[0];
  54. mAngleToPrimaryVertex[1] = c.mAngleToPrimaryVertex[1];
  55. mFracOfMergedRow[0] = c.mFracOfMergedRow[0];
  56. mFracOfMergedRow[1] = c.mFracOfMergedRow[1];
  57. mClosestRowAtDCA[0] = c.mClosestRowAtDCA[0];
  58. mClosestRowAtDCA[1] = c.mClosestRowAtDCA[1];
  59. mWeightedAvSep[0] = c.mWeightedAvSep[0];
  60. mWeightedAvSep[1] = c.mWeightedAvSep[1];
  61. mAverageSeparation[0] = c.mAverageSeparation[0];
  62. mAverageSeparation[1] = c.mAverageSeparation[1];
  63. mRValueLo = c.mRValueLo;
  64. }
  65. //_________________
  66. gregsTrackPairCut::~gregsTrackPairCut(){
  67. /* no-op */
  68. }
  69. //__________________
  70. bool gregsTrackPairCut::Pass(const StHbtPair* pair){
  71. #ifdef STHBTDEBUG
  72. std::cout << "--gregsTrackPairCut--" << std::endl
  73. << "Quality = " << pair->quality() << std::endl
  74. << "kT = " << pair->kT() << std::endl
  75. << "pT = " << pair->pT() << std::endl
  76. << "Opening angle = " << pair->OpeningAngle() << std::endl
  77. << "Rapidity = " << pair->rapidity()
  78. << std::endl
  79. << "Pseudorapity = " << pair->eta()
  80. << std::endl
  81. << "Qinv = " << pair->qInv() << std::endl
  82. << "Minv = " << pair->mInv() << std::endl
  83. << "TpcEntranceSep = " << pair->NominalTpcEntranceSeparation()
  84. << std::endl
  85. << "FracOfMergedRow = " << pair->getFracOfMergedRow() << std::endl
  86. << "ClosestRowAtDCA = " << pair->getClosestRowAtDCA() << std::endl
  87. << "WeightedAvSep = " << pair->getWeightedAvSep() << std::endl
  88. << "AverageSep = " << pair->NominalTpcAverageSeparation()
  89. << "rValue = " << pair->rValue()
  90. << std::endl << std::endl;
  91. #endif
  92. bool mGoodPair = ( (pair->quality() >= mQuality[0]) &&
  93. (pair->quality() <= mQuality[1]) &&
  94. (pair->kT() >= mKt[0]) &&
  95. (pair->kT() <= mKt[1]) &&
  96. (pair->pT() >= mPt[0]) &&
  97. (pair->pT() <= mPt[1]) &&
  98. (pair->OpeningAngle() >= mOpeningAngle[0]) &&
  99. (pair->OpeningAngle() <= mOpeningAngle[1]) &&
  100. (pair->rap() >= mRapidity[0]) &&
  101. (pair->rap() <= mRapidity[1]) &&
  102. (pair->eta() >= mEta[0]) &&
  103. (pair->eta() <= mEta[1]) &&
  104. (fabs(pair->qInv()) >= mQinv[0]) &&
  105. (fabs(pair->qInv()) <= mQinv[1]) &&
  106. (fabs(pair->mInv()) >= mMinv[0]) &&
  107. (fabs(pair->mInv()) <= mMinv[1]) &&
  108. (pair->NominalTpcEntranceSeparation() >= mEntranceSeparation[0]) &&
  109. (pair->NominalTpcEntranceSeparation() <= mEntranceSeparation[1]) &&
  110. (pair->getFracOfMergedRow() >= mFracOfMergedRow[0]) &&
  111. (pair->getFracOfMergedRow() <= mFracOfMergedRow[1]) &&
  112. (pair->getClosestRowAtDCA() >= mClosestRowAtDCA[0]) &&
  113. (pair->getClosestRowAtDCA() <= mClosestRowAtDCA[1]) &&
  114. (pair->getWeightedAvSep() >= mWeightedAvSep[0]) &&
  115. (pair->getWeightedAvSep() <= mWeightedAvSep[1]) &&
  116. (pair->NominalTpcAverageSeparation() >= mAverageSeparation[0]) &&
  117. (pair->NominalTpcAverageSeparation() <= mAverageSeparation[1]) &&
  118. (pair->rValue() >= mRValueLo)
  119. );
  120. #ifdef STHBTDEBUG
  121. if(mGoodPair)
  122. std::cout << "Pair cut passed!" << std::endl;
  123. else
  124. std::cout << "Pair cut failed!" << std::endl;
  125. #endif
  126. mGoodPair ? mNPairsPassed++ : mNPairsFailed++;
  127. return mGoodPair;
  128. }
  129. //__________________
  130. #include <sstream>
  131. StHbtString gregsTrackPairCut::Report(){
  132. ostringstream rep_stream;
  133. rep_stream << "\n-- gregsTrackPairCut --"<< std::endl
  134. << mQuality[0] << " <= mQuality <= " << mQuality[1] << std::endl
  135. << mKt[0] << " <= kT <= " << mKt[1] << std::endl
  136. << mPt[0] << " <= Pt <= " << mPt[1] << std::endl
  137. << mOpeningAngle[0] << " <= OpeningAngle <= " << mOpeningAngle[1]
  138. << std::endl
  139. << mRapidity[0] << " <= Rapidity <= " << mRapidity[1] << std::endl
  140. << mEta[0] << " <= PseudoRapidity <= " << mEta[1] << std::endl
  141. << mQinv[0] << " <= Qinv <= " << mQinv[1] << std::endl
  142. << mMinv[0] << " <= Minv <= " << mMinv[1] << std::endl
  143. << mEntranceSeparation[0] << " <= EntranceSeparation <= "
  144. << mEntranceSeparation[1] << std::endl
  145. << mAverageSeparation[0] << " <= AverageSeparation <= "
  146. << mAverageSeparation[1] << std::endl
  147. << "rValue >= " << mRValueLo << std::endl
  148. << "NPairsPassed = " << mNPairsPassed << std::endl
  149. << "NPairsFailed = " << mNPairsFailed << std::endl;
  150. return (rep_stream.str());
  151. }