1 /***************************************************************************
6 ***************************************************************************
11 ***************************************************************************
14 * Revision 1.3 2007/05/22 09:01:42 akisiel
15 * Add the possibiloity to save cut settings in the ROOT file
17 * Revision 1.2 2007/05/21 10:38:25 akisiel
18 * More coding rule conformance
20 * Revision 1.1 2007/05/16 10:25:06 akisiel
21 * Making the directory structure of AliFemtoUser flat. All files go into one common directory
23 * Revision 1.4 2007/05/03 09:46:10 akisiel
24 * Fixing Effective C++ warnings
26 * Revision 1.3 2007/04/27 07:25:59 akisiel
27 * Make revisions needed for compilation from the main AliRoot tree
29 * Revision 1.1.1.1 2007/04/25 15:38:41 panos
30 * Importing the HBT code dir
32 * Revision 1.4 2007-04-03 16:00:08 mchojnacki
33 * Changes to iprove memory managing
35 * Revision 1.3 2007/03/13 15:30:03 mchojnacki
36 * adding reader for simulated data
38 * Revision 1.2 2007/03/08 14:58:03 mchojnacki
39 * adding some alice stuff
41 * Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki
42 * First version on CVS
44 **************************************************************************/
46 #include "AliFemtoESDTrackCut.h"
50 ClassImp(AliFemtoESDTrackCut)
56 // 0 7.594129e-02 8.256141e-03
57 // 1 -5.535827e-01 8.170825e-02
58 // 2 1.728591e+00 3.104210e-01
59 // 3 -2.827893e+00 5.827802e-01
60 // 4 2.503553e+00 5.736207e-01
61 // 5 -1.125965e+00 2.821170e-01
62 // 6 2.009036e-01 5.438876e-02
66 // 0 1.063457e+00 8.872043e-03
67 // 1 -4.222208e-01 2.534402e-02
68 // 2 1.042004e-01 1.503945e-02
72 // 0 -7.289406e-02 1.686074e-03
73 // 1 4.415666e-01 1.143939e-02
74 // 2 -2.996790e-01 1.840964e-02
75 // 3 6.704652e-02 7.783990e-03
79 // 0 -3.730200e-02 2.347311e-03
80 // 1 1.163684e-01 1.319316e-02
81 // 2 8.354116e-02 1.997948e-02
82 // 3 -4.608098e-02 8.336400e-03
85 AliFemtoESDTrackCut::AliFemtoESDTrackCut() :
92 fMaxITSchiNdof(1000.0),
93 fMaxTPCchiNdof(1000.0),
94 fMaxSigmaToVertex(1000.0),
102 fMaxPforTOFpid(10000.0),
104 fMaxPforTPCpid(10000.0),
106 fMaxPforITSpid(10000.0)
108 // Default constructor
109 fNTracksPassed = fNTracksFailed = 0;
110 fCharge = 0; // takes both charges 0
111 fPt[0]=0.0; fPt[1] = 100.0;//100
112 fRapidity[0]=-2; fRapidity[1]=2;//-2 2
113 fEta[0]=-2; fEta[1]=2;//-2 2
114 fPidProbElectron[0]=-1;fPidProbElectron[1]=2;
115 fPidProbPion[0]=-1; fPidProbPion[1]=2;
116 fPidProbKaon[0]=-1;fPidProbKaon[1]=2;
117 fPidProbProton[0]=-1;fPidProbProton[1]=2;
118 fPidProbMuon[0]=-1;fPidProbMuon[1]=2;
124 //------------------------------
125 AliFemtoESDTrackCut::~AliFemtoESDTrackCut(){
128 //------------------------------
129 bool AliFemtoESDTrackCut::Pass(const AliFemtoTrack* track)
131 // test the particle and return
132 // true if it meets all the criteria
133 // false if it doesn't meet at least one of the criteria
136 //cout<<"AliFemtoESD cut"<<endl;
137 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
140 //cout<<" status "<<track->Label()<<" "<<track->Flags()<<" "<<track->TPCnclsF()<<" "<<track->ITSncls()<<endl;
141 if ((track->Flags()&fStatus)!=fStatus)
143 // cout<<track->Flags()<<" "<<fStatus<<" no go through status"<<endl;
149 if ((track->KinkIndex(0)) || (track->KinkIndex(1)) || (track->KinkIndex(2)))
152 if (fminTPCclsF>track->TPCnclsF())
154 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
157 if (fminTPCncls>track->TPCncls())
159 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
162 if (fminITScls>track->ITSncls())
164 //cout<<" No go because ITS Number of Cls"<<fminITScls<< " "<<track->ITSncls()<<endl;
168 if (fMaxImpactXY < TMath::Abs(track->ImpactD()))
171 if (fMaxImpactZ < TMath::Abs(track->ImpactZ()))
174 if (fMaxSigmaToVertex < track->SigmaToVertex()) {
178 if (track->ITSncls() > 0)
179 if ((track->ITSchi2()/track->ITSncls()) > fMaxITSchiNdof) {
183 if (track->TPCncls() > 0)
184 if ((track->TPCchi2()/track->TPCncls()) > fMaxTPCchiNdof) {
190 //cout<<"labels"<<endl;
194 // cout<<"No Go Through the cut"<<endl;
195 // cout<<fLabel<<" Label="<<track->Label()<<endl;
201 //cout<<"AliFemtoESD cut ch "<<endl;
202 //cout<<fCharge<<" Charge="<<track->Charge()<<endl;
203 if (track->Charge()!= fCharge)
206 // cout<<"No Go Through the cut"<<endl;
207 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
211 Bool_t tTPCPidIn = (track->Flags()&AliFemtoTrack::kTPCpid)>0;
212 Bool_t tITSPidIn = (track->Flags()&AliFemtoTrack::kITSpid)>0;
213 Bool_t tTOFPidIn = (track->Flags()&AliFemtoTrack::kTOFpid)>0;
215 if(fMinPforTOFpid > 0 && track->P().Mag() > fMinPforTOFpid &&
216 track->P().Mag() < fMaxPforTOFpid && !tTOFPidIn)
222 if(fMinPforTPCpid > 0 && track->P().Mag() > fMinPforTPCpid &&
223 track->P().Mag() < fMaxPforTPCpid && !tTPCPidIn)
229 if(fMinPforITSpid > 0 && track->P().Mag() > fMinPforITSpid &&
230 track->P().Mag() < fMaxPforITSpid && !tITSPidIn)
237 float tEnergy = ::sqrt(track->P().Mag2()+fMass*fMass);
238 float tRapidity = 0.5*::log((tEnergy+track->P().z())/(tEnergy-track->P().z()));
239 float tPt = ::sqrt((track->P().x())*(track->P().x())+(track->P().y())*(track->P().y()));
240 float tEta = track->P().PseudoRapidity();
241 if ((tRapidity<fRapidity[0])||(tRapidity>fRapidity[1]))
244 //cout<<"No Go Through the cut"<<endl;
245 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
248 if ((tEta<fEta[0])||(tEta>fEta[1]))
251 //cout<<"No Go Through the cut"<<endl;
252 //cout<<fEta[0]<<" < Eta ="<<tEta<<" <"<<fEta[1]<<endl;
255 if ((tPt<fPt[0])||(tPt>fPt[1]))
258 //cout<<"No Go Through the cut"<<endl;
259 //cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
262 // cout << "Track has pids: "
263 // << track->PidProbElectron() << " "
264 // << track->PidProbMuon() << " "
265 // << track->PidProbPion() << " "
266 // << track->PidProbKaon() << " "
267 // << track->PidProbProton() << " "
268 // << track->PidProbElectron()+track->PidProbMuon()+track->PidProbPion()+track->PidProbKaon()+track->PidProbProton() << endl;
271 if ((track->PidProbElectron()<fPidProbElectron[0])||(track->PidProbElectron()>fPidProbElectron[1]))
274 //cout<<"No Go Through the cut"<<endl;
275 //cout<<fPidProbElectron[0]<<" < e ="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
278 if ((track->PidProbPion()<fPidProbPion[0])||(track->PidProbPion()>fPidProbPion[1]))
281 //cout<<"No Go Through the cut"<<endl;
282 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
285 if ((track->PidProbKaon()<fPidProbKaon[0])||(track->PidProbKaon()>fPidProbKaon[1]))
288 //cout<<"No Go Through the cut"<<endl;
289 //cout<<fPidProbKaon[0]<<" < k ="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
292 if ((track->PidProbProton()<fPidProbProton[0])||(track->PidProbProton()>fPidProbProton[1]))
295 //cout<<"No Go Through the cut"<<endl;
296 //cout<<fPidProbProton[0]<<" < p ="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
299 if ((track->PidProbMuon()<fPidProbMuon[0])||(track->PidProbMuon()>fPidProbMuon[1]))
302 //cout<<"No Go Through the cut"<<endl;
303 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
309 if (fMostProbable == 2) {
310 if (IsPionTPCdEdx(track->P().Mag(), track->TPCsignal()))
313 else if (fMostProbable == 3) {
314 if (IsKaonTPCdEdx(track->P().Mag(), track->TPCsignal()))
318 tMost[0] = track->PidProbElectron()*PidFractionElectron(track->P().Mag());
320 tMost[2] = track->PidProbPion()*PidFractionPion(track->P().Mag());
321 tMost[3] = track->PidProbKaon()*PidFractionKaon(track->P().Mag());
322 tMost[4] = track->PidProbProton()*PidFractionProton(track->P().Mag());
324 for (int ip=0; ip<5; ip++)
325 if (tMost[ip] > ipidmax) { ipidmax = tMost[ip]; imost = ip; };
327 if (imost != fMostProbable) return false;
330 // cout<<"Go Through the cut"<<endl;
331 // cout<<fLabel<<" Label="<<track->Label()<<endl;
332 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
333 // cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
334 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
335 //cout<<fPidProbElectron[0]<<" < e="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
336 //cout<<fPidProbPion[0]<<" < pi="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
337 //cout<<fPidProbKaon[0]<<" < k="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
338 //cout<<fPidProbProton[0]<<" < p="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
339 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
345 //------------------------------
346 AliFemtoString AliFemtoESDTrackCut::Report()
348 // Prepare report from the execution
351 sprintf(tCtemp,"Particle mass:\t%E\n",this->Mass());
353 sprintf(tCtemp,"Particle charge:\t%d\n",fCharge);
355 sprintf(tCtemp,"Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
357 sprintf(tCtemp,"Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
359 sprintf(tCtemp,"Particle eta:\t%E - %E\n",fEta[0],fEta[1]);
361 sprintf(tCtemp,"Number of tracks which passed:\t%ld Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
363 AliFemtoString returnThis = tStemp;
366 TList *AliFemtoESDTrackCut::ListSettings()
368 // return a list of settings in a writable form
369 TList *tListSetttings = new TList();
371 snprintf(buf, 200, "AliFemtoESDTrackCut.mass=%f", this->Mass());
372 tListSetttings->AddLast(new TObjString(buf));
374 snprintf(buf, 200, "AliFemtoESDTrackCut.charge=%i", fCharge);
375 tListSetttings->AddLast(new TObjString(buf));
376 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobpion.minimum=%f", fPidProbPion[0]);
377 tListSetttings->AddLast(new TObjString(buf));
378 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobpion.maximum=%f", fPidProbPion[1]);
379 tListSetttings->AddLast(new TObjString(buf));
380 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobkaon.minimum=%f", fPidProbKaon[0]);
381 tListSetttings->AddLast(new TObjString(buf));
382 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobkaon.maximum=%f", fPidProbKaon[1]);
383 tListSetttings->AddLast(new TObjString(buf));
384 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobproton.minimum=%f", fPidProbProton[0]);
385 tListSetttings->AddLast(new TObjString(buf));
386 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobproton.maximum=%f", fPidProbProton[1]);
387 tListSetttings->AddLast(new TObjString(buf));
388 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobelectron.minimum=%f", fPidProbElectron[0]);
389 tListSetttings->AddLast(new TObjString(buf));
390 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobelectron.maximum=%f", fPidProbElectron[1]);
391 tListSetttings->AddLast(new TObjString(buf));
392 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobMuon.minimum=%f", fPidProbMuon[0]);
393 tListSetttings->AddLast(new TObjString(buf));
394 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobMuon.maximum=%f", fPidProbMuon[1]);
395 tListSetttings->AddLast(new TObjString(buf));
396 snprintf(buf, 200, "AliFemtoESDTrackCut.minimumtpcclusters=%i", fminTPCclsF);
397 tListSetttings->AddLast(new TObjString(buf));
398 snprintf(buf, 200, "AliFemtoESDTrackCut.minimumitsclusters=%i", fminTPCclsF);
399 tListSetttings->AddLast(new TObjString(buf));
400 snprintf(buf, 200, "AliFemtoESDTrackCut.pt.minimum=%f", fPt[0]);
401 tListSetttings->AddLast(new TObjString(buf));
402 snprintf(buf, 200, "AliFemtoESDTrackCut.pt.maximum=%f", fPt[1]);
403 tListSetttings->AddLast(new TObjString(buf));
404 snprintf(buf, 200, "AliFemtoESDTrackCut.rapidity.minimum=%f", fRapidity[0]);
405 tListSetttings->AddLast(new TObjString(buf));
406 snprintf(buf, 200, "AliFemtoESDTrackCut.rapidity.maximum=%f", fRapidity[1]);
407 tListSetttings->AddLast(new TObjString(buf));
408 snprintf(buf, 200, "AliFemtoESDTrackCut.removekinks=%i", fRemoveKinks);
409 tListSetttings->AddLast(new TObjString(buf));
410 snprintf(buf, 200, "AliFemtoESDTrackCut.maxitschindof=%f", fMaxITSchiNdof);
411 tListSetttings->AddLast(new TObjString(buf));
412 snprintf(buf, 200, "AliFemtoESDTrackCut.maxtpcchindof=%f", fMaxTPCchiNdof);
413 tListSetttings->AddLast(new TObjString(buf));
414 snprintf(buf, 200, "AliFemtoESDTrackCut.maxsigmatovertex=%f", fMaxSigmaToVertex);
415 tListSetttings->AddLast(new TObjString(buf));
416 snprintf(buf, 200, "AliFemtoESDTrackCut.maximpactxy=%f", fMaxImpactXY);
417 tListSetttings->AddLast(new TObjString(buf));
418 snprintf(buf, 200, "AliFemtoESDTrackCut.maximpactz=%f", fMaxImpactZ);
419 tListSetttings->AddLast(new TObjString(buf));
421 if (fMostProbable == 2)
422 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Pion");
423 if (fMostProbable == 3)
424 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Kaon");
425 if (fMostProbable == 4)
426 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Proton");
427 tListSetttings->AddLast(new TObjString(buf));
429 return tListSetttings;
431 void AliFemtoESDTrackCut::SetRemoveKinks(const bool& flag)
438 // 0 7.594129e-02 8.256141e-03
439 // 1 -5.535827e-01 8.170825e-02
440 // 2 1.728591e+00 3.104210e-01
441 // 3 -2.827893e+00 5.827802e-01
442 // 4 2.503553e+00 5.736207e-01
443 // 5 -1.125965e+00 2.821170e-01
444 // 6 2.009036e-01 5.438876e-02
445 float AliFemtoESDTrackCut::PidFractionElectron(float mom) const
447 // Provide a parameterized fraction of electrons dependent on momentum
448 if (mom<0.13) return 0.0;
449 if (mom>1.8) return 0.0;
452 +1.728591e+00*mom*mom
453 -2.827893e+00*mom*mom*mom
454 +2.503553e+00*mom*mom*mom*mom
455 -1.125965e+00*mom*mom*mom*mom*mom
456 +2.009036e-01*mom*mom*mom*mom*mom*mom);
461 // 0 1.063457e+00 8.872043e-03
462 // 1 -4.222208e-01 2.534402e-02
463 // 2 1.042004e-01 1.503945e-02
464 float AliFemtoESDTrackCut::PidFractionPion(float mom) const
466 // Provide a parameterized fraction of pions dependent on momentum
467 if (mom<0.13) return 0.0;
468 if (mom>2.0) return 0.0;
469 return ( 1.063457e+00
471 +1.042004e-01*mom*mom);
476 // 0 -7.289406e-02 1.686074e-03
477 // 1 4.415666e-01 1.143939e-02
478 // 2 -2.996790e-01 1.840964e-02
479 // 3 6.704652e-02 7.783990e-03
480 float AliFemtoESDTrackCut::PidFractionKaon(float mom) const
482 // Provide a parameterized fraction of kaons dependent on momentum
483 if (mom<0.18) return 0.0;
484 if (mom>2.0) return 0.0;
485 return (-7.289406e-02
487 -2.996790e-01*mom*mom
488 +6.704652e-02*mom*mom*mom);
493 // 0 -3.730200e-02 2.347311e-03
494 // 1 1.163684e-01 1.319316e-02
495 // 2 8.354116e-02 1.997948e-02
496 // 3 -4.608098e-02 8.336400e-03
497 float AliFemtoESDTrackCut::PidFractionProton(float mom) const
499 // Provide a parameterized fraction of protons dependent on momentum
500 if (mom<0.26) return 0.0;
501 if (mom>2.0) return 0.0;
502 return (-3.730200e-02
504 +8.354116e-02*mom*mom
505 -4.608098e-02*mom*mom*mom);
508 void AliFemtoESDTrackCut::SetMomRangeTOFpidIs(const float& minp, const float& maxp)
510 fMinPforTOFpid = minp;
511 fMaxPforTOFpid = maxp;
514 void AliFemtoESDTrackCut::SetMomRangeTPCpidIs(const float& minp, const float& maxp)
516 fMinPforTPCpid = minp;
517 fMaxPforTPCpid = maxp;
520 void AliFemtoESDTrackCut::SetMomRangeITSpidIs(const float& minp, const float& maxp)
522 fMinPforITSpid = minp;
523 fMaxPforITSpid = maxp;
526 bool AliFemtoESDTrackCut::IsPionTPCdEdx(float mom, float dEdx)
528 double a1 = -95.4545, b1 = 86.5455;
529 double a2 = 0.0, b2 = 56.0;
532 if (dEdx < a1*mom+b1) return true;
534 if (dEdx < a2*mom+b2) return true;
539 bool AliFemtoESDTrackCut::IsKaonTPCdEdx(float mom, float dEdx)
541 double a1 = -159.1, b1 = 145.9;
542 double a2 = 0.0, b2 = 60.0;
543 double a3 = -138.235, b3 = 166.44;
544 double a4 = -2015.79, b4 = 973.789;
547 if (dEdx > a1*mom+b1) return true;
549 else if (mom < 0.43) {
550 if ((dEdx > a1*mom+b1) && (dEdx < a4*mom+b4)) return true;
552 else if (mom < 0.54) {
553 if ((dEdx > a1*mom+b1) && (dEdx < a3*mom+b3)) return true;
555 else if (mom < 0.77) {
556 if ((dEdx > a2*mom+b2) && (dEdx < a3*mom+b3)) return true;