StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
helensV0Cut.cxx
1 /***************************************************************************
2  *
3  * $Id: helensV0Cut.cxx,v 1.11 2003/09/02 17:58:21 perev Exp $
4  *
5  * Authors: Helen Caines, Tom Humanic, Ohio State, humanic@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: helensV0Cut.cxx,v $
14  * Revision 1.11 2003/09/02 17:58:21 perev
15  * gcc 3.2 updates + WarnOff
16  *
17  * Revision 1.10 2001/09/28 20:41:19 lisa
18  * fixes to V0 object and cut
19  *
20  * Revision 1.9 2000/10/09 21:56:16 laue
21  * Helens new cuts
22  *
23  * Revision 1.7 2000/03/17 17:22:53 laue
24  * Roberts new three particle correlations implemented.
25  *
26  * Revision 1.6 2000/03/16 01:57:17 laue
27  * Copy constructor added to some cuts
28  *
29  * Revision 1.5 2000/02/11 18:02:26 laue
30  * Debug output removed
31  *
32  * Revision 1.4 2000/02/01 00:31:27 laue
33  * *** empty log message ***
34  *
35  * Revision 1.3 2000/01/25 17:35:02 laue
36  * I. In order to run the stand alone version of the StHbtMaker the following
37  * changes have been done:
38  * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
39  * b) unnecessary includes of StMaker.h have been removed
40  * c) the subdirectory StHbtMaker/doc/Make has been created including everything
41  * needed for the stand alone version
42  *
43  * II. To reduce the amount of compiler warning
44  * a) some variables have been type casted
45  * b) some destructors have been declared as virtual
46  *
47  * Revision 1.2 1999/10/05 11:37:38 lisa
48  * Helens realistic V0Cut and Franks memory-sealed McReader
49  *
50  * Revision 1.1 1999/09/23 23:28:03 lisa
51  * add helensV0Cut AND rename mikes and franks ParticleCuts to TrackCuts AND update documentation
52  *
53  *
54  **************************************************************************/
55 
56 #include "StHbtMaker/Cut/helensV0Cut.h"
57 #include <cstdio>
58 
59 #ifdef __ROOT__
60 ClassImp(helensV0Cut)
61 #endif
62 
63 
64 helensV0Cut::helensV0Cut(){
65  mNV0sPassed = mNV0sFailed = 0;
66 
67  mV0MassRange[0] =0;
68  mV0MassRange[1]=10000;
69 
70  mdcaV0daughters[0]=0;
71  mdcaV0daughters[1]=1000;
72 
73  mdcaV0ToPrimVertex[0]=0;
74  mdcaV0ToPrimVertex[1]=1000;
75 
76  mdecayLengthV0[0]=0;
77  mdecayLengthV0[1]=10000;
78 
79  mtpcHitsPos[0]=0;
80  mtpcHitsPos[1]=1000;
81 
82  mtpcHitsNeg[0]=0;
83  mtpcHitsNeg[1]=1000;
84 
85 
86  mdcaPosToPrimVertex[0]=0;
87  mdcaPosToPrimVertex[1]=1000;
88 
89  mdcaNegToPrimVertex[0]=0;
90  mdcaNegToPrimVertex[1]=10000;
91 
92  mptArmV0[0]=0;
93  mptArmV0[1]=100;
94 
95  malphaV0[0]=-10;
96  malphaV0[1]=10;
97 
98  mChargedEdx=0;
99  mdEdx[0]=0;
100  mdEdx[1]=-10;
101  mdEdx[2]=0;
102  mdEdx[3]=-10;
103 
104  mPt[0]=0;
105  mPt[1]=100000;
106 
107  mRapidity[0]=-100000;
108  mRapidity[1]=100000;
109 
110  V0Type = "K0Short";
111  mMass = 0.498;
112 
113 
114 }
115 //------------------------------
116 //helensV0Cut::~helensV0Cut(){
117 // /* noop */
118 //}
119 //------------------------------
120 bool helensV0Cut::Pass(const StHbtV0* V0){
121  int inMassRange;
122 
123 #ifdef STHBTDEBUG
124  cout << endl;
125  cout << " * dcaV0Daughters " << V0->dcaV0Daughters();
126  cout << " * dcaV0ToPrimVertex " << V0->dcaV0ToPrimVertex();
127  cout << " * decayLengthV0 " << V0->decayLengthV0();
128  cout << " * tpcHitsPos " << V0->tpcHitsPos();
129  cout << " * tpcHitsNeg " << V0->tpcHitsNeg();
130  cout << " * dcaPosToPrimVertex " << V0->dcaPosToPrimVertex();
131  cout << " * dcaNegToPrimVertex " << V0->dcaNegToPrimVertex();
132  cout << " * ptArmV0 " << V0->ptArmV0();
133  cout << " * alphaV0 " << V0->alphaV0();
134  cout << " * dEdxPos " << V0->dedxPos();
135  cout << " * dEdxNeg " << V0->dedxNeg();
136  cout << endl;
137 #endif
138 
139 
140  inMassRange=0;
141  // Find out what particle is desired
142 
143  if( strstr(V0Type,"k") || strstr(V0Type,"K")){
144  if( V0->massK0Short() < (mV0MassRange[1]) &&
145  V0->massK0Short() > (mV0MassRange[0]) ) inMassRange=1;
146  }
147  else if( (strstr(V0Type,"anti") || strstr(V0Type,"ANTI"))){
148  if( V0->massAntiLambda() < (mV0MassRange[1]) &&
149  V0->massAntiLambda() > (mV0MassRange[0]) ) inMassRange=1;
150  }
151  else if( (strstr(V0Type,"ambda") || strstr(V0Type,"AMBDA"))){
152  if( V0->massLambda() < (mV0MassRange[1]) &&
153  V0->massLambda() > (mV0MassRange[0]) ) inMassRange=1;
154  }
155 
156 
157 
158  bool goodPID = ( inMassRange &&
159  (V0->dcaV0Daughters() > mdcaV0daughters[0]) &&
160  (V0->dcaV0Daughters() < mdcaV0daughters[1]) &&
161  (V0->dcaV0ToPrimVertex() > mdcaV0ToPrimVertex[0]) &&
162  (V0->dcaV0ToPrimVertex() < mdcaV0ToPrimVertex[1]) &&
163  (V0->decayLengthV0() > mdecayLengthV0[0]) &&
164  (V0->decayLengthV0() < mdecayLengthV0[1]) &&
165  (V0->tpcHitsPos() > mtpcHitsPos[0]) &&
166  (V0->tpcHitsPos() < mtpcHitsPos[1]) &&
167  (V0->tpcHitsNeg() > mtpcHitsNeg[0]) &&
168  (V0->tpcHitsNeg() < mtpcHitsNeg[1]) &&
169  (V0->dcaPosToPrimVertex() > mdcaPosToPrimVertex[0]) &&
170  (V0->dcaPosToPrimVertex() < mdcaPosToPrimVertex[1]) &&
171  (V0->dcaNegToPrimVertex() > mdcaNegToPrimVertex[0]) &&
172  (V0->dcaNegToPrimVertex() < mdcaNegToPrimVertex[1]) &&
173  (V0->ptArmV0() > mptArmV0[0]) &&
174  (V0->ptArmV0() < mptArmV0[1]) &&
175  (V0->alphaV0() > malphaV0[0]) &&
176  (V0->alphaV0() < malphaV0[1]));
177 
178  if(goodPID && mChargedEdx){
179  if( mChargedEdx <0){
180  goodPID = ( (V0->dedxNeg() > (mdEdx[0]*V0->ptNeg()+mdEdx[1])) &&
181  (V0->dedxNeg() > (mdEdx[2]*V0->ptNeg()+mdEdx[3])));
182  }
183  if( mChargedEdx > 0){
184  goodPID = ( (V0->dedxPos() > (mdEdx[0]*V0->ptPos()+mdEdx[1])) &&
185  (V0->dedxPos() > (mdEdx[2]*V0->ptPos()+mdEdx[3])));
186  }
187  }
188 
189  if (goodPID){
190  float TEnergy = ::sqrt((V0->ptotV0())*(V0->ptotV0())+mMass*mMass);
191  float TRapidity = 0.5*::log((TEnergy+V0->momV0().z())/
192  (TEnergy-V0->momV0().z()));
193 
194  float Pt = V0->ptV0();
195 
196 
197 
198 #ifdef STHBTDEBUG
199  cout << " * Pt " << Pt;
200  cout << " * mPt[0] " << mPt[0];
201  cout << " * mPt[1] " << mPt[1];
202  cout << " * TRapidity " << TRapidity;
203  cout << " * mRapidity[0] " << mRapidity[0];
204  cout << " * mRapidity[1] " << mRapidity[1];
205  cout << " * Pt " << (Pt > mPt[0]) && (Pt < mPt[1]);
206  cout << " * y " << (TRapidity > mRapidity[0]) && (TRapidity < mRapidity[1]);
207  cout << endl;
208 #endif
209 
210  bool goodV0=
211  ((Pt > mPt[0]) &&
212  (Pt < mPt[1]) &&
213  (TRapidity > mRapidity[0]) &&
214  (TRapidity < mRapidity[1]));
215 
216  goodV0 ? mNV0sPassed++ : mNV0sFailed++;
217  return (goodV0);
218  }
219  else{
220  mNV0sFailed++;
221  return (goodPID);
222  }
223 }
224 //------------------------------
225 StHbtString helensV0Cut::Report(){
226  string Stemp;
227  char Ctemp[100];
228  sprintf(Ctemp,"--helensV0Cut--\n Particle mass:\t%E\n",this->Mass());
229  Stemp=Ctemp;
230  sprintf(Ctemp,"V0 mass range:\t%E - %E\n",mV0MassRange[0],
231  mV0MassRange[1]);
232  Stemp+=Ctemp;
233  sprintf(Ctemp,"dcaV0daughters:\t%E - %E\n",mdcaV0daughters[0],
234 mdcaV0daughters[1]);
235  Stemp+=Ctemp;
236  sprintf(Ctemp,"dcaV0ToPrimVertex:\t%E - %E\n",mdcaV0ToPrimVertex[0],
237 mdcaV0ToPrimVertex[1]);
238  Stemp+=Ctemp;
239  sprintf(Ctemp,"decayLengthV0:\t%E - %E\n",mdecayLengthV0[0],
240 mdecayLengthV0[1]);
241  Stemp+=Ctemp;
242  sprintf(Ctemp,"tpcHitsPos:\t%d - %d\n",mtpcHitsPos[0],mtpcHitsPos[1]);
243  Stemp+=Ctemp;
244  sprintf(Ctemp,"tpcHitsNeg:\t%d - %d\n",mtpcHitsNeg[0],mtpcHitsNeg[1]);
245  Stemp+=Ctemp;
246  sprintf(Ctemp,"dcaPosToPrimVertex:\t%E - %E\n",mdcaPosToPrimVertex[0],
247 mdcaPosToPrimVertex[1]);
248  Stemp+=Ctemp;
249  sprintf(Ctemp,"dcaNegToPrimVertex:\t%E - %E\n",mdcaNegToPrimVertex[0],
250 mdcaNegToPrimVertex[1]);
251  Stemp+=Ctemp;
252  sprintf(Ctemp,"dedx>:\t%E pt+%E and \t%E pt+ %E for Charge %E\n ",mdEdx[0],mdEdx[1],mdEdx[2],mdEdx[3],mChargedEdx);
253  Stemp+=Ctemp;
254  sprintf(Ctemp,"ptArmV0:\t%E - %E\n",mptArmV0[0],mptArmV0[1]);
255  Stemp+=Ctemp;
256  sprintf(Ctemp,"alphaV0:\t%E - %E\n",malphaV0[0],malphaV0[1]);
257  Stemp+=Ctemp;
258  sprintf(Ctemp,"Particle pT:\t%E - %E\n",mPt[0],mPt[1]);
259  Stemp+=Ctemp;
260  sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",mRapidity[0],mRapidity[1]);
261  Stemp+=Ctemp;
262  sprintf(Ctemp,"Number of V0s which passed:\t%ld Number which failed:\t%ld\n",mNV0sPassed,mNV0sFailed);
263  Stemp += Ctemp;
264  StHbtString returnThis = Stemp;
265  return returnThis;
266 }