]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCtrack.cxx
1361aaaabd3b16a957c113785fb88fcf70dd60af
[u/mrichter/AliRoot.git] / TPC / AliTPCtrack.cxx
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 /* $Id$ */
17
18 //-----------------------------------------------------------------
19 //           Implementation of the TPC track class
20 //        This class is used by the AliTPCtracker class
21 //      Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
22 //-----------------------------------------------------------------
23
24 #include <Riostream.h>
25
26 #include "AliTPCtrack.h"
27 #include "AliCluster.h"
28 #include "AliBarrelTrack.h"
29 #include "AliESDtrack.h"
30
31 ClassImp(AliTPCtrack)
32
33 //_________________________________________________________________________
34 AliTPCtrack::AliTPCtrack(): AliKalmanTrack() 
35 {
36   fX = fP0 = fP1 = fP2 = fP3 = fP3 = fP4 = 0.0;
37   fAlpha = fdEdx = 0.0;
38   fNWrong = fNRotation = fNumber = 0;  // [SR, 01.04.2003]
39 }
40
41 //_________________________________________________________________________
42 AliTPCtrack::AliTPCtrack(UInt_t index, const Double_t xx[5],
43 const Double_t cc[15], Double_t xref, Double_t alpha) : AliKalmanTrack() {
44   //-----------------------------------------------------------------
45   // This is the main track constructor.
46   //-----------------------------------------------------------------
47   fX=xref;
48   fAlpha=alpha;
49   if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi();
50   if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi();
51   fdEdx=0.;
52
53   fP0=xx[0]; fP1=xx[1]; fP2=xx[2]; fP3=xx[3]; fP4=xx[4];
54
55   fC00=cc[0];
56   fC10=cc[1];  fC11=cc[2];
57   fC20=cc[3];  fC21=cc[4];  fC22=cc[5];
58   fC30=cc[6];  fC31=cc[7];  fC32=cc[8];  fC33=cc[9];
59   fC40=cc[10]; fC41=cc[11]; fC42=cc[12]; fC43=cc[13]; fC44=cc[14];
60
61   fIndex[0]=index;
62   SetNumberOfClusters(1);
63
64 }
65
66 //_____________________________________________________________________________
67 AliTPCtrack::AliTPCtrack(const AliKalmanTrack& t,Double_t alpha) :
68 AliKalmanTrack(t) {
69   //-----------------------------------------------------------------
70   // Conversion AliKalmanTrack -> AliTPCtrack.
71   //-----------------------------------------------------------------
72   SetChi2(0.);
73   SetNumberOfClusters(0);
74
75   fdEdx  = 0.;
76   fAlpha = alpha;
77   if      (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
78   else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
79
80   //Conversion of the track parameters
81   Double_t x,p[5]; t.GetExternalParameters(x,p);
82   fX=x;    x=GetConvConst();
83   fP0=p[0]; 
84   fP1=p[1]; 
85   fP3=p[3];
86   fP4=p[4]/x; 
87   fP2=fP4*fX - p[2];
88
89   //Conversion of the covariance matrix
90   Double_t c[15]; t.GetExternalCovariance(c);
91   c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x;
92
93   Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5];
94   Double_t c32=fX*c[13] - c[8];
95   Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12];
96   
97   fC00=c[0 ];
98   fC10=c[1 ];   fC11=c[2 ];
99   fC20=c20;     fC21=c21;     fC22=c22;
100   fC30=c[6 ];   fC31=c[7 ];   fC32=c32;   fC33=c[9 ];
101   fC40=c[10];   fC41=c[11];   fC42=c42;   fC43=c[13]; fC44=c[14];
102
103 }
104
105 //_____________________________________________________________________________
106 AliTPCtrack::AliTPCtrack(const AliESDtrack& t) : AliKalmanTrack() {
107   //-----------------------------------------------------------------
108   // Conversion AliESDtrack -> AliTPCtrack.
109   //-----------------------------------------------------------------
110   SetNumberOfClusters(t.GetTPCclusters(fIndex));
111   SetLabel(t.GetLabel());
112   SetMass(t.GetMass());
113
114   fdEdx  = t.GetTPCsignal();
115   fAlpha = t.GetAlpha();
116   if      (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
117   else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
118
119   //Conversion of the track parameters
120   Double_t x,p[5]; t.GetExternalParameters(x,p);
121   fX=x;    x=GetConvConst();
122   fP0=p[0];
123   fP1=p[1];
124   fP3=p[3];
125   fP4=p[4]/x;
126   fP2=fP4*fX - p[2];
127
128   //Conversion of the covariance matrix
129   Double_t c[15]; t.GetExternalCovariance(c);
130   c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x;
131
132   Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5];
133   Double_t c32=fX*c[13] - c[8];
134   Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12];
135
136   fC00=c[0 ];
137   fC10=c[1 ];   fC11=c[2 ];
138   fC20=c20;     fC21=c21;     fC22=c22;
139   fC30=c[6 ];   fC31=c[7 ];   fC32=c32;   fC33=c[9 ];
140   fC40=c[10];   fC41=c[11];   fC42=c42;   fC43=c[13]; fC44=c[14];
141
142   if (t.GetStatus()&AliESDtrack::kTIME == 0) return;
143   StartTimeIntegral();
144   Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times);
145   SetIntegratedLength(t.GetIntegratedLength());
146 }
147
148 //_____________________________________________________________________________
149 AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) : AliKalmanTrack(t) {
150   //-----------------------------------------------------------------
151   // This is a track copy constructor.
152   //-----------------------------------------------------------------
153   fX=t.fX;
154   fAlpha=t.fAlpha;
155   fdEdx=t.fdEdx;
156
157   fP0=t.fP0; fP1=t.fP1; fP2=t.fP2; fP3=t.fP3; fP4=t.fP4;
158
159   fC00=t.fC00;
160   fC10=t.fC10;  fC11=t.fC11;
161   fC20=t.fC20;  fC21=t.fC21;  fC22=t.fC22;
162   fC30=t.fC30;  fC31=t.fC31;  fC32=t.fC32;  fC33=t.fC33;
163   fC40=t.fC40;  fC41=t.fC41;  fC42=t.fC42;  fC43=t.fC43;  fC44=t.fC44;
164
165   Int_t n=GetNumberOfClusters();
166   for (Int_t i=0; i<n; i++) fIndex[i]=t.fIndex[i];
167 }
168 //_____________________________________________________________________________
169
170 void  AliTPCtrack::GetBarrelTrack(AliBarrelTrack *track) {
171   //
172   // Create a Barrel Track out of this track
173   // Current track is propagated to the reference plane
174   // by the tracker
175   //
176   // [SR, 01.04.2003]
177   
178   if (!track) return;
179   Double_t xr, vec[5], cov[15];
180
181   track->SetLabel(GetLabel());
182   track->SetX(fX, fAlpha);
183   track->SetNClusters(GetNumberOfClusters(), GetChi2());
184   Double_t times[10];
185   GetIntegratedTimes(times);
186   track->SetTime(times, GetIntegratedLength());
187
188   track->SetMass(GetMass());
189   track->SetdEdX(GetdEdx());
190
191   track->SetNWrongClusters(fNWrong);
192   track->SetNRotate(fNRotation);
193
194   GetExternalParameters(xr, vec);
195   track->SetStateVector(vec);
196   
197   GetExternalCovariance(cov);
198   track->SetCovarianceMatrix(cov);
199
200 }
201 //_____________________________________________________________________________
202 Int_t AliTPCtrack::Compare(const TObject *o) const {
203   //-----------------------------------------------------------------
204   // This function compares tracks according to the their curvature
205   //-----------------------------------------------------------------
206   AliTPCtrack *t=(AliTPCtrack*)o;
207   //Double_t co=TMath::Abs(t->Get1Pt());
208   //Double_t c =TMath::Abs(Get1Pt());
209   Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
210   Double_t c =GetSigmaY2()*GetSigmaZ2();
211   if (c>co) return 1;
212   else if (c<co) return -1;
213   return 0;
214 }
215
216 //_____________________________________________________________________________
217 void AliTPCtrack::GetExternalCovariance(Double_t cc[15]) const {
218   //-------------------------------------------------------------------------
219   // This function returns an external representation of the covriance matrix.
220   //   (See comments in AliTPCtrack.h about external track representation)
221   //-------------------------------------------------------------------------
222   Double_t a=GetConvConst();
223
224   Double_t c22=fX*fX*fC44-2*fX*fC42+fC22;
225   Double_t c32=fX*fC43-fC32;
226   Double_t c20=fX*fC40-fC20, c21=fX*fC41-fC21, c42=fX*fC44-fC42;
227   
228   cc[0 ]=fC00;
229   cc[1 ]=fC10;   cc[2 ]=fC11;
230   cc[3 ]=c20;    cc[4 ]=c21;    cc[5 ]=c22;
231   cc[6 ]=fC30;   cc[7 ]=fC31;   cc[8 ]=c32;   cc[9 ]=fC33; 
232   cc[10]=fC40*a; cc[11]=fC41*a; cc[12]=c42*a; cc[13]=fC43*a; cc[14]=fC44*a*a;
233
234 }
235
236 //_____________________________________________________________________________
237 Double_t AliTPCtrack::GetPredictedChi2(const AliCluster *c) const 
238 {
239   //-----------------------------------------------------------------
240   // This function calculates a predicted chi2 increment.
241   //-----------------------------------------------------------------
242   Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2();
243   r00+=fC00; r01+=fC10; r11+=fC11;
244
245   Double_t det=r00*r11 - r01*r01;
246   if (TMath::Abs(det) < 1.e-10) {
247     Int_t n=GetNumberOfClusters();
248     if (n>4) cerr<<n<<" AliKalmanTrack warning: Singular matrix !\n";
249     return 1e10;
250   }
251   Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
252   
253   Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1;
254   
255   return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det;
256 }
257
258 //_____________________________________________________________________________
259 Int_t AliTPCtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho) {
260   //-----------------------------------------------------------------
261   // This function propagates a track to a reference plane x=xk.
262   //-----------------------------------------------------------------
263   if (TMath::Abs(fP4*xk - fP2) >= 0.9) {
264     //    Int_t n=GetNumberOfClusters();
265     //if (n>4) cerr<<n<<" AliTPCtrack warning: Propagation failed !\n";
266     return 0;
267   }
268   
269   // old position for time [SR, GSI 17.02.2003]
270   Double_t oldX = fX;
271   Double_t oldY = fP0;
272   Double_t oldZ = fP1;
273   //
274
275   Double_t x1=fX, x2=x1+(xk-x1), dx=x2-x1, y1=fP0, z1=fP1;
276   Double_t c1=fP4*x1 - fP2, r1=sqrt(1.- c1*c1);
277   Double_t c2=fP4*x2 - fP2, r2=sqrt(1.- c2*c2);
278   
279   fP0 += dx*(c1+c2)/(r1+r2);
280   fP1 += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3;
281
282   //f = F - 1
283   Double_t rr=r1+r2, cc=c1+c2, xx=x1+x2;
284   Double_t f02=-dx*(2*rr + cc*(c1/r1 + c2/r2))/(rr*rr);
285   Double_t f04= dx*(rr*xx + cc*(c1*x1/r1+c2*x2/r2))/(rr*rr);
286   Double_t cr=c1*r2+c2*r1;
287   Double_t f12=-dx*fP3*(2*cr + cc*(c2*c1/r1-r1 + c1*c2/r2-r2))/(cr*cr);
288   Double_t f13= dx*cc/cr; 
289   Double_t f14=dx*fP3*(cr*xx-cc*(r1*x2-c2*c1*x1/r1+r2*x1-c1*c2*x2/r2))/(cr*cr);
290
291   //b = C*ft
292   Double_t b00=f02*fC20 + f04*fC40, b01=f12*fC20 + f14*fC40 + f13*fC30;
293   Double_t b10=f02*fC21 + f04*fC41, b11=f12*fC21 + f14*fC41 + f13*fC31;
294   Double_t b20=f02*fC22 + f04*fC42, b21=f12*fC22 + f14*fC42 + f13*fC32;
295   Double_t b30=f02*fC32 + f04*fC43, b31=f12*fC32 + f14*fC43 + f13*fC33;
296   Double_t b40=f02*fC42 + f04*fC44, b41=f12*fC42 + f14*fC44 + f13*fC43;
297   
298   //a = f*b = f*C*ft
299   Double_t a00=f02*b20+f04*b40,a01=f02*b21+f04*b41,a11=f12*b21+f14*b41+f13*b31;
300
301   //F*C*Ft = C + (a + b + bt)
302   fC00 += a00 + 2*b00;
303   fC10 += a01 + b01 + b10; 
304   fC20 += b20;
305   fC30 += b30;
306   fC40 += b40;
307   fC11 += a11 + 2*b11;
308   fC21 += b21; 
309   fC31 += b31; 
310   fC41 += b41; 
311
312   fX=x2;
313
314   //Multiple scattering******************
315   Double_t d=sqrt((x1-fX)*(x1-fX)+(y1-fP0)*(y1-fP0)+(z1-fP1)*(z1-fP1));
316   Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt());
317   Double_t beta2=p2/(p2 + GetMass()*GetMass());
318   //Double_t theta2=14.1*14.1/(beta2*p2*1e6)*d/x0*rho;
319   Double_t theta2=1.0259e-6*10*10/20/(beta2*p2)*d*rho;
320
321   Double_t ey=fP4*fX - fP2, ez=fP3;
322   Double_t xz=fP4*ez, zz1=ez*ez+1, xy=fP2+ey;
323
324   fC22 += (2*ey*ez*ez*fP2+1-ey*ey+ez*ez+fP2*fP2*ez*ez)*theta2;
325   fC32 += ez*zz1*xy*theta2;
326   fC33 += zz1*zz1*theta2;
327   fC42 += xz*ez*xy*theta2;
328   fC43 += xz*zz1*theta2;
329   fC44 += xz*xz*theta2;
330
331   //Energy losses************************
332   Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d*rho;
333   if (x1 < x2) dE=-dE;
334   cc=fP4;
335   fP4*=(1.- sqrt(p2+GetMass()*GetMass())/p2*dE);
336   fP2+=fX*(fP4-cc);
337
338   // Integrated Time [SR, GSI, 17.02.2003]
339   if (IsStartedTimeIntegral()) {
340     Double_t l2 = (fX-oldX)*(fX-oldX)+(fP0-oldY)*(fP0-oldY)+(fP1-oldZ)*(fP1-oldZ);
341     AddTimeStep(TMath::Sqrt(l2));
342   }
343   //
344
345   return 1;
346 }
347
348 //_____________________________________________________________________________
349 Int_t AliTPCtrack::PropagateToVertex(Double_t x0,Double_t rho) 
350 {
351   //-----------------------------------------------------------------
352   // This function propagates tracks to the "vertex".
353   //-----------------------------------------------------------------
354   Double_t c=fP4*fX - fP2;
355   Double_t tgf=-fP2/(fP4*fP0 + sqrt(1-c*c));
356   Double_t snf=tgf/sqrt(1.+ tgf*tgf);
357   Double_t xv=(fP2+snf)/fP4;
358   return PropagateTo(xv,x0,rho);
359 }
360
361 //_____________________________________________________________________________
362 Int_t AliTPCtrack::Update(const AliCluster *c, Double_t chisq, UInt_t index) {
363   //-----------------------------------------------------------------
364   // This function associates a cluster with this track.
365   //-----------------------------------------------------------------
366
367   // update the number of wrong SR[20.03.2003]
368   Int_t absLabel = TMath::Abs(GetLabel());
369   if ( (c->GetLabel(0) != absLabel) && 
370        (c->GetLabel(0) != absLabel) &&
371        (c->GetLabel(0) != absLabel)) fNWrong++;
372   //
373
374   Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2();
375   r00+=fC00; r01+=fC10; r11+=fC11;
376   Double_t det=r00*r11 - r01*r01;
377   Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det;
378
379   Double_t k00=fC00*r00+fC10*r01, k01=fC00*r01+fC10*r11;
380   Double_t k10=fC10*r00+fC11*r01, k11=fC10*r01+fC11*r11;
381   Double_t k20=fC20*r00+fC21*r01, k21=fC20*r01+fC21*r11;
382   Double_t k30=fC30*r00+fC31*r01, k31=fC30*r01+fC31*r11;
383   Double_t k40=fC40*r00+fC41*r01, k41=fC40*r01+fC41*r11;
384
385   Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1;
386   Double_t cur=fP4 + k40*dy + k41*dz, eta=fP2 + k20*dy + k21*dz;
387   if (TMath::Abs(cur*fX-eta) >= 0.9) {
388     //    Int_t n=GetNumberOfClusters();
389     //if (n>4) cerr<<n<<" AliTPCtrack warning: Filtering failed !\n";
390     return 0;
391   }
392
393   fP0 += k00*dy + k01*dz;
394   fP1 += k10*dy + k11*dz;
395   fP2  = eta;
396   fP3 += k30*dy + k31*dz;
397   fP4  = cur;
398
399   Double_t c01=fC10, c02=fC20, c03=fC30, c04=fC40;
400   Double_t c12=fC21, c13=fC31, c14=fC41;
401
402   fC00-=k00*fC00+k01*fC10; fC10-=k00*c01+k01*fC11;
403   fC20-=k00*c02+k01*c12;   fC30-=k00*c03+k01*c13;
404   fC40-=k00*c04+k01*c14; 
405
406   fC11-=k10*c01+k11*fC11;
407   fC21-=k10*c02+k11*c12;   fC31-=k10*c03+k11*c13;
408   fC41-=k10*c04+k11*c14; 
409
410   fC22-=k20*c02+k21*c12;   fC32-=k20*c03+k21*c13;
411   fC42-=k20*c04+k21*c14; 
412
413   fC33-=k30*c03+k31*c13;
414   fC43-=k40*c03+k41*c13; 
415
416   fC44-=k40*c04+k41*c14; 
417
418   Int_t n=GetNumberOfClusters();
419   fIndex[n]=index;
420   SetNumberOfClusters(n+1);
421   SetChi2(GetChi2()+chisq);
422
423   return 1;
424 }
425
426 //_____________________________________________________________________________
427 Int_t AliTPCtrack::Rotate(Double_t alpha)
428 {
429   //-----------------------------------------------------------------
430   // This function rotates this track.
431   //-----------------------------------------------------------------
432
433   if (alpha != 0) fNRotation++;  // [SR, 01.04.2003]
434
435   fAlpha += alpha;
436   if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi();
437   if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi();
438   
439   Double_t x1=fX, y1=fP0;
440   Double_t ca=cos(alpha), sa=sin(alpha);
441   Double_t r1=fP4*fX - fP2;
442   
443   fX = x1*ca + y1*sa;
444   fP0=-x1*sa + y1*ca;
445   fP2=fP2*ca + (fP4*y1 + sqrt(1.- r1*r1))*sa;
446   
447   Double_t r2=fP4*fX - fP2;
448   if (TMath::Abs(r2) >= 0.99999) {
449     Int_t n=GetNumberOfClusters();
450     if (n>4) cerr<<n<<" AliTPCtrack warning: Rotation failed !\n";
451     return 0;
452   }
453   
454   Double_t y0=fP0 + sqrt(1.- r2*r2)/fP4;
455   if ((fP0-y0)*fP4 >= 0.) {
456     Int_t n=GetNumberOfClusters();
457     if (n>4) cerr<<n<<" AliTPCtrack warning: Rotation failed !!!\n";
458     return 0;
459   }
460
461   //f = F - 1
462   Double_t f00=ca-1,    f24=(y1 - r1*x1/sqrt(1.- r1*r1))*sa, 
463            f20=fP4*sa,  f22=(ca + sa*r1/sqrt(1.- r1*r1))-1;
464
465   //b = C*ft
466   Double_t b00=fC00*f00, b02=fC00*f20+fC40*f24+fC20*f22;
467   Double_t b10=fC10*f00, b12=fC10*f20+fC41*f24+fC21*f22;
468   Double_t b20=fC20*f00, b22=fC20*f20+fC42*f24+fC22*f22;
469   Double_t b30=fC30*f00, b32=fC30*f20+fC43*f24+fC32*f22;
470   Double_t b40=fC40*f00, b42=fC40*f20+fC44*f24+fC42*f22;
471
472   //a = f*b = f*C*ft
473   Double_t a00=f00*b00, a02=f00*b02, a22=f20*b02+f24*b42+f22*b22;
474
475   // *** Double_t dy2=fCyy;
476
477   //F*C*Ft = C + (a + b + bt)
478   fC00 += a00 + 2*b00;
479   fC10 += b10;
480   fC20 += a02+b20+b02;
481   fC30 += b30;
482   fC40 += b40;
483   fC21 += b12;
484   fC32 += b32;
485   fC22 += a22 + 2*b22;
486   fC42 += b42; 
487
488   // *** fCyy+=dy2*sa*sa*r1*r1/(1.- r1*r1);
489   // *** fCzz+=d2y*sa*sa*fT*fT/(1.- r1*r1);
490
491   return 1;
492 }
493
494 void AliTPCtrack::ResetCovariance() {
495   //------------------------------------------------------------------
496   //This function makes a track forget its history :)  
497   //------------------------------------------------------------------
498
499   fC00*=10.;
500   fC10=0.;  fC11*=10.;
501   fC20=0.;  fC21=0.;  fC22*=10.;
502   fC30=0.;  fC31=0.;  fC32=0.;  fC33*=10.;
503   fC40=0.;  fC41=0.;  fC42=0.;  fC43=0.;  fC44*=10.;
504
505 }
506
507 ////////////////////////////////////////////////////////////////////////
508 Double_t AliTPCtrack::Phi() const {
509 //
510 //
511 //
512   Double_t phi =  TMath::ASin(GetSnp()) + fAlpha;
513   if (phi<0) phi+=2*TMath::Pi();
514   if (phi>=2*TMath::Pi()) phi-=2*TMath::Pi();
515   return phi;
516 }
517 ////////////////////////////////////////////////////////////////////////
518