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