]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliV0vertexer.cxx
Regenerated with modifying geometry (adding mother volumes)
[u/mrichter/AliRoot.git] / STEER / AliV0vertexer.cxx
CommitLineData
c7bafca9 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
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>
23#include <TTree.h>
24
25#include "AliESD.h"
26#include "AliESDv0.h"
27#include "AliESDtrack.h"
28#include "AliV0vertexer.h"
29
30ClassImp(AliV0vertexer)
31
32Int_t AliV0vertexer::Tracks2V0vertices(AliESD *event) {
33 //--------------------------------------------------------------------
34 //This function reconstructs V0 vertices
35 //--------------------------------------------------------------------
36
37 Int_t nentr=event->GetNumberOfTracks();
38 Double_t b=event->GetMagneticField();
39
da46f3ca 40 if (nentr<2) return 0;
41
c7bafca9 42 TArrayI neg(nentr/2);
43 TArrayI pos(nentr/2);
44
45 Int_t nneg=0, npos=0, nvtx=0;
46
47 Int_t i;
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;
53
54 if ((status&AliESDtrack::kITSrefit)==0)
55 if (flags!=status) continue;
56
57 Double_t d=esdTrack->GetD(fX,fY,b);
58 if (TMath::Abs(d)<fDPmin) continue;
59 if (TMath::Abs(d)>fRmax) continue;
60
61 if (esdTrack->GetSign() < 0.) neg[nneg++]=i;
62 else pos[npos++]=i;
63 }
64
65
66 for (i=0; i<nneg; i++) {
67 Int_t nidx=neg[i];
68 AliESDtrack *ntrk=event->GetTrack(nidx);
69
70 for (Int_t k=0; k<npos; k++) {
71 Int_t pidx=pos[k];
72 AliESDtrack *ptrk=event->GetTrack(pidx);
73
74 if (TMath::Abs(ntrk->GetD(fX,fY,b))<fDNmin)
75 if (TMath::Abs(ptrk->GetD(fX,fY,b))<fDNmin) continue;
76
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;
81
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
86 corrected=kTRUE;
87 }
88 if ((pt.GetX() > 3.) && (xp < 3.)) {
89 //correct for the beam pipe material
90 corrected=kTRUE;
91 }
92 if (corrected) {
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;
97 }
98
99 nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);
100
101 AliESDv0 vertex(nt,nidx,pt,pidx);
102 if (vertex.GetChi2() > fChi2max) continue;
103
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;
107 */
108
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)));
114
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
119
120 event->AddV0(&vertex);
121
122 nvtx++;
123 }
124 }
125
126 Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx);
127
da46f3ca 128 return nvtx;
c7bafca9 129}
130
131
132
133
134
135
136
137
138
139
140
141
142
143