gregsFemtoDstEventCut.cxx 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #include "StHbtMaker/Cut/gregsFemtoDstEventCut.h"
  2. #include <TMath.h>
  3. #include <sstream>
  4. #ifdef __ROOT__
  5. ClassImp(gregsFemtoDstEventCut)
  6. #endif
  7. //_________________
  8. gregsFemtoDstEventCut::gregsFemtoDstEventCut() {
  9. mRefMult[0] = 0.;
  10. mRefMult[1] = 5000;
  11. mVtxX[0] = -1e9;
  12. mVtxX[1] = +1e9;
  13. mVtxY[0] = -1e9;
  14. mVtxY[1] = +1e9;
  15. mVtxZ[0] = -1e9;
  16. mVtxZ[1] = +1e9;
  17. mVtxR = 1e9;
  18. mVzVpdVzDiff[0] = -50;
  19. mVzVpdVzDiff[1] = +50;
  20. mCollisionType = 0; //0-pp; 1-AuAu
  21. mNumberOfCentralityBins = 9;
  22. mCentralityBinRange[0] = 0;
  23. mCentralityBinRange[1] = 8;
  24. mVtxXShift = 0.;
  25. mVtxYShift = 0.;
  26. mNEventsPassed = mNEventsFailed = 0;
  27. }
  28. //_________________
  29. gregsFemtoDstEventCut::gregsFemtoDstEventCut(const gregsFemtoDstEventCut& c) :StHbtEventCut(c) {
  30. mRefMult[0] = c.mRefMult[0];
  31. mRefMult[1] = c.mRefMult[1];
  32. mVtxX[0] = c.mVtxX[0];
  33. mVtxX[1] = c.mVtxX[1];
  34. mVtxY[0] = c.mVtxY[0];
  35. mVtxY[1] = c.mVtxY[1];
  36. mVtxZ[0] = c.mVtxZ[0];
  37. mVtxZ[1] = c.mVtxZ[1];
  38. mVtxR = c.mVtxR;
  39. mVzVpdVzDiff[0] = c.mVzVpdVzDiff[0];
  40. mVzVpdVzDiff[1] = c.mVzVpdVzDiff[1];
  41. mCollisionType = c.mCollisionType; //0-pp; 1-AuAu
  42. mNumberOfCentralityBins = c.mNumberOfCentralityBins;
  43. mCentralityBinRange[0] = c.mCentralityBinRange[0];
  44. mCentralityBinRange[1] = c.mCentralityBinRange[1];
  45. mVtxXShift = c.mVtxXShift;
  46. mVtxYShift = c.mVtxYShift;
  47. mNEventsPassed = 0;
  48. mNEventsFailed = 0;
  49. }
  50. //_________________
  51. gregsFemtoDstEventCut::~gregsFemtoDstEventCut() {
  52. /* no-op */
  53. }
  54. //_________________
  55. bool gregsFemtoDstEventCut::Pass(const StHbtEvent *event) {
  56. //added by gnigmat
  57. #ifdef STHBTDEBUG
  58. std::cout << "gregsFemtoDstEventCut::Pass" << std::endl;
  59. #endif
  60. int mult = event->RefMult();
  61. double vtxX = event->PrimVertPos().x();
  62. double vtxY = event->PrimVertPos().y();
  63. double vtxZ = event->PrimVertPos().z();
  64. double vtxXCorrected = vtxX - mVtxXShift;
  65. double vtxYCorrected = vtxY - mVtxYShift;
  66. double vtxR = TMath::Sqrt(vtxXCorrected * vtxXCorrected +
  67. vtxYCorrected * vtxYCorrected);
  68. float vzVpdVzDiff = vtxZ - event->VpdVz();
  69. int mCentBin;
  70. if(mCollisionType == 1) { //If Au+Au collisions
  71. if(mNumberOfCentralityBins == 9) {
  72. mCentBin = event->Cent9();
  73. }
  74. else if(mNumberOfCentralityBins == 16) {
  75. mCentBin = event->Cent16();
  76. }
  77. else {
  78. std::cout << "Wrong centrality definition: "
  79. << mNumberOfCentralityBins << std::endl;
  80. mCentBin = -1;
  81. }
  82. } //if(mCollisionType == 1)
  83. bool mGoodEvent = false;
  84. bool mGoodPrimVtx = false;
  85. bool mGoodRefMult = false;
  86. if(mCollisionType == 0) { // p+p collisions
  87. mGoodPrimVtx = ( (vtxXCorrected >= mVtxX[0]) &&
  88. (vtxXCorrected <= mVtxX[1]) &&
  89. (vtxYCorrected >= mVtxY[0]) &&
  90. (vtxYCorrected <= mVtxY[1]) &&
  91. (vtxZ >= mVtxZ[0]) && (vtxZ <= mVtxZ[1]) &&
  92. (vtxR <= mVtxR) &&
  93. (vzVpdVzDiff >= mVzVpdVzDiff[0]) &&
  94. (vzVpdVzDiff <= mVzVpdVzDiff[1]) );
  95. mGoodRefMult = ( (mult >= mRefMult[0]) && (mult<= mRefMult[1]) );
  96. }
  97. else { //Au+Au collisions
  98. mGoodPrimVtx = ( (vtxZ >= mVtxZ[0]) && (vtxZ <= mVtxZ[1]) &&
  99. (vtxR <= mVtxR) &&
  100. (vzVpdVzDiff >= mVzVpdVzDiff[0]) &&
  101. (vzVpdVzDiff <= mVzVpdVzDiff[1]) );
  102. mGoodRefMult = ( (mCentBin >= mCentralityBinRange[0]) &&
  103. (mCentBin <= mCentralityBinRange[1]) );
  104. }
  105. //Main decision
  106. if(mGoodPrimVtx && mGoodRefMult) {
  107. mGoodEvent = true;
  108. }
  109. else { //This is not needed but it's easy to check
  110. mGoodEvent = false;
  111. }
  112. mGoodEvent ? mNEventsPassed++ : mNEventsFailed++;
  113. return (mGoodEvent);
  114. }
  115. //_________________
  116. string gregsFemtoDstEventCut::Report() {
  117. stringstream rep_stream;
  118. if(mCollisionType==0) {
  119. rep_stream << mRefMult[0] << " <= Multiplicity <= " << mRefMult[1]
  120. << std::endl;
  121. }
  122. else {
  123. rep_stream << mCentralityBinRange[0] << " <= CentralityBin <= "
  124. << mCentralityBinRange[1] << std::endl;
  125. }
  126. rep_stream << mVtxX[0] << " <= VertexX <= " << mVtxX[1] << std::endl
  127. << mVtxY[0] << " <= VertexY <= " << mVtxY[1] << std::endl
  128. << mVtxZ[0] << " <= VertexZ <= " << mVtxZ[1] << std::endl
  129. << "VtxXShift: " << mVtxXShift << "\tVtxYShift: "
  130. << mVtxYShift << std::endl
  131. << "Vertex R <= " << mVtxR << std::endl
  132. << mVzVpdVzDiff[0] << " <= VpdVzDifference <= "
  133. << mVzVpdVzDiff[1] << std::endl
  134. << "Number of events passed: " << mNEventsPassed << std::endl
  135. << "Number of events failed: " << mNEventsFailed << std::endl;
  136. return ( rep_stream.str() );
  137. }