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