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 **************************************************************************/
16 //-------------------------------------------------------------------------
17 // Implementation of the V0 vertexer class
18 // reads tracks writes out V0 vertices
19 // fills the ESD with the V0s
20 // Origin: Iouri Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch
21 //-------------------------------------------------------------------------
22 #include <TObjArray.h>
27 #include "AliESDtrack.h"
28 #include "AliV0vertexer.h"
30 ClassImp(AliV0vertexer)
32 Int_t AliV0vertexer::Tracks2V0vertices(AliESD *event) {
33 //--------------------------------------------------------------------
34 //This function reconstructs V0 vertices
35 //--------------------------------------------------------------------
37 Int_t nentr=event->GetNumberOfTracks();
38 Double_t b=event->GetMagneticField();
40 if (nentr<2) return 0;
45 Int_t nneg=0, npos=0, nvtx=0;
48 for (i=0; i<nentr; i++) {
49 AliESDtrack *esdTrack=event->GetTrack(i);
50 UInt_t status=esdTrack->GetStatus();
51 UInt_t flags=AliESDtrack::kITSin|AliESDtrack::kTPCin|
52 AliESDtrack::kTPCpid|AliESDtrack::kESDpid;
54 if ((status&AliESDtrack::kITSrefit)==0)
55 if (flags!=status) continue;
57 Double_t d=esdTrack->GetD(fX,fY,b);
58 if (TMath::Abs(d)<fDPmin) continue;
59 if (TMath::Abs(d)>fRmax) continue;
61 if (esdTrack->GetSign() < 0.) neg[nneg++]=i;
66 for (i=0; i<nneg; i++) {
68 AliESDtrack *ntrk=event->GetTrack(nidx);
70 for (Int_t k=0; k<npos; k++) {
72 AliESDtrack *ptrk=event->GetTrack(pidx);
74 if (TMath::Abs(ntrk->GetD(fX,fY,b))<fDNmin)
75 if (TMath::Abs(ptrk->GetD(fX,fY,b))<fDNmin) continue;
77 Double_t xn, xp, dca=ntrk->GetDCA(ptrk,b,xn,xp);
78 if (dca > fDCAmax) continue;
79 if ((xn+xp) > 2*fRmax) continue;
80 if ((xn+xp) < 2*fRmin) continue;
82 AliExternalTrackParam nt(*ntrk), pt(*ptrk);
83 Bool_t corrected=kFALSE;
84 if ((nt.GetX() > 3.) && (xn < 3.)) {
85 //correct for the beam pipe material
88 if ((pt.GetX() > 3.) && (xp < 3.)) {
89 //correct for the beam pipe material
93 dca=nt.GetDCA(&pt,b,xn,xp);
94 if (dca > fDCAmax) continue;
95 if ((xn+xp) > 2*fRmax) continue;
96 if ((xn+xp) < 2*fRmin) continue;
99 nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);
101 AliESDv0 vertex(nt,nidx,pt,pidx);
102 if (vertex.GetChi2() > fChi2max) continue;
104 /* Think of something better here !
105 nt.PropagateToVertex(); if (TMath::Abs(nt.GetZ())<0.04) continue;
106 pt.PropagateToVertex(); if (TMath::Abs(pt.GetZ())<0.04) continue;
109 Double_t x,y,z; vertex.GetXYZ(x,y,z);
110 Double_t px,py,pz; vertex.GetPxPyPz(px,py,pz);
111 Double_t p2=px*px+py*py+pz*pz;
112 Double_t cost=((x-fX)*px + (y-fY)*py + (z-fZ)*pz)/
113 TMath::Sqrt(p2*((x-fX)*(x-fX) + (y-fY)*(y-fY) + (z-fZ)*(z-fZ)));
115 //if (cost < (5*fCPAmax-0.9-TMath::Sqrt(r2)*(fCPAmax-1))/4.1) continue;
116 if (cost < fCPAmax) continue;
117 vertex.SetDcaDaughters(dca);
118 //vertex.ChangeMassHypothesis(); //default is Lambda0
120 event->AddV0(&vertex);
126 Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx);