StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
calculateEventPlaneEventCut.cxx
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 
38 #include "StHbtMaker/Cut/calculateEventPlaneEventCut.h"
39 #include <cstdio>
40 #include "StFlowMaker/StFlowMaker.h"
41 #include "StFlowMaker/StFlowEvent.h"
42 #include "StFlowAnalysisMaker/StFlowAnalysisMaker.h"
43 #include "StFlowMaker/StFlowSelection.h"
44 
45 #ifdef __ROOT__
47 #endif
48 
49 calculateEventPlaneEventCut::calculateEventPlaneEventCut(){
50  mFlowMaker = 0;
51  mFlowAnalysisMaker = 0;
52  mFromHBT = 0;
53  mNEventsPassed = mNEventsFailed = 0;
54 
55  mVertZPos[0] = -1.e4;
56  mVertZPos[1] = 1.e4;
57  mEventMult[0] = 0;
58  mEventMult[1] = 9999;
59 
60 }
61 //------------------------------
62 //calculateEventPlaneEventCut::~calculateEventPlaneEventCut(){
63 // /* noop */
64 //}
65 //------------------------------
66 bool calculateEventPlaneEventCut::Pass(const StHbtEvent* ConstantEventIn){
67 
68  /* this next line makes it explicit that we are PURPOSELY ignoring the
69  "const" nature of the StHbtEvent for this special case - mike lisa 14nov01
70  */
71  StHbtEvent* event = (StHbtEvent*)ConstantEventIn;
72 
73  bool goodEvent = false;
74 
75  if(event) {
76 
77  double VertexZPos = event->PrimVertPos().z();
78  goodEvent = ( (VertexZPos >= mVertZPos[0]) && (VertexZPos <= mVertZPos[1]) );
79  // cout << "eventCut:: VertexZPos: " << mVertZPos[0] << " < " << VertexZPos << " < " << mVertZPos[1] << endl;
80 
81  if (goodEvent) {
82  int mult = event->UncorrectedNumberOfPrimaries();
83  goodEvent = (goodEvent && (mult >= mEventMult[0]) && (mult <= mEventMult[1]));
84  // cout << "eventCut:: mult: " << mEventMult[0] << " < " << mult << " < " << mEventMult[1] << endl;
85  }
86 
87  if (goodEvent && mFlowMaker) {
88  if (mFromHBT) mFlowMaker->FillFlowEvent(event);
89  if (mFlowMaker->FlowEventPointer()) {
90  StFlowEvent::SetPtWgt(false);
91  // First get RP for whole event
92  mFlowMaker->FlowSelection()->SetSubevent(-1);
93  double reactionPlane = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
94  cout << "Reaction Plane " << reactionPlane << endl;
95  event->SetReactionPlane(reactionPlane,0);
96  // Sub event RPs
97  mFlowMaker->FlowSelection()->SetSubevent(0);
98  double RP1 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
99  mFlowMaker->FlowSelection()->SetSubevent(1);
100  double RP2 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
101  event->SetReactionPlaneSubEventDifference(RP1-RP2,0);
102  // Now with Pt Weighting
103  StFlowEvent::SetPtWgt(true);
104  // First get RP for whole event
105  mFlowMaker->FlowSelection()->SetSubevent(-1);
106  reactionPlane = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
107  cout << "Reaction Plane ptWgt " << reactionPlane << endl;
108  event->SetReactionPlane(reactionPlane,1);
109  // Sub event RPs
110  mFlowMaker->FlowSelection()->SetSubevent(0);
111  RP1 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
112  mFlowMaker->FlowSelection()->SetSubevent(1);
113  RP2 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
114  event->SetReactionPlaneSubEventDifference(RP1-RP2,1);
115  // if Flow Analysis is switched on ... make correction histogram
116  if (mFlowAnalysisMaker) mFlowAnalysisMaker->Make();
117  }
118  else {
119  cout << "No flow event found" << endl;
120  event->SetReactionPlane(-999,0);
121  event->SetReactionPlane(-999,1);
122  event->SetReactionPlaneSubEventDifference(-999,0);
123  event->SetReactionPlaneSubEventDifference(-999,1);
124  }
125  }
126  }
127  else {
128  cout << "Something wrong with HbtEvent" << endl;
129  event->SetReactionPlane(-99,0);
130  event->SetReactionPlane(-99,1);
131  event->SetReactionPlaneSubEventDifference(-99,0);
132  event->SetReactionPlaneSubEventDifference(-99,1);
133  }
134  goodEvent ? mNEventsPassed++ : mNEventsFailed++ ;
135  return (goodEvent);
136 }
137 //------------------------------
138 StHbtString calculateEventPlaneEventCut::Report(){
139  string Stemp;
140  char Ctemp[100];
141  sprintf(Ctemp,"\nNumber of events which passed:\t%ld Number which failed:\t%ld",mNEventsPassed,mNEventsFailed);
142  Stemp += Ctemp;
143  StHbtString returnThis = Stemp;
144  return returnThis;
145 }
146