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();
43 Int_t nneg=0, npos=0, nvtx=0;
46 for (i=0; i<nentr; i++) {
47 AliESDtrack *esdTrack=event->GetTrack(i);
48 UInt_t status=esdTrack->GetStatus();
49 UInt_t flags=AliESDtrack::kITSin|AliESDtrack::kTPCin|
50 AliESDtrack::kTPCpid|AliESDtrack::kESDpid;
52 if ((status&AliESDtrack::kITSrefit)==0)
53 if (flags!=status) continue;
55 Double_t d=esdTrack->GetD(fX,fY,b);
56 if (TMath::Abs(d)<fDPmin) continue;
57 if (TMath::Abs(d)>fRmax) continue;
59 if (esdTrack->GetSign() < 0.) neg[nneg++]=i;
64 for (i=0; i<nneg; i++) {
66 AliESDtrack *ntrk=event->GetTrack(nidx);
68 for (Int_t k=0; k<npos; k++) {
70 AliESDtrack *ptrk=event->GetTrack(pidx);
72 if (TMath::Abs(ntrk->GetD(fX,fY,b))<fDNmin)
73 if (TMath::Abs(ptrk->GetD(fX,fY,b))<fDNmin) continue;
75 Double_t xn, xp, dca=ntrk->GetDCA(ptrk,b,xn,xp);
76 if (dca > fDCAmax) continue;
77 if ((xn+xp) > 2*fRmax) continue;
78 if ((xn+xp) < 2*fRmin) continue;
80 AliExternalTrackParam nt(*ntrk), pt(*ptrk);
81 Bool_t corrected=kFALSE;
82 if ((nt.GetX() > 3.) && (xn < 3.)) {
83 //correct for the beam pipe material
86 if ((pt.GetX() > 3.) && (xp < 3.)) {
87 //correct for the beam pipe material
91 dca=nt.GetDCA(&pt,b,xn,xp);
92 if (dca > fDCAmax) continue;
93 if ((xn+xp) > 2*fRmax) continue;
94 if ((xn+xp) < 2*fRmin) continue;
97 nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);
99 AliESDv0 vertex(nt,nidx,pt,pidx);
100 if (vertex.GetChi2() > fChi2max) continue;
102 /* Think of something better here !
103 nt.PropagateToVertex(); if (TMath::Abs(nt.GetZ())<0.04) continue;
104 pt.PropagateToVertex(); if (TMath::Abs(pt.GetZ())<0.04) continue;
107 Double_t x,y,z; vertex.GetXYZ(x,y,z);
108 Double_t px,py,pz; vertex.GetPxPyPz(px,py,pz);
109 Double_t p2=px*px+py*py+pz*pz;
110 Double_t cost=((x-fX)*px + (y-fY)*py + (z-fZ)*pz)/
111 TMath::Sqrt(p2*((x-fX)*(x-fX) + (y-fY)*(y-fY) + (z-fZ)*(z-fZ)));
113 //if (cost < (5*fCPAmax-0.9-TMath::Sqrt(r2)*(fCPAmax-1))/4.1) continue;
114 if (cost < fCPAmax) continue;
115 vertex.SetDcaDaughters(dca);
116 //vertex.ChangeMassHypothesis(); //default is Lambda0
118 event->AddV0(&vertex);
124 Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx);