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