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