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