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 cascade vertexer class
18 // Reads V0s and tracks, writes out cascade vertices
19 // Fills the ESD with the cascades
20 // Origin: Christian Kuhn, IReS, Strasbourg, christian.kuhn@ires.in2p3.fr
21 //-------------------------------------------------------------------------
23 //modified by R. Vernet 30/6/2006 : daughter label
24 //modified by R. Vernet 3/7/2006 : causality
25 //modified by I. Belikov 24/11/2006 : static setter for the default cuts
28 #include <TObjArray.h>
31 #include "AliESDEvent.h"
33 #include "AliESDcascade.h"
34 #include "AliCascadeVertexer.h"
35 #include "AliESDtrack.h"
36 #include "AliESDVertex.h"
38 ClassImp(AliCascadeVertexer)
42 AliCascadeVertexer::fgChi2max=33.; //maximal allowed chi2
44 AliCascadeVertexer::fgDV0min=0.05; //min V0 impact parameter
46 AliCascadeVertexer::fgMassWin=0.01; //"window" around the Lambda mass
48 AliCascadeVertexer::fgDBachMin=0.035; //min bachelor impact parameter
50 AliCascadeVertexer::fgDCAmax=0.10; //max DCA between the V0 and the track
52 AliCascadeVertexer::fgCPAmin=0.9985; //min cosine of the cascade pointing angle
54 AliCascadeVertexer::fgRmin=0.2; //min radius of the fiducial volume
56 AliCascadeVertexer::fgRmax=100.; //max radius of the fiducial volume
59 Int_t AliCascadeVertexer::V0sTracks2CascadeVertices(AliESDEvent *event) {
60 //--------------------------------------------------------------------
61 // This function reconstructs cascade vertices
62 // Adapted to the ESD by I.Belikov (Jouri.Belikov@cern.ch)
63 //--------------------------------------------------------------------
64 const AliESDVertex *vtxSPD=event->GetVertex();
65 const AliESDVertex *vtxT3D=event->GetPrimaryVertex();
67 Double_t xPrimaryVertex=999, yPrimaryVertex=999, zPrimaryVertex=999;
68 if (vtxT3D->GetStatus()) {
69 xPrimaryVertex=vtxT3D->GetXv();
70 yPrimaryVertex=vtxT3D->GetYv();
71 zPrimaryVertex=vtxT3D->GetZv();
74 xPrimaryVertex=vtxSPD->GetXv();
75 yPrimaryVertex=vtxSPD->GetYv();
76 zPrimaryVertex=vtxSPD->GetZv();
79 Double_t b=event->GetMagneticField();
80 Int_t nV0=(Int_t)event->GetNumberOfV0s();
82 //stores relevant V0s in an array
85 for (i=0; i<nV0; i++) {
86 AliESDv0 *v=event->GetV0(i);
87 if (v->GetOnFlyStatus()) continue;
88 if (v->GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex)<fDV0min) continue;
91 nV0=vtcs.GetEntriesFast();
93 // stores relevant tracks in another array
94 Int_t nentr=(Int_t)event->GetNumberOfTracks();
95 TArrayI trk(nentr); Int_t ntr=0;
96 for (i=0; i<nentr; i++) {
97 AliESDtrack *esdtr=event->GetTrack(i);
98 ULong_t status=esdtr->GetStatus();
100 if ((status&AliESDtrack::kITSrefit)==0)
101 if ((status&AliESDtrack::kTPCrefit)==0) continue;
103 if (TMath::Abs(esdtr->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDBachMin) continue;
108 Double_t massLambda=1.11568;
111 // Looking for the cascades...
113 for (i=0; i<nV0; i++) { //loop on V0s
115 AliESDv0 *v=(AliESDv0*)vtcs.UncheckedAt(i);
116 v->ChangeMassHypothesis(kLambda0); // the v0 must be Lambda
117 if (TMath::Abs(v->GetEffMass()-massLambda)>fMassWin) continue;
119 for (Int_t j=0; j<ntr; j++) {//loop on tracks
121 //Bo: if (bidx==v->GetNindex()) continue; //bachelor and v0's negative tracks must be different
122 if (bidx==v->GetIndex(0)) continue; //Bo: consistency 0 for neg
123 AliESDtrack *btrk=event->GetTrack(bidx);
124 if (btrk->GetSign()>0) continue; // bachelor's charge
126 AliESDv0 v0(*v), *pv0=&v0;
127 AliExternalTrackParam bt(*btrk), *pbt=&bt;
129 Double_t dca=PropagateToDCA(pv0,pbt,b);
130 if (dca > fDCAmax) continue;
132 AliESDcascade cascade(*pv0,*pbt,bidx);//constucts a cascade candidate
133 if (cascade.GetChi2Xi() > fChi2max) continue;
135 Double_t x,y,z; cascade.GetXYZcascade(x,y,z); // Bo: bug correction
136 Double_t r2=x*x + y*y;
137 if (r2 > fRmax*fRmax) continue; // condition on fiducial zone
138 if (r2 < fRmin*fRmin) continue;
140 Double_t pxV0,pyV0,pzV0;
141 pv0->GetPxPyPz(pxV0,pyV0,pzV0);
142 if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality
144 Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1);
145 if (r2 > (x1*x1+y1*y1)) continue;
147 if (cascade.GetCascadeCosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex) <fCPAmin) continue; //condition on the cascade pointing angle
149 event->AddCascade(&cascade);
154 // Looking for the anti-cascades...
156 for (i=0; i<nV0; i++) { //loop on V0s
157 AliESDv0 *v=(AliESDv0*)vtcs.UncheckedAt(i);
158 v->ChangeMassHypothesis(kLambda0Bar); //the v0 must be anti-Lambda
159 if (TMath::Abs(v->GetEffMass()-massLambda)>fMassWin) continue;
161 for (Int_t j=0; j<ntr; j++) {//loop on tracks
163 //Bo: if (bidx==v->GetPindex()) continue; //bachelor and v0's positive tracks must be different
164 if (bidx==v->GetIndex(1)) continue; //Bo: consistency 1 for pos
165 AliESDtrack *btrk=event->GetTrack(bidx);
166 if (btrk->GetSign()<0) continue; // bachelor's charge
168 AliESDv0 v0(*v), *pv0=&v0;
169 AliESDtrack bt(*btrk), *pbt=&bt;
171 Double_t dca=PropagateToDCA(pv0,pbt,b);
172 if (dca > fDCAmax) continue;
174 AliESDcascade cascade(*pv0,*pbt,bidx); //constucts a cascade candidate
175 if (cascade.GetChi2Xi() > fChi2max) continue;
177 Double_t x,y,z; cascade.GetXYZcascade(x,y,z); // Bo: bug correction
178 Double_t r2=x*x + y*y;
179 if (r2 > fRmax*fRmax) continue; // condition on fiducial zone
180 if (r2 < fRmin*fRmin) continue;
182 Double_t pxV0,pyV0,pzV0;
183 pv0->GetPxPyPz(pxV0,pyV0,pzV0);
184 if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality
186 Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1);
187 if (r2 > (x1*x1+y1*y1)) continue;
188 if (z*z > z1*z1) continue;
190 if (cascade.GetCascadeCosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex) < fCPAmin) continue; //condition on the cascade pointing angle
191 event->AddCascade(&cascade);
197 Info("V0sTracks2CascadeVertices","Number of reconstructed cascades: %d",ncasc);
203 Double_t det(Double_t a00, Double_t a01, Double_t a10, Double_t a11){
205 return a00*a11 - a01*a10;
208 Double_t det (Double_t a00,Double_t a01,Double_t a02,
209 Double_t a10,Double_t a11,Double_t a12,
210 Double_t a20,Double_t a21,Double_t a22) {
213 a00*det(a11,a12,a21,a22)-a01*det(a10,a12,a20,a22)+a02*det(a10,a11,a20,a21);
219 Double_t AliCascadeVertexer::
220 PropagateToDCA(AliESDv0 *v, AliExternalTrackParam *t, Double_t b) {
221 //--------------------------------------------------------------------
222 // This function returns the DCA between the V0 and the track
223 //--------------------------------------------------------------------
224 Double_t alpha=t->GetAlpha(), cs1=TMath::Cos(alpha), sn1=TMath::Sin(alpha);
225 Double_t r[3]; t->GetXYZ(r);
226 Double_t x1=r[0], y1=r[1], z1=r[2];
227 Double_t p[3]; t->GetPxPyPz(p);
228 Double_t px1=p[0], py1=p[1], pz1=p[2];
230 Double_t x2,y2,z2; // position and momentum of V0
231 Double_t px2,py2,pz2;
234 v->GetPxPyPz(px2,py2,pz2);
238 Double_t dd= det(x2-x1,y2-y1,z2-z1,px1,py1,pz1,px2,py2,pz2);
239 Double_t ax= det(py1,pz1,py2,pz2);
240 Double_t ay=-det(px1,pz1,px2,pz2);
241 Double_t az= det(px1,py1,px2,py2);
243 Double_t dca=TMath::Abs(dd)/TMath::Sqrt(ax*ax + ay*ay + az*az);
246 Double_t t1 = det(x2-x1,y2-y1,z2-z1,px2,py2,pz2,ax,ay,az)/
247 det(px1,py1,pz1,px2,py2,pz2,ax,ay,az);
249 x1 += px1*t1; y1 += py1*t1; //z1 += pz1*t1;
252 //propagate track to the points of DCA
255 if (!t->PropagateTo(x1,b)) {
256 Error("PropagateToDCA","Propagation failed !");