]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FEMTOSCOPY/AliFemtoUser/AliFemtoESDTrackCut.cxx
Adding cuts on impact parameters
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemtoUser / AliFemtoESDTrackCut.cxx
CommitLineData
67427ff7 1/***************************************************************************
2 *
3 * $Id$
4 *
5 *
6 ***************************************************************************
7 *
8 *
9 *
10 *
11 ***************************************************************************
12 *
13 * $Log$
cc5faabc 14 * Revision 1.3 2007/05/22 09:01:42 akisiel
15 * Add the possibiloity to save cut settings in the ROOT file
16 *
3a74204a 17 * Revision 1.2 2007/05/21 10:38:25 akisiel
18 * More coding rule conformance
19 *
d92ed900 20 * Revision 1.1 2007/05/16 10:25:06 akisiel
21 * Making the directory structure of AliFemtoUser flat. All files go into one common directory
22 *
65423af9 23 * Revision 1.4 2007/05/03 09:46:10 akisiel
24 * Fixing Effective C++ warnings
25 *
0215f606 26 * Revision 1.3 2007/04/27 07:25:59 akisiel
27 * Make revisions needed for compilation from the main AliRoot tree
28 *
b2f60a91 29 * Revision 1.1.1.1 2007/04/25 15:38:41 panos
30 * Importing the HBT code dir
31 *
67427ff7 32 * Revision 1.4 2007-04-03 16:00:08 mchojnacki
33 * Changes to iprove memory managing
34 *
35 * Revision 1.3 2007/03/13 15:30:03 mchojnacki
36 * adding reader for simulated data
37 *
38 * Revision 1.2 2007/03/08 14:58:03 mchojnacki
39 * adding some alice stuff
40 *
41 * Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki
42 * First version on CVS
43 *
44 **************************************************************************/
45
b2f60a91 46#include "AliFemtoESDTrackCut.h"
67427ff7 47#include <cstdio>
48
49#ifdef __ROOT__
50ClassImp(AliFemtoESDTrackCut)
51#endif
52
cc5faabc 53
54// electron
55// 0.13 - 1.8
56// 0 7.594129e-02 8.256141e-03
57// 1 -5.535827e-01 8.170825e-02
58// 2 1.728591e+00 3.104210e-01
59// 3 -2.827893e+00 5.827802e-01
60// 4 2.503553e+00 5.736207e-01
61// 5 -1.125965e+00 2.821170e-01
62// 6 2.009036e-01 5.438876e-02
63
64// pion
65// 0.13 - 2.0
66// 0 1.063457e+00 8.872043e-03
67// 1 -4.222208e-01 2.534402e-02
68// 2 1.042004e-01 1.503945e-02
69
70// kaon
71// 0.18 - 2.0
72// 0 -7.289406e-02 1.686074e-03
73// 1 4.415666e-01 1.143939e-02
74// 2 -2.996790e-01 1.840964e-02
75// 3 6.704652e-02 7.783990e-03
76
77// proton
78// 0.26 - 2.0
79// 0 -3.730200e-02 2.347311e-03
80// 1 1.163684e-01 1.319316e-02
81// 2 8.354116e-02 1.997948e-02
82// 3 -4.608098e-02 8.336400e-03
83
84
0215f606 85AliFemtoESDTrackCut::AliFemtoESDTrackCut() :
d92ed900 86 fCharge(0),
87 fLabel(0),
88 fStatus(0),
89 fminTPCclsF(0),
db2d5b4b 90 fminTPCncls(0),
d92ed900 91 fminITScls(0),
0b3bd1ac 92 fMaxITSchiNdof(1000.0),
93 fMaxTPCchiNdof(1000.0),
94 fMaxSigmaToVertex(1000.0),
d92ed900 95 fNTracksPassed(0),
cc5faabc 96 fNTracksFailed(0),
97 fRemoveKinks(kFALSE),
ab74d4d3 98 fMostProbable(0),
99 fMaxImpactXY(1000.0),
100 fMaxImpactZ(1000.0)
67427ff7 101{
d92ed900 102 // Default constructor
103 fNTracksPassed = fNTracksFailed = 0;
104 fCharge = 0; // takes both charges 0
105 fPt[0]=0.0; fPt[1] = 100.0;//100
106 fRapidity[0]=-2; fRapidity[1]=2;//-2 2
107 fPidProbElectron[0]=-1;fPidProbElectron[1]=2;
108 fPidProbPion[0]=-1; fPidProbPion[1]=2;
109 fPidProbKaon[0]=-1;fPidProbKaon[1]=2;
110 fPidProbProton[0]=-1;fPidProbProton[1]=2;
111 fPidProbMuon[0]=-1;fPidProbMuon[1]=2;
112 fLabel=false;
113 fStatus=0;
114 fminTPCclsF=0;
115 fminITScls=0;
67427ff7 116}
117//------------------------------
cc5faabc 118AliFemtoESDTrackCut::~AliFemtoESDTrackCut(){
119 /* noop */
120}
67427ff7 121//------------------------------
122bool AliFemtoESDTrackCut::Pass(const AliFemtoTrack* track)
123{
d92ed900 124 // test the particle and return
125 // true if it meets all the criteria
126 // false if it doesn't meet at least one of the criteria
cc5faabc 127 float tMost[5];
d92ed900 128
129 //cout<<"AliFemtoESD cut"<<endl;
130 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
131 if (fStatus!=0)
67427ff7 132 {
d92ed900 133 //cout<<" status "<<track->Label()<<" "<<track->Flags()<<" "<<track->TPCnclsF()<<" "<<track->ITSncls()<<endl;
134 if ((track->Flags()&fStatus)!=fStatus)
67427ff7 135 {
cc5faabc 136 // cout<<track->Flags()<<" "<<fStatus<<" no go through status"<<endl;
d92ed900 137 return false;
67427ff7 138 }
139
140 }
0b3bd1ac 141 if (fRemoveKinks) {
142 if ((track->KinkIndex(0)) || (track->KinkIndex(1)) || (track->KinkIndex(2)))
143 return false;
144 }
d92ed900 145 if (fminTPCclsF>track->TPCnclsF())
67427ff7 146 {
d92ed900 147 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
148 return false;
67427ff7 149 }
0b3bd1ac 150 if (fminTPCncls>track->TPCncls())
151 {
152 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
153 return false;
154 }
d92ed900 155 if (fminITScls>track->ITSncls())
67427ff7 156 {
d92ed900 157 //cout<<" No go because ITS Number of Cls"<<fminITScls<< " "<<track->ITSncls()<<endl;
158 return false;
67427ff7 159 }
160
ab74d4d3 161 if (fMaxImpactXY < track->ImpactD())
162 return false;
163
164 if (fMaxImpactZ < track->ImpactZ())
165 return false;
166
0b3bd1ac 167 if (fMaxSigmaToVertex < track->SigmaToVertex()) {
168 return false;
169 }
170
171 if (track->ITSncls() > 0)
172 if ((track->ITSchi2()/track->ITSncls()) > fMaxITSchiNdof) {
173 return false;
174 }
175
176 if (track->TPCncls() > 0)
177 if ((track->TPCchi2()/track->TPCncls()) > fMaxTPCchiNdof) {
178 return false;
179 }
180
d92ed900 181 if (fLabel)
67427ff7 182 {
d92ed900 183 //cout<<"labels"<<endl;
184 if(track->Label()<0)
67427ff7 185 {
d92ed900 186 fNTracksFailed++;
187 // cout<<"No Go Through the cut"<<endl;
67427ff7 188 // cout<<fLabel<<" Label="<<track->Label()<<endl;
d92ed900 189 return false;
67427ff7 190 }
191 }
d92ed900 192 if (fCharge!=0)
67427ff7 193 {
d92ed900 194 //cout<<"AliFemtoESD cut ch "<<endl;
195 //cout<<fCharge<<" Charge="<<track->Charge()<<endl;
196 if (track->Charge()!= fCharge)
67427ff7 197 {
d92ed900 198 fNTracksFailed++;
67427ff7 199 // cout<<"No Go Through the cut"<<endl;
d92ed900 200 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
201 return false;
67427ff7 202 }
203 }
d92ed900 204 float tEnergy = ::sqrt(track->P().mag2()+fMass*fMass);
205 float tRapidity = 0.5*::log((tEnergy+track->P().z())/(tEnergy-track->P().z()));
206 float tPt = ::sqrt((track->P().x())*(track->P().x())+(track->P().y())*(track->P().y()));
207 if ((tRapidity<fRapidity[0])||(tRapidity>fRapidity[1]))
67427ff7 208 {
d92ed900 209 fNTracksFailed++;
210 //cout<<"No Go Through the cut"<<endl;
211 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
212 return false;
67427ff7 213 }
d92ed900 214 if ((tPt<fPt[0])||(tPt>fPt[1]))
67427ff7 215 {
d92ed900 216 fNTracksFailed++;
217 //cout<<"No Go Through the cut"<<endl;
218 //cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
219 return false;
67427ff7 220 }
cc5faabc 221// cout << "Track has pids: "
222// << track->PidProbElectron() << " "
223// << track->PidProbMuon() << " "
224// << track->PidProbPion() << " "
225// << track->PidProbKaon() << " "
226// << track->PidProbProton() << " "
227// << track->PidProbElectron()+track->PidProbMuon()+track->PidProbPion()+track->PidProbKaon()+track->PidProbProton() << endl;
228
229
d92ed900 230 if ((track->PidProbElectron()<fPidProbElectron[0])||(track->PidProbElectron()>fPidProbElectron[1]))
67427ff7 231 {
d92ed900 232 fNTracksFailed++;
233 //cout<<"No Go Through the cut"<<endl;
234 //cout<<fPidProbElectron[0]<<" < e ="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
235 return false;
67427ff7 236 }
d92ed900 237 if ((track->PidProbPion()<fPidProbPion[0])||(track->PidProbPion()>fPidProbPion[1]))
67427ff7 238 {
d92ed900 239 fNTracksFailed++;
240 //cout<<"No Go Through the cut"<<endl;
241 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
242 return false;
67427ff7 243 }
d92ed900 244 if ((track->PidProbKaon()<fPidProbKaon[0])||(track->PidProbKaon()>fPidProbKaon[1]))
67427ff7 245 {
d92ed900 246 fNTracksFailed++;
247 //cout<<"No Go Through the cut"<<endl;
248 //cout<<fPidProbKaon[0]<<" < k ="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
249 return false;
67427ff7 250 }
d92ed900 251 if ((track->PidProbProton()<fPidProbProton[0])||(track->PidProbProton()>fPidProbProton[1]))
67427ff7 252 {
d92ed900 253 fNTracksFailed++;
254 //cout<<"No Go Through the cut"<<endl;
255 //cout<<fPidProbProton[0]<<" < p ="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
256 return false;
67427ff7 257 }
d92ed900 258 if ((track->PidProbMuon()<fPidProbMuon[0])||(track->PidProbMuon()>fPidProbMuon[1]))
67427ff7 259 {
d92ed900 260 fNTracksFailed++;
261 //cout<<"No Go Through the cut"<<endl;
262 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
263 return false;
67427ff7 264 }
cc5faabc 265
266 if (fMostProbable) {
267 tMost[0] = track->PidProbElectron()*PidFractionElectron(track->P().mag());
268 tMost[1] = 0.0;
269 tMost[2] = track->PidProbPion()*PidFractionPion(track->P().mag());
270 tMost[3] = track->PidProbKaon()*PidFractionKaon(track->P().mag());
271 tMost[4] = track->PidProbProton()*PidFractionProton(track->P().mag());
272 int imost=0;
273 float ipidmax = 0.0;
274 for (int ip=0; ip<5; ip++)
275 if (tMost[ip] > ipidmax) { ipidmax = tMost[ip]; imost = ip; };
276 if (imost != fMostProbable) return false;
277 }
67427ff7 278
d92ed900 279 // cout<<"Go Through the cut"<<endl;
280 // cout<<fLabel<<" Label="<<track->Label()<<endl;
281 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
282 // cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
283 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
284 //cout<<fPidProbElectron[0]<<" < e="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
285 //cout<<fPidProbPion[0]<<" < pi="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
286 //cout<<fPidProbKaon[0]<<" < k="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
287 //cout<<fPidProbProton[0]<<" < p="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
288 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
289 fNTracksPassed++ ;
290 return true;
67427ff7 291
292
293}
294//------------------------------
295AliFemtoString AliFemtoESDTrackCut::Report()
296{
cc5faabc 297 // Prepare report from the execution
d92ed900 298 string tStemp;
299 char tCtemp[100];
300 sprintf(tCtemp,"Particle mass:\t%E\n",this->Mass());
301 tStemp=tCtemp;
302 sprintf(tCtemp,"Particle charge:\t%d\n",fCharge);
303 tStemp+=tCtemp;
304 sprintf(tCtemp,"Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
305 tStemp+=tCtemp;
306 sprintf(tCtemp,"Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
307 tStemp+=tCtemp;
308 sprintf(tCtemp,"Number of tracks which passed:\t%ld Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
309 tStemp += tCtemp;
310 AliFemtoString returnThis = tStemp;
311 return returnThis;
67427ff7 312}
3a74204a 313TList *AliFemtoESDTrackCut::ListSettings()
314{
315 // return a list of settings in a writable form
316 TList *tListSetttings = new TList();
317 char buf[200];
db2d5b4b 318 snprintf(buf, 200, "AliFemtoESDTrackCut.mass=%f", this->Mass());
3a74204a 319 tListSetttings->AddLast(new TObjString(buf));
320
321 snprintf(buf, 200, "AliFemtoESDTrackCut.charge=%i", fCharge);
322 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 323 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobpion.minimum=%f", fPidProbPion[0]);
3a74204a 324 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 325 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobpion.maximum=%f", fPidProbPion[1]);
3a74204a 326 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 327 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobkaon.minimum=%f", fPidProbKaon[0]);
3a74204a 328 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 329 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobkaon.maximum=%f", fPidProbKaon[1]);
3a74204a 330 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 331 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobproton.minimum=%f", fPidProbProton[0]);
3a74204a 332 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 333 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobproton.maximum=%f", fPidProbProton[1]);
3a74204a 334 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 335 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobelectron.minimum=%f", fPidProbElectron[0]);
3a74204a 336 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 337 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobelectron.maximum=%f", fPidProbElectron[1]);
3a74204a 338 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 339 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobMuon.minimum=%f", fPidProbMuon[0]);
3a74204a 340 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 341 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobMuon.maximum=%f", fPidProbMuon[1]);
3a74204a 342 tListSetttings->AddLast(new TObjString(buf));
343 snprintf(buf, 200, "AliFemtoESDTrackCut.minimumtpcclusters=%i", fminTPCclsF);
344 tListSetttings->AddLast(new TObjString(buf));
345 snprintf(buf, 200, "AliFemtoESDTrackCut.minimumitsclusters=%i", fminTPCclsF);
346 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 347 snprintf(buf, 200, "AliFemtoESDTrackCut.pt.minimum=%f", fPt[0]);
3a74204a 348 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 349 snprintf(buf, 200, "AliFemtoESDTrackCut.pt.maximum=%f", fPt[1]);
3a74204a 350 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 351 snprintf(buf, 200, "AliFemtoESDTrackCut.rapidity.minimum=%f", fRapidity[0]);
3a74204a 352 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 353 snprintf(buf, 200, "AliFemtoESDTrackCut.rapidity.maximum=%f", fRapidity[1]);
3a74204a 354 tListSetttings->AddLast(new TObjString(buf));
cc5faabc 355 snprintf(buf, 200, "AliFemtoESDTrackCut.removekinks=%i", fRemoveKinks);
356 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 357 snprintf(buf, 200, "AliFemtoESDTrackCut.maxitschindof=%f", fMaxITSchiNdof);
0b3bd1ac 358 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 359 snprintf(buf, 200, "AliFemtoESDTrackCut.maxtpcchindof=%f", fMaxTPCchiNdof);
0b3bd1ac 360 tListSetttings->AddLast(new TObjString(buf));
db2d5b4b 361 snprintf(buf, 200, "AliFemtoESDTrackCut.maxsigmatovertex=%f", fMaxSigmaToVertex);
0b3bd1ac 362 tListSetttings->AddLast(new TObjString(buf));
ab74d4d3 363 snprintf(buf, 200, "AliFemtoESDTrackCut.maximpactxy=%f", fMaxImpactXY);
364 tListSetttings->AddLast(new TObjString(buf));
365 snprintf(buf, 200, "AliFemtoESDTrackCut.maximpactz=%f", fMaxImpactZ);
366 tListSetttings->AddLast(new TObjString(buf));
cc5faabc 367 if (fMostProbable) {
368 if (fMostProbable == 2)
369 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Pion");
370 if (fMostProbable == 3)
371 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Kaon");
372 if (fMostProbable == 4)
373 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Proton");
374 tListSetttings->AddLast(new TObjString(buf));
375 }
3a74204a 376 return tListSetttings;
377}
cc5faabc 378void AliFemtoESDTrackCut::SetRemoveKinks(const bool& flag)
379{
380 fRemoveKinks = flag;
381}
382
383 // electron
384// 0.13 - 1.8
385// 0 7.594129e-02 8.256141e-03
386// 1 -5.535827e-01 8.170825e-02
387// 2 1.728591e+00 3.104210e-01
388// 3 -2.827893e+00 5.827802e-01
389// 4 2.503553e+00 5.736207e-01
390// 5 -1.125965e+00 2.821170e-01
391// 6 2.009036e-01 5.438876e-02
392float AliFemtoESDTrackCut::PidFractionElectron(float mom) const
393{
394 // Provide a parameterized fraction of electrons dependent on momentum
395 if (mom<0.13) return 0.0;
396 if (mom>1.8) return 0.0;
397 return (7.594129e-02
398 -5.535827e-01*mom
399 +1.728591e+00*mom*mom
400 -2.827893e+00*mom*mom*mom
401 +2.503553e+00*mom*mom*mom*mom
402 -1.125965e+00*mom*mom*mom*mom*mom
403 +2.009036e-01*mom*mom*mom*mom*mom*mom);
404}
405
406// pion
407// 0.13 - 2.0
408// 0 1.063457e+00 8.872043e-03
409// 1 -4.222208e-01 2.534402e-02
410// 2 1.042004e-01 1.503945e-02
411float AliFemtoESDTrackCut::PidFractionPion(float mom) const
412{
413 // Provide a parameterized fraction of pions dependent on momentum
414 if (mom<0.13) return 0.0;
415 if (mom>2.0) return 0.0;
416 return ( 1.063457e+00
417 -4.222208e-01*mom
418 +1.042004e-01*mom*mom);
419}
420
421// kaon
422// 0.18 - 2.0
423// 0 -7.289406e-02 1.686074e-03
424// 1 4.415666e-01 1.143939e-02
425// 2 -2.996790e-01 1.840964e-02
426// 3 6.704652e-02 7.783990e-03
427float AliFemtoESDTrackCut::PidFractionKaon(float mom) const
428{
429 // Provide a parameterized fraction of kaons dependent on momentum
430 if (mom<0.18) return 0.0;
431 if (mom>2.0) return 0.0;
432 return (-7.289406e-02
433 +4.415666e-01*mom
434 -2.996790e-01*mom*mom
435 +6.704652e-02*mom*mom*mom);
436}
437
438// proton
439// 0.26 - 2.0
440// 0 -3.730200e-02 2.347311e-03
441// 1 1.163684e-01 1.319316e-02
442// 2 8.354116e-02 1.997948e-02
443// 3 -4.608098e-02 8.336400e-03
444float AliFemtoESDTrackCut::PidFractionProton(float mom) const
445{
446 // Provide a parameterized fraction of protons dependent on momentum
447 if (mom<0.26) return 0.0;
448 if (mom>2.0) return 0.0;
449 return (-3.730200e-02
450 +1.163684e-01*mom
451 +8.354116e-02*mom*mom
452 -4.608098e-02*mom*mom*mom);
453}