]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDtrack.cxx
Normalized positive PID weights (conditional probabilities)
[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 phisics analysis of data
19 //      Origin: Iouri Belikov, CERN
20 //      e-mail: Jouri.Belikov@cern.ch
21 //-----------------------------------------------------------------
22
23 #include "TMath.h"
24
25 #include "AliESDtrack.h"
26 #include "AliKalmanTrack.h"
27 #include "AliTrackPointArray.h"
28 #include "AliLog.h"
29
30 ClassImp(AliESDtrack)
31
32 void SetPIDValues(Float_t * dest, const Double_t * src, Int_t n) {
33   // This function copies "n" PID weights from "scr" to "dest"
34   // and normalizes their sum to 1 thus producing conditional probabilities.
35   // The negative weights are set to 0.
36   // In case all the weights are non-positive they are replaced by
37   // uniform probabilities
38
39   if (n<=0) return;
40
41   Float_t uniform = 1./(Float_t)n;
42
43   Float_t sum = 0;
44   for (Int_t i=0; i<n; i++) 
45     if (src[i]>=0) {
46       sum+=src[i];
47       dest[i] = src[i];
48     }
49     else {
50       dest[i] = 0;
51     }
52
53   if(sum>0)
54     for (Int_t i=0; i<n; i++) dest[i] /= sum;
55   else
56     for (Int_t i=0; i<n; i++) dest[i] = uniform;
57 }
58
59 //_______________________________________________________________________
60 AliESDtrack::AliESDtrack() : 
61   TObject(),
62   fFlags(0),
63   fLabel(0),
64   fID(0),
65   fTrackLength(0),
66   fD(0),
67   fZ(0),
68   fStopVertex(0),
69   fRalpha(0),
70   fRx(0),
71   fCalpha(0),
72   fCx(0),
73   fCchi2(1e10),
74   fIalpha(0),
75   fIx(0),
76   fTalpha(0),
77   fTx(0),
78   fITSchi2(0),
79   fITSncls(0),
80   fITSsignal(0),
81   fITSLabel(0),
82   fITSFakeRatio(0),
83   fITStrack(0),
84   fTPCchi2(0),
85   fTPCncls(0),
86   fTPCClusterMap(159),//number of padrows
87   fTPCsignal(0),
88   fTPCLabel(0),
89   fTRDchi2(0),
90   fTRDncls(0),
91   fTRDncls0(0),
92   fTRDsignal(0),
93   fTRDLabel(0),
94   fTRDQuality(0),
95   fTRDBudget(0),
96   fTRDtrack(0),
97   fTOFchi2(0),
98   fTOFindex(0),
99   fTOFsignal(-1),
100   fPHOSsignal(-1),
101   fEMCALsignal(-1),
102   fRICHchi2(1e10),
103   fRICHncls(0),
104   fRICHindex(0),
105   fRICHsignal(-1),
106   fRICHtheta(0),
107   fRICHphi(0),
108   fRICHdx(0),
109   fRICHdy(0),
110   fPoints(0)
111 {
112   //
113   // The default ESD constructor 
114   //
115   for (Int_t i=0; i<AliPID::kSPECIES; i++) {
116     fTrackTime[i]=0.;
117     fR[i]=1.;
118     fITSr[i]=1.;
119     fTPCr[i]=1.;
120     fTRDr[i]=1.;
121     fTOFr[i]=1.;
122     fRICHr[i]=1.;
123   }
124   
125   for (Int_t i=0; i<AliPID::kSPECIESN; i++) {
126     fPHOSr[i]  = 1.;
127     fEMCALr[i] = 1.;
128   }
129
130  
131   fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.;
132   fEMCALpos[0]=fEMCALpos[1]=fEMCALpos[2]=0.;
133   Int_t i;
134   for (i=0; i<5; i++)  { 
135     fRp[i]=fCp[i]=fIp[i]=fTp[i]=0.;
136   }
137   for (i=0; i<15; i++) { 
138     fRc[i]=fCc[i]=fIc[i]=fTc[i]=0.;  
139   }
140   for (i=0; i<6; i++)  { fITSindex[i]=0; }
141   for (i=0; i<180; i++){ fTPCindex[i]=0; }
142   for (i=0; i<3;i++)   { fKinkIndexes[i]=0;}
143   for (i=0; i<3;i++)   { fV0Indexes[i]=-1;}
144   for (i=0; i<130; i++) { fTRDindex[i]=0; }
145   for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;}
146   for (Int_t i=0;i<4;i++) {fTPCPoints[i]=-1;}
147   for (Int_t i=0;i<3;i++) {fTOFLabel[i]=-1;}
148   for (Int_t i=0;i<10;i++) {fTOFInfo[i]=-1;}
149   fTPCLabel = 0;
150   fTRDLabel = 0;
151   fTRDQuality =0;
152   fTRDBudget =0;
153   fITSLabel = 0;
154   fITStrack = 0;
155   fTRDtrack = 0;  
156 }
157
158 //_______________________________________________________________________
159 AliESDtrack::AliESDtrack(const AliESDtrack& track):
160   TObject(track),
161   fFlags(track.fFlags),
162   fLabel(track.fLabel),
163   fID(track.fID),
164   fTrackLength(track.fTrackLength),
165   fD(track.fD),
166   fZ(track.fZ),
167   fStopVertex(track.fStopVertex),
168   fRalpha(track.fRalpha),
169   fRx(track.fRx),
170   fCalpha(track.fCalpha),
171   fCx(track.fCx),
172   fCchi2(track.fCchi2),
173   fIalpha(track.fIalpha),
174   fIx(track.fIx),
175   fTalpha(track.fTalpha),
176   fTx(track.fTx),
177   fITSchi2(track.fITSchi2),
178   fITSncls(track.fITSncls),
179   fITSsignal(track.fITSsignal),
180   fITSLabel(track.fITSLabel),
181   fITSFakeRatio(track.fITSFakeRatio),
182   fITStrack(0),    //coping separatelly - in user code
183   fTPCchi2(track.fTPCchi2),
184   fTPCncls(track.fTPCncls),
185   fTPCClusterMap(track.fTPCClusterMap),
186   fTPCsignal(track.fTPCsignal),
187   fTPCLabel(track.fTPCLabel),
188   fTRDchi2(track.fTRDchi2),
189   fTRDncls(track.fTRDncls),
190   fTRDncls0(track.fTRDncls0),
191   fTRDsignal(track.fTRDsignal),
192   fTRDLabel(track.fTRDLabel),
193   fTRDQuality(track.fTRDQuality),
194   fTRDBudget(track.fTRDBudget),
195   fTRDtrack(0),
196   fTOFchi2(track.fTOFchi2),
197   fTOFindex(track.fTOFindex),
198   fTOFsignal(track.fTOFsignal),
199   fPHOSsignal(track.fPHOSsignal),
200   fEMCALsignal(track.fEMCALsignal),
201   fRICHchi2(track.fRICHchi2),
202   fRICHncls(track.fRICHncls),
203   fRICHindex(track.fRICHindex),
204   fRICHsignal(track.fRICHsignal),
205   fRICHtheta(track.fRICHtheta),
206   fRICHphi(track.fRICHphi),
207   fRICHdx(track.fRICHdx),
208   fRICHdy(track.fRICHdy),
209   fPoints(track.fPoints)
210 {
211   //
212   //copy constructor
213   //
214   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] =track.fTrackTime[i];
215   for (Int_t i=0;i<AliPID::kSPECIES;i++)  fR[i] =track.fR[i];
216   //
217   for (Int_t i=0;i<5;i++) fRp[i] =track.fRp[i];
218   for (Int_t i=0;i<15;i++) fRc[i] =track.fRc[i];
219   //
220   for (Int_t i=0;i<5;i++) fCp[i] =track.fCp[i];
221   for (Int_t i=0;i<15;i++)  fCc[i] =track.fCc[i];
222   //
223   for (Int_t i=0;i<5;i++) fIp[i] =track.fIp[i];
224   for (Int_t i=0;i<15;i++)  fIc[i] =track.fIc[i];
225   //
226   for (Int_t i=0;i<5;i++) fTp[i] =track.fTp[i];
227   for (Int_t i=0;i<15;i++)  fTc[i] =track.fTc[i];
228   //
229   for (Int_t i=0;i<12;i++) fITSchi2MIP[i] =track.fITSchi2MIP[i];
230   for (Int_t i=0;i<6;i++) fITSindex[i]=track.fITSindex[i];    
231   for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i]; 
232   //
233   for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i];  
234   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i]; 
235   for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
236   for (Int_t i=0; i<3;i++)   { fKinkIndexes[i]=track.fKinkIndexes[i];}
237   for (Int_t i=0; i<3;i++)   { fV0Indexes[i]=track.fV0Indexes[i];}
238   //
239   for (Int_t i=0;i<130;i++) fTRDindex[i]=track.fTRDindex[i];   
240   for (Int_t i=0;i<kNPlane;i++) {
241       fTRDsignals[i]=track.fTRDsignals[i]; 
242       fTRDTimBin[i]=track.fTRDTimBin[i];
243   }
244   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i]; 
245   //
246   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
247   for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
248   for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
249   //
250   for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i]; 
251   for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i]; 
252   //
253   for (Int_t i=0;i<3;i++) fEMCALpos[i]=track.fEMCALpos[i]; 
254   for (Int_t i=0;i<AliPID::kSPECIESN;i++) fEMCALr[i]=track.fEMCALr[i]; 
255   //
256   for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i];
257 }
258 //_______________________________________________________________________
259 AliESDtrack::~AliESDtrack(){ 
260   //
261   // This is destructor according Coding Conventrions 
262   //
263   //printf("Delete track\n");
264   delete fITStrack;
265   delete fTRDtrack; 
266   delete fPoints;
267 }
268
269 //_______________________________________________________________________
270 void AliESDtrack::MakeMiniESDtrack(){
271   // Resets everything except
272   // fFlags: Reconstruction status flags 
273   // fLabel: Track label
274   // fID:  Unique ID of the track
275   // fD: Impact parameter in XY-plane
276   // fZ: Impact parameter in Z 
277   // fR[AliPID::kSPECIES]: combined "detector response probability"
278   // Running track parameters
279   // fRalpha: track rotation angle
280   // fRx: X-coordinate of the track reference plane 
281   // fRp[5]: external track parameters  
282   // fRc[15]: external cov. matrix of the track parameters
283   
284   fTrackLength = 0;
285   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
286   fStopVertex = 0;
287
288   // Reset track parameters constrained to the primary vertex
289   fCalpha = 0;
290   fCx = 0;
291   for (Int_t i=0;i<5;i++) fCp[i] = 0;
292   for (Int_t i=0;i<15;i++)  fCc[i] = 0;
293   fCchi2 = 0;
294
295   // Reset track parameters at the inner wall of TPC
296   fIalpha = 0;
297   fIx = 0;
298   for (Int_t i=0;i<5;i++) fIp[i] = 0;
299   for (Int_t i=0;i<15;i++)  fIc[i] = 0;
300
301   // Reset track parameters at the inner wall of the TRD
302   fTalpha = 0;
303   fTx = 0;
304   for (Int_t i=0;i<5;i++) fTp[i] = 0;
305   for (Int_t i=0;i<15;i++)  fTc[i] = 0;
306
307   // Reset ITS track related information
308   fITSchi2 = 0;
309   for (Int_t i=0;i<12;i++) fITSchi2MIP[i] = 0;
310   fITSncls = 0;       
311   for (Int_t i=0;i<6;i++) fITSindex[i]= 0;    
312   fITSsignal = 0;     
313   for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]= 0; 
314   fITSLabel = 0;       
315   fITSFakeRatio = 0;   
316   fITStrack =0;
317
318   // Reset TPC related track information
319   fTPCchi2 = 0;       
320   fTPCncls = 0;       
321   for (Int_t i=0;i<180;i++) fTPCindex[i] = 0;  
322   fTPCClusterMap = 0;  
323   fTPCsignal= 0;      
324   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0; 
325   fTPCLabel=0;       
326   for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
327   for (Int_t i=0; i<3;i++)   fKinkIndexes[i] = 0;
328   for (Int_t i=0; i<3;i++)   fV0Indexes[i] = 0;
329
330   // Reset TRD related track information
331   fTRDchi2 = 0;        
332   fTRDncls = 0;       
333   fTRDncls0 = 0;       
334   for (Int_t i=0;i<130;i++) fTRDindex[i] = 0;   
335   fTRDsignal = 0;      
336   for (Int_t i=0;i<kNPlane;i++) {
337       fTRDsignals[i] = 0; 
338       fTRDTimBin[i]  = 0;
339   }
340   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0; 
341   fTRDLabel = 0;       
342   fTRDtrack = 0; 
343   fTRDQuality  = 0;
344   fTRDBudget  = 0;
345
346   // Reset TOF related track information
347   fTOFchi2 = 0;        
348   fTOFindex = 0;       
349   fTOFsignal = 0;      
350   for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
351   for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
352   for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
353
354   // Reset PHOS related track information
355   for (Int_t i=0;i<3;i++) fPHOSpos[i] = 0; 
356   fPHOSsignal = 0; 
357   for (Int_t i=0;i<AliPID::kSPECIESN;i++) fPHOSr[i] = 0;
358  
359   // Reset EMCAL related track information
360   for (Int_t i=0;i<3;i++) fEMCALpos[i] = 0; 
361   fEMCALsignal = 0; 
362   for (Int_t i=0;i<AliPID::kSPECIESN;i++) fEMCALr[i] = 0;
363  
364   // Reset RICH related track information
365   fRICHchi2 = 0;     
366   fRICHncls = 0;     
367   fRICHindex = 0;     
368   fRICHsignal = 0;     
369   for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i] = 0;
370   fRICHtheta = 0;     
371   fRICHphi = 0;      
372   fRICHdx = 0;     
373   fRICHdy = 0;      
374
375   fPoints = 0;
376
377 //_______________________________________________________________________
378 Double_t AliESDtrack::GetMass() const {
379   // Returns the mass of the most probable particle type
380   Float_t max=0.;
381   Int_t k=-1;
382   for (Int_t i=0; i<AliPID::kSPECIES; i++) {
383     if (fR[i]>max) {k=i; max=fR[i];}
384   }
385   if (k==0) { // dE/dx "crossing points" in the TPC
386      Double_t p=GetP();
387      if ((p>0.38)&&(p<0.48))
388         if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
389      if ((p>0.75)&&(p<0.85))
390         if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
391      return 0.00051;
392   }
393   if (k==1) return AliPID::ParticleMass(AliPID::kMuon); 
394   if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
395   if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
396   if (k==4) return AliPID::ParticleMass(AliPID::kProton);
397   AliWarning("Undefined mass !");
398   return AliPID::ParticleMass(AliPID::kPion);
399 }
400
401 //_______________________________________________________________________
402 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags) {
403   //
404   // This function updates track's running parameters 
405   //
406   Bool_t rc=kTRUE;
407
408   SetStatus(flags);
409   fLabel=t->GetLabel();
410
411   if (t->IsStartedTimeIntegral()) {
412     SetStatus(kTIME);
413     Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
414     SetIntegratedLength(t->GetIntegratedLength());
415   }
416
417   fRalpha=t->GetAlpha();
418   t->GetExternalParameters(fRx,fRp);
419   t->GetExternalCovariance(fRc);
420
421   switch (flags) {
422     
423   case kITSin: case kITSout: case kITSrefit:
424     fITSncls=t->GetNumberOfClusters();
425     fITSchi2=t->GetChi2();
426     for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
427     fITSsignal=t->GetPIDsignal();
428     fITSLabel = t->GetLabel();
429     fITSFakeRatio = t->GetFakeRatio();
430     break;
431     
432   case kTPCin: case kTPCrefit:
433     fTPCLabel = t->GetLabel();
434     fIalpha=fRalpha;
435     fIx=fRx;    
436     {
437       Int_t i;
438       for (i=0; i<5; i++) fIp[i]=fRp[i];
439       for (i=0; i<15;i++) fIc[i]=fRc[i];
440     }
441   case kTPCout:
442   
443     fTPCncls=t->GetNumberOfClusters();
444     fTPCchi2=t->GetChi2();
445     
446      {//prevrow must be declared in separate namespace, otherwise compiler cries:
447       //"jump to case label crosses initialization of `Int_t prevrow'"
448        Int_t prevrow = -1;
449        //       for (Int_t i=0;i<fTPCncls;i++) 
450        for (Int_t i=0;i<160;i++) 
451         {
452           fTPCindex[i]=t->GetClusterIndex(i);
453
454           // Piotr's Cluster Map for HBT  
455           // ### please change accordingly if cluster array is changing 
456           // to "New TPC Tracking" style (with gaps in array) 
457           Int_t idx = fTPCindex[i];
458           Int_t sect = (idx&0xff000000)>>24;
459           Int_t row = (idx&0x00ff0000)>>16;
460           if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
461
462           fTPCClusterMap.SetBitNumber(row,kTRUE);
463
464           //Fill the gap between previous row and this row with 0 bits
465           //In case  ###  pleas change it as well - just set bit 0 in case there 
466           //is no associated clusters for current "i"
467           if (prevrow < 0) 
468            {
469              prevrow = row;//if previous bit was not assigned yet == this is the first one
470            }
471           else
472            { //we don't know the order (inner to outer or reverse)
473              //just to be save in case it is going to change
474              Int_t n = 0, m = 0;
475              if (prevrow < row)
476               {
477                 n = prevrow;
478                 m = row;
479               }
480              else
481               {
482                 n = row;
483                 m = prevrow;
484               }
485
486              for (Int_t j = n+1; j < m; j++)
487               {
488                 fTPCClusterMap.SetBitNumber(j,kFALSE);
489               }
490              prevrow = row; 
491            }
492           // End Of Piotr's Cluster Map for HBT
493         }
494      }
495     fTPCsignal=t->GetPIDsignal();
496     {Double_t mass=t->GetMass();    // preliminary mass setting 
497     if (mass>0.5) fR[4]=1.;         //        used by
498     else if (mass<0.4) fR[2]=1.;    // the ITS reconstruction
499     else fR[3]=1.;}
500                      //
501     break;
502
503   case kTRDout: case kTRDin: case kTRDrefit:
504     fTRDLabel = t->GetLabel(); 
505     fTRDncls=t->GetNumberOfClusters();
506     fTRDchi2=t->GetChi2();
507     for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i);
508     fTRDsignal=t->GetPIDsignal();
509     break;
510   case kTRDbackup:
511     t->GetExternalParameters(fTx,fTp);
512     t->GetExternalCovariance(fTc);
513     fTalpha = t->GetAlpha();
514     fTRDncls0 = t->GetNumberOfClusters(); 
515     break;
516   case kTOFin: 
517     break;
518   case kTOFout: 
519     break;
520   case kTRDStop:
521     break;
522   default: 
523     AliError("Wrong flag !");
524     return kFALSE;
525   }
526
527   return rc;
528 }
529
530 //_______________________________________________________________________
531 void 
532 AliESDtrack::SetConstrainedTrackParams(const AliKalmanTrack *t, Double_t chi2) {
533   //
534   // This function sets the constrained track parameters 
535   //
536   Int_t i;
537   Double_t x,buf[15];
538   fCalpha=t->GetAlpha();
539   t->GetExternalParameters(x,buf); fCx=x;
540   for (i=0; i<5; i++) fCp[i]=buf[i];
541   t->GetExternalCovariance(buf);
542   for (i=0; i<15; i++) fCc[i]=buf[i];
543   fCchi2=chi2;
544 }
545
546
547 //_______________________________________________________________________
548 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
549   //---------------------------------------------------------------------
550   // This function returns external representation of the track parameters
551   //---------------------------------------------------------------------
552   x=fRx;
553   for (Int_t i=0; i<5; i++) p[i]=fRp[i];
554 }
555
556 //_______________________________________________________________________
557 Bool_t AliESDtrack::
558 GetExternalParametersAt(Double_t x, Double_t b, Double_t p[5]) const {
559   //---------------------------------------------------------------------
560   // This function returns external track parameters extrapolated to
561   // the radial position "x" (cm) in the magnetic field "b" (kG)  
562   //---------------------------------------------------------------------
563   Double_t convconst=0.299792458*b/1000.;
564   Double_t dx=x-fRx;
565   Double_t f1=fRp[2], f2=f1 + dx*fRp[4]*convconst;
566
567   if (TMath::Abs(f2) >= 0.9999) return kFALSE;
568   
569   Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
570   p[0] = fRp[0] + dx*(f1+f2)/(r1+r2);
571   p[1] = fRp[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
572   p[2] = f2;
573   p[3] = fRp[3];
574   p[4] = fRp[4];
575
576   return kTRUE;
577 }
578
579 //_______________________________________________________________________
580 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
581   //---------------------------------------------------------------------
582   // This function returns external representation of the cov. matrix
583   //---------------------------------------------------------------------
584   for (Int_t i=0; i<15; i++) cov[i]=fRc[i];
585 }
586
587
588 //_______________________________________________________________________
589 void 
590 AliESDtrack::GetConstrainedExternalParameters(Double_t &x, Double_t p[5])const{
591   //---------------------------------------------------------------------
592   // This function returns the constrained external track parameters
593   //---------------------------------------------------------------------
594   x=fCx;
595   for (Int_t i=0; i<5; i++) p[i]=fCp[i];
596 }
597 //_______________________________________________________________________
598 void 
599 AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
600   //---------------------------------------------------------------------
601   // This function returns the constrained external cov. matrix
602   //---------------------------------------------------------------------
603   for (Int_t i=0; i<15; i++) c[i]=fCc[i];
604 }
605
606
607 Double_t AliESDtrack::GetP() const {
608   //---------------------------------------------------------------------
609   // This function returns the track momentum
610   // Results for (nearly) straight tracks are meaningless !
611   //---------------------------------------------------------------------
612   if (TMath::Abs(fRp[4])<=0) return 0;
613   Double_t pt=1./TMath::Abs(fRp[4]);
614   return pt*TMath::Sqrt(1.+ fRp[3]*fRp[3]);
615 }
616
617 //_______________________________________________________________________
618 Double_t AliESDtrack::GetD(Double_t b, Double_t x, Double_t y) const {
619   //------------------------------------------------------------------
620   // This function calculates the transverse impact parameter
621   // with respect to a point with global coordinates (x,y)
622   // in the magnetic field "b" (kG)
623   //------------------------------------------------------------------
624   Double_t convconst=0.299792458*b/1000.;
625   Double_t rp4=fRp[4]*convconst;
626
627   Double_t xt=fRx, yt=fRp[0];
628
629   Double_t sn=TMath::Sin(fRalpha), cs=TMath::Cos(fRalpha);
630   Double_t a = x*cs + y*sn;
631   y = -x*sn + y*cs; x=a;
632   xt-=x; yt-=y;
633
634   sn=rp4*xt - fRp[2]; cs=rp4*yt + TMath::Sqrt(1.- fRp[2]*fRp[2]);
635   a=2*(xt*fRp[2] - yt*TMath::Sqrt(1.- fRp[2]*fRp[2]))-rp4*(xt*xt + yt*yt);
636   if (rp4<0) a=-a;
637   return a/(1 + TMath::Sqrt(sn*sn + cs*cs));
638 }
639
640 Bool_t Local2GlobalMomentum(Double_t p[3],Double_t alpha) {
641   //----------------------------------------------------------------
642   // This function performs local->global transformation of the
643   // track momentum.
644   // When called, the arguments are:
645   //    p[0] = 1/pt of the track;
646   //    p[1] = sine of local azim. angle of the track momentum;
647   //    p[2] = tangent of the track momentum dip angle;
648   //   alpha - rotation angle. 
649   // The result is returned as:
650   //    p[0] = px
651   //    p[1] = py
652   //    p[2] = pz
653   // Results for (nearly) straight tracks are meaningless !
654   //----------------------------------------------------------------
655   if (TMath::Abs(p[0])<=0)        return kFALSE;
656   if (TMath::Abs(p[1])> 0.999999) return kFALSE;
657
658   Double_t pt=1./TMath::Abs(p[0]);
659   Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha);
660   Double_t r=TMath::Sqrt(1 - p[1]*p[1]);
661   p[0]=pt*(r*cs - p[1]*sn); p[1]=pt*(p[1]*cs + r*sn); p[2]=pt*p[2];
662
663   return kTRUE;
664 }
665
666 Bool_t Local2GlobalPosition(Double_t r[3],Double_t alpha) {
667   //----------------------------------------------------------------
668   // This function performs local->global transformation of the
669   // track position.
670   // When called, the arguments are:
671   //    r[0] = local x
672   //    r[1] = local y
673   //    r[2] = local z
674   //   alpha - rotation angle. 
675   // The result is returned as:
676   //    r[0] = global x
677   //    r[1] = global y
678   //    r[2] = global z
679   //----------------------------------------------------------------
680   Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha), x=r[0];
681   r[0]=x*cs - r[1]*sn; r[1]=x*sn + r[1]*cs;
682
683   return kTRUE;
684 }
685
686 Bool_t AliESDtrack::GetConstrainedPxPyPz(Double_t *p) const {
687   //---------------------------------------------------------------------
688   // This function returns the constrained global track momentum components
689   // Results for (nearly) straight tracks are meaningless !
690   //---------------------------------------------------------------------
691   p[0]=fCp[4]; p[1]=fCp[2]; p[2]=fCp[3];
692   return Local2GlobalMomentum(p,fCalpha);
693 }  
694
695 Bool_t AliESDtrack::GetConstrainedXYZ(Double_t *r) const {
696   //---------------------------------------------------------------------
697   // This function returns the constrained global track position
698   //---------------------------------------------------------------------
699   r[0]=fCx; r[1]=fCp[0]; r[2]=fCp[1];
700   return Local2GlobalPosition(r,fCalpha);
701 }
702
703 Bool_t AliESDtrack::GetPxPyPz(Double_t *p) const {
704   //---------------------------------------------------------------------
705   // This function returns the global track momentum components
706   // Results for (nearly) straight tracks are meaningless !
707   //---------------------------------------------------------------------
708   p[0]=fRp[4]; p[1]=fRp[2]; p[2]=fRp[3];
709   return Local2GlobalMomentum(p,fRalpha);
710 }
711
712 Bool_t AliESDtrack::GetXYZ(Double_t *r) const {
713   //---------------------------------------------------------------------
714   // This function returns the global track position
715   //---------------------------------------------------------------------
716   r[0]=fRx; r[1]=fRp[0]; r[2]=fRp[1];
717   return Local2GlobalPosition(r,fRalpha);
718 }
719
720 void AliESDtrack::GetCovariance(Double_t cv[21]) const {
721   //---------------------------------------------------------------------
722   // This function returns the global covariance matrix of the track params
723   // 
724   // Cov(x,x) ... :   cv[0]
725   // Cov(y,x) ... :   cv[1]  cv[2]
726   // Cov(z,x) ... :   cv[3]  cv[4]  cv[5]
727   // Cov(px,x)... :   cv[6]  cv[7]  cv[8]  cv[9]
728   // Cov(py,x)... :   cv[10] cv[11] cv[12] cv[13] cv[14]
729   // Cov(pz,x)... :   cv[15] cv[16] cv[17] cv[18] cv[19] cv[20]
730   //
731   // Results for (nearly) straight tracks are meaningless !
732   //---------------------------------------------------------------------
733   if (TMath::Abs(fRp[4])<=0) {
734      for (Int_t i=0; i<21; i++) cv[i]=0.;
735      return;
736   }
737   if (TMath::Abs(fRp[2]) > 0.999999) {
738      for (Int_t i=0; i<21; i++) cv[i]=0.;
739      return;
740   }
741   Double_t pt=1./TMath::Abs(fRp[4]);
742   Double_t cs=TMath::Cos(fRalpha), sn=TMath::Sin(fRalpha);
743   Double_t r=TMath::Sqrt(1-fRp[2]*fRp[2]);
744
745   Double_t m00=-sn, m10=cs;
746   Double_t m23=-pt*(sn + fRp[2]*cs/r), m43=-pt*pt*(r*cs - fRp[2]*sn);
747   Double_t m24= pt*(cs - fRp[2]*sn/r), m44=-pt*pt*(r*sn + fRp[2]*cs);
748   Double_t m35=pt, m45=-pt*pt*fRp[3];
749
750   cv[0]=fRc[0]*m00*m00;
751   cv[1]=fRc[0]*m00*m10; 
752   cv[2]=fRc[0]*m10*m10;
753   cv[3]=fRc[1]*m00; 
754   cv[4]=fRc[1]*m10; 
755   cv[5]=fRc[2];
756   cv[6]=m00*(fRc[3]*m23+fRc[10]*m43); 
757   cv[7]=m10*(fRc[3]*m23+fRc[10]*m43); 
758   cv[8]=fRc[4]*m23+fRc[11]*m43; 
759   cv[9]=m23*(fRc[5]*m23+fRc[12]*m43)+m43*(fRc[12]*m23+fRc[14]*m43);
760   cv[10]=m00*(fRc[3]*m24+fRc[10]*m44); 
761   cv[11]=m10*(fRc[3]*m24+fRc[10]*m44); 
762   cv[12]=fRc[4]*m24+fRc[11]*m44; 
763   cv[13]=m23*(fRc[5]*m24+fRc[12]*m44)+m43*(fRc[12]*m24+fRc[14]*m44);
764   cv[14]=m24*(fRc[5]*m24+fRc[12]*m44)+m44*(fRc[12]*m24+fRc[14]*m44);
765   cv[15]=m00*(fRc[6]*m35+fRc[10]*m45); 
766   cv[16]=m10*(fRc[6]*m35+fRc[10]*m45); 
767   cv[17]=fRc[7]*m35+fRc[11]*m45; 
768   cv[18]=m23*(fRc[8]*m35+fRc[12]*m45)+m43*(fRc[13]*m35+fRc[14]*m45);
769   cv[19]=m24*(fRc[8]*m35+fRc[12]*m45)+m44*(fRc[13]*m35+fRc[14]*m45); 
770   cv[20]=m35*(fRc[9]*m35+fRc[13]*m45)+m45*(fRc[13]*m35+fRc[14]*m45);
771 }
772
773 Bool_t AliESDtrack::GetInnerPxPyPz(Double_t *p) const {
774   //---------------------------------------------------------------------
775   // This function returns the global track momentum components
776   // af the entrance of the TPC
777   //---------------------------------------------------------------------
778   p[0]=fIp[4]; p[1]=fIp[2]; p[2]=fIp[3];
779   return Local2GlobalMomentum(p,fIalpha);
780 }
781
782 Bool_t AliESDtrack::GetInnerXYZ(Double_t *r) const {
783   //---------------------------------------------------------------------
784   // This function returns the global track position
785   // af the entrance of the TPC
786   //---------------------------------------------------------------------
787   if (fIx==0) return kFALSE;
788   r[0]=fIx; r[1]=fIp[0]; r[2]=fIp[1];
789   return Local2GlobalPosition(r,fIalpha);
790 }
791
792 void AliESDtrack::GetInnerExternalParameters(Double_t &x, Double_t p[5]) const 
793 {
794   //skowron
795  //---------------------------------------------------------------------
796   // This function returns external representation of the track parameters at Inner Layer of TPC
797   //---------------------------------------------------------------------
798   x=fIx;
799   for (Int_t i=0; i<5; i++) p[i]=fIp[i];
800 }
801 void AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const
802 {
803  //skowron
804  //---------------------------------------------------------------------
805  // This function returns external representation of the cov. matrix at Inner Layer of TPC
806  //---------------------------------------------------------------------
807  for (Int_t i=0; i<15; i++) cov[i]=fIc[i];
808  
809 }
810
811 Int_t AliESDtrack::GetNcls(Int_t idet) const
812 {
813   // Get number of clusters by subdetector index
814   //
815   Int_t ncls = 0;
816   switch(idet){
817   case 0:
818     ncls = fITSncls;
819     break;
820   case 1:
821     ncls = fTPCncls;
822     break;
823   case 2:
824     ncls = fTRDncls;
825     break;
826   case 3:
827     if (fTOFindex != 0)
828       ncls = 1;
829     break;
830   default:
831     break;
832   }
833   return ncls;
834 }
835
836 Int_t AliESDtrack::GetClusters(Int_t idet, UInt_t *idx) const
837 {
838   // Get cluster index array by subdetector index
839   //
840   Int_t ncls = 0;
841   switch(idet){
842   case 0:
843     ncls = GetITSclusters(idx);
844     break;
845   case 1:
846     ncls = GetTPCclusters((Int_t *)idx);
847     break;
848   case 2:
849     ncls = GetTRDclusters(idx);
850     break;
851   case 3:
852     if (fTOFindex != 0) {
853       idx[0] = GetTOFcluster();
854       ncls = 1;
855     }
856     break;
857   default:
858     break;
859   }
860   return ncls;
861 }
862
863 void  AliESDtrack::GetTRDExternalParameters(Double_t &x, Double_t&alpha, Double_t p[5], Double_t cov[15]) const
864 {
865   //
866   //this function returns TRD parameters
867   //
868   x=fTx;
869   alpha = fTalpha; 
870   for (Int_t i=0; i<5; i++) p[i]=fTp[i];
871   for (Int_t i=0; i<15; i++) cov[i]=fTc[i];
872 }
873
874 Bool_t AliESDtrack::GetPxPyPzAt(Double_t x, Double_t b, Double_t *p) const {
875   //---------------------------------------------------------------------
876   // This function returns the global track momentum extrapolated to
877   // the radial position "x" (cm) in the magnetic field "b" (kG)
878   //---------------------------------------------------------------------
879   Double_t convconst=0.299792458*b/1000.;
880   p[0]=fRp[4]; 
881   p[1]=fRp[2]+(x-fRx)*fRp[4]*convconst; 
882   p[2]=fRp[3];
883   return Local2GlobalMomentum(p,fRalpha);
884 }
885
886 Bool_t AliESDtrack::GetXYZAt(Double_t x, Double_t b, Double_t *r) const {
887   //---------------------------------------------------------------------
888   // This function returns the global track position extrapolated to
889   // the radial position "x" (cm) in the magnetic field "b" (kG)
890   //---------------------------------------------------------------------
891   Double_t convconst=0.299792458*b/1000.;
892   Double_t dx=x-fRx;
893   Double_t f1=fRp[2], f2=f1 + dx*fRp[4]*convconst;
894
895   if (TMath::Abs(f2) >= 0.9999) return kFALSE;
896   
897   Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
898   r[0] = x;
899   r[1] = fRp[0] + dx*(f1+f2)/(r1+r2);
900   r[2] = fRp[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
901   return Local2GlobalPosition(r,fRalpha);
902 }
903
904 //_______________________________________________________________________
905 void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
906   // Returns the array with integrated times for each particle hypothesis
907   for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
908 }
909
910 //_______________________________________________________________________
911 void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
912   // Sets the array with integrated times for each particle hypotesis
913   for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
914 }
915
916 //_______________________________________________________________________
917 void AliESDtrack::SetITSpid(const Double_t *p) {
918   // Sets values for the probability of each particle type (in ITS)
919   SetPIDValues(fITSr,p,AliPID::kSPECIES);
920   SetStatus(AliESDtrack::kITSpid);
921 }
922
923 void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){
924   for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i];
925 }
926 //_______________________________________________________________________
927 void AliESDtrack::GetITSpid(Double_t *p) const {
928   // Gets the probability of each particle type (in ITS)
929   for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
930 }
931
932 //_______________________________________________________________________
933 Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
934   //---------------------------------------------------------------------
935   // This function returns indices of the assgined ITS clusters 
936   //---------------------------------------------------------------------
937   for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
938   return fITSncls;
939 }
940
941 //_______________________________________________________________________
942 Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
943   //---------------------------------------------------------------------
944   // This function returns indices of the assgined ITS clusters 
945   //---------------------------------------------------------------------
946   if (idx!=0)
947     for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i];  // MI I prefer some constant
948   return fTPCncls;
949 }
950
951 Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
952   //
953   // GetDensity of the clusters on given region between row0 and row1
954   // Dead zone effect takin into acoount
955   //
956   Int_t good  = 0;
957   Int_t found = 0;
958   //  
959   for (Int_t i=row0;i<=row1;i++){     
960     Int_t index = fTPCindex[i];
961     if (index!=-1)  good++;             // track outside of dead zone
962     if (index>0)    found++;
963   }
964   Float_t density=0.5;
965   if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
966   return density;
967 }
968
969 //_______________________________________________________________________
970 void AliESDtrack::SetTPCpid(const Double_t *p) {  
971   // Sets values for the probability of each particle type (in TPC)
972   SetPIDValues(fTPCr,p,AliPID::kSPECIES);
973   SetStatus(AliESDtrack::kTPCpid);
974 }
975
976 //_______________________________________________________________________
977 void AliESDtrack::GetTPCpid(Double_t *p) const {
978   // Gets the probability of each particle type (in TPC)
979   for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
980 }
981
982 //_______________________________________________________________________
983 Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const {
984   //---------------------------------------------------------------------
985   // This function returns indices of the assgined TRD clusters 
986   //---------------------------------------------------------------------
987   if (idx!=0)
988     for (Int_t i=0; i<130; i++) idx[i]=fTRDindex[i];  // MI I prefer some constant
989   return fTRDncls;
990 }
991
992 //_______________________________________________________________________
993 void AliESDtrack::SetTRDpid(const Double_t *p) {  
994   // Sets values for the probability of each particle type (in TRD)
995   SetPIDValues(fTRDr,p,AliPID::kSPECIES);
996   SetStatus(AliESDtrack::kTRDpid);
997 }
998
999 //_______________________________________________________________________
1000 void AliESDtrack::GetTRDpid(Double_t *p) const {
1001   // Gets the probability of each particle type (in TRD)
1002   for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
1003 }
1004
1005 //_______________________________________________________________________
1006 void    AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1007 {
1008   // Sets the probability of particle type iSpecies to p (in TRD)
1009   fTRDr[iSpecies] = p;
1010 }
1011
1012 Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
1013 {
1014   // Returns the probability of particle type iSpecies (in TRD)
1015   return fTRDr[iSpecies];
1016 }
1017
1018 //_______________________________________________________________________
1019 void AliESDtrack::SetTOFpid(const Double_t *p) {  
1020   // Sets the probability of each particle type (in TOF)
1021   SetPIDValues(fTOFr,p,AliPID::kSPECIES);
1022   SetStatus(AliESDtrack::kTOFpid);
1023 }
1024
1025 //_______________________________________________________________________
1026 void AliESDtrack::SetTOFLabel(const Int_t *p) {  
1027   // Sets  (in TOF)
1028   for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1029 }
1030
1031 //_______________________________________________________________________
1032 void AliESDtrack::GetTOFpid(Double_t *p) const {
1033   // Gets probabilities of each particle type (in TOF)
1034   for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
1035 }
1036
1037 //_______________________________________________________________________
1038 void AliESDtrack::GetTOFLabel(Int_t *p) const {
1039   // Gets (in TOF)
1040   for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1041 }
1042
1043 //_______________________________________________________________________
1044 void AliESDtrack::GetTOFInfo(Float_t *info) const {
1045   // Gets (in TOF)
1046   for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1047 }
1048
1049 //_______________________________________________________________________
1050 void AliESDtrack::SetTOFInfo(Float_t*info) {
1051   // Gets (in TOF)
1052   for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1053 }
1054
1055
1056
1057 //_______________________________________________________________________
1058 void AliESDtrack::SetPHOSpid(const Double_t *p) {  
1059   // Sets the probability of each particle type (in PHOS)
1060   SetPIDValues(fPHOSr,p,AliPID::kSPECIESN);
1061   SetStatus(AliESDtrack::kPHOSpid);
1062 }
1063
1064 //_______________________________________________________________________
1065 void AliESDtrack::GetPHOSpid(Double_t *p) const {
1066   // Gets probabilities of each particle type (in PHOS)
1067   for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fPHOSr[i];
1068 }
1069
1070 //_______________________________________________________________________
1071 void AliESDtrack::SetEMCALpid(const Double_t *p) {  
1072   // Sets the probability of each particle type (in EMCAL)
1073   SetPIDValues(fEMCALr,p,AliPID::kSPECIESN);
1074   SetStatus(AliESDtrack::kEMCALpid);
1075 }
1076
1077 //_______________________________________________________________________
1078 void AliESDtrack::GetEMCALpid(Double_t *p) const {
1079   // Gets probabilities of each particle type (in EMCAL)
1080   for (Int_t i=0; i<AliPID::kSPECIESN; i++) p[i]=fEMCALr[i];
1081 }
1082
1083 //_______________________________________________________________________
1084 void AliESDtrack::SetRICHpid(const Double_t *p) {  
1085   // Sets the probability of each particle type (in RICH)
1086   SetPIDValues(fRICHr,p,AliPID::kSPECIES);
1087   SetStatus(AliESDtrack::kRICHpid);
1088 }
1089
1090 //_______________________________________________________________________
1091 void AliESDtrack::GetRICHpid(Double_t *p) const {
1092   // Gets probabilities of each particle type (in RICH)
1093   for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i];
1094 }
1095
1096
1097
1098 //_______________________________________________________________________
1099 void AliESDtrack::SetESDpid(const Double_t *p) {  
1100   // Sets the probability of each particle type for the ESD track
1101   SetPIDValues(fR,p,AliPID::kSPECIES);
1102   SetStatus(AliESDtrack::kESDpid);
1103 }
1104
1105 //_______________________________________________________________________
1106 void AliESDtrack::GetESDpid(Double_t *p) const {
1107   // Gets probability of each particle type for the ESD track
1108   for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
1109 }
1110
1111 //_______________________________________________________________________
1112 void AliESDtrack::Print(Option_t *) const {
1113   // Prints info on the track
1114   
1115   printf("ESD track info\n") ; 
1116   Double_t p[AliPID::kSPECIESN] ; 
1117   Int_t index = 0 ; 
1118   if( IsOn(kITSpid) ){
1119     printf("From ITS: ") ; 
1120     GetITSpid(p) ; 
1121     for(index = 0 ; index < AliPID::kSPECIES; index++) 
1122       printf("%f, ", p[index]) ;
1123     printf("\n           signal = %f\n", GetITSsignal()) ;
1124   } 
1125   if( IsOn(kTPCpid) ){
1126     printf("From TPC: ") ; 
1127     GetTPCpid(p) ; 
1128     for(index = 0 ; index < AliPID::kSPECIES; index++) 
1129       printf("%f, ", p[index]) ;
1130     printf("\n           signal = %f\n", GetTPCsignal()) ;
1131   }
1132   if( IsOn(kTRDpid) ){
1133     printf("From TRD: ") ; 
1134     GetTRDpid(p) ; 
1135     for(index = 0 ; index < AliPID::kSPECIES; index++) 
1136       printf("%f, ", p[index]) ;
1137     printf("\n           signal = %f\n", GetTRDsignal()) ;
1138   }
1139   if( IsOn(kTOFpid) ){
1140     printf("From TOF: ") ; 
1141     GetTOFpid(p) ; 
1142     for(index = 0 ; index < AliPID::kSPECIES; index++) 
1143       printf("%f, ", p[index]) ;
1144     printf("\n           signal = %f\n", GetTOFsignal()) ;
1145   }
1146   if( IsOn(kRICHpid) ){
1147     printf("From RICH: ") ; 
1148     GetRICHpid(p) ; 
1149     for(index = 0 ; index < AliPID::kSPECIES; index++) 
1150       printf("%f, ", p[index]) ;
1151     printf("\n           signal = %f\n", GetRICHsignal()) ;
1152   }
1153   if( IsOn(kPHOSpid) ){
1154     printf("From PHOS: ") ; 
1155     GetPHOSpid(p) ; 
1156     for(index = 0 ; index < AliPID::kSPECIESN; index++) 
1157       printf("%f, ", p[index]) ;
1158     printf("\n           signal = %f\n", GetPHOSsignal()) ;
1159   }
1160   if( IsOn(kEMCALpid) ){
1161     printf("From EMCAL: ") ; 
1162     GetEMCALpid(p) ; 
1163     for(index = 0 ; index < AliPID::kSPECIESN; index++) 
1164       printf("%f, ", p[index]) ;
1165     printf("\n           signal = %f\n", GetEMCALsignal()) ;
1166   }
1167