StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
randomRotateEventCut.cxx
1 /***************************************************************************
2  *
3  * $Id: randomRotateEventCut.cxx,v 1.2 2001/04/02 16:16:34 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: randomRotateEventCut.cxx,v $
15  * Revision 1.2 2001/04/02 16:16:34 jeromel
16  * Type cast in sprintf() statement for bool conversion (insure++ issue)
17  *
18  * Revision 1.1 2000/05/25 21:47:27 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/randomRotateEventCut.h"
25 #include "Randomize.h"
26 #include "PhysicalConstants.h"
27 #include "SystemOfUnits.h"
28 
29 #include <cstdio>
30 
31 #ifdef __ROOT__
32 ClassImp(randomRotateEventCut)
33 #endif
34 
35 randomRotateEventCut::randomRotateEventCut() : mRotation(true) {
36  mNEventsPassed = mNEventsFailed = 0;
37  engine = new HepRandom();
38 }
39 //------------------------------
40 //randomRotateEventCut::~randomRotateEventCut(){
41 // /* noop */
42 //}
43 //------------------------------
44 bool randomRotateEventCut::Pass(const StHbtEvent* event){
45  int mult;
46  double VertexZPos;
47  double angle;
48  bool goodEvent = true;
49 
50  if ( event->TrackCollection()->size() + event->V0Collection()->size() > 0 ) {
51  mult = event->NumberOfTracks();
52  VertexZPos = event->PrimVertPos().z();
53  goodEvent =
54  ((mult > mEventMult[0]) &&
55  (mult < mEventMult[1]) &&
56  (VertexZPos > mVertZPos[0]) &&
57  (VertexZPos < mVertZPos[1]));
58 
59  if (goodEvent && mRotation ) {
60  angle = engine->flat()*2.*pi;
61  ((StHbtEvent*)event)->RotateZ(angle);
62  }
63  goodEvent ? mNEventsPassed++ : mNEventsFailed++ ;
64  }
65  return (goodEvent);
66 }
67 //------------------------------
68 StHbtString randomRotateEventCut::Report(){
69  string Stemp="";
70  char Ctemp[100];
71  sprintf(Ctemp,"\n randomRotateEventCut:");
72  Stemp += Ctemp;
73  sprintf(Ctemp,"\n Rotation :\t %d",(int) mRotation);
74  Stemp += Ctemp;
75  sprintf(Ctemp,"\n Multiplicity:\t %d-%d",mEventMult[0],mEventMult[1]);
76  Stemp += Ctemp;
77  sprintf(Ctemp,"\n Vertex Z-position:\t %E-%E",mVertZPos[0],mVertZPos[1]);
78  Stemp += Ctemp;
79  sprintf(Ctemp,"\n Number of events which passed:\t%ld Number which failed:\t%ld",mNEventsPassed,mNEventsFailed);
80  Stemp += Ctemp;
81  StHbtString returnThis = Stemp;
82  return returnThis;
83 }