]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliV0vertexer.cxx
A new method DrawPMDModule is added
[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, IPHC, Strasbourg, Jouri.Belikov@cern.ch
21 //-------------------------------------------------------------------------
22
23
24 #include <TObjArray.h>
25 #include <TTree.h>
26
27 #include "AliESDEvent.h"
28 #include "AliESDv0.h"
29 #include "AliESDtrack.h"
30 #include "AliV0vertexer.h"
31 #include "AliESDVertex.h"
32
33 ClassImp(AliV0vertexer)
34
35
36 //A set of very loose cuts 
37 Double_t AliV0vertexer::fgChi2max=33.; //max chi2
38 Double_t AliV0vertexer::fgDNmin=0.05;  //min imp parameter for the 1st daughter
39 Double_t AliV0vertexer::fgDPmin=0.05;  //min imp parameter for the 2nd daughter
40 Double_t AliV0vertexer::fgDCAmax=0.5;  //max DCA between the daughter tracks
41 Double_t AliV0vertexer::fgCPAmin=0.99; //min cosine of V0's pointing angle
42 Double_t AliV0vertexer::fgRmin=0.2;    //min radius of the fiducial volume
43 Double_t AliV0vertexer::fgRmax=100.;   //max radius of the fiducial volume
44
45 Int_t AliV0vertexer::Tracks2V0vertices(AliESDEvent *event) {
46   //--------------------------------------------------------------------
47   //This function reconstructs V0 vertices
48   //--------------------------------------------------------------------
49
50    const AliESDVertex *vtxSPD=event->GetVertex();
51    const AliESDVertex *vtxT3D=event->GetPrimaryVertex();
52
53    Double_t xPrimaryVertex=999, yPrimaryVertex=999, zPrimaryVertex=999;
54    if (vtxT3D->GetStatus()) {
55      xPrimaryVertex=vtxT3D->GetXv();
56      yPrimaryVertex=vtxT3D->GetYv();
57      zPrimaryVertex=vtxT3D->GetZv();
58    }
59    else {
60      xPrimaryVertex=vtxSPD->GetXv();
61      yPrimaryVertex=vtxSPD->GetYv();
62      zPrimaryVertex=vtxSPD->GetZv();
63    }
64
65    Int_t nentr=event->GetNumberOfTracks();
66    Double_t b=event->GetMagneticField();
67
68    if (nentr<2) return 0; 
69
70    TArrayI neg(nentr/2);
71    TArrayI pos(nentr/2);
72
73    Int_t nneg=0, npos=0, nvtx=0;
74
75    Int_t i;
76    for (i=0; i<nentr; i++) {
77      AliESDtrack *esdTrack=event->GetTrack(i);
78      ULong_t status=esdTrack->GetStatus();
79
80      if ((status&AliESDtrack::kITSrefit)==0)
81         if ((status&AliESDtrack::kTPCrefit)==0) continue;
82
83      Double_t d=esdTrack->GetD(xPrimaryVertex,yPrimaryVertex,b);
84      if (TMath::Abs(d)<fDPmin) continue;
85      if (TMath::Abs(d)>fRmax) continue;
86
87      if (esdTrack->GetSign() < 0.) neg[nneg++]=i;
88      else pos[npos++]=i;
89    }   
90
91
92    for (i=0; i<nneg; i++) {
93       Int_t nidx=neg[i];
94       AliESDtrack *ntrk=event->GetTrack(nidx);
95
96       for (Int_t k=0; k<npos; k++) {
97          Int_t pidx=pos[k];
98          AliESDtrack *ptrk=event->GetTrack(pidx);
99
100          if (TMath::Abs(ntrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin)
101            if (TMath::Abs(ptrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin) continue;
102
103          Double_t xn, xp, dca=ntrk->GetDCA(ptrk,b,xn,xp);
104          if (dca > fDCAmax) continue;
105          if ((xn+xp) > 2*fRmax) continue;
106          if ((xn+xp) < 2*fRmin) continue;
107    
108          AliExternalTrackParam nt(*ntrk), pt(*ptrk);
109          Bool_t corrected=kFALSE;
110          if ((nt.GetX() > 3.) && (xn < 3.)) {
111            //correct for the beam pipe material
112            corrected=kTRUE;
113          }
114          if ((pt.GetX() > 3.) && (xp < 3.)) {
115            //correct for the beam pipe material
116            corrected=kTRUE;
117          }
118          if (corrected) {
119            dca=nt.GetDCA(&pt,b,xn,xp);
120            if (dca > fDCAmax) continue;
121            if ((xn+xp) > 2*fRmax) continue;
122            if ((xn+xp) < 2*fRmin) continue;
123          }
124
125          nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);
126
127          AliESDv0 vertex(nt,nidx,pt,pidx);
128          if (vertex.GetChi2V0() > fChi2max) continue;
129          
130          Float_t cpa=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
131          if (cpa < fCPAmin) continue;
132          vertex.SetDcaV0Daughters(dca);
133          vertex.SetV0CosineOfPointingAngle(cpa);
134          vertex.ChangeMassHypothesis(kK0Short);
135
136          event->AddV0(&vertex);
137
138          nvtx++;
139       }
140    }
141
142    Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx);
143
144    return nvtx;
145 }
146
147
148
149
150
151
152
153
154
155
156
157
158
159