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
27 #include "AliESDEvent.h"
28 #include "AliESDcascade.h"
29 #include "AliLightCascadeVertexer.h"
31 ClassImp(AliLightCascadeVertexer)
35 AliLightCascadeVertexer::fgChi2max=33.; //maximal allowed chi2
37 AliLightCascadeVertexer::fgDV0min=0.01; //min V0 impact parameter
39 AliLightCascadeVertexer::fgMassWin=0.008; //"window" around the Lambda mass
41 AliLightCascadeVertexer::fgDBachMin=0.01; //min bachelor impact parameter
43 AliLightCascadeVertexer::fgDCAmax=2.0; //max DCA between the V0 and the track
45 AliLightCascadeVertexer::fgCPAmin=0.98; //min cosine of the cascade pointing angle
47 AliLightCascadeVertexer::fgRmin=0.2; //min radius of the fiducial volume
49 AliLightCascadeVertexer::fgRmax=100.; //max radius of the fiducial volume
51 Double_t AliLightCascadeVertexer::fgMaxEta=0.8; //max |eta|
52 Double_t AliLightCascadeVertexer::fgMinClusters=70; //min clusters (>=)
55 Int_t AliLightCascadeVertexer::V0sTracks2CascadeVertices(AliESDEvent *event) {
56 //--------------------------------------------------------------------
57 // This function reconstructs cascade vertices
58 // Adapted to the ESD by I.Belikov (Jouri.Belikov@cern.ch)
59 //--------------------------------------------------------------------
60 const AliESDVertex *vtxT3D=event->GetPrimaryVertex();
62 Double_t xPrimaryVertex=vtxT3D->GetX();
63 Double_t yPrimaryVertex=vtxT3D->GetY();
64 Double_t zPrimaryVertex=vtxT3D->GetZ();
66 Double_t b=event->GetMagneticField();
67 Int_t nV0=(Int_t)event->GetNumberOfV0s();
69 //stores relevant V0s in an array
72 for (i=0; i<nV0; i++) {
73 AliESDv0 *v=event->GetV0(i);
74 if (v->GetOnFlyStatus()) continue;
75 if (v->GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex)<fDV0min) continue;
78 nV0=vtcs.GetEntriesFast();
80 // stores relevant tracks in another array
81 Int_t nentr=(Int_t)event->GetNumberOfTracks();
82 TArrayI trk(nentr); Int_t ntr=0;
83 for (i=0; i<nentr; i++) {
84 AliESDtrack *esdtr=event->GetTrack(i);
85 ULong_t status=esdtr->GetStatus();
87 if ((status&AliESDtrack::kITSrefit)==0)
88 if ((status&AliESDtrack::kTPCrefit)==0) continue;
90 //Track pre-selection: clusters
91 if (esdtr->GetTPCNcls() < fMinClusters ) continue;
93 if (TMath::Abs(esdtr->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDBachMin) continue;
98 Double_t massLambda=1.11568;
101 // Looking for the cascades...
103 for (i=0; i<nV0; i++) { //loop on V0s
105 AliESDv0 *v=(AliESDv0*)vtcs.UncheckedAt(i);
107 v0.ChangeMassHypothesis(kLambda0); // the v0 must be Lambda
108 if (TMath::Abs(v0.GetEffMass()-massLambda)>fMassWin) continue;
110 for (Int_t j=0; j<ntr; j++) {//loop on tracks
112 //Bo: if (bidx==v->GetNindex()) continue; //bachelor and v0's negative tracks must be different
113 if (bidx==v0.GetIndex(0)) continue; //Bo: consistency 0 for neg
114 AliESDtrack *btrk=event->GetTrack(bidx);
115 if (btrk->GetSign()>0) continue; // bachelor's charge
118 AliExternalTrackParam bt(*btrk), *pbt=&bt;
120 Double_t dca=PropagateToDCA(pv0,pbt,b);
121 if (dca > fDCAmax) continue;
124 if (TMath::Abs(pbt->Eta())>fMaxEta) continue;
126 AliESDcascade cascade(*pv0,*pbt,bidx);//constucts a cascade candidate
127 //PH if (cascade.GetChi2Xi() > fChi2max) continue;
129 Double_t x,y,z; cascade.GetXYZcascade(x,y,z); // Bo: bug correction
130 Double_t r2=x*x + y*y;
131 if (r2 > fRmax*fRmax) continue; // condition on fiducial zone
132 if (r2 < fRmin*fRmin) continue;
134 Double_t pxV0,pyV0,pzV0;
135 pv0->GetPxPyPz(pxV0,pyV0,pzV0);
136 if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality
138 Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1);
139 if (r2 > (x1*x1+y1*y1)) continue;
141 if (cascade.GetCascadeCosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex) <fCPAmin) continue; //condition on the cascade pointing angle
143 cascade.SetDcaXiDaughters(dca);
144 event->AddCascade(&cascade);
149 // Looking for the anti-cascades...
151 for (i=0; i<nV0; i++) { //loop on V0s
152 AliESDv0 *v=(AliESDv0*)vtcs.UncheckedAt(i);
154 v0.ChangeMassHypothesis(kLambda0Bar); //the v0 must be anti-Lambda
155 if (TMath::Abs(v0.GetEffMass()-massLambda)>fMassWin) continue;
157 for (Int_t j=0; j<ntr; j++) {//loop on tracks
159 //Bo: if (bidx==v->GetPindex()) continue; //bachelor and v0's positive tracks must be different
160 if (bidx==v0.GetIndex(1)) continue; //Bo: consistency 1 for pos
161 AliESDtrack *btrk=event->GetTrack(bidx);
162 if (btrk->GetSign()<0) continue; // bachelor's charge
165 AliExternalTrackParam bt(*btrk), *pbt=&bt;
167 Double_t dca=PropagateToDCA(pv0,pbt,b);
168 if (dca > fDCAmax) continue;
170 AliESDcascade cascade(*pv0,*pbt,bidx); //constucts a cascade candidate
171 //PH if (cascade.GetChi2Xi() > fChi2max) continue;
173 Double_t x,y,z; cascade.GetXYZcascade(x,y,z); // Bo: bug correction
174 Double_t r2=x*x + y*y;
175 if (r2 > fRmax*fRmax) continue; // condition on fiducial zone
176 if (r2 < fRmin*fRmin) continue;
178 Double_t pxV0,pyV0,pzV0;
179 pv0->GetPxPyPz(pxV0,pyV0,pzV0);
180 if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality
182 Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1);
183 if (r2 > (x1*x1+y1*y1)) continue;
185 if (cascade.GetCascadeCosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex) < fCPAmin) continue; //condition on the cascade pointing angle
187 cascade.SetDcaXiDaughters(dca);
188 event->AddCascade(&cascade);
194 Info("V0sTracks2CascadeVertices","Number of reconstructed cascades: %d",ncasc);
200 Double_t AliLightCascadeVertexer::Det(Double_t a00, Double_t a01, Double_t a10, Double_t a11) const {
201 //--------------------------------------------------------------------
202 // This function calculates locally a 2x2 determinant
203 //--------------------------------------------------------------------
204 return a00*a11 - a01*a10;
207 Double_t AliLightCascadeVertexer::Det(Double_t a00,Double_t a01,Double_t a02,
208 Double_t a10,Double_t a11,Double_t a12,
209 Double_t a20,Double_t a21,Double_t a22) const {
210 //--------------------------------------------------------------------
211 // This function calculates locally a 3x3 determinant
212 //--------------------------------------------------------------------
213 return a00*Det(a11,a12,a21,a22)-a01*Det(a10,a12,a20,a22)+a02*Det(a10,a11,a20,a21);
219 Double_t AliLightCascadeVertexer::PropagateToDCA(AliESDv0 *v, AliExternalTrackParam *t, Double_t b) {
220 //--------------------------------------------------------------------
221 // This function returns the DCA between the V0 and the track
222 //--------------------------------------------------------------------
223 Double_t alpha=t->GetAlpha(), cs1=TMath::Cos(alpha), sn1=TMath::Sin(alpha);
224 Double_t r[3]; t->GetXYZ(r);
225 Double_t x1=r[0], y1=r[1], z1=r[2];
226 Double_t p[3]; t->GetPxPyPz(p);
227 Double_t px1=p[0], py1=p[1], pz1=p[2];
229 Double_t x2,y2,z2; // position and momentum of V0
230 Double_t px2,py2,pz2;
233 v->GetPxPyPz(px2,py2,pz2);
237 Double_t dd= Det(x2-x1,y2-y1,z2-z1,px1,py1,pz1,px2,py2,pz2);
238 Double_t ax= Det(py1,pz1,py2,pz2);
239 Double_t ay=-Det(px1,pz1,px2,pz2);
240 Double_t az= Det(px1,py1,px2,py2);
242 Double_t dca=TMath::Abs(dd)/TMath::Sqrt(ax*ax + ay*ay + az*az);
245 Double_t t1 = Det(x2-x1,y2-y1,z2-z1,px2,py2,pz2,ax,ay,az)/
246 Det(px1,py1,pz1,px2,py2,pz2,ax,ay,az);
248 x1 += px1*t1; y1 += py1*t1; //z1 += pz1*t1;
251 //propagate track to the points of DCA
254 if (!t->PropagateTo(x1,b)) {
255 Error("PropagateToDCA","Propagation failed !");