AliRoot Core  edcc906 (edcc906)
AliCascadeVertexer.cxx
Go to the documentation of this file.
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 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 //-------------------------------------------------------------------------
22 
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
26 
27 #include "AliESDEvent.h"
28 #include "AliESDcascade.h"
29 #include "AliCascadeVertexer.h"
30 
31 ClassImp(AliCascadeVertexer)
32 
33 //A set of loose cuts
34 Double_t
35  AliCascadeVertexer::fgChi2max=33.; //maximal allowed chi2
36 Double_t
37  AliCascadeVertexer::fgDV0min=0.01; //min V0 impact parameter
38 Double_t
39  AliCascadeVertexer::fgMassWin=0.008; //"window" around the Lambda mass
40 Double_t
41  AliCascadeVertexer::fgDBachMin=0.01; //min bachelor impact parameter
42 Double_t
43  AliCascadeVertexer::fgDCAmax=2.0; //max DCA between the V0 and the track
44 Double_t
45  AliCascadeVertexer::fgCPAmin=0.98; //min cosine of the cascade pointing angle
46 Double_t
47  AliCascadeVertexer::fgRmin=0.2; //min radius of the fiducial volume
48 Double_t
49  AliCascadeVertexer::fgRmax=100.; //max radius of the fiducial volume
50 
51 
52 Int_t AliCascadeVertexer::V0sTracks2CascadeVertices(AliESDEvent *event) {
53  //--------------------------------------------------------------------
54  // This function reconstructs cascade vertices
55  // Adapted to the ESD by I.Belikov (Jouri.Belikov@cern.ch)
56  //--------------------------------------------------------------------
57  const AliESDVertex *vtxT3D=event->GetPrimaryVertex();
58 
59  Double_t xPrimaryVertex=vtxT3D->GetX();
60  Double_t yPrimaryVertex=vtxT3D->GetY();
61  Double_t zPrimaryVertex=vtxT3D->GetZ();
62 
63  Double_t b=event->GetMagneticField();
64  Int_t nV0=(Int_t)event->GetNumberOfV0s();
65 
66  //stores relevant V0s in an array
67  TObjArray vtcs(nV0);
68  Int_t i;
69  for (i=0; i<nV0; i++) {
70  AliESDv0 *v=event->GetV0(i);
71  if (v->GetOnFlyStatus()) continue;
72  if (v->GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex)<fDV0min) continue;
73  vtcs.AddLast(v);
74  }
75  nV0=vtcs.GetEntriesFast();
76 
77  // stores relevant tracks in another array
78  Int_t nentr=(Int_t)event->GetNumberOfTracks();
79  int trk[nentr], ntr=0;
80  for (i=0; i<nentr; i++) {
81  AliESDtrack *esdtr=event->GetTrack(i);
82  ULong_t status=esdtr->GetStatus();
83  if (status&AliESDtrack::kITSpureSA) continue;
84  if ((status&AliESDtrack::kITSrefit)==0)
85  if ((status&AliESDtrack::kTPCrefit)==0) continue;
86 
87  if (TMath::Abs(esdtr->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDBachMin) continue;
88 
89  trk[ntr++]=i;
90  }
91 
92  Double_t massLambda=1.11568;
93  Int_t ncasc=0;
94 
95  // Looking for the cascades...
96 
97  for (i=0; i<nV0; i++) { //loop on V0s
98 
99  AliESDv0 *v=(AliESDv0*)vtcs.UncheckedAt(i);
100  AliESDv0 v0(*v);
101  v0.ChangeMassHypothesis(kLambda0); // the v0 must be Lambda
102  if (TMath::Abs(v0.GetEffMass()-massLambda)>fMassWin) continue;
103 
104  for (Int_t j=0; j<ntr; j++) {//loop on tracks
105  Int_t bidx=trk[j];
106  //Bo: if (bidx==v->GetNindex()) continue; //bachelor and v0's negative tracks must be different
107  if (bidx==v0.GetIndex(0)) continue; //Bo: consistency 0 for neg
108  AliESDtrack *btrk=event->GetTrack(bidx);
109  if (btrk->GetSign()>0) continue; // bachelor's charge
110 
111  AliESDv0 *pv0=&v0;
112  AliExternalTrackParam bt(*btrk), *pbt=&bt;
113 
114  Double_t dca=PropagateToDCA(pv0,pbt,b);
115  if (dca > fDCAmax) continue;
116 
117  AliESDcascade cascade(*pv0,*pbt,bidx);//constucts a cascade candidate
118  //PH if (cascade.GetChi2Xi() > fChi2max) continue;
119 
120  Double_t x,y,z; cascade.GetXYZcascade(x,y,z); // Bo: bug correction
121  Double_t r2=x*x + y*y;
122  if (r2 > fRmax2) continue; // condition on fiducial zone
123  if (r2 < fRmin2) continue;
124 
125  Double_t pxV0,pyV0,pzV0;
126  pv0->GetPxPyPz(pxV0,pyV0,pzV0);
127  if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality
128 
129  Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1);
130  if (r2 > (x1*x1+y1*y1)) continue;
131 
132  if (cascade.GetCascadeCosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex) <fCPAmin) continue; //condition on the cascade pointing angle
133 
134  cascade.SetDcaXiDaughters(dca);
135  event->AddCascade(&cascade);
136  v->SetUsedByCascade(kTRUE);
137  ncasc++;
138  } // end loop tracks
139  } // end loop V0s
140 
141  // Looking for the anti-cascades...
142 
143  for (i=0; i<nV0; i++) { //loop on V0s
144  AliESDv0 *v=(AliESDv0*)vtcs.UncheckedAt(i);
145  AliESDv0 v0(*v);
146  v0.ChangeMassHypothesis(kLambda0Bar); //the v0 must be anti-Lambda
147  if (TMath::Abs(v0.GetEffMass()-massLambda)>fMassWin) continue;
148 
149  for (Int_t j=0; j<ntr; j++) {//loop on tracks
150  Int_t bidx=trk[j];
151  //Bo: if (bidx==v->GetPindex()) continue; //bachelor and v0's positive tracks must be different
152  if (bidx==v0.GetIndex(1)) continue; //Bo: consistency 1 for pos
153  AliESDtrack *btrk=event->GetTrack(bidx);
154  if (btrk->GetSign()<0) continue; // bachelor's charge
155 
156  AliESDv0 *pv0=&v0;
157  AliExternalTrackParam bt(*btrk), *pbt=&bt;
158 
159  Double_t dca=PropagateToDCA(pv0,pbt,b);
160  if (dca > fDCAmax) continue;
161 
162  AliESDcascade cascade(*pv0,*pbt,bidx); //constucts a cascade candidate
163  //PH if (cascade.GetChi2Xi() > fChi2max) continue;
164 
165  Double_t x,y,z; cascade.GetXYZcascade(x,y,z); // Bo: bug correction
166  Double_t r2=x*x + y*y;
167  if (r2 > fRmax2) continue; // condition on fiducial zone
168  if (r2 < fRmin2) continue;
169 
170  Double_t pxV0,pyV0,pzV0;
171  pv0->GetPxPyPz(pxV0,pyV0,pzV0);
172  if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality
173 
174  Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1);
175  if (r2 > (x1*x1+y1*y1)) continue;
176 
177  if (cascade.GetCascadeCosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex) < fCPAmin) continue; //condition on the cascade pointing angle
178 
179  cascade.SetDcaXiDaughters(dca);
180  event->AddCascade(&cascade);
181  ncasc++;
182 
183  } // end loop tracks
184  } // end loop V0s
185 
186 Info("V0sTracks2CascadeVertices","Number of reconstructed cascades: %d",ncasc);
187 
188  return 0;
189 }
190 
191 
192 Double_t AliCascadeVertexer::Det(Double_t a00, Double_t a01, Double_t a10, Double_t a11) const {
193  //--------------------------------------------------------------------
194  // This function calculates locally a 2x2 determinant
195  //--------------------------------------------------------------------
196  return a00*a11 - a01*a10;
197 }
198 
199 Double_t AliCascadeVertexer::Det(Double_t a00,Double_t a01,Double_t a02,
200  Double_t a10,Double_t a11,Double_t a12,
201  Double_t a20,Double_t a21,Double_t a22) const {
202  //--------------------------------------------------------------------
203  // This function calculates locally a 3x3 determinant
204  //--------------------------------------------------------------------
205  return a00*Det(a11,a12,a21,a22)-a01*Det(a10,a12,a20,a22)+a02*Det(a10,a11,a20,a21);
206 }
207 
208 
209 
210 
212  //--------------------------------------------------------------------
213  // This function returns the DCA between the V0 and the track
214  //--------------------------------------------------------------------
215  Double_t alpha=t->GetAlpha(), cs1=TMath::Cos(alpha), sn1=TMath::Sin(alpha);
216  Double_t r[3]; t->GetXYZ(r);
217  Double_t x1=r[0], y1=r[1], z1=r[2];
218  Double_t p[3]; t->GetPxPyPz(p);
219  Double_t px1=p[0], py1=p[1], pz1=p[2];
220 
221  Double_t x2,y2,z2; // position and momentum of V0
222  Double_t px2,py2,pz2;
223 
224  v->GetXYZ(x2,y2,z2);
225  v->GetPxPyPz(px2,py2,pz2);
226 
227 // calculation dca
228 
229  Double_t dd= Det(x2-x1,y2-y1,z2-z1,px1,py1,pz1,px2,py2,pz2);
230  Double_t ax= Det(py1,pz1,py2,pz2);
231  Double_t ay=-Det(px1,pz1,px2,pz2);
232  Double_t az= Det(px1,py1,px2,py2);
233 
234  Double_t dca=TMath::Abs(dd)/TMath::Sqrt(ax*ax + ay*ay + az*az);
235  if (dca > fDCAmax) return 1.e+33;
236 
237 //points of the DCA
238  Double_t t1 = Det(x2-x1,y2-y1,z2-z1,px2,py2,pz2,ax,ay,az)/
239  Det(px1,py1,pz1,px2,py2,pz2,ax,ay,az);
240 
241  x1 += px1*t1; y1 += py1*t1; //z1 += pz1*t1;
242 
243  if (x1*x1+y1*y1 > fRmaxMargin2) return 1.e+33;
244 
245  //propagate track to the points of DCA
246 
247  x1=x1*cs1 + y1*sn1;
248 
249  if (!t->PropagateTo(x1,b)) {
250  AliError("Propagation failed");
251  // AliErrorF("Propagation failed for X=%f | V0: %f %f %f",x1,x2,y2,z2);
252  // t->Print();
253  //
254  return 1.e+33;
255  }
256 
257  return dca;
258 }
259 
260 
261 
262 
263 
264 
265 
266 
267 
268 
269 
TBrowser b
Definition: RunAnaESD.C:12
ULong_t GetStatus() const
Definition: AliESDtrack.h:82
virtual Double_t GetY() const
Definition: AliVertex.h:39
void SetUsedByCascade(Bool_t v)
Definition: AliESDv0.h:148
#define TObjArray
Bool_t GetXYZ(Double_t *p) const
Bool_t GetOnFlyStatus() const
Definition: AliESDv0.h:93
Float_t p[]
Definition: kNNTest.C:133
void GetXYZ(Double_t &x, Double_t &y, Double_t &z) const
Definition: AliESDv0.cxx:527
Double_t GetAlpha() const
Double_t GetCascadeCosineOfPointingAngle(Double_t refPointX, Double_t refPointY, Double_t refPointZ) const
Double_t PropagateToDCA(AliESDv0 *vtx, AliExternalTrackParam *trk, Double_t b)
void SetDcaXiDaughters(Double_t rDcaXiDaughters=0.)
Double_t ChangeMassHypothesis(Int_t code=kK0Short)
Definition: AliESDv0.cxx:463
Double_t GetEffMass(UInt_t p1, UInt_t p2) const
Definition: AliESDv0.cxx:824
virtual Double_t GetZ() const
Definition: AliVertex.h:40
Double_t Det(Double_t a00, Double_t a01, Double_t a10, Double_t a11) const
Bool_t GetPxPyPz(Double_t *p) const
AliTPCcalibV0 v0
void GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const
Definition: AliESDv0.cxx:518
virtual Double_t GetX() const
Definition: AliVertex.h:38
Int_t GetIndex(Int_t i) const
Definition: AliESDv0.h:120
#define AliError(message)
Definition: AliLog.h:591
Bool_t PropagateTo(Double_t p[3], Double_t covyz[3], Double_t covxyz[3], Double_t b)
void GetXYZcascade(Double_t &x, Double_t &y, Double_t &z) const
Float_t GetD(Double_t x0, Double_t y0) const
Definition: AliESDv0.cxx:536
Double_t GetD(Double_t xv, Double_t yv, Double_t b) const