]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDtrack.cxx
bugfix in copy constructor
[u/mrichter/AliRoot.git] / STEER / AliESDtrack.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 //           Implementation of the ESD track class
17 //   ESD = Event Summary Data
18 //   This is the class to deal with during the phisical analysis of data
19 //      Origin: Iouri Belikov, CERN
20 //      e-mail: Jouri.Belikov@cern.ch
21 //-----------------------------------------------------------------
22
23 #include "TMath.h"
24 #include "TString.h"
25
26 #include "AliESDtrack.h"
27 #include "AliKalmanTrack.h"
28
29 ClassImp(AliESDtrack)
30
31 //_______________________________________________________________________
32 AliESDtrack::AliESDtrack() : 
33 fFlags(0),
34 fLabel(0),
35 fTrackLength(0),
36 fStopVertex(0),
37 fRalpha(0),
38 fRx(0),
39 fCalpha(0),
40 fCx(0),
41 fCchi2(1e10),
42 fIalpha(0),
43 fIx(0),
44 fTalpha(0),
45 fTx(0),
46 fOalpha(0),
47 fOx(0),
48 fITSchi2(0),
49 fITSncls(0),
50 fITSsignal(0),
51 fTPCchi2(0),
52 fTPCncls(0),
53 fTPCClusterMap(159),//number of padrows
54 fTPCsignal(0),
55 fTRDchi2(0),
56 fTRDncls(0),
57 fTRDncls0(0),
58 fTRDsignal(0),
59 fTOFchi2(0),
60 fTOFindex(0),
61 fTOFsignal(-1),
62 fPHOSsignal(-1),
63 fEMCALsignal(-1),
64 fRICHsignal(-1)
65 {
66   //
67   // The default ESD constructor 
68   //
69   for (Int_t i=0; i<kSPECIES; i++) {
70     fTrackTime[i]=0.;
71     fR[i]=1.;
72     fITSr[i]=1.;
73     fTPCr[i]=1.;
74     fTRDr[i]=1.;
75     fTOFr[i]=1.;
76     fRICHr[i]=1.;
77   }
78   
79   for (Int_t i=0; i<kSPECIESN; i++) {
80     fPHOSr[i]  = 1.;
81     fEMCALr[i] = 1.;
82   }
83
84  
85   fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
86   fEMCALpos[0]=fEMCALpos[1]=fEMCALpos[2]=0.;
87   Int_t i;
88   for (i=0; i<5; i++)  { fRp[i]=0.; fCp[i]=0.; fIp[i]=0.; fOp[i]=0.; fTp[i]=0.;}
89   for (i=0; i<15; i++) { fRc[i]=0.; fCc[i]=0.; fIc[i]=0.; fOc[i]=0.; fTc[i]=0.;  }
90   for (i=0; i<6; i++)  { fITSindex[i]=0; }
91   for (i=0; i<180; i++){ fTPCindex[i]=0; }
92   for (i=0; i<130; i++) { fTRDindex[i]=0; }
93   fTPCLabel = 0;
94   fTRDLabel = 0;
95   fITSLabel = 0;
96   fITStrack = 0;
97   fTRDtrack = 0;  
98 }
99
100 //_______________________________________________________________________
101
102 AliESDtrack::AliESDtrack(const AliESDtrack& track):TObject(track){
103   //
104   //copy constructor
105   //
106   fFlags = track.fFlags;
107   fLabel =track.fLabel;
108   fTrackLength =track.fTrackLength;
109   for (Int_t i=0;i<kSPECIES;i++) fTrackTime[i] =track.fTrackTime[i];
110   for (Int_t i=0;i<kSPECIES;i++)  fR[i] =track.fR[i];
111   fStopVertex =track.fStopVertex;
112   //
113   fRalpha =track.fRalpha;
114   fRx =track.fRx;
115   for (Int_t i=0;i<5;i++) fRp[i] =track.fRp[i];
116   for (Int_t i=0;i<15;i++) fRc[i] =track.fRc[i];
117   //
118   fCalpha =track.fCalpha;
119   fCx =track.fCx;
120   for (Int_t i=0;i<5;i++) fCp[i] =track.fCp[i];
121   for (Int_t i=0;i<15;i++)  fCc[i] =track.fCc[i];
122   fCchi2 =track.fCchi2;
123   //
124   fIalpha =track.fIalpha;
125   fIx =track.fIx;
126   for (Int_t i=0;i<5;i++) fIp[i] =track.fIp[i];
127   for (Int_t i=0;i<15;i++)  fIc[i] =track.fIc[i];
128   //
129   fTalpha =track.fTalpha;
130   fTx =track.fTx;
131   for (Int_t i=0;i<5;i++) fTp[i] =track.fTp[i];
132   for (Int_t i=0;i<15;i++)  fTc[i] =track.fTc[i];
133   //
134   fOalpha =track.fOalpha;
135   fOx =track.fOx;
136   for (Int_t i=0;i<5;i++) fOp[i] =track.fOp[i];
137   for (Int_t i=0;i<15;i++)  fOc[i] =track.fOc[i];
138   //
139   fXalpha =track.fXalpha;
140   fXx =track.fXx;
141   for (Int_t i=0;i<5;i++) fXp[i] =track.fXp[i];
142   for (Int_t i=0;i<15;i++) fXc[i] =track.fXc[i];
143   //
144   fITSchi2 =track.fITSchi2;
145   for (Int_t i=0;i<12;i++) fITSchi2MIP[i] =track.fITSchi2MIP[i];
146   fITSncls =track.fITSncls;       
147   for (Int_t i=0;i<6;i++) fITSindex[i]=track.fITSindex[i];    
148   fITSsignal =track.fITSsignal;     
149   for (Int_t i=0;i<kSPECIES;i++) fITSr[i]=track.fITSr[i]; 
150   fITSLabel =track.fITSLabel;       
151   fITSFakeRatio =track.fITSFakeRatio;   
152   fITStrack =0;  //coping separatelly - in user code
153   //
154   fTPCchi2 =track.fTPCchi2;       
155   fTPCncls =track.fTPCncls;       
156   for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i];  
157   fTPCClusterMap=track.fTPCClusterMap;  
158   fTPCsignal=track.fTPCsignal;      
159   for (Int_t i=0;i<kSPECIES;i++) fTPCr[i]=track.fTPCr[i]; 
160   fTPCLabel=track.fTPCLabel;       
161   //
162   fTRDchi2=track.fTRDchi2;        
163   fTRDncls=track.fTRDncls;       
164   fTRDncls0=track.fTRDncls0;       
165   for (Int_t i=0;i<130;i++) fTRDindex[i]=track.fTRDindex[i];   
166   fTRDsignal=track.fTRDsignal;      
167   for (Int_t i=0;i<kSPECIES;i++) fTRDr[i]=track.fTRDr[i]; 
168   fTRDLabel=track.fTRDLabel;       
169   fTRDtrack=0; 
170   //
171   fTOFchi2=track.fTOFchi2;        
172   fTOFindex=track.fTOFindex;       
173   fTOFsignal=track.fTOFsignal;      
174   for (Int_t i=0;i<kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
175   //
176   for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i]; 
177   fPHOSsignal=track.fPHOSsignal; 
178   for (Int_t i=0;i<kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i]; 
179   //
180   for (Int_t i=0;i<3;i++) fEMCALpos[i]=track.fEMCALpos[i]; 
181   fEMCALsignal=track.fEMCALsignal; 
182   for (Int_t i=0;i<kSPECIESN;i++) fEMCALr[i]=track.fEMCALr[i]; 
183   //
184   fRICHsignal=track.fRICHsignal;     
185   for (Int_t i=0;i<kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
186   
187   
188 }
189 //_______________________________________________________________________
190 AliESDtrack::~AliESDtrack(){ 
191   //
192   // This is destructor according Coding Conventrions 
193   //
194   //printf("Delete track\n");
195   if (fITStrack) delete fITStrack;
196   if (fTRDtrack) delete fTRDtrack;  
197 }
198
199 //_______________________________________________________________________
200 Double_t AliESDtrack::GetMass() const {
201   // Returns the mass of the most probable particle type
202   Float_t max=0.;
203   Int_t k=-1;
204   for (Int_t i=0; i<kSPECIES; i++) {
205     if (fR[i]>max) {k=i; max=fR[i];}
206   }
207   if (k==0) { // dE/dx "crossing points" in the TPC
208      Double_t p=GetP();
209      if ((p>0.38)&&(p<0.48))
210         if (fR[0]<fR[3]*10.) return 0.49368;
211      if ((p>0.75)&&(p<0.85))
212         if (fR[0]<fR[4]*10.) return 0.93827;
213      return 0.00051;
214   }
215   if (k==1) return 0.10566; 
216   if (k==2||k==-1) return 0.13957;
217   if (k==3) return 0.49368;
218   if (k==4) return 0.93827;
219   Warning("GetMass()","Undefined mass !");
220   return 0.13957;
221 }
222
223 //_______________________________________________________________________
224 Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) {
225   //
226   // This function updates track's running parameters 
227   //
228   SetStatus(flags);
229   fLabel=t->GetLabel();
230
231   if (t->IsStartedTimeIntegral()) {
232     SetStatus(kTIME);
233     Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
234     SetIntegratedLength(t->GetIntegratedLength());
235   }
236
237   fRalpha=t->GetAlpha();
238   t->GetExternalParameters(fRx,fRp);
239   t->GetExternalCovariance(fRc);
240
241   switch (flags) {
242     
243   case kITSin: case kITSout: case kITSrefit:
244     fITSncls=t->GetNumberOfClusters();
245     fITSchi2=t->GetChi2();
246     for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
247     fITSsignal=t->GetPIDsignal();
248     fITSLabel = t->GetLabel();
249     fITSFakeRatio = t->GetFakeRatio();
250     break;
251     
252   case kTPCin: case kTPCrefit:
253     fTPCLabel = t->GetLabel();
254     fIalpha=fRalpha;
255     fIx=fRx;
256     {
257       Int_t i;
258       for (i=0; i<5; i++) fIp[i]=fRp[i];
259       for (i=0; i<15;i++) fIc[i]=fRc[i];
260     }
261   case kTPCout:
262   
263     fTPCncls=t->GetNumberOfClusters();
264     fTPCchi2=t->GetChi2();
265     
266      {//prevrow must be declared in separate namespace, otherwise compiler cries:
267       //"jump to case label crosses initialization of `Int_t prevrow'"
268        Int_t prevrow = -1;
269        //       for (Int_t i=0;i<fTPCncls;i++) 
270        for (Int_t i=0;i<160;i++) 
271         {
272           fTPCindex[i]=t->GetClusterIndex(i);
273
274           // Piotr's Cluster Map for HBT  
275           // ### please change accordingly if cluster array is changing 
276           // to "New TPC Tracking" style (with gaps in array) 
277           Int_t idx = fTPCindex[i];
278           Int_t sect = (idx&0xff000000)>>24;
279           Int_t row = (idx&0x00ff0000)>>16;
280           if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
281
282           fTPCClusterMap.SetBitNumber(row,kTRUE);
283
284           //Fill the gap between previous row and this row with 0 bits
285           //In case  ###  pleas change it as well - just set bit 0 in case there 
286           //is no associated clusters for current "i"
287           if (prevrow < 0) 
288            {
289              prevrow = row;//if previous bit was not assigned yet == this is the first one
290            }
291           else
292            { //we don't know the order (inner to outer or reverse)
293              //just to be save in case it is going to change
294              Int_t n = 0, m = 0;
295              if (prevrow < row)
296               {
297                 n = prevrow;
298                 m = row;
299               }
300              else
301               {
302                 n = row;
303                 m = prevrow;
304               }
305
306              for (Int_t j = n+1; j < m; j++)
307               {
308                 fTPCClusterMap.SetBitNumber(j,kFALSE);
309               }
310              prevrow = row; 
311            }
312           // End Of Piotr's Cluster Map for HBT
313         }
314      }
315     fTPCsignal=t->GetPIDsignal();
316     {Double_t mass=t->GetMass();    // preliminary mass setting 
317     if (mass>0.5) fR[4]=1.;         //        used by
318     else if (mass<0.4) fR[2]=1.;    // the ITS reconstruction
319     else fR[3]=1.;}
320                      //
321     break;
322
323   case kTRDout:
324     { //requested by the PHOS/EMCAL  ("temporary solution")
325       Int_t i;
326       Double_t x=460.,buf[15];
327       if (t->PropagateTo(x,30.,0.)) {  
328          fOalpha=t->GetAlpha();
329          t->GetExternalParameters(x,buf); fOx=x;
330          for (i=0; i<5; i++) fOp[i]=buf[i];
331          t->GetExternalCovariance(buf);
332          for (i=0; i<15; i++) fOc[i]=buf[i];
333       }
334       x=450.;
335       if (t->PropagateTo(x,30.,0.)) {  
336          fXalpha=t->GetAlpha();
337          t->GetExternalParameters(x,buf); fXx=x;
338          for (i=0; i<5; i++) fXp[i]=buf[i];
339          t->GetExternalCovariance(buf);
340          for (i=0; i<15; i++) fXc[i]=buf[i];
341       }
342     }
343   case kTRDin: case kTRDrefit:
344     fTRDLabel = t->GetLabel();
345  
346     fTRDncls=t->GetNumberOfClusters();
347     fTRDchi2=t->GetChi2();
348     for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
349     fTRDsignal=t->GetPIDsignal();
350     break;
351   case kTRDbackup:
352     t->GetExternalParameters(fTx,fTp);
353     t->GetExternalCovariance(fTc);
354     fTRDncls0 = t->GetNumberOfClusters(); 
355     break;
356   case kTOFin: 
357     break;
358   case kTOFout: 
359     break;
360   case kTRDStop:
361     break;
362   default: 
363     Error("UpdateTrackParams()","Wrong flag !\n");
364     return kFALSE;
365   }
366
367   return kTRUE;
368 }
369
370 //_______________________________________________________________________
371 void 
372 AliESDtrack::SetConstrainedTrackParams(AliKalmanTrack *t, Double_t chi2) {
373   //
374   // This function sets the constrained track parameters 
375   //
376   Int_t i;
377   Double_t x,buf[15];
378   fCalpha=t->GetAlpha();
379   t->GetExternalParameters(x,buf); fCx=x;
380   for (i=0; i<5; i++) fCp[i]=buf[i];
381   t->GetExternalCovariance(buf);
382   for (i=0; i<15; i++) fCc[i]=buf[i];
383   fCchi2=chi2;
384 }
385
386
387 //_______________________________________________________________________
388 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
389   //---------------------------------------------------------------------
390   // This function returns external representation of the track parameters
391   //---------------------------------------------------------------------
392   x=fRx;
393   for (Int_t i=0; i<5; i++) p[i]=fRp[i];
394 }
395 //_______________________________________________________________________
396 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
397   //---------------------------------------------------------------------
398   // This function returns external representation of the cov. matrix
399   //---------------------------------------------------------------------
400   for (Int_t i=0; i<15; i++) cov[i]=fRc[i];
401 }
402
403
404 //_______________________________________________________________________
405 void 
406 AliESDtrack::GetConstrainedExternalParameters(Double_t &x, Double_t p[5])const{
407   //---------------------------------------------------------------------
408   // This function returns the constrained external track parameters
409   //---------------------------------------------------------------------
410   x=fCx;
411   for (Int_t i=0; i<5; i++) p[i]=fCp[i];
412 }
413 //_______________________________________________________________________
414 void 
415 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
416   //---------------------------------------------------------------------
417   // This function returns the constrained external cov. matrix
418   //---------------------------------------------------------------------
419   for (Int_t i=0; i<15; i++) c[i]=fCc[i];
420 }
421
422
423 Double_t AliESDtrack::GetP() const {
424   //---------------------------------------------------------------------
425   // This function returns the track momentum
426   //---------------------------------------------------------------------
427   if (TMath::Abs(fRp[4])<=0) return 0;
428   Double_t pt=1./TMath::Abs(fRp[4]);
429   return pt*TMath::Sqrt(1.+ fRp[3]*fRp[3]);
430 }
431
432 void AliESDtrack::GetConstrainedPxPyPz(Double_t *p) const {
433   //---------------------------------------------------------------------
434   // This function returns the constrained global track momentum components
435   //---------------------------------------------------------------------
436   if (TMath::Abs(fCp[4])<=0) {
437     p[0]=p[1]=p[2]=0;
438     return;
439   }
440   Double_t phi=TMath::ASin(fCp[2]) + fCalpha;
441   Double_t pt=1./TMath::Abs(fCp[4]);
442   p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fCp[3]; 
443 }
444 void AliESDtrack::GetConstrainedXYZ(Double_t *xyz) const {
445   //---------------------------------------------------------------------
446   // This function returns the global track position
447   //---------------------------------------------------------------------
448   Double_t phi=TMath::ATan2(fCp[0],fCx) + fCalpha;
449   Double_t r=TMath::Sqrt(fCx*fCx + fCp[0]*fCp[0]);
450   xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fCp[1]; 
451 }
452
453 void AliESDtrack::GetPxPyPz(Double_t *p) const {
454   //---------------------------------------------------------------------
455   // This function returns the global track momentum components
456   //---------------------------------------------------------------------
457   if (TMath::Abs(fRp[4])<=0) {
458     p[0]=p[1]=p[2]=0;
459     return;
460   }
461   Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
462   Double_t pt=1./TMath::Abs(fRp[4]);
463   p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3]; 
464 }
465 void AliESDtrack::GetXYZ(Double_t *xyz) const {
466   //---------------------------------------------------------------------
467   // This function returns the global track position
468   //---------------------------------------------------------------------
469   Double_t phi=TMath::ATan2(fRp[0],fRx) + fRalpha;
470   Double_t r=TMath::Sqrt(fRx*fRx + fRp[0]*fRp[0]);
471   xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1]; 
472 }
473
474
475 void AliESDtrack::GetInnerPxPyPz(Double_t *p) const {
476   //---------------------------------------------------------------------
477   // This function returns the global track momentum components
478   // af the entrance of the TPC
479   //---------------------------------------------------------------------
480   if (fIx==0) {p[0]=p[1]=p[2]=0.; return;}
481   Double_t phi=TMath::ASin(fIp[2]) + fIalpha;
482   Double_t pt=1./TMath::Abs(fIp[4]);
483   p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fIp[3]; 
484 }
485
486 void AliESDtrack::GetInnerXYZ(Double_t *xyz) const {
487   //---------------------------------------------------------------------
488   // This function returns the global track position
489   // af the entrance of the TPC
490   //---------------------------------------------------------------------
491   if (fIx==0) {xyz[0]=xyz[1]=xyz[2]=0.; return;}
492   Double_t phi=TMath::ATan2(fIp[0],fIx) + fIalpha;
493   Double_t r=TMath::Sqrt(fIx*fIx + fIp[0]*fIp[0]);
494   xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fIp[1]; 
495 }
496
497 void AliESDtrack::GetInnerExternalParameters(Double_t &x, Double_t p[5]) const 
498 {
499   //skowron
500  //---------------------------------------------------------------------
501   // This function returns external representation of the track parameters at Inner Layer of TPC
502   //---------------------------------------------------------------------
503   x=fIx;
504   for (Int_t i=0; i<5; i++) p[i]=fIp[i];
505 }
506 void AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const
507 {
508  //skowron
509  //---------------------------------------------------------------------
510  // This function returns external representation of the cov. matrix at Inner Layer of TPC
511  //---------------------------------------------------------------------
512  for (Int_t i=0; i<15; i++) cov[i]=fIc[i];
513  
514 }
515
516 void  AliESDtrack::GetTRDExternalParameters(Double_t &x, Double_t p[5], Double_t cov[15]) const
517 {
518   //
519   //this function returns TRD parameters
520   //
521   x=fTx;
522   for (Int_t i=0; i<5; i++) p[i]=fTp[i];
523   for (Int_t i=0; i<15; i++) cov[i]=fTc[i];
524 }
525
526 void AliESDtrack::GetOuterPxPyPz(Double_t *p, TString det) const {
527   //---------------------------------------------------------------------
528   // This function returns the global track momentum components
529   // af the radius of the PHOS
530   //---------------------------------------------------------------------
531   p[0]=p[1]=p[2]=0. ; 
532   if (det == "PHOS") { 
533     if (fOx==0) 
534       return;
535     Double_t phi=TMath::ASin(fOp[2]) + fOalpha;
536     Double_t pt=1./TMath::Abs(fOp[4]);
537     p[0]=pt*TMath::Cos(phi); 
538     p[1]=pt*TMath::Sin(phi); 
539     p[2]=pt*fOp[3];
540   } 
541   else if (det == "EMCAL" ) {
542     if (fXx==0)
543       return;
544     Double_t phi=TMath::ASin(fXp[2]) + fXalpha;
545     Double_t pt=1./TMath::Abs(fXp[4]);
546     p[0]=pt*TMath::Cos(phi); 
547     p[1]=pt*TMath::Sin(phi); 
548     p[2]=pt*fXp[3];
549   }
550   else 
551     Warning("GetOuterPxPyPz", "Only valid for PHOS or EMCAL") ; 
552 }
553
554 void AliESDtrack::GetOuterXYZ(Double_t *xyz, TString det) const {
555   //---------------------------------------------------------------------
556   // This function returns the global track position
557   // af the radius of the PHOS/EMCAL
558   //---------------------------------------------------------------------
559   xyz[0]=xyz[1]=xyz[2]=0.;
560   if ( det == "PHOS" ) {
561     if (fOx==0) 
562       return;
563     Double_t phi=TMath::ATan2(fOp[0],fOx) + fOalpha;
564     Double_t r=TMath::Sqrt(fOx*fOx + fOp[0]*fOp[0]);
565     xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fOp[1]; 
566   } 
567   else if ( det == "EMCAL" ) {
568     if (fXx==0) 
569       return;
570     Double_t phi=TMath::ATan2(fXp[0],fOx) + fXalpha;
571     Double_t r=TMath::Sqrt(fXx*fXx + fXp[0]*fXp[0]);
572     xyz[0]=r*TMath::Cos(phi); 
573     xyz[1]=r*TMath::Sin(phi); 
574     xyz[2]=fXp[1]; 
575   } 
576 }
577
578 //_______________________________________________________________________
579 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
580   // Returns the array with integrated times for each particle hypothesis
581   for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
582 }
583
584 //_______________________________________________________________________
585 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
586   // Sets the array with integrated times for each particle hypotesis
587   for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
588 }
589
590 //_______________________________________________________________________
591 void AliESDtrack::SetITSpid(const Double_t *p) {
592   // Sets values for the probability of each particle type (in ITS)
593   for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
594   SetStatus(AliESDtrack::kITSpid);
595 }
596
597 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
598   for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i];
599 }
600 //_______________________________________________________________________
601 void AliESDtrack::GetITSpid(Double_t *p) const {
602   // Gets the probability of each particle type (in ITS)
603   for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
604 }
605
606 //_______________________________________________________________________
607 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
608   //---------------------------------------------------------------------
609   // This function returns indices of the assgined ITS clusters 
610   //---------------------------------------------------------------------
611   for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
612   return fITSncls;
613 }
614
615 //_______________________________________________________________________
616 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
617   //---------------------------------------------------------------------
618   // This function returns indices of the assgined ITS clusters 
619   //---------------------------------------------------------------------
620   if (idx!=0)
621     for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i];  // MI I prefer some constant
622   return fTPCncls;
623 }
624
625 //_______________________________________________________________________
626 void AliESDtrack::SetTPCpid(const Double_t *p) {  
627   // Sets values for the probability of each particle type (in TPC)
628   for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
629   SetStatus(AliESDtrack::kTPCpid);
630 }
631
632 //_______________________________________________________________________
633 void AliESDtrack::GetTPCpid(Double_t *p) const {
634   // Gets the probability of each particle type (in TPC)
635   for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
636 }
637
638 //_______________________________________________________________________
639 Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const {
640   //---------------------------------------------------------------------
641   // This function returns indices of the assgined TRD clusters 
642   //---------------------------------------------------------------------
643   if (idx!=0)
644     for (Int_t i=0; i<130; i++) idx[i]=fTRDindex[i];  // MI I prefer some constant
645   return fTRDncls;
646 }
647
648 //_______________________________________________________________________
649 void AliESDtrack::SetTRDpid(const Double_t *p) {  
650   // Sets values for the probability of each particle type (in TRD)
651   for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
652   SetStatus(AliESDtrack::kTRDpid);
653 }
654
655 //_______________________________________________________________________
656 void AliESDtrack::GetTRDpid(Double_t *p) const {
657   // Gets the probability of each particle type (in TRD)
658   for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
659 }
660
661 //_______________________________________________________________________
662 void    AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
663 {
664   // Sets the probability of particle type iSpecies to p (in TRD)
665   fTRDr[iSpecies] = p;
666 }
667
668 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
669 {
670   // Returns the probability of particle type iSpecies (in TRD)
671   return fTRDr[iSpecies];
672 }
673
674 //_______________________________________________________________________
675 void AliESDtrack::SetTOFpid(const Double_t *p) {  
676   // Sets the probability of each particle type (in TOF)
677   for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
678   SetStatus(AliESDtrack::kTOFpid);
679 }
680
681 //_______________________________________________________________________
682 void AliESDtrack::GetTOFpid(Double_t *p) const {
683   // Gets probabilities of each particle type (in TOF)
684   for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
685 }
686
687
688
689 //_______________________________________________________________________
690 void AliESDtrack::SetPHOSpid(const Double_t *p) {  
691   // Sets the probability of each particle type (in PHOS)
692   for (Int_t i=0; i<kSPECIESN; i++) fPHOSr[i]=p[i];
693   SetStatus(AliESDtrack::kPHOSpid);
694 }
695
696 //_______________________________________________________________________
697 void AliESDtrack::GetPHOSpid(Double_t *p) const {
698   // Gets probabilities of each particle type (in PHOS)
699   for (Int_t i=0; i<kSPECIESN; i++) p[i]=fPHOSr[i];
700 }
701
702 //_______________________________________________________________________
703 void AliESDtrack::SetEMCALpid(const Double_t *p) {  
704   // Sets the probability of each particle type (in EMCAL)
705   for (Int_t i=0; i<kSPECIESN; i++) fEMCALr[i]=p[i];
706   SetStatus(AliESDtrack::kEMCALpid);
707 }
708
709 //_______________________________________________________________________
710 void AliESDtrack::GetEMCALpid(Double_t *p) const {
711   // Gets probabilities of each particle type (in EMCAL)
712   for (Int_t i=0; i<kSPECIESN; i++) p[i]=fEMCALr[i];
713 }
714
715 //_______________________________________________________________________
716 void AliESDtrack::SetRICHpid(const Double_t *p) {  
717   // Sets the probability of each particle type (in RICH)
718   for (Int_t i=0; i<kSPECIES; i++) fRICHr[i]=p[i];
719   SetStatus(AliESDtrack::kRICHpid);
720 }
721
722 //_______________________________________________________________________
723 void AliESDtrack::GetRICHpid(Double_t *p) const {
724   // Gets probabilities of each particle type (in RICH)
725   for (Int_t i=0; i<kSPECIES; i++) p[i]=fRICHr[i];
726 }
727
728
729
730 //_______________________________________________________________________
731 void AliESDtrack::SetESDpid(const Double_t *p) {  
732   // Sets the probability of each particle type for the ESD track
733   for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
734   SetStatus(AliESDtrack::kESDpid);
735 }
736
737 //_______________________________________________________________________
738 void AliESDtrack::GetESDpid(Double_t *p) const {
739   // Gets probability of each particle type for the ESD track
740   for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];
741 }
742
743 //_______________________________________________________________________
744 void AliESDtrack::Print(Option_t *) const {
745   // Prints info on the track
746   
747   Info("Print","Track info") ; 
748   Double_t p[kSPECIESN] ; 
749   Int_t index = 0 ; 
750   if( IsOn(kITSpid) ){
751     printf("From ITS: ") ; 
752     GetITSpid(p) ; 
753     for(index = 0 ; index < kSPECIES; index++) 
754       printf("%f, ", p[index]) ;
755     printf("\n           signal = %f\n", GetITSsignal()) ;
756   } 
757   if( IsOn(kTPCpid) ){
758     printf("From TPC: ") ; 
759     GetTPCpid(p) ; 
760     for(index = 0 ; index < kSPECIES; index++) 
761       printf("%f, ", p[index]) ;
762     printf("\n           signal = %f\n", GetTPCsignal()) ;
763   }
764   if( IsOn(kTRDpid) ){
765     printf("From TRD: ") ; 
766     GetTRDpid(p) ; 
767     for(index = 0 ; index < kSPECIES; index++) 
768       printf("%f, ", p[index]) ;
769     printf("\n           signal = %f\n", GetTRDsignal()) ;
770   }
771   if( IsOn(kTOFpid) ){
772     printf("From TOF: ") ; 
773     GetTOFpid(p) ; 
774     for(index = 0 ; index < kSPECIES; index++) 
775       printf("%f, ", p[index]) ;
776     printf("\n           signal = %f\n", GetTOFsignal()) ;
777   }
778   if( IsOn(kRICHpid) ){
779     printf("From TOF: ") ; 
780     GetRICHpid(p) ; 
781     for(index = 0 ; index < kSPECIES; index++) 
782       printf("%f, ", p[index]) ;
783     printf("\n           signal = %f\n", GetRICHsignal()) ;
784   }
785   if( IsOn(kPHOSpid) ){
786     printf("From PHOS: ") ; 
787     GetPHOSpid(p) ; 
788     for(index = 0 ; index < kSPECIESN; index++) 
789       printf("%f, ", p[index]) ;
790     printf("\n           signal = %f\n", GetPHOSsignal()) ;
791   }
792   if( IsOn(kEMCALpid) ){
793     printf("From EMCAL: ") ; 
794     GetEMCALpid(p) ; 
795     for(index = 0 ; index < kSPECIESN; index++) 
796       printf("%f, ", p[index]) ;
797     printf("\n           signal = %f\n", GetEMCALsignal()) ;
798   }
799