Update to pythi8.170
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemtoUser / AliFemtoESDTrackCut.cxx
CommitLineData
76ce4b5b 1/*
2***************************************************************************
3*
4* $Id$
5*
6*
7***************************************************************************
8*
9*
10*
11*
12***************************************************************************
13*
14* $Log$
15* Revision 1.3 2007/05/22 09:01:42 akisiel
16* Add the possibiloity to save cut settings in the ROOT file
17*
18* Revision 1.2 2007/05/21 10:38:25 akisiel
19* More coding rule conformance
20*
21* Revision 1.1 2007/05/16 10:25:06 akisiel
22* Making the directory structure of AliFemtoUser flat. All files go into one common directory
23*
24* Revision 1.4 2007/05/03 09:46:10 akisiel
25* Fixing Effective C++ warnings
26*
27* Revision 1.3 2007/04/27 07:25:59 akisiel
28* Make revisions needed for compilation from the main AliRoot tree
29*
30* Revision 1.1.1.1 2007/04/25 15:38:41 panos
31* Importing the HBT code dir
32*
33* Revision 1.4 2007-04-03 16:00:08 mchojnacki
34* Changes to iprove memory managing
35*
36* Revision 1.3 2007/03/13 15:30:03 mchojnacki
37* adding reader for simulated data
38*
39* Revision 1.2 2007/03/08 14:58:03 mchojnacki
40* adding some alice stuff
41*
42* Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki
43* First version on CVS
44*
45**************************************************************************/
46
47#include "AliFemtoESDTrackCut.h"
48#include <cstdio>
49
50#ifdef __ROOT__
51ClassImp(AliFemtoESDTrackCut)
52#endif
53
54
55// electron
56// 0.13 - 1.8
57// 0 7.594129e-02 8.256141e-03
58// 1 -5.535827e-01 8.170825e-02
59// 2 1.728591e+00 3.104210e-01
60// 3 -2.827893e+00 5.827802e-01
61// 4 2.503553e+00 5.736207e-01
62// 5 -1.125965e+00 2.821170e-01
63// 6 2.009036e-01 5.438876e-02
64
65// pion
66// 0.13 - 2.0
67// 0 1.063457e+00 8.872043e-03
68// 1 -4.222208e-01 2.534402e-02
69// 2 1.042004e-01 1.503945e-02
70
71// kaon
72// 0.18 - 2.0
73// 0 -7.289406e-02 1.686074e-03
74// 1 4.415666e-01 1.143939e-02
75// 2 -2.996790e-01 1.840964e-02
76// 3 6.704652e-02 7.783990e-03
77
78// proton
79// 0.26 - 2.0
80// 0 -3.730200e-02 2.347311e-03
81// 1 1.163684e-01 1.319316e-02
82// 2 8.354116e-02 1.997948e-02
83// 3 -4.608098e-02 8.336400e-03
84
85
86 AliFemtoESDTrackCut::AliFemtoESDTrackCut() :
87 fCharge(0),
88 fLabel(0),
89 fStatus(0),
90 fPIDMethod(knSigma),
91 fminTPCclsF(0),
92 fminTPCncls(0),
93 fminITScls(0),
94 fMaxITSchiNdof(1000.0),
95 fMaxTPCchiNdof(1000.0),
96 fMaxSigmaToVertex(1000.0),
97 fNTracksPassed(0),
98 fNTracksFailed(0),
99 fRemoveKinks(kFALSE),
100 fRemoveITSFake(kFALSE),
101 fMostProbable(0),
102 fMaxImpactXY(1000.0),
103 fMaxImpactZ(1000.0),
104 fMaxImpactXYPtOff(1000.0),
105 fMaxImpactXYPtNrm(1000.0),
106 fMaxImpactXYPtPow(1000.0),
107 fMinPforTOFpid(0.0),
108 fMaxPforTOFpid(10000.0),
109 fMinPforTPCpid(0.0),
110 fMaxPforTPCpid(10000.0),
111 fMinPforITSpid(0.0),
112 fMaxPforITSpid(10000.0)
113{
114 // Default constructor
115 fNTracksPassed = fNTracksFailed = 0;
116 fCharge = 0; // takes both charges 0
117 fPt[0]=0.0; fPt[1] = 100.0;//100
118 fRapidity[0]=-2; fRapidity[1]=2;//-2 2
119 fEta[0]=-2; fEta[1]=2;//-2 2
120 fPidProbElectron[0]=-1;fPidProbElectron[1]=2;
121 fPidProbPion[0]=-1; fPidProbPion[1]=2;
122 fPidProbKaon[0]=-1;fPidProbKaon[1]=2;
123 fPidProbProton[0]=-1;fPidProbProton[1]=2;
124 fPidProbMuon[0]=-1;fPidProbMuon[1]=2;
125 fLabel=false;
126 fStatus=0;
127 fminTPCclsF=0;
128 fminITScls=0;
129 fPIDMethod=knSigma;
130}
131//------------------------------
132AliFemtoESDTrackCut::~AliFemtoESDTrackCut(){
133 /* noop */
134}
135//------------------------------
136bool AliFemtoESDTrackCut::Pass(const AliFemtoTrack* track)
137{
c9b0c11d 138
139
76ce4b5b 140 // test the particle and return
141 // true if it meets all the criteria
142 // false if it doesn't meet at least one of the criteria
143 float tMost[5];
144
145 //cout<<"AliFemtoESD cut"<<endl;
146 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
147 if (fStatus!=0)
148 {
149 //cout<<" status "<<track->Label()<<" "<<track->Flags()<<" "<<track->TPCnclsF()<<" "<<track->ITSncls()<<endl;
150 if ((track->Flags()&fStatus)!=fStatus)
151 {
152 // cout<<track->Flags()<<" "<<fStatus<<" no go through status"<<endl;
153 return false;
154 }
155
156 }
157 if (fRemoveKinks) {
158 if ((track->KinkIndex(0)) || (track->KinkIndex(1)) || (track->KinkIndex(2)))
159 return false;
160 }
161 if (fRemoveITSFake) {
162 if (track->ITSncls() < 0)
163 return false;
164 }
165 if (fminTPCclsF>track->TPCnclsF())
166 {
167 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
168 return false;
169 }
170 if (fminTPCncls>track->TPCncls())
171 {
172 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
173 return false;
174 }
175 if (fminITScls>track->ITSncls())
176 {
177 //cout<<" No go because ITS Number of Cls"<<fminITScls<< " "<<track->ITSncls()<<endl;
178 return false;
179 }
180
181 if (fMaxImpactXY < TMath::Abs(track->ImpactD()))
182 return false;
183
184 if (fMaxImpactZ < TMath::Abs(track->ImpactZ()))
185 return false;
186
187 if (fMaxSigmaToVertex < track->SigmaToVertex()) {
188 return false;
189 }
190
191 if (track->ITSncls() > 0)
192 if ((track->ITSchi2()/track->ITSncls()) > fMaxITSchiNdof) {
193 return false;
194 }
195
196 if (track->TPCncls() > 0)
197 if ((track->TPCchi2()/track->TPCncls()) > fMaxTPCchiNdof) {
198 return false;
199 }
200
201 if (fLabel)
202 {
203 //cout<<"labels"<<endl;
204 if(track->Label()<0)
205 {
206 fNTracksFailed++;
207 // cout<<"No Go Through the cut"<<endl;
208 // cout<<fLabel<<" Label="<<track->Label()<<endl;
209 return false;
210 }
211 }
212 if (fCharge!=0)
213 {
214 //cout<<"AliFemtoESD cut ch "<<endl;
215 //cout<<fCharge<<" Charge="<<track->Charge()<<endl;
216 if (track->Charge()!= fCharge)
217 {
218 fNTracksFailed++;
219 // cout<<"No Go Through the cut"<<endl;
220 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
221 return false;
222 }
223 }
224 Bool_t tTPCPidIn = (track->Flags()&AliFemtoTrack::kTPCpid)>0;
225 Bool_t tITSPidIn = (track->Flags()&AliFemtoTrack::kITSpid)>0;
226 Bool_t tTOFPidIn = (track->Flags()&AliFemtoTrack::kTOFpid)>0;
227
228 if(fMinPforTOFpid > 0 && track->P().Mag() > fMinPforTOFpid &&
229 track->P().Mag() < fMaxPforTOFpid && !tTOFPidIn)
230 {
231 fNTracksFailed++;
232 return false;
233 }
234
235 if(fMinPforTPCpid > 0 && track->P().Mag() > fMinPforTPCpid &&
236 track->P().Mag() < fMaxPforTPCpid && !tTPCPidIn)
237 {
238 fNTracksFailed++;
239 return false;
240 }
241
242 if(fMinPforITSpid > 0 && track->P().Mag() > fMinPforITSpid &&
243 track->P().Mag() < fMaxPforITSpid && !tITSPidIn)
244 {
245 fNTracksFailed++;
246 return false;
247 }
248
249
250 float tEnergy = ::sqrt(track->P().Mag2()+fMass*fMass);
251 float tRapidity = 0.5*::log((tEnergy+track->P().z())/(tEnergy-track->P().z()));
252 float tPt = ::sqrt((track->P().x())*(track->P().x())+(track->P().y())*(track->P().y()));
253 float tEta = track->P().PseudoRapidity();
254
255 if (fMaxImpactXYPtOff < 999.0) {
256 if ((fMaxImpactXYPtOff + fMaxImpactXYPtNrm*TMath::Power(tPt, fMaxImpactXYPtPow)) < TMath::Abs(track->ImpactD())) {
257 fNTracksFailed++;
258 return false;
259 }
260 }
261
262 if ((tRapidity<fRapidity[0])||(tRapidity>fRapidity[1]))
263 {
264 fNTracksFailed++;
265 //cout<<"No Go Through the cut"<<endl;
266 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
267 return false;
268 }
269 if ((tEta<fEta[0])||(tEta>fEta[1]))
270 {
271 fNTracksFailed++;
272 //cout<<"No Go Through the cut"<<endl;
273 //cout<<fEta[0]<<" < Eta ="<<tEta<<" <"<<fEta[1]<<endl;
274 return false;
275 }
276 if ((tPt<fPt[0])||(tPt>fPt[1]))
277 {
278 fNTracksFailed++;
279 //cout<<"No Go Through the cut"<<endl;
280 //cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
281 return false;
282 }
283 // cout << "Track has pids: "
284 // << track->PidProbElectron() << " "
285 // << track->PidProbMuon() << " "
286 // << track->PidProbPion() << " "
287 // << track->PidProbKaon() << " "
288 // << track->PidProbProton() << " "
289 // << track->PidProbElectron()+track->PidProbMuon()+track->PidProbPion()+track->PidProbKaon()+track->PidProbProton() << endl;
290
291
292 if ((track->PidProbElectron()<fPidProbElectron[0])||(track->PidProbElectron()>fPidProbElectron[1]))
293 {
294 fNTracksFailed++;
295 //cout<<"No Go Through the cut"<<endl;
296 //cout<<fPidProbElectron[0]<<" < e ="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
297 return false;
298 }
299 if ((track->PidProbPion()<fPidProbPion[0])||(track->PidProbPion()>fPidProbPion[1]))
300 {
301 fNTracksFailed++;
302 //cout<<"No Go Through the cut"<<endl;
303 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
304 return false;
305 }
306 if ((track->PidProbKaon()<fPidProbKaon[0])||(track->PidProbKaon()>fPidProbKaon[1]))
307 {
308 fNTracksFailed++;
309 //cout<<"No Go Through the cut"<<endl;
310 //cout<<fPidProbKaon[0]<<" < k ="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
311 return false;
312 }
313 if ((track->PidProbProton()<fPidProbProton[0])||(track->PidProbProton()>fPidProbProton[1]))
314 {
315 fNTracksFailed++;
316 //cout<<"No Go Through the cut"<<endl;
317 //cout<<fPidProbProton[0]<<" < p ="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
318 return false;
319 }
320 if ((track->PidProbMuon()<fPidProbMuon[0])||(track->PidProbMuon()>fPidProbMuon[1]))
321 {
322 fNTracksFailed++;
323 //cout<<"No Go Through the cut"<<endl;
324 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
325 return false;
326 }
327
328 if (fMostProbable) {
c9b0c11d 329
76ce4b5b 330 int imost=0;
331 tMost[0] = track->PidProbElectron()*PidFractionElectron(track->P().Mag());
332 tMost[1] = 0.0;
333 tMost[2] = track->PidProbPion()*PidFractionPion(track->P().Mag());
334 tMost[3] = track->PidProbKaon()*PidFractionKaon(track->P().Mag());
335 tMost[4] = track->PidProbProton()*PidFractionProton(track->P().Mag());
336 float ipidmax = 0.0;
337
338
339 //****N Sigma Method****
340 if(fPIDMethod==0){
341 // Looking for pions
342 if (fMostProbable == 2) {
c9b0c11d 343 if (IsPionNSigma(track->P().Mag(), track->NSigmaTPCPi(), track->NSigmaTOFPi()))
76ce4b5b 344 imost = 2;
345
346 }
347 else if (fMostProbable == 3) {
c9b0c11d 348
349
350 if (IsKaonNSigma(track->P().Mag(), track->NSigmaTPCK(), track->NSigmaTOFK())){
351
76ce4b5b 352 imost = 3;
353 }
354
355 }
356 else if (fMostProbable == 4) { // proton nsigma-PID required contour adjusting
ceeb8ab7 357 if (IsProtonNSigma(track->P().Mag(), track->NSigmaTPCP(), track->NSigmaTOFP()) // && IsProtonTPCdEdx(track->P().Mag(), track->TPCsignal())
358 )
76ce4b5b 359 imost = 4;
360 }
361
362 }
c9b0c11d 363
364
76ce4b5b 365
366 //****Contour Method****
367 if(fPIDMethod==1){
368 for (int ip=0; ip<5; ip++)
369 if (tMost[ip] > ipidmax) { ipidmax = tMost[ip]; imost = ip; };
370
371 // Looking for pions
372 if (fMostProbable == 2) {
373 if (imost == 2) {
374 // Using the TPC to reject non-pions
375 if (!(IsPionTPCdEdx(track->P().Mag(), track->TPCsignal())))
376 imost = 0;
377 if (0) {
378 // Using the TOF to reject non-pions
379 if (track->P().Mag() < 0.6) {
380 if (tTOFPidIn)
381 if (!IsPionTOFTime(track->P().Mag(), track->TOFpionTime()))
382 imost = 0;
383 }
384 else {
385 if (tTOFPidIn) {
386 if (!IsPionTOFTime(track->P().Mag(), track->TOFpionTime()))
387 imost = 0;
388 }
389 else {
390 imost = 0;
391 }
392 }
393 }
394 }
395 }
396
397 // Looking for kaons
398 else if (fMostProbable == 3) {
399 // if (imost == 3) {
400 // Using the TPC to reject non-kaons
401 if (track->P().Mag() < 0.6) {
402 if (!(IsKaonTPCdEdx(track->P().Mag(), track->TPCsignal())))
403 imost = 0;
404 else imost = 3;
405 if (1) {
406 // Using the TOF to reject non-kaons
407 if (tTOFPidIn)
408 if (!IsKaonTOFTime(track->P().Mag(), track->TOFkaonTime()))
409 imost = 0;
410 }
411 }
412 else {
413 if (1) {
414 if (tTOFPidIn) {
415 if (!IsKaonTOFTime(track->P().Mag(), track->TOFkaonTime()))
416 imost = 0;
417 else
418 imost = 3;
419 }
420 else {
421 if (!(IsKaonTPCdEdx(track->P().Mag(), track->TPCsignal())))
422 imost = 0;
423 else
424 imost = 3;
425 }
426 }
427 }
428 // }
429 }
430
431 // Looking for protons
432 else if (fMostProbable == 4) {
433 // if (imost == 3) {
434 // Using the TPC to reject non-kaons
435 if (track->P().Mag() < 0.8) {
436 if (!(IsProtonTPCdEdx(track->P().Mag(), track->TPCsignal())))
437 imost = 0;
438 else imost = 4;
439 if (0) {
440 // Using the TOF to reject non-kaons
441 if (tTOFPidIn)
442 if (!IsKaonTOFTime(track->P().Mag(), track->TOFkaonTime()))
443 imost = 0;
444 }
445 }
446 else {
447 if (0) {
448 if (tTOFPidIn) {
449 if (!IsKaonTOFTime(track->P().Mag(), track->TOFkaonTime()))
450 imost = 0;
451 else
452 imost = 3;
453 }
454 else {
455 if (!(IsKaonTPCdEdx(track->P().Mag(), track->TPCsignal())))
456 imost = 0;
457 else
458 imost = 3;
459 }
460 }
461 }
462 // }
463 }
464 }
465 if (imost != fMostProbable) return false;
466 }
467
468 //fan
469 //cout<<"****** Go Through the cut ******"<<endl;
470 // cout<<fLabel<<" Label="<<track->Label()<<endl;
471 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
472 // cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
473 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
474 //cout<<fPidProbElectron[0]<<" < e="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
475 //cout<<fPidProbPion[0]<<" < pi="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
476 //cout<<fPidProbKaon[0]<<" < k="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
477 //cout<<fPidProbProton[0]<<" < p="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
478 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
479 fNTracksPassed++ ;
480 return true;
481
482
483}
484//------------------------------
485AliFemtoString AliFemtoESDTrackCut::Report()
486{
487 // Prepare report from the execution
488 string tStemp;
489 char tCtemp[100];
490 snprintf(tCtemp , 100, "Particle mass:\t%E\n",this->Mass());
491 tStemp=tCtemp;
492 snprintf(tCtemp , 100, "Particle charge:\t%d\n",fCharge);
493 tStemp+=tCtemp;
494 snprintf(tCtemp , 100, "Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
495 tStemp+=tCtemp;
496 snprintf(tCtemp , 100, "Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
497 tStemp+=tCtemp;
498 snprintf(tCtemp , 100, "Particle eta:\t%E - %E\n",fEta[0],fEta[1]);
499 tStemp+=tCtemp;
500 snprintf(tCtemp , 100, "Number of tracks which passed:\t%ld Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
501 tStemp += tCtemp;
502 AliFemtoString returnThis = tStemp;
503 return returnThis;
504}
505TList *AliFemtoESDTrackCut::ListSettings()
506{
507 // return a list of settings in a writable form
508 TList *tListSetttings = new TList();
509 char buf[200];
510 snprintf(buf, 200, "AliFemtoESDTrackCut.mass=%f", this->Mass());
511 tListSetttings->AddLast(new TObjString(buf));
512
513 snprintf(buf, 200, "AliFemtoESDTrackCut.charge=%i", fCharge);
514 tListSetttings->AddLast(new TObjString(buf));
515 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobpion.minimum=%f", fPidProbPion[0]);
516 tListSetttings->AddLast(new TObjString(buf));
517 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobpion.maximum=%f", fPidProbPion[1]);
518 tListSetttings->AddLast(new TObjString(buf));
519 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobkaon.minimum=%f", fPidProbKaon[0]);
520 tListSetttings->AddLast(new TObjString(buf));
521 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobkaon.maximum=%f", fPidProbKaon[1]);
522 tListSetttings->AddLast(new TObjString(buf));
523 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobproton.minimum=%f", fPidProbProton[0]);
524 tListSetttings->AddLast(new TObjString(buf));
525 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobproton.maximum=%f", fPidProbProton[1]);
526 tListSetttings->AddLast(new TObjString(buf));
527 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobelectron.minimum=%f", fPidProbElectron[0]);
528 tListSetttings->AddLast(new TObjString(buf));
529 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobelectron.maximum=%f", fPidProbElectron[1]);
530 tListSetttings->AddLast(new TObjString(buf));
531 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobMuon.minimum=%f", fPidProbMuon[0]);
532 tListSetttings->AddLast(new TObjString(buf));
533 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobMuon.maximum=%f", fPidProbMuon[1]);
534 tListSetttings->AddLast(new TObjString(buf));
535 snprintf(buf, 200, "AliFemtoESDTrackCut.minimumtpcclusters=%i", fminTPCclsF);
536 tListSetttings->AddLast(new TObjString(buf));
537 snprintf(buf, 200, "AliFemtoESDTrackCut.minimumitsclusters=%i", fminTPCclsF);
538 tListSetttings->AddLast(new TObjString(buf));
539 snprintf(buf, 200, "AliFemtoESDTrackCut.pt.minimum=%f", fPt[0]);
540 tListSetttings->AddLast(new TObjString(buf));
541 snprintf(buf, 200, "AliFemtoESDTrackCut.pt.maximum=%f", fPt[1]);
542 tListSetttings->AddLast(new TObjString(buf));
543 snprintf(buf, 200, "AliFemtoESDTrackCut.rapidity.minimum=%f", fRapidity[0]);
544 tListSetttings->AddLast(new TObjString(buf));
545 snprintf(buf, 200, "AliFemtoESDTrackCut.rapidity.maximum=%f", fRapidity[1]);
546 tListSetttings->AddLast(new TObjString(buf));
547 snprintf(buf, 200, "AliFemtoESDTrackCut.removekinks=%i", fRemoveKinks);
548 tListSetttings->AddLast(new TObjString(buf));
549 snprintf(buf, 200, "AliFemtoESDTrackCut.maxitschindof=%f", fMaxITSchiNdof);
550 tListSetttings->AddLast(new TObjString(buf));
551 snprintf(buf, 200, "AliFemtoESDTrackCut.maxtpcchindof=%f", fMaxTPCchiNdof);
552 tListSetttings->AddLast(new TObjString(buf));
553 snprintf(buf, 200, "AliFemtoESDTrackCut.maxsigmatovertex=%f", fMaxSigmaToVertex);
554 tListSetttings->AddLast(new TObjString(buf));
555 snprintf(buf, 200, "AliFemtoESDTrackCut.maximpactxy=%f", fMaxImpactXY);
556 tListSetttings->AddLast(new TObjString(buf));
557 snprintf(buf, 200, "AliFemtoESDTrackCut.maximpactz=%f", fMaxImpactZ);
558 tListSetttings->AddLast(new TObjString(buf));
559 if (fMostProbable) {
560 if (fMostProbable == 2)
561 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Pion");
562 if (fMostProbable == 3)
563 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Kaon");
564 if (fMostProbable == 4)
565 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Proton");
566 tListSetttings->AddLast(new TObjString(buf));
567 }
568 return tListSetttings;
569}
570void AliFemtoESDTrackCut::SetRemoveKinks(const bool& flag)
571{
572 fRemoveKinks = flag;
573}
574
575void AliFemtoESDTrackCut::SetRemoveITSFake(const bool& flag)
576{
577 fRemoveITSFake = flag;
578}
579
580// electron
581// 0.13 - 1.8
582// 0 7.594129e-02 8.256141e-03
583// 1 -5.535827e-01 8.170825e-02
584// 2 1.728591e+00 3.104210e-01
585// 3 -2.827893e+00 5.827802e-01
586// 4 2.503553e+00 5.736207e-01
587// 5 -1.125965e+00 2.821170e-01
588// 6 2.009036e-01 5.438876e-02
589float AliFemtoESDTrackCut::PidFractionElectron(float mom) const
590{
591 // Provide a parameterized fraction of electrons dependent on momentum
592 if (mom<0.13)
593 return (7.594129e-02
594 -5.535827e-01*0.13
595 +1.728591e+00*0.13*0.13
596 -2.827893e+00*0.13*0.13*0.13
597 +2.503553e+00*0.13*0.13*0.13*0.13
598 -1.125965e+00*0.13*0.13*0.13*0.13*0.13
599 +2.009036e-01*0.13*0.13*0.13*0.13*0.13*0.13);
600
601 if (mom>1.8)
602 return (7.594129e-02
603 -5.535827e-01*1.8
604 +1.728591e+00*1.8*1.8
605 -2.827893e+00*1.8*1.8*1.8
606 +2.503553e+00*1.8*1.8*1.8*1.8
607 -1.125965e+00*1.8*1.8*1.8*1.8*1.8
608 +2.009036e-01*1.8*1.8*1.8*1.8*1.8*1.8);
609 return (7.594129e-02
610 -5.535827e-01*mom
611 +1.728591e+00*mom*mom
612 -2.827893e+00*mom*mom*mom
613 +2.503553e+00*mom*mom*mom*mom
614 -1.125965e+00*mom*mom*mom*mom*mom
615 +2.009036e-01*mom*mom*mom*mom*mom*mom);
616}
617
618// pion
619// 0.13 - 2.0
620// 0 1.063457e+00 8.872043e-03
621// 1 -4.222208e-01 2.534402e-02
622// 2 1.042004e-01 1.503945e-02
623float AliFemtoESDTrackCut::PidFractionPion(float mom) const
624{
625 // Provide a parameterized fraction of pions dependent on momentum
626 if (mom<0.13)
627 return ( 1.063457e+00
628 -4.222208e-01*0.13
629 +1.042004e-01*0.0169);
630 if (mom>2.0)
631 return ( 1.063457e+00
632 -4.222208e-01*2.0
633 +1.042004e-01*4.0);
634 return ( 1.063457e+00
635 -4.222208e-01*mom
636 +1.042004e-01*mom*mom);
637}
638
639// kaon
640// 0.18 - 2.0
641// 0 -7.289406e-02 1.686074e-03
642// 1 4.415666e-01 1.143939e-02
643// 2 -2.996790e-01 1.840964e-02
644// 3 6.704652e-02 7.783990e-03
645float AliFemtoESDTrackCut::PidFractionKaon(float mom) const
646{
647 // Provide a parameterized fraction of kaons dependent on momentum
648 if (mom<0.18)
649 return (-7.289406e-02
650 +4.415666e-01*0.18
651 -2.996790e-01*0.18*0.18
652 +6.704652e-02*0.18*0.18*0.18);
653 if (mom>2.0)
654 return (-7.289406e-02
655 +4.415666e-01*2.0
656 -2.996790e-01*2.0*2.0
657 +6.704652e-02*2.0*2.0*2.0);
658 return (-7.289406e-02
659 +4.415666e-01*mom
660 -2.996790e-01*mom*mom
661 +6.704652e-02*mom*mom*mom);
662}
663
664// proton
665// 0.26 - 2.0
666// 0 -3.730200e-02 2.347311e-03
667// 1 1.163684e-01 1.319316e-02
668// 2 8.354116e-02 1.997948e-02
669// 3 -4.608098e-02 8.336400e-03
670float AliFemtoESDTrackCut::PidFractionProton(float mom) const
671{
672 // Provide a parameterized fraction of protons dependent on momentum
673 if (mom<0.26) return 0.0;
674 if (mom>2.0)
675 return (-3.730200e-02
676 +1.163684e-01*2.0
677 +8.354116e-02*2.0*2.0
678 -4.608098e-02*2.0*2.0*2.0);
679 return (-3.730200e-02
680 +1.163684e-01*mom
681 +8.354116e-02*mom*mom
682 -4.608098e-02*mom*mom*mom);
683}
684
685void AliFemtoESDTrackCut::SetMomRangeTOFpidIs(const float& minp, const float& maxp)
686{
687 fMinPforTOFpid = minp;
688 fMaxPforTOFpid = maxp;
689}
690
691void AliFemtoESDTrackCut::SetMomRangeTPCpidIs(const float& minp, const float& maxp)
692{
693 fMinPforTPCpid = minp;
694 fMaxPforTPCpid = maxp;
695}
696
697void AliFemtoESDTrackCut::SetMomRangeITSpidIs(const float& minp, const float& maxp)
698{
699 fMinPforITSpid = minp;
700 fMaxPforITSpid = maxp;
701}
702
703bool AliFemtoESDTrackCut::IsPionTPCdEdx(float mom, float dEdx)
704{
705 // double a1 = -95.4545, b1 = 86.5455;
706 // double a2 = 0.0, b2 = 56.0;
707 double a1 = -343.75, b1 = 168.125;
708 double a2 = 0.0, b2 = 65.0;
709
710 if (mom < 0.32) {
711 if (dEdx < a1*mom+b1) return true;
712 }
713 if (dEdx < a2*mom+b2) return true;
714
715 return false;
716}
717
718bool AliFemtoESDTrackCut::IsKaonTPCdEdx(float mom, float dEdx)
719{
720
721// double a1 = -547.0; double b1 = 297.0;
722// double a2 = -125.0; double b2 = 145.0;
723// double a3 = -420.0; double b3 = 357.0;
724// double a4 = -110.0; double b4 = 171.0;
725// double b5 = 72.0;
726
727// if (mom<0.2) return false;
728
729// if (mom<0.36) {
730// if (dEdx < a1*mom+b1) return false;
731// if (dEdx > a3*mom+b3) return false;
732// }
733// else if (mom<0.6) {
734// if (dEdx < a2*mom+b2) return false;
735// if (dEdx > a3*mom+b3) return false;
736// }
737// else if (mom<0.9) {
738// if (dEdx > a4*mom+b4) return false;
739// if (dEdx < b5) return false;
740// }
741// else
742// return false;
743// // else {
744// // if (dEdx > b5) return false;
745// // }
746
747// return true;
748
749 double a1 = -268.896; double b1 = 198.669;
750 double a2 = -49.0012; double b2 = 88.7214;
751
752 if (mom<0.2) return false;
753
754 if (mom>0.3 && mom<0.5) {
755 if (dEdx < a1*mom+b1) return false;
756 }
757 else if (mom<1.2) {
758 if (dEdx < a2*mom+b2) return false;
759 }
760
761 return true;
762
763}
764
765bool AliFemtoESDTrackCut::IsProtonTPCdEdx(float mom, float dEdx)
766{
767 double a1 = -1800.0; double b1 = 940.0;
768 double a2 = -500.0; double b2 = 420.0;
769 double a3 = -216.7; double b3 = 250.0;
770
771 if (mom<0.2) return false;
772
773 if (mom>0.3 && mom<0.4) {
774 if (dEdx < a1*mom+b1) return false;
775 }
776 else if (mom<0.6) {
777 if (dEdx < a2*mom+b2) return false;
778 }
779 else if (mom<0.9) {
780 if (dEdx < a3*mom+b3) return false;
781 }
782
783 return true;
784
785}
786
787bool AliFemtoESDTrackCut::IsPionTOFTime(float mom, float ttof)
788{
789 double a1 = -427.0; double b1 = 916.0;
790 double a2 = 327.0; double b2 = -888.0;
791 if (mom<0.3) return kFALSE;
792 if (mom>2.0) return kFALSE;
793 if (ttof > a1*mom+b1) return kFALSE;
794 if (ttof < a2*mom+b2) return kFALSE;
795
796 return kTRUE;
797}
798
799bool AliFemtoESDTrackCut::IsKaonTOFTime(float mom, float ttof)
800{
801 double a1 = 000.0; double b1 = -500.0;
802 double a2 = 000.0; double b2 = 500.0;
803 double a3 = 850.0; double b3 = -1503.0;
804 double a4 = -1637.0; double b4 = 3621.0;
805
806 if (mom<0.3) return kFALSE;
807 if (mom>2.06) return kFALSE;
808 if (mom<1.2) {
809 if (ttof > a2*mom+b2) return kFALSE;
810 if (ttof < a1*mom+b1) return kFALSE;
811 }
812 if (mom<1.9) {
813 if (ttof > a2*mom+b2) return kFALSE;
814 if (ttof < a3*mom+b3) return kFALSE;
815 }
816 if (mom<2.06) {
817 if (ttof > a4*mom+b4) return kFALSE;
818 if (ttof < a3*mom+b3) return kFALSE;
819 }
820 return kTRUE;
821}
822
823bool AliFemtoESDTrackCut::IsProtonTOFTime(float mom, float ttof)
824{
825 double a1 = 000.0; double b1 = -915.0;
826 double a2 = 000.0; double b2 = 600.0;
827 double a3 = 572.0; double b3 = -1715.0;
828
829 if (mom<0.3) return kFALSE;
830 if (mom>3.0) return kFALSE;
831 if (mom<1.4) {
832 if (ttof > a2*mom+b2) return kFALSE;
833 if (ttof < a1*mom+b1) return kFALSE;
834 }
835 if (mom<3.0) {
836 if (ttof > a2*mom+b2) return kFALSE;
837 if (ttof < a3*mom+b3) return kFALSE;
838 }
839 return kTRUE;
840}
841
842
843
844
845bool AliFemtoESDTrackCut::IsKaonTPCdEdxNSigma(float mom, float nsigmaK)
846{
c9b0c11d 847// cout<<" AliFemtoESDTrackCut::IsKaonTPCdEdxNSigma "<<mom<<" "<<nsigmaK<<endl;
76ce4b5b 848
849
850 if(mom<0.35 && TMath::Abs(nsigmaK)<5.0)return true;
851 if(mom>=0.35 && mom<0.5 && TMath::Abs(nsigmaK)<3.0)return true;
852 if(mom>=0.5 && mom<0.7 && TMath::Abs(nsigmaK)<2.0)return true;
853
854 return false;
855}
856
76ce4b5b 857bool AliFemtoESDTrackCut::IsKaonTOFNSigma(float mom, float nsigmaK)
858{
c9b0c11d 859// cout<<" AliFemtoESDTrackCut::IsKaonTPCdEdxNSigma "<<mom<<" "<<nsigmaK<<endl;
76ce4b5b 860 //fan
861 // if(mom<1.5 && TMath::Abs(nsigmaK)<3.0)return true;
862 if(mom>=1.5 && TMath::Abs(nsigmaK)<2.0)return true;
863 return false;
864}
865
c9b0c11d 866/*
cbc2bfd8 867bool AliFemtoESDTrackCut::IsKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK)
868{
869
870
871 if(mom<0.5)
872 {
873 if(TMath::Abs(nsigmaTPCK)<2.0)
874 {
875 return true;
876 }
877 else
878 {
879 return false;
880 }
881 }
882
883
884 if(mom>=0.5)
885 {
886 if(TMath::Abs(nsigmaTOFK)<3.0 && TMath::Abs(nsigmaTPCK)<3.0)
887 {
888 return true;
889 }
890 else
891 {
892 return false;
893 }
894 }
895
896// if(mom>1.5 || mom<0.15)return false;
897
c9b0c11d 898
cbc2bfd8 899}
900
c9b0c11d 901*/
902
903//old
76ce4b5b 904bool AliFemtoESDTrackCut::IsKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK)
905{
c9b0c11d 906
ce7b3d98 907 if(mom<0.4)
908 {
909 if(nsigmaTOFK<-999.)
910 {
cbc2bfd8 911 if(TMath::Abs(nsigmaTPCK)<2.0) return true;
ce7b3d98 912 }
913 else if(TMath::Abs(nsigmaTOFK)<3.0 && TMath::Abs(nsigmaTPCK)<3.0) return true;
914 }
915 else if(mom>=0.4 && mom<=0.6)
916 {
917 if(nsigmaTOFK<-999.)
918 {
919 if(TMath::Abs(nsigmaTPCK)<2.0) return true;
920 }
921 else if(TMath::Abs(nsigmaTOFK)<3.0 && TMath::Abs(nsigmaTPCK)<3.0) return true;
922 }
923 else if(nsigmaTOFK<-999.)
924 {
925 return false;
926 }
927 else if(TMath::Abs(nsigmaTOFK)<3.0 && TMath::Abs(nsigmaTPCK)<3.0) return true;
76ce4b5b 928
929 return false;
930}
c9b0c11d 931
76ce4b5b 932
933
76ce4b5b 934bool AliFemtoESDTrackCut::IsPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi)
935{
ce7b3d98 936 if(mom<0.65)
937 {
938 if(nsigmaTOFPi<-999.)
939 {
940 if(mom<0.35 && TMath::Abs(nsigmaTPCPi)<3.0) return true;
941 else if(mom<0.5 && mom>=0.35 && TMath::Abs(nsigmaTPCPi)<3.0) return true;
942 else if(mom>=0.5 && TMath::Abs(nsigmaTPCPi)<2.0) return true;
943 else return false;
944 }
945 else if(TMath::Abs(nsigmaTOFPi)<3.0 && TMath::Abs(nsigmaTPCPi)<3.0) return true;
946 }
947 else if(nsigmaTOFPi<-999.)
948 {
949 return false;
950 }
951 else if(mom<1.5 && TMath::Abs(nsigmaTOFPi)<3.0 && TMath::Abs(nsigmaTPCPi)<5.0) return true;
952 else if(mom>=1.5 && TMath::Abs(nsigmaTOFPi)<2.0 && TMath::Abs(nsigmaTPCPi)<5.0) return true;
76ce4b5b 953
76ce4b5b 954 return false;
955}
956
957
958bool AliFemtoESDTrackCut::IsProtonNSigma(float mom, float nsigmaTPCP, float nsigmaTOFP)
959{
ceeb8ab7 960 if (mom > 0.8) {
961 if (TMath::Hypot( nsigmaTOFP, nsigmaTPCP )/TMath::Sqrt(2) < 3.0)
962 return true;
ce7b3d98 963 }
ceeb8ab7 964 else {
965 if (TMath::Abs(nsigmaTPCP) < 3.0)
966 return true;
ce7b3d98 967 }
76ce4b5b 968
969 return false;
970}
971
972
973void AliFemtoESDTrackCut::SetPIDMethod(ReadPIDMethodType newMethod)
974{
975 fPIDMethod = newMethod;
976}