calculateEventPlaneEventCut.cxx 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /***************************************************************************
  2. *
  3. * $Id: calculateEventPlaneEventCut.cxx,v 1.7 2004/02/20 20:30:45 magestro Exp $
  4. *
  5. * Author: Randall Wells, Ohio State, rcwells@mps.ohio-state.edu
  6. ***************************************************************************
  7. *
  8. * Description: Passes HbtEvent to FlowMaker to calculate the event
  9. * plane. Warning ... this will change event charateristics!
  10. *
  11. ***************************************************************************
  12. *
  13. * $Log: calculateEventPlaneEventCut.cxx,v $
  14. * Revision 1.7 2004/02/20 20:30:45 magestro
  15. * Added Vz, multiplicity event cuts
  16. *
  17. * Revision 1.6 2003/08/05 00:29:55 perev
  18. * warnOff
  19. *
  20. * Revision 1.5 2003/08/04 20:21:27 perev
  21. * warnOff
  22. *
  23. * Revision 1.4 2001/11/14 21:07:19 lisa
  24. * Fixed several small things (mostly discarded const) that caused fatal errors with gcc2.95.3
  25. *
  26. * Revision 1.3 2001/07/22 19:57:05 rcwells
  27. * Fixed switch in calculateEventPlaneEventCut
  28. *
  29. * Revision 1.2 2001/07/21 12:04:28 rcwells
  30. * Only calls FlowAnalysis if using HbtEvent
  31. *
  32. * Revision 1.1 2001/07/20 20:03:50 rcwells
  33. * Added pT weighting and moved event angle cal. to event cut
  34. *
  35. *
  36. **************************************************************************/
  37. #include "StHbtMaker/Cut/calculateEventPlaneEventCut.h"
  38. #include <cstdio>
  39. #include "StFlowMaker/StFlowMaker.h"
  40. #include "StFlowMaker/StFlowEvent.h"
  41. #include "StFlowAnalysisMaker/StFlowAnalysisMaker.h"
  42. #include "StFlowMaker/StFlowSelection.h"
  43. #ifdef __ROOT__
  44. ClassImp(calculateEventPlaneEventCut)
  45. #endif
  46. calculateEventPlaneEventCut::calculateEventPlaneEventCut(){
  47. mFlowMaker = 0;
  48. mFlowAnalysisMaker = 0;
  49. mFromHBT = 0;
  50. mNEventsPassed = mNEventsFailed = 0;
  51. mVertZPos[0] = -1.e4;
  52. mVertZPos[1] = 1.e4;
  53. mEventMult[0] = 0;
  54. mEventMult[1] = 9999;
  55. }
  56. //------------------------------
  57. //calculateEventPlaneEventCut::~calculateEventPlaneEventCut(){
  58. // /* noop */
  59. //}
  60. //------------------------------
  61. bool calculateEventPlaneEventCut::Pass(const StHbtEvent* ConstantEventIn){
  62. /* this next line makes it explicit that we are PURPOSELY ignoring the
  63. "const" nature of the StHbtEvent for this special case - mike lisa 14nov01
  64. */
  65. StHbtEvent* event = (StHbtEvent*)ConstantEventIn;
  66. bool goodEvent = false;
  67. if(event) {
  68. double VertexZPos = event->PrimVertPos().z();
  69. goodEvent = ( (VertexZPos >= mVertZPos[0]) && (VertexZPos <= mVertZPos[1]) );
  70. // cout << "eventCut:: VertexZPos: " << mVertZPos[0] << " < " << VertexZPos << " < " << mVertZPos[1] << endl;
  71. if (goodEvent) {
  72. int mult = event->UncorrectedNumberOfPrimaries();
  73. goodEvent = (goodEvent && (mult >= mEventMult[0]) && (mult <= mEventMult[1]));
  74. // cout << "eventCut:: mult: " << mEventMult[0] << " < " << mult << " < " << mEventMult[1] << endl;
  75. }
  76. if (goodEvent && mFlowMaker) {
  77. if (mFromHBT) mFlowMaker->FillFlowEvent(event);
  78. if (mFlowMaker->FlowEventPointer()) {
  79. StFlowEvent::SetPtWgt(false);
  80. // First get RP for whole event
  81. mFlowMaker->FlowSelection()->SetSubevent(-1);
  82. double reactionPlane = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
  83. cout << "Reaction Plane " << reactionPlane << endl;
  84. event->SetReactionPlane(reactionPlane,0);
  85. // Sub event RPs
  86. mFlowMaker->FlowSelection()->SetSubevent(0);
  87. double RP1 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
  88. mFlowMaker->FlowSelection()->SetSubevent(1);
  89. double RP2 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
  90. event->SetReactionPlaneSubEventDifference(RP1-RP2,0);
  91. // Now with Pt Weighting
  92. StFlowEvent::SetPtWgt(true);
  93. // First get RP for whole event
  94. mFlowMaker->FlowSelection()->SetSubevent(-1);
  95. reactionPlane = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
  96. cout << "Reaction Plane ptWgt " << reactionPlane << endl;
  97. event->SetReactionPlane(reactionPlane,1);
  98. // Sub event RPs
  99. mFlowMaker->FlowSelection()->SetSubevent(0);
  100. RP1 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
  101. mFlowMaker->FlowSelection()->SetSubevent(1);
  102. RP2 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
  103. event->SetReactionPlaneSubEventDifference(RP1-RP2,1);
  104. // if Flow Analysis is switched on ... make correction histogram
  105. if (mFlowAnalysisMaker) mFlowAnalysisMaker->Make();
  106. }
  107. else {
  108. cout << "No flow event found" << endl;
  109. event->SetReactionPlane(-999,0);
  110. event->SetReactionPlane(-999,1);
  111. event->SetReactionPlaneSubEventDifference(-999,0);
  112. event->SetReactionPlaneSubEventDifference(-999,1);
  113. }
  114. }
  115. }
  116. else {
  117. cout << "Something wrong with HbtEvent" << endl;
  118. event->SetReactionPlane(-99,0);
  119. event->SetReactionPlane(-99,1);
  120. event->SetReactionPlaneSubEventDifference(-99,0);
  121. event->SetReactionPlaneSubEventDifference(-99,1);
  122. }
  123. goodEvent ? mNEventsPassed++ : mNEventsFailed++ ;
  124. return (goodEvent);
  125. }
  126. //------------------------------
  127. StHbtString calculateEventPlaneEventCut::Report(){
  128. string Stemp;
  129. char Ctemp[100];
  130. sprintf(Ctemp,"\nNumber of events which passed:\t%ld Number which failed:\t%ld",mNEventsPassed,mNEventsFailed);
  131. Stemp += Ctemp;
  132. StHbtString returnThis = Stemp;
  133. return returnThis;
  134. }