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, IPHC, Strasbourg, Jouri.Belikov@cern.ch
21 //-------------------------------------------------------------------------
22 // Adapted for more customizability and
23 // lightweight operation in Pb-Pb
25 // This is still being tested! Use at your own risk!
26 //-------------------------------------------------------------------------
28 #include "AliESDEvent.h"
30 #include "AliLightV0vertexer.h"
32 ClassImp(AliLightV0vertexer)
35 //A set of very loose cuts
36 Double_t AliLightV0vertexer::fgChi2max=33.; //max chi2
37 Double_t AliLightV0vertexer::fgDNmin=0.05; //min imp parameter for the 1st daughter
38 Double_t AliLightV0vertexer::fgDPmin=0.05; //min imp parameter for the 2nd daughter
39 Double_t AliLightV0vertexer::fgDCAmax=1.5; //max DCA between the daughter tracks
40 Double_t AliLightV0vertexer::fgCPAmin=0.9; //min cosine of V0's pointing angle
41 Double_t AliLightV0vertexer::fgRmin=0.2; //min radius of the fiducial volume
42 Double_t AliLightV0vertexer::fgRmax=200.; //max radius of the fiducial volume
44 Double_t AliLightV0vertexer::fgMaxEta=0.8; //max |eta|
45 Double_t AliLightV0vertexer::fgMinClusters=70; //min clusters (>=)
47 Int_t AliLightV0vertexer::Tracks2V0vertices(AliESDEvent *event) {
48 //--------------------------------------------------------------------
49 //This function reconstructs V0 vertices
50 //--------------------------------------------------------------------
52 const AliESDVertex *vtxT3D=event->GetPrimaryVertex();
54 Double_t xPrimaryVertex=vtxT3D->GetX();
55 Double_t yPrimaryVertex=vtxT3D->GetY();
56 Double_t zPrimaryVertex=vtxT3D->GetZ();
58 Int_t nentr=event->GetNumberOfTracks();
59 Double_t b=event->GetMagneticField();
61 if (nentr<2) return 0;
66 Int_t nneg=0, npos=0, nvtx=0;
69 for (i=0; i<nentr; i++) {
70 AliESDtrack *esdTrack=event->GetTrack(i);
71 ULong_t status=esdTrack->GetStatus();
73 //if ((status&AliESDtrack::kITSrefit)==0)//not to accept the ITS SA tracks
74 if ((status&AliESDtrack::kTPCrefit)==0) continue;
76 //Track pre-selection: clusters
77 if (esdTrack->GetTPCNcls() < fMinClusters ) continue;
79 Double_t d=esdTrack->GetD(xPrimaryVertex,yPrimaryVertex,b);
80 if (TMath::Abs(d)<fDPmin) continue;
81 if (TMath::Abs(d)>fRmax) continue;
83 if (esdTrack->GetSign() < 0.) neg[nneg++]=i;
88 for (i=0; i<nneg; i++) {
90 AliESDtrack *ntrk=event->GetTrack(nidx);
92 for (Int_t k=0; k<npos; k++) {
94 AliESDtrack *ptrk=event->GetTrack(pidx);
96 //Track pre-selection: clusters
97 if (ptrk->GetTPCNcls() < fMinClusters ) continue;
99 if (TMath::Abs(ntrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin)
100 if (TMath::Abs(ptrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin) continue;
102 Double_t xn, xp, dca=ntrk->GetDCA(ptrk,b,xn,xp);
103 if (dca > fDCAmax) continue;
104 if ((xn+xp) > 2*fRmax) continue;
105 if ((xn+xp) < 2*fRmin) continue;
107 AliExternalTrackParam nt(*ntrk), pt(*ptrk);
108 Bool_t corrected=kFALSE;
109 if ((nt.GetX() > 3.) && (xn < 3.)) {
110 //correct for the beam pipe material
113 if ((pt.GetX() > 3.) && (xp < 3.)) {
114 //correct for the beam pipe material
118 dca=nt.GetDCA(&pt,b,xn,xp);
119 if (dca > fDCAmax) continue;
120 if ((xn+xp) > 2*fRmax) continue;
121 if ((xn+xp) < 2*fRmin) continue;
124 nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);
126 //select maximum eta range (after propagation)
127 if (TMath::Abs(nt.Eta())>fMaxEta) continue;
128 if (TMath::Abs(pt.Eta())>fMaxEta) continue;
130 AliESDv0 vertex(nt,nidx,pt,pidx);
131 if (vertex.GetChi2V0() > fChi2max) continue;
133 Double_t x=vertex.Xv(), y=vertex.Yv();
134 Double_t r2=x*x + y*y;
135 if (r2 < fRmin*fRmin) continue;
136 if (r2 > fRmax*fRmax) continue;
138 Float_t cpa=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
140 //Simple cosine cut (no pt dependence for now)
141 if (cpa < fCPAmin) continue;
143 vertex.SetDcaV0Daughters(dca);
144 vertex.SetV0CosineOfPointingAngle(cpa);
145 vertex.ChangeMassHypothesis(kK0Short);
147 event->AddV0(&vertex);
153 Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx);