]>
Commit | Line | Data |
---|---|---|
c7bafca9 | 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 | //------------------------------------------------------------------------- | |
c028b974 | 22 | |
23 | //modified by R. Vernet 30/6/2006 : daughter label | |
24 | //modified by R. Vernet 3/7/2006 : causality | |
25 | ||
26 | ||
c7bafca9 | 27 | #include <TObjArray.h> |
28 | #include <TTree.h> | |
29 | ||
30 | #include "AliESD.h" | |
31 | #include "AliESDv0.h" | |
32 | #include "AliESDcascade.h" | |
33 | #include "AliCascadeVertexer.h" | |
34 | ||
35 | ClassImp(AliCascadeVertexer) | |
36 | ||
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(); | |
c028b974 | 44 | |
45 | //stores relevant V0s in an array | |
c7bafca9 | 46 | TObjArray vtcs(nV0); |
47 | Int_t i; | |
48 | for (i=0; i<nV0; i++) { | |
49 | AliESDv0 *v=event->GetV0(i); | |
50 | if (v->GetD(fX,fY,fZ)<fDV0min) continue; | |
51 | vtcs.AddLast(v); | |
52 | } | |
53 | nV0=vtcs.GetEntriesFast(); | |
54 | ||
c028b974 | 55 | // stores relevant tracks in another array |
c7bafca9 | 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; | |
63 | ||
64 | if ((status&AliESDtrack::kITSrefit)==0) | |
65 | if (flags!=status) continue; | |
66 | ||
67 | if (TMath::Abs(esdtr->GetD(fX,fY,b))<fDBachMin) continue; | |
68 | ||
69 | trk[ntr++]=i; | |
70 | } | |
71 | ||
72 | Double_t massLambda=1.11568; | |
73 | Int_t ncasc=0; | |
74 | ||
75 | // Looking for the cascades... | |
c028b974 | 76 | |
77 | for (i=0; i<nV0; i++) { //loop on V0s | |
78 | ||
c7bafca9 | 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; | |
c028b974 | 82 | |
83 | for (Int_t j=0; j<ntr; j++) {//loop on tracks | |
c7bafca9 | 84 | Int_t bidx=trk[j]; |
c028b974 | 85 | if (bidx==v->GetNindex()) continue; //bachelor and v0's negative tracks must be different |
c7bafca9 | 86 | AliESDtrack *btrk=event->GetTrack(bidx); |
c7bafca9 | 87 | if (btrk->GetSign()>0) continue; // bachelor's charge |
88 | ||
c028b974 | 89 | AliESDv0 v0(*v), *pv0=&v0; |
c7bafca9 | 90 | AliExternalTrackParam bt(*btrk), *pbt=&bt; |
91 | ||
92 | Double_t dca=PropagateToDCA(pv0,pbt,b); | |
93 | if (dca > fDCAmax) continue; | |
94 | ||
c028b974 | 95 | AliESDcascade cascade(*pv0,*pbt,bidx);//constucts a cascade candidate |
96 | if (cascade.GetChi2Xi() > fChi2max) continue; | |
c7bafca9 | 97 | |
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; | |
102 | ||
c028b974 | 103 | Double_t pxV0,pyV0,pzV0; |
104 | pv0->GetPxPyPz(pxV0,pyV0,pzV0); | |
105 | if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality | |
106 | ||
c7bafca9 | 107 | Double_t x1,y1,z1; pv0->GetXYZ(x1,y1,z1); |
108 | if (r2 > (x1*x1+y1*y1)) continue; | |
c7bafca9 | 109 | |
c028b974 | 110 | if (cascade.GetCascadeCosineOfPointingAngle(fX,fY,fZ) <fCPAmax) continue; //condition on the cascade pointing angle |
111 | ||
112 | event->AddCascade(&cascade); | |
c7bafca9 | 113 | ncasc++; |
c028b974 | 114 | } // end loop tracks |
115 | } // end loop V0s | |
c7bafca9 | 116 | |
117 | // Looking for the anti-cascades... | |
c028b974 | 118 | |
119 | for (i=0; i<nV0; i++) { //loop on V0s | |
c7bafca9 | 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; | |
c028b974 | 123 | |
124 | for (Int_t j=0; j<ntr; j++) {//loop on tracks | |
c7bafca9 | 125 | Int_t bidx=trk[j]; |
c028b974 | 126 | if (bidx==v->GetPindex()) continue; //bachelor and v0's positive tracks must be different |
c7bafca9 | 127 | AliESDtrack *btrk=event->GetTrack(bidx); |
c7bafca9 | 128 | if (btrk->GetSign()<0) continue; // bachelor's charge |
129 | ||
130 | AliESDv0 v0(*v), *pv0=&v0; | |
131 | AliESDtrack bt(*btrk), *pbt=&bt; | |
132 | ||
133 | Double_t dca=PropagateToDCA(pv0,pbt,b); | |
134 | if (dca > fDCAmax) continue; | |
135 | ||
c028b974 | 136 | AliESDcascade cascade(*pv0,*pbt,bidx); //constucts a cascade candidate |
137 | if (cascade.GetChi2Xi() > fChi2max) continue; | |
c7bafca9 | 138 | |
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; | |
143 | ||
c028b974 | 144 | Double_t pxV0,pyV0,pzV0; |
145 | pv0->GetPxPyPz(pxV0,pyV0,pzV0); | |
146 | if (x*pxV0+y*pyV0+z*pzV0 < 0) continue; //causality | |
147 | ||
c7bafca9 | 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; | |
c7bafca9 | 151 | |
c028b974 | 152 | if (cascade.GetCascadeCosineOfPointingAngle(fX,fY,fZ) < fCPAmax) continue; //condition on the cascade pointing angle |
153 | event->AddCascade(&cascade); | |
c7bafca9 | 154 | ncasc++; |
155 | ||
c028b974 | 156 | } // end loop tracks |
157 | } // end loop V0s | |
c7bafca9 | 158 | |
159 | Info("V0sTracks2CascadeVertices","Number of reconstructed cascades: %d",ncasc); | |
160 | ||
161 | return 0; | |
162 | } | |
163 | ||
164 | ||
df53c9d5 | 165 | Double_t det(Double_t a00, Double_t a01, Double_t a10, Double_t a11){ |
c7bafca9 | 166 | // determinant 2x2 |
167 | return a00*a11 - a01*a10; | |
168 | } | |
169 | ||
df53c9d5 | 170 | Double_t det (Double_t a00,Double_t a01,Double_t a02, |
c7bafca9 | 171 | Double_t a10,Double_t a11,Double_t a12, |
172 | Double_t a20,Double_t a21,Double_t a22) { | |
173 | // determinant 3x3 | |
174 | return | |
175 | a00*det(a11,a12,a21,a22)-a01*det(a10,a12,a20,a22)+a02*det(a10,a11,a20,a21); | |
176 | } | |
177 | ||
178 | ||
179 | ||
180 | ||
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]; | |
191 | ||
192 | Double_t x2,y2,z2; // position and momentum of V0 | |
193 | Double_t px2,py2,pz2; | |
194 | ||
195 | v->GetXYZ(x2,y2,z2); | |
196 | v->GetPxPyPz(px2,py2,pz2); | |
197 | ||
198 | // calculation dca | |
199 | ||
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); | |
204 | ||
205 | Double_t dca=TMath::Abs(dd)/TMath::Sqrt(ax*ax + ay*ay + az*az); | |
206 | ||
207 | //points of the DCA | |
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); | |
210 | ||
211 | x1 += px1*t1; y1 += py1*t1; //z1 += pz1*t1; | |
212 | ||
213 | ||
214 | //propagate track to the points of DCA | |
215 | ||
216 | x1=x1*cs1 + y1*sn1; | |
217 | if (!t->PropagateTo(x1,b)) { | |
218 | Error("PropagateToDCA","Propagation failed !"); | |
219 | return 1.e+33; | |
220 | } | |
221 | ||
222 | return dca; | |
223 | } | |
224 | ||
225 | ||
226 | ||
227 | ||
228 | ||
229 | ||
230 | ||
231 | ||
232 | ||
233 | ||
234 |