Added methods for finding a given module in the DDL map (F. Prino)
[u/mrichter/AliRoot.git] / STEER / AliESDtrack.cxx
CommitLineData
ae982df3 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 **************************************************************************/
ae982df3 15//-----------------------------------------------------------------
16// Implementation of the ESD track class
4427806c 17// ESD = Event Summary Data
15614b8b 18// This is the class to deal with during the phisics analysis of data
4427806c 19// Origin: Iouri Belikov, CERN
20// e-mail: Jouri.Belikov@cern.ch
ae982df3 21//-----------------------------------------------------------------
22
e1e6896f 23#include <TMath.h>
49edfa08 24#include <TParticle.h>
ae982df3 25
49d13e89 26#include "AliESDVertex.h"
ae982df3 27#include "AliESDtrack.h"
28#include "AliKalmanTrack.h"
5f7789fc 29#include "AliLog.h"
15e85efa 30#include "AliTrackPointArray.h"
0c19adf7 31#include "TPolyMarker3D.h"
ae982df3 32
33ClassImp(AliESDtrack)
34
562dd0b4 35void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) {
d27bbc79 36 // This function copies "n" PID weights from "scr" to "dest"
37 // and normalizes their sum to 1 thus producing conditional probabilities.
38 // The negative weights are set to 0.
39 // In case all the weights are non-positive they are replaced by
40 // uniform probabilities
41
42 if (n<=0) return;
43
44 Float_t uniform = 1./(Float_t)n;
45
46 Float_t sum = 0;
47 for (Int_t i=0; i<n; i++)
48 if (src[i]>=0) {
49 sum+=src[i];
50 dest[i] = src[i];
51 }
52 else {
53 dest[i] = 0;
54 }
55
56 if(sum>0)
57 for (Int_t i=0; i<n; i++) dest[i] /= sum;
58 else
59 for (Int_t i=0; i<n; i++) dest[i] = uniform;
60}
61
ae982df3 62//_______________________________________________________________________
63AliESDtrack::AliESDtrack() :
c9ec41e8 64 AliExternalTrackParam(),
562dd0b4 65 fCp(0),
66 fIp(0),
67 fTPCInner(0),
68 fOp(0),
69 fFriendTrack(new AliESDfriendTrack()),
70 fTPCClusterMap(159),//number of padrows
71 fTPCSharedMap(159),//number of padrows
90e48c0c 72 fFlags(0),
90e48c0c 73 fID(0),
562dd0b4 74 fLabel(0),
75 fITSLabel(0),
76 fTPCLabel(0),
77 fTRDLabel(0),
78 fTOFCalChannel(0),
79 fTOFindex(0),
80 fHMPIDqn(0),
81 fHMPIDcluIdx(0),
82 fEMCALindex(kEMCALNoMatch),
83 fHMPIDtrkTheta(0),
84 fHMPIDtrkPhi(0),
85 fHMPIDsignal(0),
90e48c0c 86 fTrackLength(0),
49d13e89 87 fD(0),fZ(0),
88 fCdd(0),fCdz(0),fCzz(0),
562dd0b4 89 fCchi2(0),
90e48c0c 90 fITSchi2(0),
90e48c0c 91 fTPCchi2(0),
562dd0b4 92 fTRDchi2(0),
93 fTOFchi2(0),
94 fHMPIDchi2(0),
95 fITSsignal(0),
90e48c0c 96 fTPCsignal(0),
e1d4c1b5 97 fTPCsignalS(0),
90e48c0c 98 fTRDsignal(0),
90e48c0c 99 fTRDQuality(0),
23d49657 100 fTRDBudget(0),
562dd0b4 101 fTOFsignal(0),
85324138 102 fTOFsignalToT(0),
d321691a 103 fTOFsignalRaw(0),
104 fTOFsignalDz(0),
562dd0b4 105 fHMPIDtrkX(0),
106 fHMPIDtrkY(0),
107 fHMPIDmipX(0),
108 fHMPIDmipY(0),
109 fTPCncls(0),
110 fTPCnclsF(0),
111 fTPCsignalN(0),
112 fITSncls(0),
113 fITSClusterMap(0),
114 fTRDncls(0),
115 fTRDncls0(0),
116 fTRDpidQuality(0)
ae982df3 117{
118 //
119 // The default ESD constructor
120 //
6d45eaef 121 Int_t i, j;
6238d7a9 122 for (i=0; i<AliPID::kSPECIES; i++) {
4a78b8c5 123 fTrackTime[i]=0.;
562dd0b4 124 fR[i]=0.;
125 fITSr[i]=0.;
126 fTPCr[i]=0.;
127 fTRDr[i]=0.;
128 fTOFr[i]=0.;
129 fHMPIDr[i]=0.;
2bad268c 130 }
ac2f7574 131
ef7253ac 132 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
562dd0b4 133 for (i=0; i<3; i++) { fV0Indexes[i]=0;}
6d45eaef 134 for (i=0;i<kNPlane;i++) {
135 for (j=0;j<kNSlice;j++) {
136 fTRDsignals[i][j]=0.;
137 }
562dd0b4 138 fTRDTimBin[i]=0;
6d45eaef 139 }
562dd0b4 140 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
141 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
142 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
89f1b176 143 for (i=0;i<12;i++) {fITSModule[i]=-1;}
c4d11b15 144}
145
146//_______________________________________________________________________
90e48c0c 147AliESDtrack::AliESDtrack(const AliESDtrack& track):
c9ec41e8 148 AliExternalTrackParam(track),
562dd0b4 149 fCp(0),
150 fIp(0),
151 fTPCInner(0),
152 fOp(0),
153 fFriendTrack(0),
154 fTPCClusterMap(track.fTPCClusterMap),
155 fTPCSharedMap(track.fTPCSharedMap),
90e48c0c 156 fFlags(track.fFlags),
90e48c0c 157 fID(track.fID),
562dd0b4 158 fLabel(track.fLabel),
159 fITSLabel(track.fITSLabel),
160 fTPCLabel(track.fTPCLabel),
161 fTRDLabel(track.fTRDLabel),
162 fTOFCalChannel(track.fTOFCalChannel),
163 fTOFindex(track.fTOFindex),
164 fHMPIDqn(track.fHMPIDqn),
165 fHMPIDcluIdx(track.fHMPIDcluIdx),
166 fEMCALindex(track.fEMCALindex),
167 fHMPIDtrkTheta(track.fHMPIDtrkTheta),
168 fHMPIDtrkPhi(track.fHMPIDtrkPhi),
169 fHMPIDsignal(track.fHMPIDsignal),
90e48c0c 170 fTrackLength(track.fTrackLength),
49d13e89 171 fD(track.fD),fZ(track.fZ),
172 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
90e48c0c 173 fCchi2(track.fCchi2),
90e48c0c 174 fITSchi2(track.fITSchi2),
90e48c0c 175 fTPCchi2(track.fTPCchi2),
562dd0b4 176 fTRDchi2(track.fTRDchi2),
177 fTOFchi2(track.fTOFchi2),
178 fHMPIDchi2(track.fHMPIDchi2),
179 fITSsignal(track.fITSsignal),
90e48c0c 180 fTPCsignal(track.fTPCsignal),
e1d4c1b5 181 fTPCsignalS(track.fTPCsignalS),
90e48c0c 182 fTRDsignal(track.fTRDsignal),
90e48c0c 183 fTRDQuality(track.fTRDQuality),
23d49657 184 fTRDBudget(track.fTRDBudget),
90e48c0c 185 fTOFsignal(track.fTOFsignal),
85324138 186 fTOFsignalToT(track.fTOFsignalToT),
d321691a 187 fTOFsignalRaw(track.fTOFsignalRaw),
188 fTOFsignalDz(track.fTOFsignalDz),
f4b3bbb7 189 fHMPIDtrkX(track.fHMPIDtrkX),
190 fHMPIDtrkY(track.fHMPIDtrkY),
191 fHMPIDmipX(track.fHMPIDmipX),
192 fHMPIDmipY(track.fHMPIDmipY),
562dd0b4 193 fTPCncls(track.fTPCncls),
194 fTPCnclsF(track.fTPCnclsF),
195 fTPCsignalN(track.fTPCsignalN),
196 fITSncls(track.fITSncls),
197 fITSClusterMap(track.fITSClusterMap),
198 fTRDncls(track.fTRDncls),
199 fTRDncls0(track.fTRDncls0),
200 fTRDpidQuality(track.fTRDpidQuality)
90e48c0c 201{
c4d11b15 202 //
203 //copy constructor
204 //
ef7253ac 205 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
206 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
c4d11b15 207 //
304864ab 208 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
c4d11b15 209 //
304864ab 210 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
51ad6848 211 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
212 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
213 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
c4d11b15 214 //
eab5961e 215 for (Int_t i=0;i<kNPlane;i++) {
6d45eaef 216 for (Int_t j=0;j<kNSlice;j++) {
217 fTRDsignals[i][j]=track.fTRDsignals[i][j];
218 }
219 fTRDTimBin[i]=track.fTRDTimBin[i];
eab5961e 220 }
304864ab 221 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
304864ab 222 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
51ad6848 223 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
224 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
89f1b176 225 for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
f4b3bbb7 226 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
c9ec41e8 227
228 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
229 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
4aeb9470 230 if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
c9ec41e8 231 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
15e85efa 232
8497bca0 233 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
ae982df3 234}
15e85efa 235
c4d11b15 236//_______________________________________________________________________
49edfa08 237AliESDtrack::AliESDtrack(TParticle * part) :
238 AliExternalTrackParam(),
562dd0b4 239 fCp(0),
240 fIp(0),
241 fTPCInner(0),
242 fOp(0),
243 fFriendTrack(0),
244 fTPCClusterMap(159),//number of padrows
245 fTPCSharedMap(159),//number of padrows
49edfa08 246 fFlags(0),
49edfa08 247 fID(0),
562dd0b4 248 fLabel(0),
249 fITSLabel(0),
250 fTPCLabel(0),
251 fTRDLabel(0),
252 fTOFCalChannel(0),
253 fTOFindex(0),
254 fHMPIDqn(0),
255 fHMPIDcluIdx(0),
256 fEMCALindex(kEMCALNoMatch),
257 fHMPIDtrkTheta(0),
258 fHMPIDtrkPhi(0),
259 fHMPIDsignal(0),
49edfa08 260 fTrackLength(0),
261 fD(0),fZ(0),
262 fCdd(0),fCdz(0),fCzz(0),
562dd0b4 263 fCchi2(0),
49edfa08 264 fITSchi2(0),
49edfa08 265 fTPCchi2(0),
562dd0b4 266 fTRDchi2(0),
267 fTOFchi2(0),
268 fHMPIDchi2(0),
269 fITSsignal(0),
49edfa08 270 fTPCsignal(0),
49edfa08 271 fTPCsignalS(0),
49edfa08 272 fTRDsignal(0),
49edfa08 273 fTRDQuality(0),
274 fTRDBudget(0),
562dd0b4 275 fTOFsignal(0),
49edfa08 276 fTOFsignalToT(0),
d321691a 277 fTOFsignalRaw(0),
278 fTOFsignalDz(0),
562dd0b4 279 fHMPIDtrkX(0),
280 fHMPIDtrkY(0),
281 fHMPIDmipX(0),
282 fHMPIDmipY(0),
283 fTPCncls(0),
284 fTPCnclsF(0),
285 fTPCsignalN(0),
286 fITSncls(0),
287 fITSClusterMap(0),
288 fTRDncls(0),
289 fTRDncls0(0),
290 fTRDpidQuality(0)
49edfa08 291{
292 //
293 // ESD track from TParticle
294 //
295
296 // Reset all the arrays
297 Int_t i, j;
298 for (i=0; i<AliPID::kSPECIES; i++) {
299 fTrackTime[i]=0.;
300 fR[i]=0.;
301 fITSr[i]=0.;
302 fTPCr[i]=0.;
303 fTRDr[i]=0.;
304 fTOFr[i]=0.;
f4b3bbb7 305 fHMPIDr[i]=0.;
49edfa08 306 }
307
308 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
309 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
310 for (i=0;i<kNPlane;i++) {
311 for (j=0;j<kNSlice;j++) {
312 fTRDsignals[i][j]=0.;
313 }
562dd0b4 314 fTRDTimBin[i]=0;
49edfa08 315 }
562dd0b4 316 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
317 for (i=0;i<3;i++) {fTOFLabel[i]=0;}
318 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
89f1b176 319 for (i=0;i<12;i++) {fITSModule[i]=-1;}
49edfa08 320
321 // Calculate the AliExternalTrackParam content
322
323 Double_t xref;
324 Double_t alpha;
325 Double_t param[5];
326 Double_t covar[15];
327
328 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
329 alpha = part->Phi()*180./TMath::Pi();
330 if (alpha<0) alpha+= 360.;
331 if (alpha>360) alpha -= 360.;
332
333 Int_t sector = (Int_t)(alpha/20.);
334 alpha = 10. + 20.*sector;
335 alpha /= 180;
336 alpha *= TMath::Pi();
337
338 // Covariance matrix: no errors, the parameters are exact
6c27b212 339 for (i=0; i<15; i++) covar[i]=0.;
49edfa08 340
341 // Get the vertex of origin and the momentum
342 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
343 TVector3 mom(part->Px(),part->Py(),part->Pz());
344
345 // Rotate to the local coordinate system (TPC sector)
346 ver.RotateZ(-alpha);
347 mom.RotateZ(-alpha);
348
349 // X of the referense plane
350 xref = ver.X();
351
352 Int_t pdgCode = part->GetPdgCode();
353
354 Double_t charge =
355 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
356
357 param[0] = ver.Y();
358 param[1] = ver.Z();
359 param[2] = TMath::Sin(mom.Phi());
360 param[3] = mom.Pz()/mom.Pt();
361 param[4] = TMath::Sign(1/mom.Pt(),charge);
362
363 // Set AliExternalTrackParam
364 Set(xref, alpha, param, covar);
365
366 // Set the PID
367 Int_t indexPID = 99;
368
369 switch (TMath::Abs(pdgCode)) {
370
371 case 11: // electron
372 indexPID = 0;
373 break;
374
375 case 13: // muon
376 indexPID = 1;
377 break;
378
379 case 211: // pion
380 indexPID = 2;
381 break;
382
383 case 321: // kaon
384 indexPID = 3;
385 break;
386
387 case 2212: // proton
388 indexPID = 4;
389 break;
390
391 default:
392 break;
393 }
394
395 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
396 if (indexPID < AliPID::kSPECIES) {
397 fR[indexPID]=1.;
398 fITSr[indexPID]=1.;
399 fTPCr[indexPID]=1.;
400 fTRDr[indexPID]=1.;
401 fTOFr[indexPID]=1.;
f4b3bbb7 402 fHMPIDr[indexPID]=1.;
49edfa08 403
404 }
405 // AliESD track label
406 SetLabel(part->GetUniqueID());
407
408}
409
410//_______________________________________________________________________
c4d11b15 411AliESDtrack::~AliESDtrack(){
412 //
413 // This is destructor according Coding Conventrions
414 //
415 //printf("Delete track\n");
c9ec41e8 416 delete fIp;
4aeb9470 417 delete fTPCInner;
c9ec41e8 418 delete fOp;
419 delete fCp;
15e85efa 420 delete fFriendTrack;
c4d11b15 421}
ae982df3 422
00dce61a 423void AliESDtrack::AddCalibObject(TObject * object){
424 //
425 // add calib object to the list
426 //
427 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
428 fFriendTrack->AddCalibObject(object);
429}
430
431TObject * AliESDtrack::GetCalibObject(Int_t index){
432 //
433 // return calib objct at given position
434 //
435 if (!fFriendTrack) return 0;
436 return fFriendTrack->GetCalibObject(index);
437}
438
439
ae982df3 440//_______________________________________________________________________
9559cbc4 441void AliESDtrack::MakeMiniESDtrack(){
442 // Resets everything except
443 // fFlags: Reconstruction status flags
444 // fLabel: Track label
445 // fID: Unique ID of the track
446 // fD: Impact parameter in XY-plane
447 // fZ: Impact parameter in Z
448 // fR[AliPID::kSPECIES]: combined "detector response probability"
8497bca0 449 // Running track parameters in the base class (AliExternalTrackParam)
9559cbc4 450
451 fTrackLength = 0;
562dd0b4 452
9559cbc4 453 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
9559cbc4 454
455 // Reset track parameters constrained to the primary vertex
562dd0b4 456 delete fCp;fCp = 0;
9559cbc4 457 fCchi2 = 0;
458
459 // Reset track parameters at the inner wall of TPC
562dd0b4 460 delete fIp;fIp = 0;
461 delete fTPCInner;fTPCInner=0;
9559cbc4 462 // Reset track parameters at the inner wall of the TRD
562dd0b4 463 delete fOp;fOp = 0;
464
9559cbc4 465
466 // Reset ITS track related information
467 fITSchi2 = 0;
9559cbc4 468 fITSncls = 0;
62665e7f 469 fITSClusterMap=0;
9559cbc4 470 fITSsignal = 0;
ef7253ac 471 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
9559cbc4 472 fITSLabel = 0;
9559cbc4 473
474 // Reset TPC related track information
475 fTPCchi2 = 0;
476 fTPCncls = 0;
e1d4c1b5 477 fTPCnclsF = 0;
9559cbc4 478 fTPCClusterMap = 0;
eb7f6854 479 fTPCSharedMap = 0;
9559cbc4 480 fTPCsignal= 0;
e1d4c1b5 481 fTPCsignalS= 0;
482 fTPCsignalN= 0;
9559cbc4 483 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
484 fTPCLabel=0;
485 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
486 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
487 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
488
489 // Reset TRD related track information
490 fTRDchi2 = 0;
491 fTRDncls = 0;
492 fTRDncls0 = 0;
9559cbc4 493 fTRDsignal = 0;
494 for (Int_t i=0;i<kNPlane;i++) {
6d45eaef 495 for (Int_t j=0;j<kNSlice;j++) {
496 fTRDsignals[i][j] = 0;
497 }
498 fTRDTimBin[i] = 0;
9559cbc4 499 }
500 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
501 fTRDLabel = 0;
9559cbc4 502 fTRDQuality = 0;
562dd0b4 503 fTRDpidQuality = 0;
23d49657 504 fTRDBudget = 0;
9559cbc4 505
506 // Reset TOF related track information
507 fTOFchi2 = 0;
508 fTOFindex = 0;
509 fTOFsignal = 0;
562dd0b4 510 fTOFCalChannel = 0;
85324138 511 fTOFsignalToT = 0;
d321691a 512 fTOFsignalRaw = 0;
513 fTOFsignalDz = 0;
9559cbc4 514 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
515 for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0;
516 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
517
f4b3bbb7 518 // Reset HMPID related track information
519 fHMPIDchi2 = 0;
562dd0b4 520 fHMPIDqn = 0;
521 fHMPIDcluIdx = 0;
f4b3bbb7 522 fHMPIDsignal = 0;
523 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
562dd0b4 524 fHMPIDtrkTheta = 0;
525 fHMPIDtrkPhi = 0;
526 fHMPIDtrkX = 0;
527 fHMPIDtrkY = 0;
528 fHMPIDmipX = 0;
529 fHMPIDmipY = 0;
2e1dcd14 530 fEMCALindex = kEMCALNoMatch;
9559cbc4 531
15e85efa 532 delete fFriendTrack; fFriendTrack = 0;
9559cbc4 533}
534//_______________________________________________________________________
4a78b8c5 535Double_t AliESDtrack::GetMass() const {
4427806c 536 // Returns the mass of the most probable particle type
ae982df3 537 Float_t max=0.;
538 Int_t k=-1;
304864ab 539 for (Int_t i=0; i<AliPID::kSPECIES; i++) {
ae982df3 540 if (fR[i]>max) {k=i; max=fR[i];}
541 }
db3989b3 542 if (k==0) { // dE/dx "crossing points" in the TPC
543 Double_t p=GetP();
544 if ((p>0.38)&&(p<0.48))
304864ab 545 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
db3989b3 546 if ((p>0.75)&&(p<0.85))
304864ab 547 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
db3989b3 548 return 0.00051;
549 }
304864ab 550 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
551 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
552 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
553 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
5f7789fc 554 AliWarning("Undefined mass !");
304864ab 555 return AliPID::ParticleMass(AliPID::kPion);
ae982df3 556}
557
aad8d435 558//______________________________________________________________________________
559Double_t AliESDtrack::E() const
560{
561 // Returns the energy of the particle given its assumed mass.
562 // Assumes the pion mass if the particle can't be identified properly.
563
564 Double_t m = M();
565 Double_t p = P();
566 return TMath::Sqrt(p*p + m*m);
567}
568
569//______________________________________________________________________________
570Double_t AliESDtrack::Y() const
571{
572 // Returns the rapidity of a particle given its assumed mass.
573 // Assumes the pion mass if the particle can't be identified properly.
574
575 Double_t e = E();
576 Double_t pz = Pz();
e03e4544 577 if (e != TMath::Abs(pz)) { // energy was not equal to pz
aad8d435 578 return 0.5*TMath::Log((e+pz)/(e-pz));
579 } else { // energy was equal to pz
580 return -999.;
581 }
582}
583
ae982df3 584//_______________________________________________________________________
c9ec41e8 585Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
ae982df3 586 //
587 // This function updates track's running parameters
588 //
15e85efa 589 Int_t *index=0;
15614b8b 590 Bool_t rc=kTRUE;
591
9b859005 592 SetStatus(flags);
593 fLabel=t->GetLabel();
594
595 if (t->IsStartedTimeIntegral()) {
596 SetStatus(kTIME);
597 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
598 SetIntegratedLength(t->GetIntegratedLength());
599 }
600
6c94f330 601 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
e1d4c1b5 602
ae982df3 603 switch (flags) {
ad2f1f2b 604
9b859005 605 case kITSin: case kITSout: case kITSrefit:
48704648 606 fITSClusterMap=0;
ae982df3 607 fITSncls=t->GetNumberOfClusters();
62665e7f 608 index=fFriendTrack->GetITSindices();
609 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
610 index[i]=t->GetClusterIndex(i);
611 if (i<fITSncls) {
612 Int_t l=(index[i] & 0xf0000000) >> 28;
613 SETBIT(fITSClusterMap,l);
614 }
615 }
ae982df3 616 fITSchi2=t->GetChi2();
ae982df3 617 fITSsignal=t->GetPIDsignal();
6e5b1b04 618 fITSLabel = t->GetLabel();
ae982df3 619 break;
ad2f1f2b 620
9b859005 621 case kTPCin: case kTPCrefit:
6e5b1b04 622 fTPCLabel = t->GetLabel();
4aeb9470 623 if (flags==kTPCin) fTPCInner=new AliExternalTrackParam(*t);
c9ec41e8 624 if (!fIp) fIp=new AliExternalTrackParam(*t);
6c94f330 625 else
626 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
9b859005 627 case kTPCout:
15e85efa 628 index=fFriendTrack->GetTPCindices();
1d303a24 629 if (flags & kTPCout){
630 if (!fOp) fOp=new AliExternalTrackParam(*t);
6c94f330 631 else
632 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1d303a24 633 }
e1d4c1b5 634 fTPCncls=t->GetNumberOfClusters();
ae982df3 635 fTPCchi2=t->GetChi2();
a866ac60 636
637 {//prevrow must be declared in separate namespace, otherwise compiler cries:
638 //"jump to case label crosses initialization of `Int_t prevrow'"
639 Int_t prevrow = -1;
6e5b1b04 640 // for (Int_t i=0;i<fTPCncls;i++)
15e85efa 641 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
a866ac60 642 {
15e85efa 643 index[i]=t->GetClusterIndex(i);
644 Int_t idx = index[i];
a866ac60 645
15e85efa 646 if (idx<0) continue;
9fe5b2ff 647
a866ac60 648 // Piotr's Cluster Map for HBT
649 // ### please change accordingly if cluster array is changing
650 // to "New TPC Tracking" style (with gaps in array)
a866ac60 651 Int_t sect = (idx&0xff000000)>>24;
652 Int_t row = (idx&0x00ff0000)>>16;
653 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
654
655 fTPCClusterMap.SetBitNumber(row,kTRUE);
656
657 //Fill the gap between previous row and this row with 0 bits
658 //In case ### pleas change it as well - just set bit 0 in case there
659 //is no associated clusters for current "i"
660 if (prevrow < 0)
661 {
662 prevrow = row;//if previous bit was not assigned yet == this is the first one
663 }
664 else
665 { //we don't know the order (inner to outer or reverse)
666 //just to be save in case it is going to change
667 Int_t n = 0, m = 0;
668 if (prevrow < row)
669 {
670 n = prevrow;
671 m = row;
672 }
673 else
674 {
675 n = row;
676 m = prevrow;
677 }
678
679 for (Int_t j = n+1; j < m; j++)
680 {
681 fTPCClusterMap.SetBitNumber(j,kFALSE);
682 }
683 prevrow = row;
684 }
685 // End Of Piotr's Cluster Map for HBT
686 }
687 }
ae982df3 688 fTPCsignal=t->GetPIDsignal();
ae982df3 689 break;
9b859005 690
23904d16 691 case kTRDout: case kTRDin: case kTRDrefit:
2f83b7a6 692 index = fFriendTrack->GetTRDindices();
51ad6848 693 fTRDLabel = t->GetLabel();
2f83b7a6 694 fTRDchi2 = t->GetChi2();
695 fTRDncls = t->GetNumberOfClusters();
5bc3e158 696 for (Int_t i=0;i<6;i++) index[i]=t->GetTrackletIndex(i);
697
79e94bf8 698 fTRDsignal=t->GetPIDsignal();
699 break;
c4d11b15 700 case kTRDbackup:
c9ec41e8 701 if (!fOp) fOp=new AliExternalTrackParam(*t);
6c94f330 702 else
703 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
c4d11b15 704 fTRDncls0 = t->GetNumberOfClusters();
705 break;
706 case kTOFin:
707 break;
708 case kTOFout:
709 break;
d0862fea 710 case kTRDStop:
711 break;
ae982df3 712 default:
5f7789fc 713 AliError("Wrong flag !");
ae982df3 714 return kFALSE;
715 }
716
15614b8b 717 return rc;
ae982df3 718}
719
720//_______________________________________________________________________
721void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
722 //---------------------------------------------------------------------
723 // This function returns external representation of the track parameters
724 //---------------------------------------------------------------------
c9ec41e8 725 x=GetX();
726 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
15614b8b 727}
728
67c3dcbe 729//_______________________________________________________________________
a866ac60 730void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
67c3dcbe 731 //---------------------------------------------------------------------
732 // This function returns external representation of the cov. matrix
733 //---------------------------------------------------------------------
c9ec41e8 734 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
67c3dcbe 735}
736
67c3dcbe 737//_______________________________________________________________________
c0b978f0 738Bool_t AliESDtrack::GetConstrainedExternalParameters
739 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
67c3dcbe 740 //---------------------------------------------------------------------
741 // This function returns the constrained external track parameters
742 //---------------------------------------------------------------------
c0b978f0 743 if (!fCp) return kFALSE;
744 alpha=fCp->GetAlpha();
c9ec41e8 745 x=fCp->GetX();
746 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
c0b978f0 747 return kTRUE;
67c3dcbe 748}
c9ec41e8 749
67c3dcbe 750//_______________________________________________________________________
c0b978f0 751Bool_t
67c3dcbe 752AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
753 //---------------------------------------------------------------------
754 // This function returns the constrained external cov. matrix
755 //---------------------------------------------------------------------
c0b978f0 756 if (!fCp) return kFALSE;
c9ec41e8 757 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
c0b978f0 758 return kTRUE;
67c3dcbe 759}
760
c0b978f0 761Bool_t
762AliESDtrack::GetInnerExternalParameters
763 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
764 //---------------------------------------------------------------------
c9ec41e8 765 // This function returns external representation of the track parameters
766 // at the inner layer of TPC
9b859005 767 //---------------------------------------------------------------------
c0b978f0 768 if (!fIp) return kFALSE;
769 alpha=fIp->GetAlpha();
c9ec41e8 770 x=fIp->GetX();
771 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
c0b978f0 772 return kTRUE;
9b859005 773}
774
c0b978f0 775Bool_t
776AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
c9ec41e8 777 //---------------------------------------------------------------------
778 // This function returns external representation of the cov. matrix
779 // at the inner layer of TPC
780 //---------------------------------------------------------------------
c0b978f0 781 if (!fIp) return kFALSE;
c9ec41e8 782 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
c0b978f0 783 return kTRUE;
9b859005 784}
785
c0b978f0 786Bool_t
787AliESDtrack::GetOuterExternalParameters
788 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
789 //---------------------------------------------------------------------
c9ec41e8 790 // This function returns external representation of the track parameters
791 // at the inner layer of TRD
a866ac60 792 //---------------------------------------------------------------------
c0b978f0 793 if (!fOp) return kFALSE;
794 alpha=fOp->GetAlpha();
c9ec41e8 795 x=fOp->GetX();
796 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
c0b978f0 797 return kTRUE;
a866ac60 798}
c9ec41e8 799
c0b978f0 800Bool_t
801AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
a866ac60 802 //---------------------------------------------------------------------
c9ec41e8 803 // This function returns external representation of the cov. matrix
804 // at the inner layer of TRD
a866ac60 805 //---------------------------------------------------------------------
c0b978f0 806 if (!fOp) return kFALSE;
c9ec41e8 807 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
c0b978f0 808 return kTRUE;
a866ac60 809}
810
98937d93 811Int_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
ef7253ac 836Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
98937d93 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:
ef7253ac 846 ncls = GetTPCclusters(idx);
98937d93 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
ae982df3 863//_______________________________________________________________________
ae982df3 864void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
4427806c 865 // Returns the array with integrated times for each particle hypothesis
304864ab 866 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
ae982df3 867}
868
869//_______________________________________________________________________
870void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
4427806c 871 // Sets the array with integrated times for each particle hypotesis
304864ab 872 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
ae982df3 873}
874
875//_______________________________________________________________________
4427806c 876void AliESDtrack::SetITSpid(const Double_t *p) {
877 // Sets values for the probability of each particle type (in ITS)
d27bbc79 878 SetPIDValues(fITSr,p,AliPID::kSPECIES);
c630aafd 879 SetStatus(AliESDtrack::kITSpid);
880}
881
882//_______________________________________________________________________
883void AliESDtrack::GetITSpid(Double_t *p) const {
4427806c 884 // Gets the probability of each particle type (in ITS)
304864ab 885 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
c630aafd 886}
887
888//_______________________________________________________________________
562dd0b4 889Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
ae982df3 890 //---------------------------------------------------------------------
891 // This function returns indices of the assgined ITS clusters
892 //---------------------------------------------------------------------
15e85efa 893 if (idx!=0) {
894 Int_t *index=fFriendTrack->GetITSindices();
895 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) idx[i]=index[i];
896 }
ae982df3 897 return fITSncls;
898}
899
900//_______________________________________________________________________
89f1b176 901Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
902 Float_t &xloc,Float_t &zloc) const {
903 //----------------------------------------------------------------------
904 // This function encodes in the module number also the status of cluster association
905 // "status" can have the following values:
906 // 1 "found" (cluster is associated),
907 // 2 "dead" (module is dead from OCDB),
908 // 3 "skipped" (module or layer forced to be skipped),
909 // 4 "outinz" (track out of z acceptance),
910 // 5 "nocls" (no clusters in the road),
911 // 6 "norefit" (cluster rejected during refit),
912 // 7 "deadzspd" (holes in z in SPD)
913 // Also given are the coordinates of the crossing point of track and module
914 // (in the local module ref. system)
915 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
916 //----------------------------------------------------------------------
917
918 if(fITSModule[ilayer]==-1) {
919 AliError("fModule was not set !");
920 idet = -1;
921 status=0;
922 xloc=-99.; zloc=-99.;
923 return kFALSE;
924 }
925
926 Int_t module = fITSModule[ilayer];
927
928 idet = Int_t(module/1000000);
929
930 module -= idet*1000000;
931
932 status = Int_t(module/100000);
933
934 module -= status*100000;
935
936 Int_t signs = Int_t(module/10000);
937
938 module-=signs*10000;
939
940 Int_t xInt = Int_t(module/100);
941 module -= xInt*100;
942
943 Int_t zInt = module;
944
945 if(signs==1) { xInt*=1; zInt*=1; }
946 if(signs==2) { xInt*=1; zInt*=-1; }
947 if(signs==3) { xInt*=-1; zInt*=1; }
948 if(signs==4) { xInt*=-1; zInt*=-1; }
949
950 xloc = 0.1*(Float_t)xInt;
951 zloc = 0.1*(Float_t)zInt;
952
953 if(status==4) idet = -1;
954
955 return kTRUE;
956}
957
958//_______________________________________________________________________
562dd0b4 959UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
ae982df3 960 //---------------------------------------------------------------------
961 // This function returns indices of the assgined ITS clusters
962 //---------------------------------------------------------------------
15e85efa 963 if (idx!=0) {
964 Int_t *index=fFriendTrack->GetTPCindices();
965 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
966 }
ae982df3 967 return fTPCncls;
968}
8c6a71ab 969
562dd0b4 970Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
81e97e0d 971 //
972 // GetDensity of the clusters on given region between row0 and row1
973 // Dead zone effect takin into acoount
974 //
975 Int_t good = 0;
976 Int_t found = 0;
977 //
15e85efa 978 Int_t *index=fFriendTrack->GetTPCindices();
81e97e0d 979 for (Int_t i=row0;i<=row1;i++){
15e85efa 980 Int_t idx = index[i];
981 if (idx!=-1) good++; // track outside of dead zone
982 if (idx>0) found++;
81e97e0d 983 }
984 Float_t density=0.5;
985 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
986 return density;
987}
c84a5e9e 988
8c6a71ab 989//_______________________________________________________________________
990void AliESDtrack::SetTPCpid(const Double_t *p) {
4427806c 991 // Sets values for the probability of each particle type (in TPC)
d27bbc79 992 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
8c6a71ab 993 SetStatus(AliESDtrack::kTPCpid);
994}
995
996//_______________________________________________________________________
997void AliESDtrack::GetTPCpid(Double_t *p) const {
4427806c 998 // Gets the probability of each particle type (in TPC)
304864ab 999 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
8c6a71ab 1000}
1001
1002//_______________________________________________________________________
562dd0b4 1003UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
bb2ceb1f 1004 //---------------------------------------------------------------------
1005 // This function returns indices of the assgined TRD clusters
1006 //---------------------------------------------------------------------
15e85efa 1007 if (idx!=0) {
1008 Int_t *index=fFriendTrack->GetTRDindices();
1009 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
1010 }
bb2ceb1f 1011 return fTRDncls;
1012}
1013
1014//_______________________________________________________________________
5bc3e158 1015UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
1016 //---------------------------------------------------------------------
1017 // This function returns indices of the assigned TRD tracklets
1018 //---------------------------------------------------------------------
1019 if (idx!=0) {
1020 Int_t *index=fFriendTrack->GetTRDindices();
1021 for (Int_t i=0; i<6/*AliESDfriendTrack::kMaxTRDcluster*/; i++) idx[i]=index[i];
1022 }
1023 return fTRDncls;
1024}
1025
1026//_______________________________________________________________________
c630aafd 1027void AliESDtrack::SetTRDpid(const Double_t *p) {
4427806c 1028 // Sets values for the probability of each particle type (in TRD)
d27bbc79 1029 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
c630aafd 1030 SetStatus(AliESDtrack::kTRDpid);
1031}
1032
1033//_______________________________________________________________________
1034void AliESDtrack::GetTRDpid(Double_t *p) const {
4427806c 1035 // Gets the probability of each particle type (in TRD)
304864ab 1036 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
c630aafd 1037}
1038
1039//_______________________________________________________________________
79e94bf8 1040void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1041{
4427806c 1042 // Sets the probability of particle type iSpecies to p (in TRD)
79e94bf8 1043 fTRDr[iSpecies] = p;
1044}
1045
562dd0b4 1046Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
79e94bf8 1047{
4427806c 1048 // Returns the probability of particle type iSpecies (in TRD)
79e94bf8 1049 return fTRDr[iSpecies];
1050}
1051
1052//_______________________________________________________________________
c630aafd 1053void AliESDtrack::SetTOFpid(const Double_t *p) {
4427806c 1054 // Sets the probability of each particle type (in TOF)
d27bbc79 1055 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
c630aafd 1056 SetStatus(AliESDtrack::kTOFpid);
1057}
1058
1059//_______________________________________________________________________
51ad6848 1060void AliESDtrack::SetTOFLabel(const Int_t *p) {
1061 // Sets (in TOF)
1062 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1063}
1064
1065//_______________________________________________________________________
c630aafd 1066void AliESDtrack::GetTOFpid(Double_t *p) const {
4427806c 1067 // Gets probabilities of each particle type (in TOF)
304864ab 1068 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
c630aafd 1069}
1070
51ad6848 1071//_______________________________________________________________________
1072void AliESDtrack::GetTOFLabel(Int_t *p) const {
1073 // Gets (in TOF)
1074 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1075}
1076
1077//_______________________________________________________________________
1078void AliESDtrack::GetTOFInfo(Float_t *info) const {
1079 // Gets (in TOF)
1080 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1081}
1082
1083//_______________________________________________________________________
1084void AliESDtrack::SetTOFInfo(Float_t*info) {
1085 // Gets (in TOF)
1086 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1087}
1088
4a78b8c5 1089
1090
1091//_______________________________________________________________________
f4b3bbb7 1092void AliESDtrack::SetHMPIDpid(const Double_t *p) {
1093 // Sets the probability of each particle type (in HMPID)
1094 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
1095 SetStatus(AliESDtrack::kHMPIDpid);
4a78b8c5 1096}
1097
1098//_______________________________________________________________________
f4b3bbb7 1099void AliESDtrack::GetHMPIDpid(Double_t *p) const {
1100 // Gets probabilities of each particle type (in HMPID)
1101 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
4a78b8c5 1102}
1103
1104
1105
c630aafd 1106//_______________________________________________________________________
8c6a71ab 1107void AliESDtrack::SetESDpid(const Double_t *p) {
4427806c 1108 // Sets the probability of each particle type for the ESD track
d27bbc79 1109 SetPIDValues(fR,p,AliPID::kSPECIES);
8c6a71ab 1110 SetStatus(AliESDtrack::kESDpid);
1111}
1112
1113//_______________________________________________________________________
1114void AliESDtrack::GetESDpid(Double_t *p) const {
4427806c 1115 // Gets probability of each particle type for the ESD track
304864ab 1116 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
8c6a71ab 1117}
1118
ac2f7574 1119//_______________________________________________________________________
49d13e89 1120Bool_t AliESDtrack::RelateToVertex
1121(const AliESDVertex *vtx, Double_t b, Double_t maxd) {
1122 //
1123 // Try to relate this track to the vertex "vtx",
1124 // if the (rough) transverse impact parameter is not bigger then "maxd".
1125 // Magnetic field is "b" (kG).
1126 //
1127 // a) The track gets extapolated to the DCA to the vertex.
1128 // b) The impact parameters and their covariance matrix are calculated.
1129 // c) An attempt to constrain this track to the vertex is done.
1130 //
1131 // In the case of success, the returned value is kTRUE
1132 // (otherwise, it's kFALSE)
1133 //
b5d34a4c 1134
1135 if (!vtx) return kFALSE;
1136
e99a34df 1137 Double_t dz[2],cov[3];
1138 if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
1139
1140 fD = dz[0];
1141 fZ = dz[1];
1142 fCdd = cov[0];
1143 fCdz = cov[1];
1144 fCzz = cov[2];
49d13e89 1145
e99a34df 1146 Double_t covar[6]; vtx->GetCovMatrix(covar);
1147 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
1148 Double_t c[3]={covar[2],0.,covar[5]};
3231f9e5 1149
e99a34df 1150 Double_t chi2=GetPredictedChi2(p,c);
1151 if (chi2>77.) return kFALSE;
49d13e89 1152
e99a34df 1153 delete fCp;
1154 fCp=new AliExternalTrackParam(*this);
49d13e89 1155
e99a34df 1156 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
1157
1158 fCchi2=chi2;
49d13e89 1159 return kTRUE;
1160}
1161
1162//_______________________________________________________________________
ac2f7574 1163void AliESDtrack::Print(Option_t *) const {
1164 // Prints info on the track
1165
5f7789fc 1166 printf("ESD track info\n") ;
304864ab 1167 Double_t p[AliPID::kSPECIESN] ;
ac2f7574 1168 Int_t index = 0 ;
1169 if( IsOn(kITSpid) ){
1170 printf("From ITS: ") ;
1171 GetITSpid(p) ;
304864ab 1172 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 1173 printf("%f, ", p[index]) ;
1174 printf("\n signal = %f\n", GetITSsignal()) ;
1175 }
1176 if( IsOn(kTPCpid) ){
1177 printf("From TPC: ") ;
1178 GetTPCpid(p) ;
304864ab 1179 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 1180 printf("%f, ", p[index]) ;
1181 printf("\n signal = %f\n", GetTPCsignal()) ;
1182 }
1183 if( IsOn(kTRDpid) ){
1184 printf("From TRD: ") ;
1185 GetTRDpid(p) ;
304864ab 1186 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 1187 printf("%f, ", p[index]) ;
1188 printf("\n signal = %f\n", GetTRDsignal()) ;
1189 }
1190 if( IsOn(kTOFpid) ){
1191 printf("From TOF: ") ;
1192 GetTOFpid(p) ;
304864ab 1193 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 1194 printf("%f, ", p[index]) ;
1195 printf("\n signal = %f\n", GetTOFsignal()) ;
1196 }
f4b3bbb7 1197 if( IsOn(kHMPIDpid) ){
1198 printf("From HMPID: ") ;
1199 GetHMPIDpid(p) ;
304864ab 1200 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 1201 printf("%f, ", p[index]) ;
f4b3bbb7 1202 printf("\n signal = %f\n", GetHMPIDsignal()) ;
ac2f7574 1203 }
ac2f7574 1204}
6c94f330 1205
0c19adf7 1206
1207//
1208// Draw functionality
1209// Origin: Marian Ivanov, Marian.Ivanov@cern.ch
1210//
1211void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
1212 //
1213 // Fill points in the polymarker
1214 //
1215 TObjArray arrayRef;
1216 arrayRef.AddLast(new AliExternalTrackParam(*this));
1217 if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
1218 if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
1219 //
1220 Double_t mpos[3]={0,0,0};
1221 Int_t entries=arrayRef.GetEntries();
1222 for (Int_t i=0;i<entries;i++){
1223 Double_t pos[3];
1224 ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
1225 mpos[0]+=pos[0]/entries;
1226 mpos[1]+=pos[1]/entries;
1227 mpos[2]+=pos[2]/entries;
1228 }
1229 // Rotate to the mean position
1230 //
1231 Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
1232 for (Int_t i=0;i<entries;i++){
1233 Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
1234 if (!res) delete arrayRef.RemoveAt(i);
1235 }
1236 Int_t counter=0;
1237 for (Double_t r=minR; r<maxR; r+=stepR){
1238 Double_t sweight=0;
1239 Double_t mlpos[3]={0,0,0};
1240 for (Int_t i=0;i<entries;i++){
1241 Double_t point[3]={0,0,0};
1242 AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
1243 if (!param) continue;
1244 if (param->GetXYZAt(r,magF,point)){
1245 Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
1246 sweight+=weight;
1247 mlpos[0]+=point[0]*weight;
1248 mlpos[1]+=point[1]*weight;
1249 mlpos[2]+=point[2]*weight;
1250 }
1251 }
1252 if (sweight>0){
1253 mlpos[0]/=sweight;
1254 mlpos[1]/=sweight;
1255 mlpos[2]/=sweight;
1256 pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
1257 printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);
1258 counter++;
1259 }
1260 }
1261}