rotateToReactionPlaneEventCut.cxx 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /***************************************************************************
  2. *
  3. * $Id: rotateToReactionPlaneEventCut.cxx,v 1.2 2001/04/02 16:15:48 jeromel Exp $
  4. *
  5. * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
  6. ***************************************************************************
  7. *
  8. * Description: part of STAR HBT Framework: StHbtMaker package
  9. * A simple event-wise cut that selects on multiplicity and z-position
  10. * of primary vertex and rotates the event around the z-axis
  11. *
  12. ***************************************************************************
  13. *
  14. * $Log: rotateToReactionPlaneEventCut.cxx,v $
  15. * Revision 1.2 2001/04/02 16:15:48 jeromel
  16. * Type cast in sprintf() statement for bool conversion (insure++ issue)
  17. *
  18. * Revision 1.1 2000/05/25 21:47:28 laue
  19. * new event cut which can be used to rotate an event around the z-axis
  20. *
  21. *
  22. **************************************************************************/
  23. #include "StHbtMaker/Cut/rotateToReactionPlaneEventCut.h"
  24. #include "Randomize.h"
  25. #include "PhysicalConstants.h"
  26. #include "SystemOfUnits.h"
  27. #include <cstdio>
  28. #ifdef __ROOT__
  29. ClassImp(rotateToReactionPlaneEventCut)
  30. #endif
  31. rotateToReactionPlaneEventCut::rotateToReactionPlaneEventCut() : mRotation(true), mSmear(0) {
  32. mNEventsPassed = mNEventsFailed = 0;
  33. engine = new HepJamesRandom();
  34. gauss = new RandGauss(engine);
  35. }
  36. //------------------------------
  37. //rotateToReactionPlaneEventCut::~rotateToReactionPlaneEventCut(){
  38. // /* noop */
  39. //}
  40. //------------------------------
  41. bool rotateToReactionPlaneEventCut::Pass(const StHbtEvent* event){
  42. int mult;
  43. double VertexZPos;
  44. double angle;
  45. bool goodEvent = true;
  46. if ( event->TrackCollection()->size() + event->V0Collection()->size() > 0 ) {
  47. mult = event->NumberOfTracks();
  48. VertexZPos = event->PrimVertPos().z();
  49. goodEvent =
  50. ((mult > mEventMult[0]) &&
  51. (mult < mEventMult[1]) &&
  52. (VertexZPos > mVertZPos[0]) &&
  53. (VertexZPos < mVertZPos[1]));
  54. if (goodEvent && mRotation ) {
  55. angle = gauss->shoot()*mSmear*2.*pi; // gaussian
  56. ((StHbtEvent*)event)->RotateZ(-1.* event->ReactionPlane() + angle);
  57. }
  58. goodEvent ? mNEventsPassed++ : mNEventsFailed++ ;
  59. }
  60. return (goodEvent);
  61. }
  62. //------------------------------
  63. StHbtString rotateToReactionPlaneEventCut::Report(){
  64. string Stemp="";
  65. char Ctemp[100];
  66. sprintf(Ctemp,"rotateToReactionPlaneEventCut: ");
  67. Stemp += Ctemp;
  68. sprintf(Ctemp,"\n Rotation :\t %d",(int) mRotation);
  69. Stemp += Ctemp;
  70. sprintf(Ctemp,"\n Multiplicity:\t %d-%d",mEventMult[0],mEventMult[1]);
  71. Stemp += Ctemp;
  72. sprintf(Ctemp,"\n Vertex Z-position:\t %E-%E",mVertZPos[0],mVertZPos[1]);
  73. Stemp += Ctemp;
  74. sprintf(Ctemp,"\n Number of events which passed:\t%ld Number which failed:\t%ld",mNEventsPassed,mNEventsFailed);
  75. Stemp += Ctemp;
  76. StHbtString returnThis = Stemp;
  77. return returnThis;
  78. }