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
27 #include <TObjArray.h>
32 #include "AliESDcascade.h"
33 #include "AliCascadeVertexer.h"
35 ClassImp(AliCascadeVertexer)
37 Int_t AliCascadeVertexer::V0sTracks2CascadeVertices(AliESD *event) {
38 //--------------------------------------------------------------------
39 // This function reconstructs cascade vertices
40 // Adapted to the ESD by I.Belikov (Jouri.Belikov@cern.ch)
41 //--------------------------------------------------------------------
42 Double_t b=event->GetMagneticField();
43 Int_t nV0=(Int_t)event->GetNumberOfV0s();
45 //stores relevant V0s in an array
48 for (i=0; i<nV0; i++) {
49 AliESDv0 *v=event->GetV0(i);
50 if (v->GetD(fX,fY,fZ)<fDV0min) continue;
53 nV0=vtcs.GetEntriesFast();
55 // stores relevant tracks in another array
56 Int_t nentr=(Int_t)event->GetNumberOfTracks();
57 TArrayI trk(nentr); Int_t ntr=0;
58 for (i=0; i<nentr; i++) {
59 AliESDtrack *esdtr=event->GetTrack(i);
60 UInt_t status=esdtr->GetStatus();
61 UInt_t flags=AliESDtrack::kITSin|AliESDtrack::kTPCin|
62 AliESDtrack::kTPCpid|AliESDtrack::kESDpid;
64 if ((status&AliESDtrack::kITSrefit)==0)
65 if (flags!=status) continue;
67 if (TMath::Abs(esdtr->GetD(fX,fY,b))<fDBachMin) continue;
72 Double_t massLambda=1.11568;
75 // Looking for the cascades...
77 for (i=0; i<nV0; i++) { //loop on V0s
79 AliESDv0 *v=(AliESDv0*)vtcs.UncheckedAt(i);
80 v->ChangeMassHypothesis(kLambda0); // the v0 must be Lambda
81 if (TMath::Abs(v->GetEffMass()-massLambda)>fMassWin) continue;
83 for (Int_t j=0; j<ntr; j++) {//loop on tracks
85 if (bidx==v->GetNindex()) continue; //bachelor and v0's negative tracks must be different
86 AliESDtrack *btrk=event->GetTrack(bidx);
87 if (btrk->GetSign()>0) continue; // bachelor's charge
89 AliESDv0 v0(*v), *pv0=&v0;
90 AliExternalTrackParam bt(*btrk), *pbt=&bt;
92 Double_t dca=PropagateToDCA(pv0,pbt,b);
93 if (dca > fDCAmax) continue;
95 AliESDcascade cascade(*pv0,*pbt,bidx);//constucts a cascade candidate
96 if (cascade.GetChi2Xi() > fChi2max) continue;
98 Double_t x,y,z; cascade.GetXYZ(x,y,z);
99 Double_t r2=x*x + y*y;
100 if (r2 > fRmax*fRmax) continue; // condition on fiducial zone
101 if (r2 < fRmin*fRmin) continue;
103 Double_t pxV0,pyV0,pzV0;
104 pv0->GetPxPyPz(pxV0,pyV0,pzV0);
105 if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality
107 Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1);
108 if (r2 > (x1*x1+y1*y1)) continue;
110 if (cascade.GetCascadeCosineOfPointingAngle(fX,fY,fZ) <fCPAmax) continue; //condition on the cascade pointing angle
112 event->AddCascade(&cascade);
117 // Looking for the anti-cascades...
119 for (i=0; i<nV0; i++) { //loop on V0s
120 AliESDv0 *v=(AliESDv0*)vtcs.UncheckedAt(i);
121 v->ChangeMassHypothesis(kLambda0Bar); //the v0 must be anti-Lambda
122 if (TMath::Abs(v->GetEffMass()-massLambda)>fMassWin) continue;
124 for (Int_t j=0; j<ntr; j++) {//loop on tracks
126 if (bidx==v->GetPindex()) continue; //bachelor and v0's positive tracks must be different
127 AliESDtrack *btrk=event->GetTrack(bidx);
128 if (btrk->GetSign()<0) continue; // bachelor's charge
130 AliESDv0 v0(*v), *pv0=&v0;
131 AliESDtrack bt(*btrk), *pbt=&bt;
133 Double_t dca=PropagateToDCA(pv0,pbt,b);
134 if (dca > fDCAmax) continue;
136 AliESDcascade cascade(*pv0,*pbt,bidx); //constucts a cascade candidate
137 if (cascade.GetChi2Xi() > fChi2max) continue;
139 Double_t x,y,z; cascade.GetXYZ(x,y,z);
140 Double_t r2=x*x + y*y;
141 if (r2 > fRmax*fRmax) continue; // condition on fiducial zone
142 if (r2 < fRmin*fRmin) continue;
144 Double_t pxV0,pyV0,pzV0;
145 pv0->GetPxPyPz(pxV0,pyV0,pzV0);
146 if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality
148 Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1);
149 if (r2 > (x1*x1+y1*y1)) continue;
150 if (z*z > z1*z1) continue;
152 if (cascade.GetCascadeCosineOfPointingAngle(fX,fY,fZ) < fCPAmax) continue; //condition on the cascade pointing angle
153 event->AddCascade(&cascade);
159 Info("V0sTracks2CascadeVertices","Number of reconstructed cascades: %d",ncasc);
165 inline Double_t det(Double_t a00, Double_t a01, Double_t a10, Double_t a11){
167 return a00*a11 - a01*a10;
170 inline Double_t det (Double_t a00,Double_t a01,Double_t a02,
171 Double_t a10,Double_t a11,Double_t a12,
172 Double_t a20,Double_t a21,Double_t a22) {
175 a00*det(a11,a12,a21,a22)-a01*det(a10,a12,a20,a22)+a02*det(a10,a11,a20,a21);
181 Double_t AliCascadeVertexer::
182 PropagateToDCA(AliESDv0 *v, AliExternalTrackParam *t, Double_t b) {
183 //--------------------------------------------------------------------
184 // This function returns the DCA between the V0 and the track
185 //--------------------------------------------------------------------
186 Double_t alpha=t->GetAlpha(), cs1=TMath::Cos(alpha), sn1=TMath::Sin(alpha);
187 Double_t r[3]; t->GetXYZ(r);
188 Double_t x1=r[0], y1=r[1], z1=r[2];
189 Double_t p[3]; t->GetPxPyPz(p);
190 Double_t px1=p[0], py1=p[1], pz1=p[2];
192 Double_t x2,y2,z2; // position and momentum of V0
193 Double_t px2,py2,pz2;
196 v->GetPxPyPz(px2,py2,pz2);
200 Double_t dd= det(x2-x1,y2-y1,z2-z1,px1,py1,pz1,px2,py2,pz2);
201 Double_t ax= det(py1,pz1,py2,pz2);
202 Double_t ay=-det(px1,pz1,px2,pz2);
203 Double_t az= det(px1,py1,px2,py2);
205 Double_t dca=TMath::Abs(dd)/TMath::Sqrt(ax*ax + ay*ay + az*az);
208 Double_t t1 = det(x2-x1,y2-y1,z2-z1,px2,py2,pz2,ax,ay,az)/
209 det(px1,py1,pz1,px2,py2,pz2,ax,ay,az);
211 x1 += px1*t1; y1 += py1*t1; //z1 += pz1*t1;
214 //propagate track to the points of DCA
217 if (!t->PropagateTo(x1,b)) {
218 Error("PropagateToDCA","Propagation failed !");