1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 * author: M.Kalisky@gsi.de
20 * Description: This class allows with purely kinematical cuts
21 * to select clean samples of electrons, pions and protons from the
22 * V0 online finder ESD V0 candidates for PID and dectector resonse
27 #include <TDatabasePDG.h>
30 #include "AliESDtrack.h"
31 #include "AliESDEvent.h"
32 #include "AliVEvent.h"
34 #include "AliKFParticle.h"
35 #include "AliVTrack.h"
36 #include "AliKFVertex.h"
38 #include "AliESDv0KineCuts.h"
40 ClassImp(AliESDv0KineCuts)
42 //____________________________________________________________________
43 AliESDv0KineCuts::AliESDv0KineCuts() :
57 , fUseExternalVertex(kFALSE)
58 , fDeleteVertex(kFALSE)
61 // Default constructor
64 // default single track cuts
65 fTPCNcls = 1; // minimal number of the TPC clusters
66 fTPCrefit = kTRUE; // TPC refit
67 fTPCchi2perCls = 4.0; // chi2 per TPC cluster
68 fTPCclsRatio = 0.6; // minimal foun/findable TPC cluster ratio
69 fNoKinks = kTRUE; // kinks - no [kTRUE] or do not care [kFalse]
72 // default gamma cuts values
73 fGcutChi2NDF = 10; // Chi2NF cut value for the AliKFparticle gamma
74 fGcutCosPoint[0] = 0; // cos of the pointing angle [min, max]
75 fGcutCosPoint[1] = 0.02; // cos of the pointing angle [min, max]
76 fGcutDCA[0] = 0.; // DCA between the daughter tracks [min, max]
77 fGcutDCA[1] = 0.25; // DCA between the daughter tracks [min, max]
78 fGcutVertexR[0] = 3.; // radius of the conversion point [min, max]
79 fGcutVertexR[1] = 90.; // radius of the conversion point [min, max]
80 fGcutPsiPair[0] = 0.; // value of the psi pair cut [min, max]
81 fGcutPsiPair[1] = 0.05; // value of the psi pair cut [min, max]
82 fGcutInvMass = 0.05; // upper value on the gamma invariant mass
84 fK0cutChi2NDF = 10; // Chi2NF cut value for the AliKFparticle K0
85 fK0cutCosPoint[0] = 0.; // cos of the pointing angle [min, max]
86 fK0cutCosPoint[1] = 0.02; // cos of the pointing angle [min, max]
87 fK0cutDCA[0] = 0.; // DCA between the daughter tracks [min, max]
88 fK0cutDCA[1] = 0.2; // DCA between the daughter tracks [min, max]
89 fK0cutVertexR[0] = 2.0; // radius of the decay point [min, max]
90 fK0cutVertexR[1] = 30.0; // radius of the decay point [min, max]
91 fK0cutInvMass[0] = 0.486; // invariant mass window
92 fK0cutInvMass[1] = 0.508; // invariant mass window
93 // Lambda & anti-Lambda cut values
94 fLcutChi2NDF = 10; // Chi2NF cut value for the AliKFparticle K0
95 fLcutCosPoint[0] = 0.; // cos of the pointing angle [min, max]
96 fLcutCosPoint[1] = 0.02; // cos of the pointing angle [min, max]
97 fLcutDCA[0] = 0.; // DCA between the daughter tracks [min, max]
98 fLcutDCA[1] = 0.2; // DCA between the daughter tracks [min, max]
99 fLcutVertexR[0] = 2.0; // radius of the decay point [min, max]
100 fLcutVertexR[1] = 40.0; // radius of the decay point [min, max]
101 fLcutInvMass[0] = 1.11; // invariant mass window
102 fLcutInvMass[1] = 1.12; // invariant mass window
105 //____________________________________________________________________
106 AliESDv0KineCuts::~AliESDv0KineCuts(){
113 //____________________________________________________________________
114 AliESDv0KineCuts::AliESDv0KineCuts(const AliESDv0KineCuts &ref):
117 , fPrimaryVertex(0x0)
122 , fTPCchi2perCls(4.0)
129 , fUseExternalVertex(kFALSE)
130 , fDeleteVertex(kFALSE)
138 //____________________________________________________________________
139 AliESDv0KineCuts &AliESDv0KineCuts::operator=(const AliESDv0KineCuts &ref){
141 // assignment operator
147 //____________________________________________________________________
148 void AliESDv0KineCuts::Copy(TObject &ref) const {
150 // Performs the copying of the object
155 AliESDv0KineCuts &target = dynamic_cast<AliESDv0KineCuts &>(ref);
157 // default single track cuts
158 target.fTPCNcls = fTPCNcls;
159 target.fTPCrefit = fTPCrefit;
160 target.fTPCchi2perCls = fTPCchi2perCls;
161 target.fTPCclsRatio = fTPCclsRatio;
162 target.fNoKinks = fNoKinks;
163 target.fUseExternalVertex = fUseExternalVertex; //added december 2nd 2011
164 target.fDeleteVertex = fDeleteVertex; //added december 2nd 2011
166 // default gamma cuts values
167 target.fGcutChi2NDF = fGcutChi2NDF;
168 memcpy(target.fGcutCosPoint, fGcutCosPoint, sizeof(Float_t) * 2);
169 memcpy(target.fGcutDCA, fGcutDCA, sizeof(Float_t) * 2);
170 memcpy(target.fGcutVertexR, fGcutVertexR, sizeof(Float_t) * 2);
171 memcpy(target.fGcutPsiPair, fGcutPsiPair, sizeof(Float_t) * 2);
172 target.fGcutInvMass = fGcutInvMass;
174 target.fK0cutChi2NDF = fK0cutChi2NDF;
175 memcpy(target.fK0cutCosPoint, fK0cutCosPoint, sizeof(Float_t) * 2);
176 memcpy(target.fK0cutDCA, fK0cutDCA, sizeof(Float_t) * 2);
177 memcpy(target.fK0cutVertexR, fK0cutVertexR, sizeof(Float_t) * 2);
178 memcpy(target.fK0cutInvMass, fK0cutInvMass, sizeof(Float_t) * 2);
179 // Lambda & anti-Lambda cut values
180 target.fLcutChi2NDF = fLcutChi2NDF;
181 memcpy(target.fLcutCosPoint, fLcutCosPoint, sizeof(Float_t) * 2);
182 memcpy(target.fLcutDCA, fLcutDCA, sizeof(Float_t) * 2);
183 memcpy(target.fLcutVertexR, fLcutVertexR, sizeof(Float_t) * 2);
184 memcpy(target.fLcutInvMass, fLcutInvMass, sizeof(Float_t) * 2);
187 //____________________________________________________________________
188 Bool_t AliESDv0KineCuts::ProcessV0(AliESDv0* const v0, Int_t &pdgV0, Int_t &pdgP, Int_t &pdgN) const
191 // main user function
194 if(!v0) return kFALSE;
196 AliErrorClass("No valid Event pointer available, provide it first");
200 if(!V0CutsCommon(v0)) return kFALSE;
202 const Int_t id = PreselectV0(v0);
204 if(!SingleTrackCuts(v0)) return kFALSE;
210 return CaseGamma(v0, pdgV0, pdgP, pdgN);
212 return CaseK0(v0, pdgV0, pdgP, pdgN);
214 return CaseLambda(v0, pdgV0, pdgP, pdgN, 0);
216 return CaseLambda(v0, pdgV0, pdgP, pdgN, 1);
223 //____________________________________________________________________
224 Bool_t AliESDv0KineCuts::ProcessV0(AliESDv0* const v0, Int_t &pdgP, Int_t &pdgN) const
227 // main user function, simplified if the V0 identity is not necessary
230 if(!v0) return kFALSE;
232 AliErrorClass("No valid Event pointer available, provide it first");
237 return ProcessV0(v0, idV0, pdgP, pdgN);
240 //____________________________________________________________________
241 Int_t AliESDv0KineCuts::PreselectV0(AliESDv0* const v0) const
244 // Make a preselection (exclusive) of the V0 cadidates based on
246 // the armenteros cut values are currently fixed and user is not able to set them via
247 // set funcions. The reason is that these cuts are optimized and furneter changes should
248 // not be necessary. To prove otherwise please study in detail before changing the values
251 Float_t ap[2] = {-1., -1.};
254 const Float_t alpha = ap[0];
255 const Float_t qt = ap[1];
258 // - the reagions for different candidates must not overlap
261 const Double_t cutAlphaG = 0.35;
262 const Double_t cutQTG = 0.05;
263 const Double_t cutAlphaG2[2] = {0.6, 0.8};
264 const Double_t cutQTG2 = 0.04;
267 const Float_t cutQTK0[2] = {0.1075, 0.215};
268 const Float_t cutAPK0[2] = {0.199, 0.8}; // parameters for curved QT cut
270 // Lambda & A-Lambda cuts
271 const Float_t cutQTL = 0.03;
272 const Float_t cutAlphaL[2] = {0.35, 0.7};
273 const Float_t cutAlphaAL[2] = {-0.7, -0.35};
274 const Float_t cutAPL[3] = {0.107, -0.69, 0.5}; // parameters fir curved QT cut
277 if(kPurity == fMode){
278 // Check for Gamma candidates
280 if( (TMath::Abs(alpha) < cutAlphaG) ) return kGamma;
282 // additional region - should help high pT gammas
284 if( (TMath::Abs(alpha) > cutAlphaG2[0]) && (TMath::Abs(alpha) < cutAlphaG2[1]) ) return kGamma;
287 if(kEffGamma == fMode){
288 if(qt < cutQTG) return kGamma;
292 // Check for K0 candidates
293 Float_t q = cutAPK0[0] * TMath::Sqrt(TMath::Abs(1 - alpha*alpha/(cutAPK0[1]*cutAPK0[1])));
294 if( (qt > cutQTK0[0]) && (qt < cutQTK0[1]) && (qt > q) ){
298 // Check for Lambda candidates
299 q = cutAPL[0] * TMath::Sqrt(TMath::Abs(1 - ( (alpha + cutAPL[1]) * (alpha + cutAPL[1]) ) / (cutAPL[2]*cutAPL[2]) ));
300 if( (alpha > cutAlphaL[0]) && (alpha < cutAlphaL[1]) && (qt > cutQTL) && (qt < q) ){
304 // Check for A-Lambda candidates
305 q = cutAPL[0] * TMath::Sqrt(TMath::Abs(1 - ( (alpha - cutAPL[1]) * (alpha - cutAPL[1]) ) / (cutAPL[2]*cutAPL[2]) ));
306 if( (alpha > cutAlphaAL[0]) && (alpha < cutAlphaAL[1]) && (qt > cutQTL) && (qt < q) ){
312 //____________________________________________________________________
313 Bool_t AliESDv0KineCuts::SingleTrackCuts(AliESDv0 * const v0) const
316 // apply single track cuts
317 // correct sign not relevat here
320 if(!v0) return kFALSE;
322 Int_t pIndex = 0, nIndex = 0;
323 pIndex = v0->GetPindex();
324 nIndex = v0->GetNindex();
326 d[0] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(pIndex));
327 d[1] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(nIndex));
329 for(Int_t i=0; i<2; ++i){
330 if(!d[i]) return kFALSE;
333 ULong_t status = d[i]->GetStatus();
335 // No. of TPC clusters leave to the users
336 if(d[i]->GetTPCNcls() < 1) return kFALSE;
339 if(!(status & AliESDtrack::kTPCrefit)) return kFALSE;
341 // Chi2 per TPC cluster
342 Int_t nTPCclusters = d[i]->GetTPCNcls();
343 Float_t chi2perTPCcluster = d[i]->GetTPCchi2()/Float_t(nTPCclusters);
344 if(chi2perTPCcluster > 4) return kFALSE;
347 Float_t cRatioTPC = d[i]->GetTPCNclsF() > 0. ? static_cast<Float_t>(d[i]->GetTPCNcls())/static_cast<Float_t> (d[i]->GetTPCNclsF()) : 1.;
348 if(cRatioTPC < 0.6) return kFALSE;
351 if(d[i]->GetKinkIndex(0) != 0) return kFALSE;
357 //____________________________________________________________________
358 Bool_t AliESDv0KineCuts::CaseGamma(AliESDv0* const v0, Int_t &pdgV0, Int_t &pdgP, Int_t &pdgN) const
361 // process the gamma conversion candidate
364 if(!v0) return kFALSE;
366 AliVTrack* daughter[2];
367 Int_t pIndex = 0, nIndex = 0;
369 Bool_t sign = CheckSigns(v0);
371 pIndex = v0->GetPindex();
372 nIndex = v0->GetNindex();
375 pIndex = v0->GetNindex();
376 nIndex = v0->GetPindex();
378 daughter[0] = dynamic_cast<AliVTrack *>(fEvent->GetTrack(pIndex));
379 daughter[1] = dynamic_cast<AliVTrack *>(fEvent->GetTrack(nIndex));
380 if(!daughter[0] || !daughter[1]) return kFALSE;
382 AliKFParticle *kfMother = CreateMotherParticle(daughter[0], daughter[1], TMath::Abs(kElectron), TMath::Abs(kElectron));
383 if(!kfMother) return kFALSE;
386 d[0] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(pIndex));
387 d[1] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(nIndex));
389 Float_t iMass = v0->GetEffMass(0, 0);
391 // cos pointing angle
392 Double_t cosPoint = v0->GetV0CosineOfPointingAngle();
393 cosPoint = TMath::ACos(cosPoint);
395 // DCA between daughters
396 Double_t dca = v0->GetDcaV0Daughters();
401 Double_t r = TMath::Sqrt(x*x + y*y);
405 if ( GetConvPosXY(d[0], d[1], xy) ){
406 r2 = TMath::Sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
410 Double_t psiPair = PsiPair(v0);
413 Double_t chi2ndf = kfMother->GetChi2()/kfMother->GetNDF();
415 if(kfMother) delete kfMother;
419 if(iMass > fGcutInvMass) return kFALSE;
421 if(chi2ndf > fGcutChi2NDF) return kFALSE;
423 if(cosPoint < fGcutCosPoint[0] || cosPoint > fGcutCosPoint[1]) return kFALSE;
425 if(dca < fGcutDCA[0] || dca > fGcutDCA[1]) return kFALSE;
427 if(r < fGcutVertexR[0] || r > fGcutVertexR[1]) return kFALSE;
429 if(psiPair < fGcutPsiPair[0] || psiPair > fGcutPsiPair[1]) return kFALSE;
445 //____________________________________________________________________
446 Bool_t AliESDv0KineCuts::CaseK0(AliESDv0* const v0, Int_t &pdgV0, Int_t &pdgP, Int_t &pdgN) const {
448 // process the K0 candidate
451 if(!v0) return kFALSE;
453 AliVTrack* daughter[2];
454 Int_t pIndex = 0, nIndex = 0;
455 Bool_t sign = CheckSigns(v0);
457 pIndex = v0->GetPindex();
458 nIndex = v0->GetNindex();
461 pIndex = v0->GetNindex();
462 nIndex = v0->GetPindex();
465 daughter[0] = dynamic_cast<AliVTrack *>(fEvent->GetTrack(pIndex));
466 daughter[1] = dynamic_cast<AliVTrack *>(fEvent->GetTrack(nIndex));
467 if(!daughter[0] || !daughter[1]) return kFALSE;
469 AliKFParticle *kfMother = CreateMotherParticle(daughter[0], daughter[1], TMath::Abs(kPiPlus), TMath::Abs(kPiPlus));
470 if(!kfMother) return kFALSE;
473 d[0] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(pIndex));
474 d[1] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(nIndex));
476 Float_t iMass = v0->GetEffMass(2, 2);
478 // cos pointing angle
479 Double_t cosPoint = v0->GetV0CosineOfPointingAngle();
480 cosPoint = TMath::ACos(cosPoint);
482 // DCA between daughters
483 Double_t dca = v0->GetDcaV0Daughters();
489 Double_t r = TMath::Sqrt(x*x + y*y);
492 Double_t chi2ndf = kfMother->GetChi2()/kfMother->GetNDF();
494 if(kfMother) delete kfMother;
499 if(iMass < fK0cutInvMass[0] || iMass > fK0cutInvMass[1]) return kFALSE;
501 if(chi2ndf > fK0cutChi2NDF) return kFALSE;
503 if(cosPoint < fK0cutCosPoint[0] || cosPoint > fK0cutCosPoint[1]) return kFALSE;
505 if(dca < fK0cutDCA[0] || dca > fK0cutDCA[1]) return kFALSE;
507 if(r < fK0cutVertexR[0] || r > fK0cutVertexR[1]) return kFALSE;
522 //____________________________________________________________________
523 Bool_t AliESDv0KineCuts::CaseLambda(AliESDv0* const v0, Int_t &pdgV0, Int_t &pdgP, Int_t &pdgN, Int_t id) const {
525 // process teh Lambda and Anti-Lambda candidate
528 if(!v0) return kFALSE;
530 const Double_t cL0mass=TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass(); // PDG lambda mass
532 AliVTrack* daughter[2];
533 Int_t pIndex = 0, nIndex = 0;
534 Float_t mMass[2] = {-1., -1.};
535 Bool_t sign = CheckSigns(v0);
537 pIndex = v0->GetPindex();
538 nIndex = v0->GetNindex();
539 mMass[0] = v0->GetEffMass(4, 2);
540 mMass[1] = v0->GetEffMass(2, 4);
543 pIndex = v0->GetNindex();
544 nIndex = v0->GetPindex();
545 mMass[0] = v0->GetEffMass(2, 4);
546 mMass[1] = v0->GetEffMass(4, 2);
549 daughter[0] = dynamic_cast<AliVTrack *>(fEvent->GetTrack(pIndex));
550 daughter[1] = dynamic_cast<AliVTrack *>(fEvent->GetTrack(nIndex));
551 if(!daughter[0] || !daughter[1]) return kFALSE;
553 AliKFParticle *kfMother[2] = {0x0, 0x0};
555 kfMother[0] = CreateMotherParticle(daughter[0], daughter[1], TMath::Abs(kProton), TMath::Abs(kPiPlus));
556 if(!kfMother[0]) return kFALSE;
559 kfMother[1] = CreateMotherParticle(daughter[0], daughter[1], TMath::Abs(kPiPlus), TMath::Abs(kProton));
560 if(!kfMother[1]) return kFALSE;
562 Float_t dMass[2] = {static_cast<Float_t>(TMath::Abs(mMass[0] - cL0mass)), static_cast<Float_t>(TMath::Abs(mMass[1] - cL0mass))};
565 d[0] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(pIndex));
566 d[1] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(nIndex));
567 if(!d[0] || !d[1]) return kFALSE;
569 Float_t p[2] = {static_cast<Float_t>(d[0]->GetP()), static_cast<Float_t>(d[1]->GetP())};
571 // check the 3 lambda - antilambda variables
572 Int_t check[2] = {-1, -1}; // 0 : lambda, 1 : antilambda
573 // 1) momentum of the daughter particles - proton is expected to have higher momentum than pion
574 check[0] = (p[0] > p[1]) ? 0 : 1;
575 // 2) mass of the mother particle
576 check[1] = (dMass[0] < dMass[1]) ? 0 : 1;
578 // require positive correlation of (1) and (2)
579 if(check[0] != check[1]){
580 if(kfMother[0]) delete kfMother[0];
581 if(kfMother[1]) delete kfMother[1];
585 // now that the check[0] == check[1]
586 const Int_t type = check[0];
588 // require that the input armenteros preselection agree:
589 if(type != id) return kFALSE;
593 iMass = (type == 0) ? v0->GetEffMass(4, 2) : v0->GetEffMass(2, 4);
596 iMass = (type == 0) ? v0->GetEffMass(2, 4) : v0->GetEffMass(4, 2);
599 // cos pointing angle
600 Double_t cosPoint = v0->GetV0CosineOfPointingAngle();
601 cosPoint = TMath::ACos(cosPoint);
603 // DCA between daughters
604 Double_t dca = v0->GetDcaV0Daughters();
609 Double_t r = TMath::Sqrt(x*x + y*y);
611 // proton - pion indices
612 Int_t ix[2] = {0, 1};
619 Double_t chi2ndf = kfMother[type]->GetChi2()/kfMother[type]->GetNDF();
621 if(kfMother[0]) delete kfMother[0];
622 if(kfMother[1]) delete kfMother[1];
628 if(iMass < fLcutInvMass[0] || iMass > fLcutInvMass[1]) return kFALSE;
630 if(chi2ndf > fLcutChi2NDF) return kFALSE;
632 if(cosPoint < fLcutCosPoint[0] || cosPoint > fLcutCosPoint[1]) return kFALSE;
634 if(dca < fLcutDCA[0] || dca > fLcutDCA[1]) return kFALSE;
636 if(r < fLcutVertexR[0] || r > fLcutVertexR[1]) return kFALSE;
665 //____________________________________________________________________
666 Bool_t AliESDv0KineCuts::V0CutsCommon(const AliESDv0 * const v0) const
669 // V0 cuts common to all V0s
672 AliESDtrack* dN, *dP;
674 dP = dynamic_cast<AliESDtrack *>(fEvent->GetTrack(v0->GetPindex()));
675 dN = dynamic_cast<AliESDtrack *>(fEvent->GetTrack(v0->GetNindex()));
677 if(!dN || !dP) return kFALSE;
679 Int_t qP = dP->Charge();
680 Int_t qN = dN->Charge();
682 if((qP*qN) != -1) return kFALSE;
686 //____________________________________________________________________
687 void AliESDv0KineCuts::Armenteros(AliESDv0* const v0, Float_t val[2]) const
690 // computes the Armenteros variables for given V0
691 // fills the histogram
692 // returns the values via "val"
695 Double_t mn[3] = {0,0,0};
696 Double_t mp[3] = {0,0,0};
697 Double_t mm[3] = {0,0,0};
700 v0->GetNPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter
701 v0->GetPPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter
704 v0->GetPPxPyPz(mn[0],mn[1],mn[2]); //reconstructed cartesian momentum components of negative daughter
705 v0->GetNPxPyPz(mp[0],mp[1],mp[2]); //reconstructed cartesian momentum components of positive daughter
707 v0->GetPxPyPz(mm[0],mm[1],mm[2]); //reconstructed cartesian momentum components of mother
709 TVector3 vecN(mn[0],mn[1],mn[2]);
710 TVector3 vecP(mp[0],mp[1],mp[2]);
711 TVector3 vecM(mm[0],mm[1],mm[2]);
713 Double_t thetaP = acos((vecP * vecM)/(vecP.Mag() * vecM.Mag()));
714 Double_t thetaN = acos((vecN * vecM)/(vecN.Mag() * vecM.Mag()));
716 Double_t alfa = ((vecP.Mag())*cos(thetaP)-(vecN.Mag())*cos(thetaN))/
717 ((vecP.Mag())*cos(thetaP)+(vecN.Mag())*cos(thetaN)) ;
718 Double_t qt = vecP.Mag()*sin(thetaP);
723 //____________________________________________________________________
724 Bool_t AliESDv0KineCuts::CheckSigns(AliESDv0* const v0) const
727 // check wheter the sign was correctly applied to
728 // V0 daughter tracks
731 Bool_t correct = kFALSE;
733 Int_t pIndex = 0, nIndex = 0;
734 pIndex = v0->GetPindex();
735 nIndex = v0->GetNindex();
738 d[0] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(pIndex));
739 d[1] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(nIndex));
742 sign[0] = (int)d[0]->GetSign();
743 sign[1] = (int)d[1]->GetSign();
745 if(-1 == sign[0] && 1 == sign[1]){
754 //________________________________________________________________
755 Double_t AliESDv0KineCuts::PsiPair(AliESDv0* const v0) const
758 // Angle between daughter momentum plane and plane
761 if(!fEvent) return -1.;
763 Float_t magField = fEvent->GetMagneticField();
768 pIndex = v0->GetPindex();
769 nIndex = v0->GetNindex();
772 pIndex = v0->GetNindex();
773 nIndex = v0->GetPindex();
777 AliESDtrack* daughter[2];
779 daughter[0] = dynamic_cast<AliESDtrack *>(fEvent->GetTrack(pIndex));
780 daughter[1] = dynamic_cast<AliESDtrack *>(fEvent->GetTrack(nIndex));
783 v0->GetXYZ(x,y,z);//Reconstructed coordinates of V0; to be replaced by Markus Rammler's method in case of conversions!
785 Double_t mn[3] = {0,0,0};
786 Double_t mp[3] = {0,0,0};
789 v0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter;
790 v0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter;
793 Double_t deltat = 1.;
794 deltat = TMath::ATan(mp[2]/(TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1])+1.e-13)) - TMath::ATan(mn[2]/(TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1])+1.e-13));//difference of angles of the two daughter tracks with z-axis
796 Double_t radiussum = TMath::Sqrt(x*x + y*y) + 50;//radius to which tracks shall be propagated
798 Double_t momPosProp[3];
799 Double_t momNegProp[3];
801 AliExternalTrackParam pt(*daughter[0]), nt(*daughter[1]);
803 Double_t psiPair = 4.;
805 if(nt.PropagateTo(radiussum,magField) == 0)//propagate tracks to the outside
807 if(pt.PropagateTo(radiussum,magField) == 0)
809 pt.GetPxPyPz(momPosProp);//Get momentum vectors of tracks after propagation
810 nt.GetPxPyPz(momNegProp);
813 TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
815 TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
817 Double_t scalarproduct =
818 momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];//scalar product of propagated positive and negative daughters' momenta
820 Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));//Angle between propagated daughter tracks
822 psiPair = TMath::Abs(TMath::ASin(deltat/chipair));
826 //___________________________________________________________________
827 Bool_t AliESDv0KineCuts::GetConvPosXY(AliESDtrack * const ptrack, AliESDtrack * const ntrack, Double_t convpos[2]) const
830 // recalculate the gamma conversion XY postition
833 const Double_t b = fEvent->GetMagneticField();
835 Double_t helixcenterpos[2];
836 GetHelixCenter(ptrack,b,ptrack->Charge(),helixcenterpos);
838 Double_t helixcenterneg[2];
839 GetHelixCenter(ntrack,b,ntrack->Charge(),helixcenterneg);
841 Double_t poshelix[6];
842 ptrack->GetHelixParameters(poshelix,b);
843 Double_t posradius = TMath::Abs(1./poshelix[4]);
845 Double_t neghelix[6];
846 ntrack->GetHelixParameters(neghelix,b);
847 Double_t negradius = TMath::Abs(1./neghelix[4]);
849 Double_t xpos = helixcenterpos[0];
850 Double_t ypos = helixcenterpos[1];
851 Double_t xneg = helixcenterneg[0];
852 Double_t yneg = helixcenterneg[1];
854 convpos[0] = (xpos*negradius + xneg*posradius)/(negradius+posradius);
855 convpos[1] = (ypos*negradius+ yneg*posradius)/(negradius+posradius);
859 //___________________________________________________________________
860 Bool_t AliESDv0KineCuts::GetHelixCenter(AliESDtrack * const track, Double_t b,Int_t charge, Double_t center[2]) const
863 // computes the center of the track helix
866 Double_t pi = TMath::Pi();
869 track->GetHelixParameters(helix,b);
871 Double_t xpos = helix[5];
872 Double_t ypos = helix[0];
873 Double_t radius = TMath::Abs(1./helix[4]);
874 Double_t phi = helix[2];
881 Double_t xpoint = radius * TMath::Cos(phi);
882 Double_t ypoint = radius * TMath::Sin(phi);
889 /* avoid self assignment
897 /* avoid self assignment
908 center[0] = xpos + xpoint;
909 center[1] = ypos + ypoint;
913 //___________________________________________________________________
914 AliKFParticle *AliESDv0KineCuts::CreateMotherParticle(const AliVTrack* const pdaughter, const AliVTrack* const ndaughter, Int_t pspec, Int_t nspec) const
917 // Creates a mother particle
919 AliKFParticle pkfdaughter(*pdaughter, pspec);
920 AliKFParticle nkfdaughter(*ndaughter, nspec);
923 // Create the mother particle
924 AliKFParticle *m = new AliKFParticle(pkfdaughter, nkfdaughter);
925 m->SetField(fEvent->GetMagneticField());
926 if(TMath::Abs(kElectron) == pspec && TMath::Abs(kElectron) == nspec) m->SetMassConstraint(0, 0.001);
927 else if(TMath::Abs(kPiPlus) == pspec && TMath::Abs(kPiPlus) == nspec) m->SetMassConstraint(TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass(), 0.);
928 else if(TMath::Abs(kProton) == pspec && TMath::Abs(kPiPlus) == nspec) m->SetMassConstraint(TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass(), 0.);
929 else if(TMath::Abs(kPiPlus) == pspec && TMath::Abs(kProton) == nspec) m->SetMassConstraint(TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass(), 0.);
931 AliErrorClass("Wrong daughter ID - mass constraint can not be set");
934 AliKFVertex improvedVertex = *fPrimaryVertex;
935 improvedVertex += *m;
936 m->SetProductionVertex(improvedVertex);
939 // mother particle will not be added to primary vertex but only to its copy
940 // as this confilcts with calling
941 // m->SetPrimaryVertex() function and
942 // subsequently removing the mother particle afterwards
943 // Source: Sergey Gorbunov
947 //____________________________________________________________________
948 void AliESDv0KineCuts::SetEvent(AliESDEvent* const event){
950 // direct setter of ESD event
954 AliErrorClass("Invalid input event pointer");
957 if (fUseExternalVertex) return;
959 if(fPrimaryVertex && fDeleteVertex){
960 delete fPrimaryVertex;
963 fPrimaryVertex = new AliKFVertex(*(fEvent->GetPrimaryVertex()));
970 //____________________________________________________________________
971 void AliESDv0KineCuts::SetEvent(AliVEvent* const event){
973 // direct setter of ESD event
976 fEvent = dynamic_cast<AliESDEvent*>(event);
978 AliErrorClass("Invalid input event pointer");
982 if (fUseExternalVertex) return;
984 if(fPrimaryVertex && fDeleteVertex){
985 delete fPrimaryVertex;
988 fPrimaryVertex = new AliKFVertex(*(fEvent->GetPrimaryVertex()));
994 //________________________________________________________________
995 void AliESDv0KineCuts::UseExternalVertex(Bool_t use_external){
997 // Reenable primary Vertex from ESD event
999 if (use_external) fUseExternalVertex =kTRUE;
1000 else fUseExternalVertex =kFALSE;
1006 //________________________________________________________________
1007 void AliESDv0KineCuts::SetPrimaryVertex(AliKFVertex* const v){
1009 // set the primary vertex of the event
1011 if(fPrimaryVertex && fDeleteVertex){
1012 delete fPrimaryVertex;
1013 fPrimaryVertex =0x0;
1014 fDeleteVertex = kFALSE;
1016 fUseExternalVertex=kTRUE;
1017 fPrimaryVertex = v; // set primary Vertex
1018 if(!fPrimaryVertex){
1019 AliErrorClass("Failed to initialize the primary vertex");
1023 //___________________________________________________________________
1024 void AliESDv0KineCuts::SetMode(Int_t mode, Int_t type){
1026 // this function allows the user to select (prior running the 'ProcessV0' function)
1027 // to select different approaches to V0 selection - the 'mode'
1029 // different systems (pp, PbPb) - 'type'
1031 // To see the cut values for different modes please refer to the
1032 // function SetCuts()
1034 // Important notice: based on the parameters particular sets of cuts will
1035 // be activated for teh V0 selection. If some additional changes to single
1036 // cuts are needed please us the SetXXXcut function (see the header file)
1041 fMode = kPurity; // used to obtain highest purity possible - the efficiency may be low
1044 fMode = kEffGamma; // used to obtain highes efficiency possible - the purity may be worse
1047 AliError("V0 selection mode not recognozed, setting 'kPurity'");
1053 fType = kPP; // cuts optimized for low multiplicity
1056 fType = kPbPb; // cuts optimized for high multiplicity
1060 // setup the cut values for selected mode & type
1064 //___________________________________________________________________
1065 void AliESDv0KineCuts::SetMode(Int_t mode, const char* type){
1067 // overloaded function - please see above
1072 if(!strcmp("pp", type)) t = kPP;
1073 else if(!(strcmp("PbPb", type))) t = kPbPb;
1075 AliError("data type not recognized, setting 'pp'");
1082 //___________________________________________________________________
1083 void AliESDv0KineCuts::SetCuts(){
1085 // this funciton sets the default cut values based on the selected
1087 // please note that only the cuts that have different values than the default
1088 // cuts are updated here
1091 // last update: 14/02/2011
1092 // as a very preliminary - the only change to default cuts is to apply
1093 // less restricting gamma conversion selection in PreselectV0() function