StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rotateToReactionPlaneEventCut.cxx
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 
24 #include "StHbtMaker/Cut/rotateToReactionPlaneEventCut.h"
25 #include "Randomize.h"
26 #include "PhysicalConstants.h"
27 #include "SystemOfUnits.h"
28 
29 #include <cstdio>
30 
31 #ifdef __ROOT__
33 #endif
34 
35 rotateToReactionPlaneEventCut::rotateToReactionPlaneEventCut() : mRotation(true), mSmear(0) {
36  mNEventsPassed = mNEventsFailed = 0;
37  engine = new HepJamesRandom();
38  gauss = new RandGauss(engine);
39 }
40 //------------------------------
41 //rotateToReactionPlaneEventCut::~rotateToReactionPlaneEventCut(){
42 // /* noop */
43 //}
44 //------------------------------
45 bool rotateToReactionPlaneEventCut::Pass(const StHbtEvent* event){
46  int mult;
47  double VertexZPos;
48  double angle;
49  bool goodEvent = true;
50 
51  if ( event->TrackCollection()->size() + event->V0Collection()->size() > 0 ) {
52  mult = event->NumberOfTracks();
53  VertexZPos = event->PrimVertPos().z();
54  goodEvent =
55  ((mult > mEventMult[0]) &&
56  (mult < mEventMult[1]) &&
57  (VertexZPos > mVertZPos[0]) &&
58  (VertexZPos < mVertZPos[1]));
59 
60  if (goodEvent && mRotation ) {
61  angle = gauss->shoot()*mSmear*2.*pi; // gaussian
62  ((StHbtEvent*)event)->RotateZ(-1.* event->ReactionPlane() + angle);
63  }
64  goodEvent ? mNEventsPassed++ : mNEventsFailed++ ;
65  }
66 
67  return (goodEvent);
68 }
69 //------------------------------
70 StHbtString rotateToReactionPlaneEventCut::Report(){
71  string Stemp="";
72  char Ctemp[100];
73  sprintf(Ctemp,"rotateToReactionPlaneEventCut: ");
74  Stemp += Ctemp;
75  sprintf(Ctemp,"\n Rotation :\t %d",(int) mRotation);
76  Stemp += Ctemp;
77  sprintf(Ctemp,"\n Multiplicity:\t %d-%d",mEventMult[0],mEventMult[1]);
78  Stemp += Ctemp;
79  sprintf(Ctemp,"\n Vertex Z-position:\t %E-%E",mVertZPos[0],mVertZPos[1]);
80  Stemp += Ctemp;
81  sprintf(Ctemp,"\n Number of events which passed:\t%ld Number which failed:\t%ld",mNEventsPassed,mNEventsFailed);
82  Stemp += Ctemp;
83  StHbtString returnThis = Stemp;
84  return returnThis;
85 }