ParityEventCut.cxx 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /***************************************************************************
  2. *
  3. * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
  4. ***************************************************************************
  5. *
  6. * Description: part of STAR HBT Framework: StHbtMaker package
  7. * This cut is for the Parity Violation studies.
  8. * It is different from the other Event Cuts in that it interacts with
  9. * the correlation function. In the parity violation study, we want a
  10. * number associated with EVENTS, not PAIRS. Thus, this cut has a pair of
  11. * histograms associated with it, one for real and one for mixed events.
  12. * The AddRealPair() and AddMixedPair() methods of the correlation function
  13. * have access to two data members of this EventCut class.
  14. *
  15. ***************************************************************************
  16. *
  17. **************************************************************************/
  18. #include "StHbtMaker/Cut/ParityEventCut.h"
  19. #include <cstdio>
  20. #ifdef __ROOT__
  21. ClassImp(ParityEventCut)
  22. #endif
  23. ParityEventCut::ParityEventCut(const char* title, const int& nbins, const float& Lo, const float& Hi){
  24. mNEventsPassed = mNEventsFailed = 0;
  25. RealQuantity = MixedQuantity = 0.0;
  26. nReals = nMixed = 0;
  27. char Tit[100];
  28. sprintf(Tit,"Real Events");
  29. strcat(Tit,title);
  30. mReals = new StHbt1DHisto(Tit,title,nbins,Lo,Hi);
  31. sprintf(Tit,"Mixed Events");
  32. strcat(Tit,title);
  33. mMixed = new StHbt1DHisto(Tit,title,nbins,Lo,Hi);
  34. }
  35. //------------------------------
  36. ParityEventCut::~ParityEventCut(){
  37. delete mReals;
  38. delete mMixed;
  39. }
  40. //------------------------------
  41. bool ParityEventCut::Pass(const StHbtEvent* event){
  42. if (nReals>0){ // fill the Reals histo
  43. double temp = RealQuantity / nReals;
  44. mReals->Fill(temp);
  45. cout << "Real value was " << temp << " with " << nReals << " pairs" << endl;
  46. RealQuantity = 0.0;
  47. nReals = 0;
  48. }
  49. if (nMixed>0){ // fill the Mixed histo
  50. double temp = MixedQuantity / nMixed;
  51. mMixed->Fill(temp);
  52. cout << "Mixed value was " << temp << " with " << nMixed << " pairs" << endl;
  53. MixedQuantity = 0.0;
  54. nMixed = 0;
  55. }
  56. int mult = event->NumberOfTracks();
  57. double VertexZPos = event->PrimVertPos().z();
  58. cout << "ParityEventCut::Pass -- mult, VertexZPos : " << mult << " " << VertexZPos << endl;
  59. bool goodEvent =
  60. ((mult > mEventMult[0]) &&
  61. (mult < mEventMult[1]) &&
  62. (VertexZPos > mVertZPos[0]) &&
  63. (VertexZPos < mVertZPos[1]));
  64. goodEvent ? mNEventsPassed++ : mNEventsFailed++ ;
  65. return (goodEvent);
  66. }
  67. //------------------------------
  68. StHbtString ParityEventCut::Report(){
  69. string Stemp;
  70. char Ctemp[100];
  71. sprintf(Ctemp,"Parity EventCut\nMultiplicity:\t %d-%d\n",mEventMult[0],mEventMult[1]);
  72. Stemp = Ctemp;
  73. sprintf(Ctemp,"Vertex Z-position:\t %E-%E\n",mVertZPos[0],mVertZPos[1]);
  74. Stemp += Ctemp;
  75. sprintf(Ctemp,"Number of events which passed:\t%ld Number which failed:\t%ld\n",mNEventsPassed,mNEventsFailed);
  76. Stemp += Ctemp;
  77. StHbtString returnThis = Stemp;
  78. return returnThis;
  79. }