StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
franksV0Cut.cxx
1 /***************************************************************************
2  *
3  * $Id: franksV0Cut.cxx,v 1.2 2003/09/02 17:58:21 perev Exp $
4  *
5  * Authors: Frank Laue, Ohio State, laue@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * a V0 particle cut that selects on phasespace, particle type, etc..
10  *
11  ***************************************************************************
12  *
13  * $Log: franksV0Cut.cxx,v $
14  * Revision 1.2 2003/09/02 17:58:21 perev
15  * gcc 3.2 updates + WarnOff
16  *
17  * Revision 1.1 2000/08/28 22:32:04 laue
18  * NEW: a V0 cut that allows to reject V0 pairs with share a track
19  *
20  *
21  **************************************************************************/
22 
23 #include "StHbtMaker/Cut/franksV0Cut.h"
24 #include "StarClassLibrary/SystemOfUnits.h"
25 #include <cstdio>
26 
27 #ifdef __ROOT__
28 ClassImp(franksV0Cut)
29 #endif
30 
31 
32 franksV0Cut::franksV0Cut() : mNV0sPassed(0), mNV0sFailed(0) {
33 
34 }
35 //------------------------------
36 //franksV0Cut::~franksV0Cut(){
37 // /* noop */
38 //}
39 //------------------------------
40 
41 void franksV0Cut::EventBegin(const StHbtEvent* ev) {
42  mPrimaryVertex = ev->PrimVertPos();
43 }
44 
45 
46 
47 bool franksV0Cut::Pass(const StHbtV0* V0){
48  double degree=3.1415927/180.;
49  int inMassRange;
50 
51 #ifdef STHBTDEBUG
52  cout << endl;
53  cout << " v0 " << V0 << endl;
54  cout << " * dcaV0Daughters " << V0->dcaV0Daughters();
55  cout << " * dcaV0ToPrimVertex " << V0->dcaV0ToPrimVertex();
56  cout << " * pV0ToPrimVertexAngle " << V0->pV0ToPrimVertexAngle();
57  cout << " * decayLengthV0 " << V0->decayLengthV0();
58  cout << " * tpcHitsPos " << V0->tpcHitsPos();
59  cout << " * tpcHitsNeg " << V0->tpcHitsNeg();
60  cout << " * dcaPosToPrimVertex " << V0->dcaPosToPrimVertex();
61  cout << " * dcaNegToPrimVertex " << V0->dcaNegToPrimVertex();
62  cout << " * ptArmV0 " << V0->ptArmV0();
63  cout << " * alphaV0 " << V0->alphaV0();
64 #endif
65 
66 
67  inMassRange=0;
68  // Find out what particle is desired
69 
70  if( strstr(V0Type,"k") || strstr(V0Type,"K")){
71  if( V0->massK0Short() < (mMass+mV0MassRange[1]) &&
72  V0->massK0Short() > (mMass+mV0MassRange[0]) ) inMassRange=1;
73  }
74  else if( (strstr(V0Type,"anti") || strstr(V0Type,"ANTI"))){
75  if( V0->massAntiLambda() < (mMass+mV0MassRange[1]) &&
76  V0->massAntiLambda() > (mMass+mV0MassRange[0]) ) inMassRange=1;
77  }
78  else if( (strstr(V0Type,"ambda") || strstr(V0Type,"AMBDA"))){
79  if( V0->massLambda() < (mMass+mV0MassRange[1]) &&
80  V0->massLambda() > (mMass+mV0MassRange[0]) ) inMassRange=1;
81  }
82 
83 #ifdef STHBTDEBUG
84  cout << " inMassRange " << inMassRange << endl;
85 #endif
86 
87  double angle = (V0->decayVertexV0() - mPrimaryVertex).angle(V0->momV0()) / degree;
88 #ifdef STHBTDEBUG
89  cout << " decayVertexV0 " << V0->decayVertexV0() << endl;
90  cout << " mPrimaryVertex " << mPrimaryVertex << endl;
91  cout << " angle " << angle << endl;
92 #endif
93 
94  bool goodPID = ( inMassRange &&
95  (V0->dcaV0Daughters() > mdcaV0daughters[0]) &&
96  (V0->dcaV0Daughters() < mdcaV0daughters[1]) &&
97  (V0->dcaV0ToPrimVertex() > mdcaV0ToPrimVertex[0]) &&
98  (V0->dcaV0ToPrimVertex() < mdcaV0ToPrimVertex[1]) &&
99  (angle > mpV0ToPrimVertexAngle[0]) &&
100  (angle < mpV0ToPrimVertexAngle[1]) &&
101  (V0->decayLengthV0() > mdecayLengthV0[0]) &&
102  (V0->decayLengthV0() < mdecayLengthV0[1]) &&
103  (V0->tpcHitsPos() > mtpcHitsPos[0]) &&
104  (V0->tpcHitsPos() < mtpcHitsPos[1]) &&
105  (V0->tpcHitsNeg() > mtpcHitsNeg[0]) &&
106  (V0->tpcHitsNeg() < mtpcHitsNeg[1]) &&
107  (V0->dcaPosToPrimVertex() > mdcaPosToPrimVertex[0]) &&
108  (V0->dcaPosToPrimVertex() < mdcaPosToPrimVertex[1]) &&
109  (V0->dcaNegToPrimVertex() > mdcaNegToPrimVertex[0]) &&
110  (V0->dcaNegToPrimVertex() < mdcaNegToPrimVertex[1]) &&
111  (V0->ptArmV0() > mptArmV0[0]) &&
112  (V0->ptArmV0() < mptArmV0[1]) &&
113  (V0->alphaV0() > malphaV0[0]) &&
114  (V0->alphaV0() < malphaV0[1]));
115 
116 
117 #ifdef STHBTDEBUG
118  cout << " goodPID " << goodPID << endl;
119 #endif
120 
121  if (goodPID){
122 #ifdef STHBTDEBUG
123  cout << "now calculate rapidity" << endl;
124 #endif
125  float TEnergy = ::sqrt((V0->ptotV0())*(V0->ptotV0())+mMass*mMass);
126  float TRapidity = 0.5*::log((TEnergy+V0->momV0().z())/
127  (TEnergy-V0->momV0().z()));
128  float Pt = V0->ptV0();
129 
130 
131 
132 #ifdef STHBTDEBUG
133  cout << " * Pt " << Pt;
134  cout << " * mPt[0] " << mPt[0];
135  cout << " * mPt[1] " << mPt[1];
136  cout << " * TRapidity " << TRapidity;
137  cout << " * mRapidity[0] " << mRapidity[0];
138  cout << " * mRapidity[1] " << mRapidity[1];
139  cout << " * Pt " << (Pt > mPt[0]) && (Pt < mPt[1]);
140  cout << " * y " << (TRapidity > mRapidity[0]) && (TRapidity < mRapidity[1]);
141  cout << endl;
142 #endif
143 
144  bool goodV0=
145  ((Pt > mPt[0]) &&
146  (Pt < mPt[1]) &&
147  (TRapidity > mRapidity[0]) &&
148  (TRapidity < mRapidity[1]));
149 
150  goodV0 ? mNV0sPassed++ : mNV0sFailed++;
151  return (goodV0);
152  }
153  else{
154  mNV0sFailed++;
155  return (goodPID);
156  }
157 }
158 //------------------------------
159 StHbtString franksV0Cut::Report(){
160  string Stemp;
161  char Ctemp[100];
162  sprintf(Ctemp,"--franksV0Cut--\n Particle mass:\t%E\n",this->Mass());
163  Stemp=Ctemp;
164  sprintf(Ctemp,"dcaV0daughters:\t%E - %E\n",mdcaV0daughters[0],
165 mdcaV0daughters[1]);
166  Stemp+=Ctemp;
167  sprintf(Ctemp,"dcaV0ToPrimVertex:\t%E - %E\n",mdcaV0ToPrimVertex[0],
168 mdcaV0ToPrimVertex[1]);
169  Stemp+=Ctemp;
170  sprintf(Ctemp,"pV0ToPrimVertexAngle:\t%E - %E\n",mpV0ToPrimVertexAngle[0],mpV0ToPrimVertexAngle[1]);
171  Stemp+=Ctemp;
172  sprintf(Ctemp,"decayLengthV0:\t%E - %E\n",mdecayLengthV0[0],
173 mdecayLengthV0[1]);
174  Stemp+=Ctemp;
175  sprintf(Ctemp,"tpcHitsPos:\t%d - %d\n",mtpcHitsPos[0],mtpcHitsPos[1]);
176  Stemp+=Ctemp;
177  sprintf(Ctemp,"tpcHitsNeg:\t%d - %d\n",mtpcHitsNeg[0],mtpcHitsNeg[1]);
178  Stemp+=Ctemp;
179  sprintf(Ctemp,"dcaPosToPrimVertex:\t%E - %E\n",mdcaPosToPrimVertex[0],
180 mdcaPosToPrimVertex[1]);
181  Stemp+=Ctemp;
182  sprintf(Ctemp,"dcaNegToPrimVertex:\t%E - %E\n",mdcaNegToPrimVertex[0],
183 mdcaNegToPrimVertex[1]);
184  Stemp+=Ctemp;
185  sprintf(Ctemp,"ptArmV0:\t%E - %E\n",mptArmV0[0],mptArmV0[1]);
186  Stemp+=Ctemp;
187  sprintf(Ctemp,"alphaV0:\t%E - %E\n",malphaV0[0],malphaV0[1]);
188  Stemp+=Ctemp;
189  sprintf(Ctemp,"Particle pT:\t%E - %E\n",mPt[0],mPt[1]);
190  Stemp+=Ctemp;
191  sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",mRapidity[0],mRapidity[1]);
192  Stemp+=Ctemp;
193  sprintf(Ctemp,"Number of V0s which passed:\t%ld Number which failed:\t%ld\n",mNV0sPassed,mNV0sFailed);
194  Stemp += Ctemp;
195  StHbtString returnThis = Stemp;
196  return returnThis;
197 }