]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliV0vertexer.cxx
Possibility to calculate the DCA between two ESD track. The V0 and cascade vertexes...
[u/mrichter/AliRoot.git] / STEER / AliV0vertexer.cxx
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
30 ClassImp(AliV0vertexer)
31
32 Int_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
40    TArrayI neg(nentr/2);
41    TArrayI pos(nentr/2);
42
43    Int_t nneg=0, npos=0, nvtx=0;
44
45    Int_t i;
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;
51
52      if ((status&AliESDtrack::kITSrefit)==0)
53         if (flags!=status) continue;
54
55      Double_t d=esdTrack->GetD(fX,fY,b);
56      if (TMath::Abs(d)<fDPmin) continue;
57      if (TMath::Abs(d)>fRmax) continue;
58
59      if (esdTrack->GetSign() < 0.) neg[nneg++]=i;
60      else pos[npos++]=i;
61    }   
62
63
64    for (i=0; i<nneg; i++) {
65       Int_t nidx=neg[i];
66       AliESDtrack *ntrk=event->GetTrack(nidx);
67
68       for (Int_t k=0; k<npos; k++) {
69          Int_t pidx=pos[k];
70          AliESDtrack *ptrk=event->GetTrack(pidx);
71
72          if (TMath::Abs(ntrk->GetD(fX,fY,b))<fDNmin)
73            if (TMath::Abs(ptrk->GetD(fX,fY,b))<fDNmin) continue;
74
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;
79    
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
84            corrected=kTRUE;
85          }
86          if ((pt.GetX() > 3.) && (xp < 3.)) {
87            //correct for the beam pipe material
88            corrected=kTRUE;
89          }
90          if (corrected) {
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;
95          }
96
97          nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);
98
99          AliESDv0 vertex(nt,nidx,pt,pidx);
100          if (vertex.GetChi2() > fChi2max) continue;
101          
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;
105          */
106
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)));
112
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 
117
118          event->AddV0(&vertex);
119
120          nvtx++;
121       }
122    }
123
124    Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx);
125
126    return 0;
127 }
128
129
130
131
132
133
134
135
136
137
138
139
140
141