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 fPidProbElectron[0]=-1;fPidProbElectron[1]=2;
114 fPidProbPion[0]=-1; fPidProbPion[1]=2;
115 fPidProbKaon[0]=-1;fPidProbKaon[1]=2;
116 fPidProbProton[0]=-1;fPidProbProton[1]=2;
117 fPidProbMuon[0]=-1;fPidProbMuon[1]=2;
123 //------------------------------
124 AliFemtoESDTrackCut::~AliFemtoESDTrackCut(){
127 //------------------------------
128 bool AliFemtoESDTrackCut::Pass(const AliFemtoTrack* track)
130 // test the particle and return
131 // true if it meets all the criteria
132 // false if it doesn't meet at least one of the criteria
135 //cout<<"AliFemtoESD cut"<<endl;
136 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
139 //cout<<" status "<<track->Label()<<" "<<track->Flags()<<" "<<track->TPCnclsF()<<" "<<track->ITSncls()<<endl;
140 if ((track->Flags()&fStatus)!=fStatus)
142 // cout<<track->Flags()<<" "<<fStatus<<" no go through status"<<endl;
148 if ((track->KinkIndex(0)) || (track->KinkIndex(1)) || (track->KinkIndex(2)))
151 if (fminTPCclsF>track->TPCnclsF())
153 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
156 if (fminTPCncls>track->TPCncls())
158 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
161 if (fminITScls>track->ITSncls())
163 //cout<<" No go because ITS Number of Cls"<<fminITScls<< " "<<track->ITSncls()<<endl;
167 if (fMaxImpactXY < TMath::Abs(track->ImpactD()))
170 if (fMaxImpactZ < TMath::Abs(track->ImpactZ()))
173 if (fMaxSigmaToVertex < track->SigmaToVertex()) {
177 if (track->ITSncls() > 0)
178 if ((track->ITSchi2()/track->ITSncls()) > fMaxITSchiNdof) {
182 if (track->TPCncls() > 0)
183 if ((track->TPCchi2()/track->TPCncls()) > fMaxTPCchiNdof) {
189 //cout<<"labels"<<endl;
193 // cout<<"No Go Through the cut"<<endl;
194 // cout<<fLabel<<" Label="<<track->Label()<<endl;
200 //cout<<"AliFemtoESD cut ch "<<endl;
201 //cout<<fCharge<<" Charge="<<track->Charge()<<endl;
202 if (track->Charge()!= fCharge)
205 // cout<<"No Go Through the cut"<<endl;
206 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
210 Bool_t tTPCPidIn = (track->Flags()&AliFemtoTrack::kTPCpid)>0;
211 Bool_t tITSPidIn = (track->Flags()&AliFemtoTrack::kITSpid)>0;
212 Bool_t tTOFPidIn = (track->Flags()&AliFemtoTrack::kTOFpid)>0;
214 if(fMinPforTOFpid > 0 && track->P().mag() > fMinPforTOFpid &&
215 track->P().mag() < fMaxPforTOFpid && !tTOFPidIn)
221 if(fMinPforTPCpid > 0 && track->P().mag() > fMinPforTPCpid &&
222 track->P().mag() < fMaxPforTPCpid && !tTPCPidIn)
228 if(fMinPforITSpid > 0 && track->P().mag() > fMinPforITSpid &&
229 track->P().mag() < fMaxPforITSpid && !tITSPidIn)
236 float tEnergy = ::sqrt(track->P().mag2()+fMass*fMass);
237 float tRapidity = 0.5*::log((tEnergy+track->P().z())/(tEnergy-track->P().z()));
238 float tPt = ::sqrt((track->P().x())*(track->P().x())+(track->P().y())*(track->P().y()));
239 if ((tRapidity<fRapidity[0])||(tRapidity>fRapidity[1]))
242 //cout<<"No Go Through the cut"<<endl;
243 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
246 if ((tPt<fPt[0])||(tPt>fPt[1]))
249 //cout<<"No Go Through the cut"<<endl;
250 //cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
253 // cout << "Track has pids: "
254 // << track->PidProbElectron() << " "
255 // << track->PidProbMuon() << " "
256 // << track->PidProbPion() << " "
257 // << track->PidProbKaon() << " "
258 // << track->PidProbProton() << " "
259 // << track->PidProbElectron()+track->PidProbMuon()+track->PidProbPion()+track->PidProbKaon()+track->PidProbProton() << endl;
262 if ((track->PidProbElectron()<fPidProbElectron[0])||(track->PidProbElectron()>fPidProbElectron[1]))
265 //cout<<"No Go Through the cut"<<endl;
266 //cout<<fPidProbElectron[0]<<" < e ="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
269 if ((track->PidProbPion()<fPidProbPion[0])||(track->PidProbPion()>fPidProbPion[1]))
272 //cout<<"No Go Through the cut"<<endl;
273 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
276 if ((track->PidProbKaon()<fPidProbKaon[0])||(track->PidProbKaon()>fPidProbKaon[1]))
279 //cout<<"No Go Through the cut"<<endl;
280 //cout<<fPidProbKaon[0]<<" < k ="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
283 if ((track->PidProbProton()<fPidProbProton[0])||(track->PidProbProton()>fPidProbProton[1]))
286 //cout<<"No Go Through the cut"<<endl;
287 //cout<<fPidProbProton[0]<<" < p ="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
290 if ((track->PidProbMuon()<fPidProbMuon[0])||(track->PidProbMuon()>fPidProbMuon[1]))
293 //cout<<"No Go Through the cut"<<endl;
294 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
299 tMost[0] = track->PidProbElectron()*PidFractionElectron(track->P().mag());
301 tMost[2] = track->PidProbPion()*PidFractionPion(track->P().mag());
302 tMost[3] = track->PidProbKaon()*PidFractionKaon(track->P().mag());
303 tMost[4] = track->PidProbProton()*PidFractionProton(track->P().mag());
306 for (int ip=0; ip<5; ip++)
307 if (tMost[ip] > ipidmax) { ipidmax = tMost[ip]; imost = ip; };
308 if (imost != fMostProbable) return false;
311 // cout<<"Go Through the cut"<<endl;
312 // cout<<fLabel<<" Label="<<track->Label()<<endl;
313 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
314 // cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
315 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
316 //cout<<fPidProbElectron[0]<<" < e="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
317 //cout<<fPidProbPion[0]<<" < pi="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
318 //cout<<fPidProbKaon[0]<<" < k="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
319 //cout<<fPidProbProton[0]<<" < p="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
320 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
326 //------------------------------
327 AliFemtoString AliFemtoESDTrackCut::Report()
329 // Prepare report from the execution
332 sprintf(tCtemp,"Particle mass:\t%E\n",this->Mass());
334 sprintf(tCtemp,"Particle charge:\t%d\n",fCharge);
336 sprintf(tCtemp,"Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
338 sprintf(tCtemp,"Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
340 sprintf(tCtemp,"Number of tracks which passed:\t%ld Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
342 AliFemtoString returnThis = tStemp;
345 TList *AliFemtoESDTrackCut::ListSettings()
347 // return a list of settings in a writable form
348 TList *tListSetttings = new TList();
350 snprintf(buf, 200, "AliFemtoESDTrackCut.mass=%f", this->Mass());
351 tListSetttings->AddLast(new TObjString(buf));
353 snprintf(buf, 200, "AliFemtoESDTrackCut.charge=%i", fCharge);
354 tListSetttings->AddLast(new TObjString(buf));
355 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobpion.minimum=%f", fPidProbPion[0]);
356 tListSetttings->AddLast(new TObjString(buf));
357 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobpion.maximum=%f", fPidProbPion[1]);
358 tListSetttings->AddLast(new TObjString(buf));
359 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobkaon.minimum=%f", fPidProbKaon[0]);
360 tListSetttings->AddLast(new TObjString(buf));
361 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobkaon.maximum=%f", fPidProbKaon[1]);
362 tListSetttings->AddLast(new TObjString(buf));
363 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobproton.minimum=%f", fPidProbProton[0]);
364 tListSetttings->AddLast(new TObjString(buf));
365 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobproton.maximum=%f", fPidProbProton[1]);
366 tListSetttings->AddLast(new TObjString(buf));
367 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobelectron.minimum=%f", fPidProbElectron[0]);
368 tListSetttings->AddLast(new TObjString(buf));
369 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobelectron.maximum=%f", fPidProbElectron[1]);
370 tListSetttings->AddLast(new TObjString(buf));
371 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobMuon.minimum=%f", fPidProbMuon[0]);
372 tListSetttings->AddLast(new TObjString(buf));
373 snprintf(buf, 200, "AliFemtoESDTrackCut.pidprobMuon.maximum=%f", fPidProbMuon[1]);
374 tListSetttings->AddLast(new TObjString(buf));
375 snprintf(buf, 200, "AliFemtoESDTrackCut.minimumtpcclusters=%i", fminTPCclsF);
376 tListSetttings->AddLast(new TObjString(buf));
377 snprintf(buf, 200, "AliFemtoESDTrackCut.minimumitsclusters=%i", fminTPCclsF);
378 tListSetttings->AddLast(new TObjString(buf));
379 snprintf(buf, 200, "AliFemtoESDTrackCut.pt.minimum=%f", fPt[0]);
380 tListSetttings->AddLast(new TObjString(buf));
381 snprintf(buf, 200, "AliFemtoESDTrackCut.pt.maximum=%f", fPt[1]);
382 tListSetttings->AddLast(new TObjString(buf));
383 snprintf(buf, 200, "AliFemtoESDTrackCut.rapidity.minimum=%f", fRapidity[0]);
384 tListSetttings->AddLast(new TObjString(buf));
385 snprintf(buf, 200, "AliFemtoESDTrackCut.rapidity.maximum=%f", fRapidity[1]);
386 tListSetttings->AddLast(new TObjString(buf));
387 snprintf(buf, 200, "AliFemtoESDTrackCut.removekinks=%i", fRemoveKinks);
388 tListSetttings->AddLast(new TObjString(buf));
389 snprintf(buf, 200, "AliFemtoESDTrackCut.maxitschindof=%f", fMaxITSchiNdof);
390 tListSetttings->AddLast(new TObjString(buf));
391 snprintf(buf, 200, "AliFemtoESDTrackCut.maxtpcchindof=%f", fMaxTPCchiNdof);
392 tListSetttings->AddLast(new TObjString(buf));
393 snprintf(buf, 200, "AliFemtoESDTrackCut.maxsigmatovertex=%f", fMaxSigmaToVertex);
394 tListSetttings->AddLast(new TObjString(buf));
395 snprintf(buf, 200, "AliFemtoESDTrackCut.maximpactxy=%f", fMaxImpactXY);
396 tListSetttings->AddLast(new TObjString(buf));
397 snprintf(buf, 200, "AliFemtoESDTrackCut.maximpactz=%f", fMaxImpactZ);
398 tListSetttings->AddLast(new TObjString(buf));
400 if (fMostProbable == 2)
401 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Pion");
402 if (fMostProbable == 3)
403 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Kaon");
404 if (fMostProbable == 4)
405 snprintf(buf, 200, "AliFemtoESDTrackCut.mostprobable=%s", "Proton");
406 tListSetttings->AddLast(new TObjString(buf));
408 return tListSetttings;
410 void AliFemtoESDTrackCut::SetRemoveKinks(const bool& flag)
417 // 0 7.594129e-02 8.256141e-03
418 // 1 -5.535827e-01 8.170825e-02
419 // 2 1.728591e+00 3.104210e-01
420 // 3 -2.827893e+00 5.827802e-01
421 // 4 2.503553e+00 5.736207e-01
422 // 5 -1.125965e+00 2.821170e-01
423 // 6 2.009036e-01 5.438876e-02
424 float AliFemtoESDTrackCut::PidFractionElectron(float mom) const
426 // Provide a parameterized fraction of electrons dependent on momentum
427 if (mom<0.13) return 0.0;
428 if (mom>1.8) return 0.0;
431 +1.728591e+00*mom*mom
432 -2.827893e+00*mom*mom*mom
433 +2.503553e+00*mom*mom*mom*mom
434 -1.125965e+00*mom*mom*mom*mom*mom
435 +2.009036e-01*mom*mom*mom*mom*mom*mom);
440 // 0 1.063457e+00 8.872043e-03
441 // 1 -4.222208e-01 2.534402e-02
442 // 2 1.042004e-01 1.503945e-02
443 float AliFemtoESDTrackCut::PidFractionPion(float mom) const
445 // Provide a parameterized fraction of pions dependent on momentum
446 if (mom<0.13) return 0.0;
447 if (mom>2.0) return 0.0;
448 return ( 1.063457e+00
450 +1.042004e-01*mom*mom);
455 // 0 -7.289406e-02 1.686074e-03
456 // 1 4.415666e-01 1.143939e-02
457 // 2 -2.996790e-01 1.840964e-02
458 // 3 6.704652e-02 7.783990e-03
459 float AliFemtoESDTrackCut::PidFractionKaon(float mom) const
461 // Provide a parameterized fraction of kaons dependent on momentum
462 if (mom<0.18) return 0.0;
463 if (mom>2.0) return 0.0;
464 return (-7.289406e-02
466 -2.996790e-01*mom*mom
467 +6.704652e-02*mom*mom*mom);
472 // 0 -3.730200e-02 2.347311e-03
473 // 1 1.163684e-01 1.319316e-02
474 // 2 8.354116e-02 1.997948e-02
475 // 3 -4.608098e-02 8.336400e-03
476 float AliFemtoESDTrackCut::PidFractionProton(float mom) const
478 // Provide a parameterized fraction of protons dependent on momentum
479 if (mom<0.26) return 0.0;
480 if (mom>2.0) return 0.0;
481 return (-3.730200e-02
483 +8.354116e-02*mom*mom
484 -4.608098e-02*mom*mom*mom);
487 void AliFemtoESDTrackCut::SetMomRangeTOFpidIs(const float& minp, const float& maxp)
489 fMinPforTOFpid = minp;
490 fMaxPforTOFpid = maxp;
493 void AliFemtoESDTrackCut::SetMomRangeTPCpidIs(const float& minp, const float& maxp)
495 fMinPforTPCpid = minp;
496 fMaxPforTPCpid = maxp;
499 void AliFemtoESDTrackCut::SetMomRangeITSpidIs(const float& minp, const float& maxp)
501 fMinPforITSpid = minp;
502 fMaxPforITSpid = maxp;