2 ***************************************************************************
7 ***************************************************************************
12 ***************************************************************************
15 * Revision 1.3 2007/05/22 09:01:42 akisiel
16 * Add the possibiloity to save cut settings in the ROOT file
18 * Revision 1.2 2007/05/21 10:38:25 akisiel
19 * More coding rule conformance
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
24 * Revision 1.4 2007/05/03 09:46:10 akisiel
25 * Fixing Effective C++ warnings
27 * Revision 1.3 2007/04/27 07:25:59 akisiel
28 * Make revisions needed for compilation from the main AliRoot tree
30 * Revision 1.1.1.1 2007/04/25 15:38:41 panos
31 * Importing the HBT code dir
33 * Revision 1.4 2007-04-03 16:00:08 mchojnacki
34 * Changes to iprove memory managing
36 * Revision 1.3 2007/03/13 15:30:03 mchojnacki
37 * adding reader for simulated data
39 * Revision 1.2 2007/03/08 14:58:03 mchojnacki
40 * adding some alice stuff
42 * Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki
43 * First version on CVS
45 **************************************************************************/
47 #include "AliFemtoMJTrackCut.h"
51 ClassImp(AliFemtoMJTrackCut)
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
67 // 0 1.063457e+00 8.872043e-03
68 // 1 -4.222208e-01 2.534402e-02
69 // 2 1.042004e-01 1.503945e-02
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
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
86 AliFemtoMJTrackCut::AliFemtoMJTrackCut() :
91 fNsigmaTPCTOF(kFALSE),
92 fNsigmaTPConly(kFALSE),
97 fMaxITSchiNdof(1000.0),
98 fMaxTPCchiNdof(1000.0),
99 fMaxSigmaToVertex(1000.0),
102 fRemoveKinks(kFALSE),
103 fRemoveITSFake(kFALSE),
105 fMaxImpactXY(1000.0),
106 fMinImpactXY(-1000.0),
108 fMaxImpactXYPtOff(1000.0),
109 fMaxImpactXYPtNrm(1000.0),
110 fMaxImpactXYPtPow(1000.0),
112 fMaxPforTOFpid(10000.0),
114 fMaxPforTPCpid(10000.0),
116 fMaxPforITSpid(10000.0),
117 fElectronRejection(0)
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;
130 for (Int_t i = 0; i < 3; i++)
131 fCutClusterRequirementITS[i] = AliESDtrackCuts::kOff;
137 fNsigmaTPCTOF=kFALSE;
138 fNsigmaTPConly=kFALSE;
141 //------------------------------
142 AliFemtoMJTrackCut::~AliFemtoMJTrackCut(){
145 //------------------------------
146 bool AliFemtoMJTrackCut::Pass(const AliFemtoTrack* track)
148 //cout<<"AliFemtoMJTrackCut::Pass"<<endl;
150 // test the particle and return
151 // true if it meets all the criteria
152 // false if it doesn't meet at least one of the criteria
155 //cout<<"AliFemtoESD cut"<<endl;
156 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
159 //cout<<" status "<<track->Label()<<" "<<track->Flags()<<" "<<track->TPCnclsF()<<" "<<track->ITSncls()<<endl;
160 if ((track->Flags()&fStatus)!=fStatus)
162 // cout<<track->Flags()<<" "<<fStatus<<" no go through status"<<endl;
168 if ((track->KinkIndex(0)) || (track->KinkIndex(1)) || (track->KinkIndex(2)))
171 if (fRemoveITSFake) {
172 if (track->ITSncls() < 0)
175 if (fminTPCclsF>track->TPCnclsF())
177 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
180 if (fminTPCncls>track->TPCncls())
182 //cout<<" No go because TPC Number of ClsF"<<fminTPCclsF<< " "<<track->TPCnclsF()<<endl;
185 if (fminITScls>track->ITSncls())
187 //cout<<" No go because ITS Number of Cls"<<fminITScls<< " "<<track->ITSncls()<<endl;
191 if (fMaxImpactXY < TMath::Abs(track->ImpactD()))
194 if (fMinImpactXY > TMath::Abs(track->ImpactD()))
197 if (fMaxImpactZ < TMath::Abs(track->ImpactZ()))
200 if (fMaxSigmaToVertex < track->SigmaToVertex()) {
204 if (track->ITSncls() > 0)
205 if ((track->ITSchi2()/track->ITSncls()) > fMaxITSchiNdof) {
209 if (track->TPCncls() > 0)
210 if ((track->TPCchi2()/track->TPCncls()) > fMaxTPCchiNdof) {
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)))
220 //cout<<"labels"<<endl;
224 // cout<<"No Go Through the cut"<<endl;
225 // cout<<fLabel<<" Label="<<track->Label()<<endl;
231 //cout<<"AliFemtoESD cut ch "<<endl;
232 //cout<<fCharge<<" Charge="<<track->Charge()<<endl;
233 if (track->Charge()!= fCharge)
236 // cout<<"No Go Through the cut"<<endl;
237 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
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;
249 if(fMinPforTOFpid > 0 && track->P().Mag() > fMinPforTOFpid &&
250 track->P().Mag() < fMaxPforTOFpid && !tTOFPidIn)
256 if(fMinPforTPCpid > 0 && track->P().Mag() > fMinPforTPCpid &&
257 track->P().Mag() < fMaxPforTPCpid && !tTPCPidIn)
263 if(fMinPforITSpid > 0 && track->P().Mag() > fMinPforITSpid &&
264 track->P().Mag() < fMaxPforITSpid && !tITSPidIn)
271 float tEnergy = ::sqrt(track->P().Mag2()+fMass*fMass);
273 if(tEnergy-track->P().z()!=0 && (tEnergy+track->P().z())/(tEnergy-track->P().z())>0)
274 tRapidity = 0.5*::log((tEnergy+track->P().z())/(tEnergy-track->P().z()));
275 float tPt = ::sqrt((track->P().x())*(track->P().x())+(track->P().y())*(track->P().y()));
276 float tEta = track->P().PseudoRapidity();
278 if (fMaxImpactXYPtOff < 999.0) {
279 if ((fMaxImpactXYPtOff + fMaxImpactXYPtNrm*TMath::Power(tPt, fMaxImpactXYPtPow)) < TMath::Abs(track->ImpactD())) {
285 if ((tRapidity<fRapidity[0])||(tRapidity>fRapidity[1]))
288 //cout<<"No Go Through the cut"<<endl;
289 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
292 if ((tEta<fEta[0])||(tEta>fEta[1]))
295 //cout<<"No Go Through the cut"<<endl;
296 //cout<<fEta[0]<<" < Eta ="<<tEta<<" <"<<fEta[1]<<endl;
299 if ((tPt<fPt[0])||(tPt>fPt[1]))
302 //cout<<"No Go Through the cut"<<endl;
303 //cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
310 // cout << "Track has pids: "
311 // << track->PidProbElectron() << " "
312 // << track->PidProbMuon() << " "
313 // << track->PidProbPion() << " "
314 // << track->PidProbKaon() << " "
315 // << track->PidProbProton() << " "
316 // << track->PidProbElectron()+track->PidProbMuon()+track->PidProbPion()+track->PidProbKaon()+track->PidProbProton() << endl;
319 if ((track->PidProbElectron()<fPidProbElectron[0])||(track->PidProbElectron()>fPidProbElectron[1]))
322 //cout<<"No Go Through the cut"<<endl;
323 //cout<<fPidProbElectron[0]<<" < e ="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
326 if ((track->PidProbPion()<fPidProbPion[0])||(track->PidProbPion()>fPidProbPion[1]))
329 //cout<<"No Go Through the cut"<<endl;
330 //cout<<fPidProbPion[0]<<" < pi ="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
333 if ((track->PidProbKaon()<fPidProbKaon[0])||(track->PidProbKaon()>fPidProbKaon[1]))
336 //cout<<"No Go Through the cut"<<endl;
337 //cout<<fPidProbKaon[0]<<" < k ="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
340 if ((track->PidProbProton()<fPidProbProton[0])||(track->PidProbProton()>fPidProbProton[1]))
343 //cout<<"No Go Through the cut"<<endl;
344 //cout<<fPidProbProton[0]<<" < p ="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
347 if ((track->PidProbMuon()<fPidProbMuon[0])||(track->PidProbMuon()>fPidProbMuon[1]))
350 //cout<<"No Go Through the cut"<<endl;
351 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
355 //****N Sigma Method -- electron rejection****
356 if(fElectronRejection)
357 if(!IsElectron(track->NSigmaTPCE(),track->NSigmaTPCPi(),track->NSigmaTPCK(), track->NSigmaTPCP()))
364 tMost[0] = track->PidProbElectron()*PidFractionElectron(track->P().Mag());
366 tMost[2] = track->PidProbPion()*PidFractionPion(track->P().Mag());
367 tMost[3] = track->PidProbKaon()*PidFractionKaon(track->P().Mag());
368 tMost[4] = track->PidProbProton()*PidFractionProton(track->P().Mag());
371 //****N Sigma Method****
374 if (fMostProbable == 2) {
375 if (IsPionNSigma(track->P().Mag(), track->NSigmaTPCPi(), track->NSigmaTOFPi()))
379 else if (fMostProbable == 3) {
382 if (IsKaonNSigma(track->P().Mag(), track->NSigmaTPCK(), track->NSigmaTOFK())){
387 else if (fMostProbable == 4) { // proton nsigma-PID required contour adjusting (in LHC10h)
388 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()))
389 // && IsProtonTPCdEdx(track->P().Mag(), track->TPCsignal())
393 else if (fMostProbable == 5) { // no-protons
394 if ( !IsProtonNSigma(track->P().Mag(), track->NSigmaTPCP(), track->NSigmaTOFP()) )
397 else if (fMostProbable == 6) { //pions OR kaons OR protons
398 if (IsPionNSigma(track->P().Mag(), track->NSigmaTPCPi(), track->NSigmaTOFPi()))
400 else if (IsKaonNSigma(track->P().Mag(), track->NSigmaTPCK(), track->NSigmaTOFK()))
402 else if (IsProtonNSigma(track->P().Mag(), track->NSigmaTPCP(), track->NSigmaTOFP()) )
405 else if (fMostProbable == 7) { // pions OR kaons OR protons OR electrons
406 if (IsPionNSigma(track->P().Mag(), track->NSigmaTPCPi(), track->NSigmaTOFPi()))
408 else if (IsKaonNSigma(track->P().Mag(), track->NSigmaTPCK(), track->NSigmaTOFK()))
410 else if (IsProtonNSigma(track->P().Mag(), track->NSigmaTPCP(), track->NSigmaTOFP()) )
412 else if (TMath::Abs(track->NSigmaTPCE())<3)
416 else if (fMostProbable == 8) { // TOF matching
417 if(track->NSigmaTOFPi() != -1000 || track->Pt()<0.5){
421 else if (fMostProbable == 9) { // Other: no kaons, no pions, no protons
422 if (IsPionNSigma(track->P().Mag(), track->NSigmaTPCPi(), track->NSigmaTOFPi()))
424 else if (IsKaonNSigma(track->P().Mag(), track->NSigmaTPCK(), track->NSigmaTOFK()))
426 else if (IsProtonNSigma(track->P().Mag(), track->NSigmaTPCP(), track->NSigmaTOFP()) )
428 else if(track->NSigmaTOFPi() != -1000 || track->Pt()<0.5){
432 if (fMostProbable == 10) {//cut on Nsigma in pT not p
433 if (IsPionNSigma(track->Pt(), track->NSigmaTPCPi(), track->NSigmaTOFPi()))
436 else if (fMostProbable == 11) {//cut on Nsigma in pT not p
437 if (IsKaonNSigma(track->Pt(), track->NSigmaTPCK(), track->NSigmaTOFK()))
440 else if (fMostProbable == 12) { //cut on Nsigma in pT not p
441 if ( IsProtonNSigma(track->Pt(), track->NSigmaTPCP(), track->NSigmaTOFP()))
444 else if (fMostProbable == 13) { //cut on Nsigma in pT not p, EXCLUSIVE PID
445 if ((IsPionNSigma(track->Pt(),track->NSigmaTPCPi(), track->NSigmaTOFPi()) && !IsKaonNSigma(track->Pt(),track->NSigmaTPCK(), track->NSigmaTOFK()) && !IsProtonNSigma(track->Pt(),track->NSigmaTPCP(), track->NSigmaTOFP())))
448 else if (fMostProbable == 14) { //cut on Nsigma in pT not p, EXCLUSIVE PID
449 if (!IsPionNSigma(track->Pt(),track->NSigmaTPCPi(), track->NSigmaTOFPi()) && IsKaonNSigma(track->Pt(),track->NSigmaTPCK(), track->NSigmaTOFK()) && !IsProtonNSigma(track->Pt(),track->NSigmaTPCP(), track->NSigmaTOFP()))
452 else if (fMostProbable == 15) { //cut on Nsigma in pT not p, EXCLUSIVE PID
453 if (!IsPionNSigma(track->Pt(),track->NSigmaTPCPi(), track->NSigmaTOFPi()) && !IsKaonNSigma(track->Pt(), !track->NSigmaTPCK(), track->NSigmaTOFK()) && IsProtonNSigma(track->Pt(),track->NSigmaTPCP(), track->NSigmaTOFP()))
456 //*************** Without double counting, pions ************************
457 else if (fMostProbable == 16) { //cut on Nsigma in pT not p, without double counting
458 double nSigmaPIDPi = 0, nSigmaPIDK = 0, nSigmaPIDP = 0;
460 nSigmaPIDPi = abs(track->NSigmaTPCPi());
461 nSigmaPIDK = abs(track->NSigmaTPCK());
462 nSigmaPIDP = abs(track->NSigmaTPCP());
465 nSigmaPIDPi = TMath::Hypot(track->NSigmaTOFPi(), track->NSigmaTPCPi());
466 nSigmaPIDK= TMath::Hypot(track->NSigmaTOFK(), track->NSigmaTPCK());
467 nSigmaPIDP= TMath::Hypot(track->NSigmaTOFP(), track->NSigmaTPCP());
470 if(nSigmaPIDPi<nSigmaPIDK && nSigmaPIDPi<nSigmaPIDP){
471 bool isPionNsigma = 0;
472 isPionNsigma = (IsPionNSigma(track->Pt(),track->NSigmaTPCPi(), track->NSigmaTOFPi()));
473 if(isPionNsigma) imost=16;
477 else if (fMostProbable == 17) { //cut on Nsigma in pT not p, without double counting
478 double nSigmaPIDPi = 0, nSigmaPIDK = 0, nSigmaPIDP = 0;
480 nSigmaPIDPi = abs(track->NSigmaTPCPi());
481 nSigmaPIDK = abs(track->NSigmaTPCK());
482 nSigmaPIDP = abs(track->NSigmaTPCP());
485 nSigmaPIDPi = TMath::Hypot(track->NSigmaTOFPi(), track->NSigmaTPCPi());
486 nSigmaPIDK= TMath::Hypot(track->NSigmaTOFK(), track->NSigmaTPCK());
487 nSigmaPIDP= TMath::Hypot(track->NSigmaTOFP(), track->NSigmaTPCP());
490 if(nSigmaPIDK<nSigmaPIDPi && nSigmaPIDK<nSigmaPIDP){
491 bool isKaonNsigma = 0;
492 isKaonNsigma = (IsKaonNSigma(track->Pt(),track->NSigmaTPCK(), track->NSigmaTOFK()));
493 if(isKaonNsigma) imost=17;
496 else if (fMostProbable == 18) { //cut on Nsigma in pT not p, without double counting
497 double nSigmaPIDPi = 0, nSigmaPIDK = 0, nSigmaPIDP = 0;
499 nSigmaPIDPi = abs(track->NSigmaTPCPi());
500 nSigmaPIDK = abs(track->NSigmaTPCK());
501 nSigmaPIDP = abs(track->NSigmaTPCP());
504 nSigmaPIDPi = TMath::Hypot(track->NSigmaTOFPi(), track->NSigmaTPCPi());
505 nSigmaPIDK= TMath::Hypot(track->NSigmaTOFK(), track->NSigmaTPCK());
506 nSigmaPIDP= TMath::Hypot(track->NSigmaTOFP(), track->NSigmaTPCP());
509 if(nSigmaPIDP<nSigmaPIDPi && nSigmaPIDP<nSigmaPIDK){
510 bool isProtonNsigma = 0;
511 isProtonNsigma = (IsProtonNSigma(track->Pt(),track->NSigmaTPCP(), track->NSigmaTOFP()));
512 if(isProtonNsigma) imost=18;
520 //****Contour Method****
522 for (int ip=0; ip<5; ip++)
523 if (tMost[ip] > ipidmax) { ipidmax = tMost[ip]; imost = ip; };
526 if (fMostProbable == 2) {
528 // Using the TPC to reject non-pions
529 if (!(IsPionTPCdEdx(track->P().Mag(), track->TPCsignal())))
532 // Using the TOF to reject non-pions
533 if (track->P().Mag() < 0.6) {
535 if (!IsPionTOFTime(track->P().Mag(), track->TOFpionTime()))
540 if (!IsPionTOFTime(track->P().Mag(), track->TOFpionTime()))
552 else if (fMostProbable == 3) {
554 // Using the TPC to reject non-kaons
555 if (track->P().Mag() < 0.6) {
556 if (!(IsKaonTPCdEdx(track->P().Mag(), track->TPCsignal())))
560 // Using the TOF to reject non-kaons
562 if (!IsKaonTOFTime(track->P().Mag(), track->TOFkaonTime()))
569 if (!IsKaonTOFTime(track->P().Mag(), track->TOFkaonTime()))
575 if (!(IsKaonTPCdEdx(track->P().Mag(), track->TPCsignal())))
585 // Looking for protons
586 else if (fMostProbable == 4) {
588 // Using the TPC to reject non-kaons
589 if (track->P().Mag() < 0.8) {
590 if (!(IsProtonTPCdEdx(track->P().Mag(), track->TPCsignal())))
594 // Using the TOF to reject non-kaons
596 if (!IsKaonTOFTime(track->P().Mag(), track->TOFkaonTime()))
603 if (!IsKaonTOFTime(track->P().Mag(), track->TOFkaonTime()))
609 if (!(IsKaonTPCdEdx(track->P().Mag(), track->TPCsignal())))
619 if (imost != fMostProbable) return false;
623 //cout<<"****** Go Through the cut ******"<<endl;
624 // cout<<fLabel<<" Label="<<track->Label()<<endl;
625 // cout<<fCharge<<" Charge="<<track->Charge()<<endl;
626 // cout<<fPt[0]<<" < Pt ="<<Pt<<" <"<<fPt[1]<<endl;
627 //cout<<fRapidity[0]<<" < Rapidity ="<<tRapidity<<" <"<<fRapidity[1]<<endl;
628 //cout<<fPidProbElectron[0]<<" < e="<<track->PidProbElectron()<<" <"<<fPidProbElectron[1]<<endl;
629 //cout<<fPidProbPion[0]<<" < pi="<<track->PidProbPion()<<" <"<<fPidProbPion[1]<<endl;
630 //cout<<fPidProbKaon[0]<<" < k="<<track->PidProbKaon()<<" <"<<fPidProbKaon[1]<<endl;
631 //cout<<fPidProbProton[0]<<" < p="<<track->PidProbProton()<<" <"<<fPidProbProton[1]<<endl;
632 //cout<<fPidProbMuon[0]<<" < mi="<<track->PidProbMuon()<<" <"<<fPidProbMuon[1]<<endl;
638 //------------------------------
639 AliFemtoString AliFemtoMJTrackCut::Report()
641 // Prepare report from the execution
644 snprintf(tCtemp , 100, "Particle mass:\t%E\n",this->Mass());
646 snprintf(tCtemp , 100, "Particle charge:\t%d\n",fCharge);
648 snprintf(tCtemp , 100, "Particle pT:\t%E - %E\n",fPt[0],fPt[1]);
650 snprintf(tCtemp , 100, "Particle rapidity:\t%E - %E\n",fRapidity[0],fRapidity[1]);
652 snprintf(tCtemp , 100, "Particle eta:\t%E - %E\n",fEta[0],fEta[1]);
654 snprintf(tCtemp , 100, "Number of tracks which passed:\t%ld Number which failed:\t%ld\n",fNTracksPassed,fNTracksFailed);
656 AliFemtoString returnThis = tStemp;
659 TList *AliFemtoMJTrackCut::ListSettings()
661 // return a list of settings in a writable form
662 TList *tListSetttings = new TList();
664 snprintf(buf, 200, "AliFemtoMJTrackCut.mass=%f", this->Mass());
665 tListSetttings->AddLast(new TObjString(buf));
667 snprintf(buf, 200, "AliFemtoMJTrackCut.charge=%i", fCharge);
668 tListSetttings->AddLast(new TObjString(buf));
669 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobpion.minimum=%f", fPidProbPion[0]);
670 tListSetttings->AddLast(new TObjString(buf));
671 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobpion.maximum=%f", fPidProbPion[1]);
672 tListSetttings->AddLast(new TObjString(buf));
673 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobkaon.minimum=%f", fPidProbKaon[0]);
674 tListSetttings->AddLast(new TObjString(buf));
675 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobkaon.maximum=%f", fPidProbKaon[1]);
676 tListSetttings->AddLast(new TObjString(buf));
677 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobproton.minimum=%f", fPidProbProton[0]);
678 tListSetttings->AddLast(new TObjString(buf));
679 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobproton.maximum=%f", fPidProbProton[1]);
680 tListSetttings->AddLast(new TObjString(buf));
681 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobelectron.minimum=%f", fPidProbElectron[0]);
682 tListSetttings->AddLast(new TObjString(buf));
683 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobelectron.maximum=%f", fPidProbElectron[1]);
684 tListSetttings->AddLast(new TObjString(buf));
685 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobMuon.minimum=%f", fPidProbMuon[0]);
686 tListSetttings->AddLast(new TObjString(buf));
687 snprintf(buf, 200, "AliFemtoMJTrackCut.pidprobMuon.maximum=%f", fPidProbMuon[1]);
688 tListSetttings->AddLast(new TObjString(buf));
689 snprintf(buf, 200, "AliFemtoMJTrackCut.minimumtpcclusters=%i", fminTPCclsF);
690 tListSetttings->AddLast(new TObjString(buf));
691 snprintf(buf, 200, "AliFemtoMJTrackCut.minimumitsclusters=%i", fminTPCclsF);
692 tListSetttings->AddLast(new TObjString(buf));
693 snprintf(buf, 200, "AliFemtoMJTrackCut.pt.minimum=%f", fPt[0]);
694 tListSetttings->AddLast(new TObjString(buf));
695 snprintf(buf, 200, "AliFemtoMJTrackCut.pt.maximum=%f", fPt[1]);
696 tListSetttings->AddLast(new TObjString(buf));
697 snprintf(buf, 200, "AliFemtoMJTrackCut.rapidity.minimum=%f", fRapidity[0]);
698 tListSetttings->AddLast(new TObjString(buf));
699 snprintf(buf, 200, "AliFemtoMJTrackCut.rapidity.maximum=%f", fRapidity[1]);
700 tListSetttings->AddLast(new TObjString(buf));
701 snprintf(buf, 200, "AliFemtoMJTrackCut.removekinks=%i", fRemoveKinks);
702 tListSetttings->AddLast(new TObjString(buf));
703 snprintf(buf, 200, "AliFemtoMJTrackCut.maxitschindof=%f", fMaxITSchiNdof);
704 tListSetttings->AddLast(new TObjString(buf));
705 snprintf(buf, 200, "AliFemtoMJTrackCut.maxtpcchindof=%f", fMaxTPCchiNdof);
706 tListSetttings->AddLast(new TObjString(buf));
707 snprintf(buf, 200, "AliFemtoMJTrackCut.maxsigmatovertex=%f", fMaxSigmaToVertex);
708 tListSetttings->AddLast(new TObjString(buf));
709 snprintf(buf, 200, "AliFemtoMJTrackCut.maximpactxy=%f", fMaxImpactXY);
710 tListSetttings->AddLast(new TObjString(buf));
711 snprintf(buf, 200, "AliFemtoMJTrackCut.maximpactz=%f", fMaxImpactZ);
712 tListSetttings->AddLast(new TObjString(buf));
714 if (fMostProbable == 2)
715 snprintf(buf, 200, "AliFemtoMJTrackCut.mostprobable=%s", "Pion");
716 if (fMostProbable == 3)
717 snprintf(buf, 200, "AliFemtoMJTrackCut.mostprobable=%s", "Kaon");
718 if (fMostProbable == 4)
719 snprintf(buf, 200, "AliFemtoMJTrackCut.mostprobable=%s", "Proton");
720 tListSetttings->AddLast(new TObjString(buf));
722 return tListSetttings;
724 void AliFemtoMJTrackCut::SetRemoveKinks(const bool& flag)
729 void AliFemtoMJTrackCut::SetRemoveITSFake(const bool& flag)
731 fRemoveITSFake = flag;
736 // 0 7.594129e-02 8.256141e-03
737 // 1 -5.535827e-01 8.170825e-02
738 // 2 1.728591e+00 3.104210e-01
739 // 3 -2.827893e+00 5.827802e-01
740 // 4 2.503553e+00 5.736207e-01
741 // 5 -1.125965e+00 2.821170e-01
742 // 6 2.009036e-01 5.438876e-02
743 float AliFemtoMJTrackCut::PidFractionElectron(float mom) const
745 // Provide a parameterized fraction of electrons dependent on momentum
749 +1.728591e+00*0.13*0.13
750 -2.827893e+00*0.13*0.13*0.13
751 +2.503553e+00*0.13*0.13*0.13*0.13
752 -1.125965e+00*0.13*0.13*0.13*0.13*0.13
753 +2.009036e-01*0.13*0.13*0.13*0.13*0.13*0.13);
758 +1.728591e+00*1.8*1.8
759 -2.827893e+00*1.8*1.8*1.8
760 +2.503553e+00*1.8*1.8*1.8*1.8
761 -1.125965e+00*1.8*1.8*1.8*1.8*1.8
762 +2.009036e-01*1.8*1.8*1.8*1.8*1.8*1.8);
765 +1.728591e+00*mom*mom
766 -2.827893e+00*mom*mom*mom
767 +2.503553e+00*mom*mom*mom*mom
768 -1.125965e+00*mom*mom*mom*mom*mom
769 +2.009036e-01*mom*mom*mom*mom*mom*mom);
774 // 0 1.063457e+00 8.872043e-03
775 // 1 -4.222208e-01 2.534402e-02
776 // 2 1.042004e-01 1.503945e-02
777 float AliFemtoMJTrackCut::PidFractionPion(float mom) const
779 // Provide a parameterized fraction of pions dependent on momentum
781 return ( 1.063457e+00
783 +1.042004e-01*0.0169);
785 return ( 1.063457e+00
788 return ( 1.063457e+00
790 +1.042004e-01*mom*mom);
795 // 0 -7.289406e-02 1.686074e-03
796 // 1 4.415666e-01 1.143939e-02
797 // 2 -2.996790e-01 1.840964e-02
798 // 3 6.704652e-02 7.783990e-03
799 float AliFemtoMJTrackCut::PidFractionKaon(float mom) const
801 // Provide a parameterized fraction of kaons dependent on momentum
803 return (-7.289406e-02
805 -2.996790e-01*0.18*0.18
806 +6.704652e-02*0.18*0.18*0.18);
808 return (-7.289406e-02
810 -2.996790e-01*2.0*2.0
811 +6.704652e-02*2.0*2.0*2.0);
812 return (-7.289406e-02
814 -2.996790e-01*mom*mom
815 +6.704652e-02*mom*mom*mom);
820 // 0 -3.730200e-02 2.347311e-03
821 // 1 1.163684e-01 1.319316e-02
822 // 2 8.354116e-02 1.997948e-02
823 // 3 -4.608098e-02 8.336400e-03
824 float AliFemtoMJTrackCut::PidFractionProton(float mom) const
826 // Provide a parameterized fraction of protons dependent on momentum
827 if (mom<0.26) return 0.0;
829 return (-3.730200e-02
831 +8.354116e-02*2.0*2.0
832 -4.608098e-02*2.0*2.0*2.0);
833 return (-3.730200e-02
835 +8.354116e-02*mom*mom
836 -4.608098e-02*mom*mom*mom);
839 void AliFemtoMJTrackCut::SetMomRangeTOFpidIs(const float& minp, const float& maxp)
841 fMinPforTOFpid = minp;
842 fMaxPforTOFpid = maxp;
845 void AliFemtoMJTrackCut::SetMomRangeTPCpidIs(const float& minp, const float& maxp)
847 fMinPforTPCpid = minp;
848 fMaxPforTPCpid = maxp;
851 void AliFemtoMJTrackCut::SetMomRangeITSpidIs(const float& minp, const float& maxp)
853 fMinPforITSpid = minp;
854 fMaxPforITSpid = maxp;
857 bool AliFemtoMJTrackCut::IsPionTPCdEdx(float mom, float dEdx)
859 // double a1 = -95.4545, b1 = 86.5455;
860 // double a2 = 0.0, b2 = 56.0;
861 double a1 = -343.75, b1 = 168.125;
862 double a2 = 0.0, b2 = 65.0;
865 if (dEdx < a1*mom+b1) return true;
867 if (dEdx < a2*mom+b2) return true;
872 bool AliFemtoMJTrackCut::IsKaonTPCdEdx(float mom, float dEdx)
875 // double a1 = -547.0; double b1 = 297.0;
876 // double a2 = -125.0; double b2 = 145.0;
877 // double a3 = -420.0; double b3 = 357.0;
878 // double a4 = -110.0; double b4 = 171.0;
881 // if (mom<0.2) return false;
884 // if (dEdx < a1*mom+b1) return false;
885 // if (dEdx > a3*mom+b3) return false;
887 // else if (mom<0.6) {
888 // if (dEdx < a2*mom+b2) return false;
889 // if (dEdx > a3*mom+b3) return false;
891 // else if (mom<0.9) {
892 // if (dEdx > a4*mom+b4) return false;
893 // if (dEdx < b5) return false;
898 // // if (dEdx > b5) return false;
903 double a1 = -268.896; double b1 = 198.669;
904 double a2 = -49.0012; double b2 = 88.7214;
906 if (mom<0.2) return false;
908 if (mom>0.3 && mom<0.5) {
909 if (dEdx < a1*mom+b1) return false;
912 if (dEdx < a2*mom+b2) return false;
919 bool AliFemtoMJTrackCut::IsProtonTPCdEdx(float mom, float dEdx)
921 double a1 = -1800.0; double b1 = 940.0;
922 double a2 = -500.0; double b2 = 420.0;
923 double a3 = -216.7; double b3 = 250.0;
925 if (mom<0.2) return false;
927 if (mom>0.3 && mom<0.4) {
928 if (dEdx < a1*mom+b1) return false;
931 if (dEdx < a2*mom+b2) return false;
934 if (dEdx < a3*mom+b3) return false;
941 bool AliFemtoMJTrackCut::IsPionTOFTime(float mom, float ttof)
943 double a1 = -427.0; double b1 = 916.0;
944 double a2 = 327.0; double b2 = -888.0;
945 if (mom<0.3) return kFALSE;
946 if (mom>2.0) return kFALSE;
947 if (ttof > a1*mom+b1) return kFALSE;
948 if (ttof < a2*mom+b2) return kFALSE;
953 bool AliFemtoMJTrackCut::IsKaonTOFTime(float mom, float ttof)
955 double a1 = 000.0; double b1 = -500.0;
956 double a2 = 000.0; double b2 = 500.0;
957 double a3 = 850.0; double b3 = -1503.0;
958 double a4 = -1637.0; double b4 = 3621.0;
960 if (mom<0.3) return kFALSE;
961 if (mom>2.06) return kFALSE;
963 if (ttof > a2*mom+b2) return kFALSE;
964 if (ttof < a1*mom+b1) return kFALSE;
967 if (ttof > a2*mom+b2) return kFALSE;
968 if (ttof < a3*mom+b3) return kFALSE;
971 if (ttof > a4*mom+b4) return kFALSE;
972 if (ttof < a3*mom+b3) return kFALSE;
977 bool AliFemtoMJTrackCut::IsProtonTOFTime(float mom, float ttof)
979 double a1 = 000.0; double b1 = -915.0;
980 double a2 = 000.0; double b2 = 600.0;
981 double a3 = 572.0; double b3 = -1715.0;
983 if (mom<0.3) return kFALSE;
984 if (mom>3.0) return kFALSE;
986 if (ttof > a2*mom+b2) return kFALSE;
987 if (ttof < a1*mom+b1) return kFALSE;
990 if (ttof > a2*mom+b2) return kFALSE;
991 if (ttof < a3*mom+b3) return kFALSE;
999 bool AliFemtoMJTrackCut::IsKaonTPCdEdxNSigma(float mom, float nsigmaK)
1001 // cout<<" AliFemtoMJTrackCut::IsKaonTPCdEdxNSigma "<<mom<<" "<<nsigmaK<<endl;
1004 if(mom<0.35 && TMath::Abs(nsigmaK)<5.0)return true;
1005 if(mom>=0.35 && mom<0.5 && TMath::Abs(nsigmaK)<3.0)return true;
1006 if(mom>=0.5 && mom<0.7 && TMath::Abs(nsigmaK)<2.0)return true;
1011 bool AliFemtoMJTrackCut::IsKaonTOFNSigma(float mom, float nsigmaK)
1013 // cout<<" AliFemtoMJTrackCut::IsKaonTPCdEdxNSigma "<<mom<<" "<<nsigmaK<<endl;
1015 // if(mom<1.5 && TMath::Abs(nsigmaK)<3.0)return true;
1016 if(mom>=1.5 && TMath::Abs(nsigmaK)<2.0)return true;
1021 bool AliFemtoMJTrackCut::IsKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK)
1027 if(TMath::Abs(nsigmaTPCK)<2.0)
1040 if(TMath::Abs(nsigmaTOFK)<3.0 && TMath::Abs(nsigmaTPCK)<3.0)
1050 // if(mom>1.5 || mom<0.15)return false;
1058 bool AliFemtoMJTrackCut::IsKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK)
1060 if (fNsigmaTPCTOF) {
1062 // if (TMath::Hypot( nsigmaTOFP, nsigmaTPCP )/TMath::Sqrt(2) < 3.0)
1063 if (TMath::Hypot( nsigmaTOFK, nsigmaTPCK ) < fNsigma)
1067 if (TMath::Abs(nsigmaTPCK) < fNsigma)
1075 if(nsigmaTOFK<-999.)
1077 if(TMath::Abs(nsigmaTPCK)<2.0) return true;
1079 else if(TMath::Abs(nsigmaTOFK)<3.0 && TMath::Abs(nsigmaTPCK)<3.0) return true;
1081 else if(mom>=0.4 && mom<=0.6)
1083 if(nsigmaTOFK<-999.)
1085 if(TMath::Abs(nsigmaTPCK)<2.0) return true;
1087 else if(TMath::Abs(nsigmaTOFK)<3.0 && TMath::Abs(nsigmaTPCK)<3.0) return true;
1089 else if(nsigmaTOFK<-999.)
1093 else if(TMath::Abs(nsigmaTOFK)<3.0 && TMath::Abs(nsigmaTPCK)<3.0) return true;
1100 bool AliFemtoMJTrackCut::IsPionNSigma(float mom, float nsigmaTPCPi, float nsigmaTOFPi)
1102 if (fNsigmaTPCTOF) {
1104 // if (TMath::Hypot( nsigmaTOFP, nsigmaTPCP )/TMath::Sqrt(2) < 3.0)
1105 if (TMath::Hypot( nsigmaTOFPi, nsigmaTPCPi ) < fNsigma)
1109 if (TMath::Abs(nsigmaTPCPi) < fNsigma)
1116 if(nsigmaTOFPi<-999.)
1118 if(mom<0.35 && TMath::Abs(nsigmaTPCPi)<3.0) return true;
1119 else if(mom<0.5 && mom>=0.35 && TMath::Abs(nsigmaTPCPi)<3.0) return true;
1120 else if(mom>=0.5 && TMath::Abs(nsigmaTPCPi)<2.0) return true;
1123 else if(TMath::Abs(nsigmaTOFPi)<3.0 && TMath::Abs(nsigmaTPCPi)<3.0) return true;
1125 else if(nsigmaTOFPi<-999.)
1129 else if(mom<1.5 && TMath::Abs(nsigmaTOFPi)<3.0 && TMath::Abs(nsigmaTPCPi)<5.0) return true;
1130 else if(mom>=1.5 && TMath::Abs(nsigmaTOFPi)<2.0 && TMath::Abs(nsigmaTPCPi)<5.0) return true;
1136 bool AliFemtoMJTrackCut::IsProtonNSigma(float mom, float nsigmaTPCP, float nsigmaTOFP)
1139 if (fNsigmaTPCTOF) {
1141 // if (TMath::Hypot( nsigmaTOFP, nsigmaTPCP )/TMath::Sqrt(2) < 3.0)
1142 if (TMath::Hypot( nsigmaTOFP, nsigmaTPCP ) < fNsigma)
1146 if (TMath::Abs(nsigmaTPCP) < fNsigma)
1150 else if (fNsigmaTPConly) {
1151 if (TMath::Abs(nsigmaTPCP) < fNsigma)
1155 if (mom > 0.8 && mom < 2.5) {
1156 if ( TMath::Abs(nsigmaTPCP) < 3.0 && TMath::Abs(nsigmaTOFP) < 3.0)
1159 else if (mom > 2.5) {
1160 if ( TMath::Abs(nsigmaTPCP) < 3.0 && TMath::Abs(nsigmaTOFP) < 2.0)
1164 if (TMath::Abs(nsigmaTPCP) < 3.0)
1173 void AliFemtoMJTrackCut::SetPIDMethod(ReadPIDMethodType newMethod)
1175 fPIDMethod = newMethod;
1179 void AliFemtoMJTrackCut::SetNsigmaTPCTOF(Bool_t nsigma)
1181 fNsigmaTPCTOF = nsigma;
1184 void AliFemtoMJTrackCut::SetNsigmaTPConly(Bool_t nsigma)
1186 fNsigmaTPConly = nsigma;
1189 void AliFemtoMJTrackCut::SetNsigma(Double_t nsigma)
1195 void AliFemtoMJTrackCut::SetClusterRequirementITS(AliESDtrackCuts::Detector det, AliESDtrackCuts::ITSClusterRequirement req)
1197 fCutClusterRequirementITS[det] = req;
1200 Bool_t AliFemtoMJTrackCut::CheckITSClusterRequirement(AliESDtrackCuts::ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2)
1202 // checks if the cluster requirement is fullfilled (in this case: return kTRUE)
1206 case AliESDtrackCuts::kOff: return kTRUE;
1207 case AliESDtrackCuts::kNone: return !clusterL1 && !clusterL2;
1208 case AliESDtrackCuts::kAny: return clusterL1 || clusterL2;
1209 case AliESDtrackCuts::kFirst: return clusterL1;
1210 case AliESDtrackCuts::kOnlyFirst: return clusterL1 && !clusterL2;
1211 case AliESDtrackCuts::kSecond: return clusterL2;
1212 case AliESDtrackCuts::kOnlySecond: return clusterL2 && !clusterL1;
1213 case AliESDtrackCuts::kBoth: return clusterL1 && clusterL2;
1219 bool AliFemtoMJTrackCut::IsElectron(float nsigmaTPCE, float nsigmaTPCPi,float nsigmaTPCK, float nsigmaTPCP)
1221 if(TMath::Abs(nsigmaTPCE)<3 && TMath::Abs(nsigmaTPCPi)>3 && TMath::Abs(nsigmaTPCK)>3 && TMath::Abs(nsigmaTPCP)>3)