- macro for drawing the output of HLT/QA/tasks/AliAnalysisTaskHLTCentralBarrel.cxx...
[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
4df45162 21//
22//
23//
24// What do you need to know before starting analysis
25// (by Marian Ivanov: marian.ivanov@cern.ch)
26//
27//
28// AliESDtrack:
29// 1. What is the AliESDtrack
30// 2. What informations do we store
31// 3. How to use the information for analysis
32//
33//
34// 1.AliESDtrack is the container of the information about the track/particle
35// reconstructed during Barrel Tracking.
36// The track information is propagated from one tracking detector to
37// other using the functionality of AliESDtrack - Current parameters.
38//
39// No global fit model is used.
40// Barrel tracking use Kalman filtering technique, it gives optimal local
41// track parameters at given point under certian assumptions.
42//
43// Kalman filter take into account additional effect which are
44// difficult to handle using global fit.
45// Effects:
46// a.) Multiple scattering
47// b.) Energy loss
48// c.) Non homogenous magnetic field
49//
50// In general case, following barrel detectors are contributing to
51// the Kalman track information:
52// a. TPC
53// b. ITS
54// c. TRD
55//
56// In general 3 reconstruction itteration are performed:
57// 1. Find tracks - sequence TPC->ITS
58// 2. PropagateBack - sequence ITS->TPC->TRD -> Outer PID detectors
59// 3. Refit invward - sequence TRD->TPC->ITS
60// The current tracks are updated after each detector (see bellow).
61// In specical cases a track sanpshots are stored.
62//
63//
64// For some type of analysis (+visualization) track local parameters at
65// different position are neccesary. A snapshots during the track
66// propagation are created.
67// (See AliExternalTrackParam class for desctiption of variables and
68// functionality)
69// Snapshots:
70// a. Current parameters - class itself (AliExternalTrackParam)
71// Contributors: general case TRD->TPC->ITS
72// Preferable usage: Decission - primary or secondary track
73// NOTICE - By default the track parameters are stored at the DCA point
74// to the primary vertex. optimal for primary tracks,
75// far from optimal for secondary tracks.
76// b. Constrained parameters - Kalman information updated with
77// the Primary vertex information
78// Contributors: general case TRD->TPC->ITS
79// Preferable usage: Use only for tracks selected as primary
80// NOTICE - not real constrain - taken as additional measurement
81// with corresponding error
82// Function:
83// const AliExternalTrackParam *GetConstrainedParam() const {return fCp;}
84// c. Inner parameters - Track parameters at inner wall of the TPC
85// Contributors: general case TRD->TPC
86// function:
87// const AliExternalTrackParam *GetInnerParam() const { return fIp;}
88//
89// d. TPCinnerparam - contributors - TPC only
90// Contributors: TPC
91// Preferable usage: Requested for HBT study
92// (smaller correlations as using also ITS information)
93// NOTICE - the track parameters are propagated to the DCA to
94// to primary vertex
95// Optimal for primary, far from optimal for secondary tracks
96// Function:
97// const AliExternalTrackParam *GetTPCInnerParam() const {return fTPCInner;}
98//
99// e. Outer parameters -
100// Contributors- general case - ITS-> TPC -> TRD
101// The last point - Outer parameters radius is determined
102// e.a) Local inclination angle bigger than threshold -
103// Low momenta tracks
104// e.a) Catastrofic energy losss in material
105// e.b) Not further improvement (no space points)
106// Usage:
107// a.) Tracking: Starting parameter for Refit inward
108// b.) Visualization
109// c.) QA
110// NOTICE: Should be not used for the physic analysis
111// Function:
112// const AliExternalTrackParam *GetOuterParam() const { return fOp;}
113//
ae982df3 114//-----------------------------------------------------------------
115
e1e6896f 116#include <TMath.h>
49edfa08 117#include <TParticle.h>
c180f65d 118#include <TDatabasePDG.h>
ae982df3 119
49d13e89 120#include "AliESDVertex.h"
ae982df3 121#include "AliESDtrack.h"
95621324 122#include "AliESDEvent.h"
ae982df3 123#include "AliKalmanTrack.h"
4f6e22bd 124#include "AliVTrack.h"
5f7789fc 125#include "AliLog.h"
15e85efa 126#include "AliTrackPointArray.h"
0c19adf7 127#include "TPolyMarker3D.h"
ae982df3 128
129ClassImp(AliESDtrack)
130
562dd0b4 131void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) {
d27bbc79 132 // This function copies "n" PID weights from "scr" to "dest"
133 // and normalizes their sum to 1 thus producing conditional probabilities.
134 // The negative weights are set to 0.
135 // In case all the weights are non-positive they are replaced by
136 // uniform probabilities
137
138 if (n<=0) return;
139
140 Float_t uniform = 1./(Float_t)n;
141
142 Float_t sum = 0;
143 for (Int_t i=0; i<n; i++)
144 if (src[i]>=0) {
145 sum+=src[i];
146 dest[i] = src[i];
147 }
148 else {
149 dest[i] = 0;
150 }
151
152 if(sum>0)
153 for (Int_t i=0; i<n; i++) dest[i] /= sum;
154 else
155 for (Int_t i=0; i<n; i++) dest[i] = uniform;
156}
157
ae982df3 158//_______________________________________________________________________
159AliESDtrack::AliESDtrack() :
c9ec41e8 160 AliExternalTrackParam(),
562dd0b4 161 fCp(0),
162 fIp(0),
163 fTPCInner(0),
164 fOp(0),
c38d443f 165 fHMPIDp(0),
562dd0b4 166 fFriendTrack(new AliESDfriendTrack()),
167 fTPCClusterMap(159),//number of padrows
168 fTPCSharedMap(159),//number of padrows
90e48c0c 169 fFlags(0),
90e48c0c 170 fID(0),
562dd0b4 171 fLabel(0),
172 fITSLabel(0),
173 fTPCLabel(0),
174 fTRDLabel(0),
ab37ab1e 175 fTOFCalChannel(-1),
ce3f4882 176 fTOFindex(-1),
562dd0b4 177 fHMPIDqn(0),
81aa7a0d 178 fHMPIDcluIdx(-1),
f1cedef3 179 fCaloIndex(kEMCALNoMatch),
562dd0b4 180 fHMPIDtrkTheta(0),
181 fHMPIDtrkPhi(0),
182 fHMPIDsignal(0),
90e48c0c 183 fTrackLength(0),
d7ddf1e9 184 fdTPC(0),fzTPC(0),
185 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
436dfe39 186 fCchi2TPC(0),
49d13e89 187 fD(0),fZ(0),
188 fCdd(0),fCdz(0),fCzz(0),
562dd0b4 189 fCchi2(0),
90e48c0c 190 fITSchi2(0),
90e48c0c 191 fTPCchi2(0),
949840f6 192 fTPCchi2Iter1(0),
562dd0b4 193 fTRDchi2(0),
194 fTOFchi2(0),
195 fHMPIDchi2(0),
b5b2b4db 196 fGlobalChi2(0),
562dd0b4 197 fITSsignal(0),
90e48c0c 198 fTPCsignal(0),
e1d4c1b5 199 fTPCsignalS(0),
90e48c0c 200 fTRDsignal(0),
90e48c0c 201 fTRDQuality(0),
23d49657 202 fTRDBudget(0),
ab37ab1e 203 fTOFsignal(99999),
204 fTOFsignalToT(99999),
205 fTOFsignalRaw(99999),
206 fTOFsignalDz(999),
207 fTOFsignalDx(999),
208 fTOFdeltaBC(999),
209 fTOFl0l1(999),
f1cedef3 210 fCaloDx(0),
211 fCaloDz(0),
562dd0b4 212 fHMPIDtrkX(0),
213 fHMPIDtrkY(0),
214 fHMPIDmipX(0),
215 fHMPIDmipY(0),
216 fTPCncls(0),
217 fTPCnclsF(0),
218 fTPCsignalN(0),
949840f6 219 fTPCnclsIter1(0),
220 fTPCnclsFIter1(0),
562dd0b4 221 fITSncls(0),
222 fITSClusterMap(0),
223 fTRDncls(0),
224 fTRDncls0(0),
ed15ef4f 225 fTRDntracklets(0),
6984f7c1 226 fTRDnSlices(0),
6dc21f57 227 fTRDslices(0x0),
95621324 228 fVertexID(-2),// -2 means an orphan track
229 fESDEvent(0)
ae982df3 230{
231 //
232 // The default ESD constructor
233 //
6984f7c1 234 Int_t i;
6238d7a9 235 for (i=0; i<AliPID::kSPECIES; i++) {
4a78b8c5 236 fTrackTime[i]=0.;
562dd0b4 237 fR[i]=0.;
238 fITSr[i]=0.;
239 fTPCr[i]=0.;
240 fTRDr[i]=0.;
241 fTOFr[i]=0.;
242 fHMPIDr[i]=0.;
2bad268c 243 }
ac2f7574 244
ef7253ac 245 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
562dd0b4 246 for (i=0; i<3; i++) { fV0Indexes[i]=0;}
6984f7c1 247 for (i=0;i<kTRDnPlanes;i++) {
562dd0b4 248 fTRDTimBin[i]=0;
6d45eaef 249 }
1d4882da 250 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
562dd0b4 251 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
ab37ab1e 252 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
562dd0b4 253 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
89f1b176 254 for (i=0;i<12;i++) {fITSModule[i]=-1;}
c4d11b15 255}
256
257//_______________________________________________________________________
90e48c0c 258AliESDtrack::AliESDtrack(const AliESDtrack& track):
c9ec41e8 259 AliExternalTrackParam(track),
562dd0b4 260 fCp(0),
261 fIp(0),
262 fTPCInner(0),
263 fOp(0),
c38d443f 264 fHMPIDp(0),
562dd0b4 265 fFriendTrack(0),
266 fTPCClusterMap(track.fTPCClusterMap),
267 fTPCSharedMap(track.fTPCSharedMap),
90e48c0c 268 fFlags(track.fFlags),
90e48c0c 269 fID(track.fID),
562dd0b4 270 fLabel(track.fLabel),
271 fITSLabel(track.fITSLabel),
272 fTPCLabel(track.fTPCLabel),
273 fTRDLabel(track.fTRDLabel),
274 fTOFCalChannel(track.fTOFCalChannel),
275 fTOFindex(track.fTOFindex),
276 fHMPIDqn(track.fHMPIDqn),
277 fHMPIDcluIdx(track.fHMPIDcluIdx),
f1cedef3 278 fCaloIndex(track.fCaloIndex),
562dd0b4 279 fHMPIDtrkTheta(track.fHMPIDtrkTheta),
280 fHMPIDtrkPhi(track.fHMPIDtrkPhi),
281 fHMPIDsignal(track.fHMPIDsignal),
90e48c0c 282 fTrackLength(track.fTrackLength),
d7ddf1e9 283 fdTPC(track.fdTPC),fzTPC(track.fzTPC),
284 fCddTPC(track.fCddTPC),fCdzTPC(track.fCdzTPC),fCzzTPC(track.fCzzTPC),
436dfe39 285 fCchi2TPC(track.fCchi2TPC),
49d13e89 286 fD(track.fD),fZ(track.fZ),
287 fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
90e48c0c 288 fCchi2(track.fCchi2),
90e48c0c 289 fITSchi2(track.fITSchi2),
90e48c0c 290 fTPCchi2(track.fTPCchi2),
949840f6 291 fTPCchi2Iter1(track.fTPCchi2Iter1),
562dd0b4 292 fTRDchi2(track.fTRDchi2),
293 fTOFchi2(track.fTOFchi2),
294 fHMPIDchi2(track.fHMPIDchi2),
b5b2b4db 295 fGlobalChi2(track.fGlobalChi2),
562dd0b4 296 fITSsignal(track.fITSsignal),
90e48c0c 297 fTPCsignal(track.fTPCsignal),
e1d4c1b5 298 fTPCsignalS(track.fTPCsignalS),
90e48c0c 299 fTRDsignal(track.fTRDsignal),
90e48c0c 300 fTRDQuality(track.fTRDQuality),
23d49657 301 fTRDBudget(track.fTRDBudget),
90e48c0c 302 fTOFsignal(track.fTOFsignal),
85324138 303 fTOFsignalToT(track.fTOFsignalToT),
d321691a 304 fTOFsignalRaw(track.fTOFsignalRaw),
305 fTOFsignalDz(track.fTOFsignalDz),
a5d9ff0f 306 fTOFsignalDx(track.fTOFsignalDx),
d86081b1 307 fTOFdeltaBC(track.fTOFdeltaBC),
308 fTOFl0l1(track.fTOFl0l1),
f1cedef3 309 fCaloDx(track.fCaloDx),
310 fCaloDz(track.fCaloDz),
f4b3bbb7 311 fHMPIDtrkX(track.fHMPIDtrkX),
312 fHMPIDtrkY(track.fHMPIDtrkY),
313 fHMPIDmipX(track.fHMPIDmipX),
314 fHMPIDmipY(track.fHMPIDmipY),
562dd0b4 315 fTPCncls(track.fTPCncls),
316 fTPCnclsF(track.fTPCnclsF),
317 fTPCsignalN(track.fTPCsignalN),
949840f6 318 fTPCnclsIter1(track.fTPCnclsIter1),
319 fTPCnclsFIter1(track.fTPCnclsIter1),
562dd0b4 320 fITSncls(track.fITSncls),
321 fITSClusterMap(track.fITSClusterMap),
322 fTRDncls(track.fTRDncls),
323 fTRDncls0(track.fTRDncls0),
ed15ef4f 324 fTRDntracklets(track.fTRDntracklets),
6984f7c1 325 fTRDnSlices(track.fTRDnSlices),
6dc21f57 326 fTRDslices(0x0),
95621324 327 fVertexID(track.fVertexID),
328 fESDEvent(track.fESDEvent)
90e48c0c 329{
c4d11b15 330 //
331 //copy constructor
332 //
ef7253ac 333 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i];
334 for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i];
c4d11b15 335 //
304864ab 336 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
c4d11b15 337 //
304864ab 338 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
1d4882da 339 for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=track.fITSdEdxSamples[i];}
51ad6848 340 for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
341 for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
342 for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
c4d11b15 343 //
6984f7c1 344 for (Int_t i=0;i<kTRDnPlanes;i++) {
6d45eaef 345 fTRDTimBin[i]=track.fTRDTimBin[i];
eab5961e 346 }
6984f7c1 347
348 if (fTRDnSlices) {
349 fTRDslices=new Double32_t[fTRDnSlices];
350 for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=track.fTRDslices[i];
351 }
352
304864ab 353 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i];
304864ab 354 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i];
51ad6848 355 for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
356 for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
89f1b176 357 for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
f4b3bbb7 358 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i]=track.fHMPIDr[i];
c9ec41e8 359
360 if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
361 if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
4aeb9470 362 if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
c9ec41e8 363 if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
c38d443f 364 if (track.fHMPIDp) fHMPIDp=new AliExternalTrackParam(*track.fHMPIDp);
365
8497bca0 366 if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
ae982df3 367}
15e85efa 368
c4d11b15 369//_______________________________________________________________________
4f6e22bd 370AliESDtrack::AliESDtrack(const AliVTrack *track) :
371 AliExternalTrackParam(track),
372 fCp(0),
373 fIp(0),
374 fTPCInner(0),
375 fOp(0),
c38d443f 376 fHMPIDp(0),
4f6e22bd 377 fFriendTrack(0),
378 fTPCClusterMap(159),//number of padrows
379 fTPCSharedMap(159),//number of padrows
380 fFlags(0),
381 fID(),
382 fLabel(0),
383 fITSLabel(0),
384 fTPCLabel(0),
385 fTRDLabel(0),
ab37ab1e 386 fTOFCalChannel(-1),
4f6e22bd 387 fTOFindex(-1),
388 fHMPIDqn(0),
81aa7a0d 389 fHMPIDcluIdx(-1),
f1cedef3 390 fCaloIndex(kEMCALNoMatch),
4f6e22bd 391 fHMPIDtrkTheta(0),
392 fHMPIDtrkPhi(0),
393 fHMPIDsignal(0),
394 fTrackLength(0),
395 fdTPC(0),fzTPC(0),
396 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
397 fCchi2TPC(0),
398 fD(0),fZ(0),
399 fCdd(0),fCdz(0),fCzz(0),
400 fCchi2(0),
401 fITSchi2(0),
402 fTPCchi2(0),
949840f6 403 fTPCchi2Iter1(0),
4f6e22bd 404 fTRDchi2(0),
405 fTOFchi2(0),
406 fHMPIDchi2(0),
b5b2b4db 407 fGlobalChi2(0),
4f6e22bd 408 fITSsignal(0),
409 fTPCsignal(0),
410 fTPCsignalS(0),
411 fTRDsignal(0),
412 fTRDQuality(0),
413 fTRDBudget(0),
ab37ab1e 414 fTOFsignal(99999),
415 fTOFsignalToT(99999),
416 fTOFsignalRaw(99999),
417 fTOFsignalDz(999),
418 fTOFsignalDx(999),
419 fTOFdeltaBC(999),
420 fTOFl0l1(999),
f1cedef3 421 fCaloDx(0),
422 fCaloDz(0),
4f6e22bd 423 fHMPIDtrkX(0),
424 fHMPIDtrkY(0),
425 fHMPIDmipX(0),
426 fHMPIDmipY(0),
427 fTPCncls(0),
428 fTPCnclsF(0),
429 fTPCsignalN(0),
949840f6 430 fTPCnclsIter1(0),
431 fTPCnclsFIter1(0),
4f6e22bd 432 fITSncls(0),
433 fITSClusterMap(0),
434 fTRDncls(0),
435 fTRDncls0(0),
ed15ef4f 436 fTRDntracklets(0),
4f6e22bd 437 fTRDnSlices(0),
6dc21f57 438 fTRDslices(0x0),
95621324 439 fVertexID(-2), // -2 means an orphan track
440 fESDEvent(0)
4f6e22bd 441{
442 //
610e3088 443 // ESD track from AliVTrack.
444 // This is not a copy constructor !
4f6e22bd 445 //
446
610e3088 447 if (track->InheritsFrom("AliExternalTrackParam")) {
448 AliError("This is not a copy constructor. Use AliESDtrack(const AliESDtrack &) !");
449 AliWarning("Calling the default constructor...");
450 AliESDtrack();
451 return;
452 }
453
4f6e22bd 454 // Reset all the arrays
455 Int_t i;
456 for (i=0; i<AliPID::kSPECIES; i++) {
457 fTrackTime[i]=0.;
458 fR[i]=0.;
459 fITSr[i]=0.;
460 fTPCr[i]=0.;
461 fTRDr[i]=0.;
462 fTOFr[i]=0.;
463 fHMPIDr[i]=0.;
464 }
465
466 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
467 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
468 for (i=0;i<kTRDnPlanes;i++) {
469 fTRDTimBin[i]=0;
470 }
1d4882da 471 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
4f6e22bd 472 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
ab37ab1e 473 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
4f6e22bd 474 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
475 for (i=0;i<12;i++) {fITSModule[i]=-1;}
476
477 // Set the ID
478 SetID(track->GetID());
479
480 // Set ITS cluster map
481 fITSClusterMap=track->GetITSClusterMap();
482
d577eec9 483 fITSncls=0;
484 for(i=0; i<6; i++) {
485 if(HasPointOnITSLayer(i)) fITSncls++;
486 }
487
07cc7a48 488 // Set TPC ncls
489 fTPCncls=track->GetTPCNcls();
490
491
4f6e22bd 492 // Set the combined PID
493 const Double_t *pid = track->PID();
67be2d29 494 if(pid){
495 for (i=0; i<AliPID::kSPECIES; i++) fR[i]=pid[i];
496 }
4f6e22bd 497 // AliESD track label
498 SetLabel(track->GetLabel());
39ca41b3 499 // Set the status
500 SetStatus(track->GetStatus());
4f6e22bd 501}
502
503//_______________________________________________________________________
49edfa08 504AliESDtrack::AliESDtrack(TParticle * part) :
505 AliExternalTrackParam(),
562dd0b4 506 fCp(0),
507 fIp(0),
508 fTPCInner(0),
509 fOp(0),
c38d443f 510 fHMPIDp(0),
562dd0b4 511 fFriendTrack(0),
512 fTPCClusterMap(159),//number of padrows
513 fTPCSharedMap(159),//number of padrows
49edfa08 514 fFlags(0),
49edfa08 515 fID(0),
562dd0b4 516 fLabel(0),
517 fITSLabel(0),
518 fTPCLabel(0),
519 fTRDLabel(0),
ab37ab1e 520 fTOFCalChannel(-1),
ce3f4882 521 fTOFindex(-1),
562dd0b4 522 fHMPIDqn(0),
81aa7a0d 523 fHMPIDcluIdx(-1),
f1cedef3 524 fCaloIndex(kEMCALNoMatch),
562dd0b4 525 fHMPIDtrkTheta(0),
526 fHMPIDtrkPhi(0),
527 fHMPIDsignal(0),
49edfa08 528 fTrackLength(0),
d7ddf1e9 529 fdTPC(0),fzTPC(0),
530 fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
436dfe39 531 fCchi2TPC(0),
49edfa08 532 fD(0),fZ(0),
533 fCdd(0),fCdz(0),fCzz(0),
562dd0b4 534 fCchi2(0),
49edfa08 535 fITSchi2(0),
49edfa08 536 fTPCchi2(0),
949840f6 537 fTPCchi2Iter1(0),
562dd0b4 538 fTRDchi2(0),
539 fTOFchi2(0),
540 fHMPIDchi2(0),
b5b2b4db 541 fGlobalChi2(0),
562dd0b4 542 fITSsignal(0),
49edfa08 543 fTPCsignal(0),
49edfa08 544 fTPCsignalS(0),
49edfa08 545 fTRDsignal(0),
49edfa08 546 fTRDQuality(0),
547 fTRDBudget(0),
ab37ab1e 548 fTOFsignal(99999),
549 fTOFsignalToT(99999),
550 fTOFsignalRaw(99999),
551 fTOFsignalDz(999),
552 fTOFsignalDx(999),
553 fTOFdeltaBC(999),
554 fTOFl0l1(999),
f1cedef3 555 fCaloDx(0),
556 fCaloDz(0),
562dd0b4 557 fHMPIDtrkX(0),
558 fHMPIDtrkY(0),
559 fHMPIDmipX(0),
560 fHMPIDmipY(0),
561 fTPCncls(0),
562 fTPCnclsF(0),
563 fTPCsignalN(0),
949840f6 564 fTPCnclsIter1(0),
565 fTPCnclsFIter1(0),
562dd0b4 566 fITSncls(0),
567 fITSClusterMap(0),
568 fTRDncls(0),
569 fTRDncls0(0),
ed15ef4f 570 fTRDntracklets(0),
6984f7c1 571 fTRDnSlices(0),
6dc21f57 572 fTRDslices(0x0),
95621324 573 fVertexID(-2), // -2 means an orphan track
574 fESDEvent(0)
49edfa08 575{
576 //
577 // ESD track from TParticle
578 //
579
580 // Reset all the arrays
6984f7c1 581 Int_t i;
49edfa08 582 for (i=0; i<AliPID::kSPECIES; i++) {
583 fTrackTime[i]=0.;
584 fR[i]=0.;
585 fITSr[i]=0.;
586 fTPCr[i]=0.;
587 fTRDr[i]=0.;
588 fTOFr[i]=0.;
f4b3bbb7 589 fHMPIDr[i]=0.;
49edfa08 590 }
591
592 for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
593 for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
6984f7c1 594 for (i=0;i<kTRDnPlanes;i++) {
562dd0b4 595 fTRDTimBin[i]=0;
49edfa08 596 }
1d4882da 597 for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
562dd0b4 598 for (i=0;i<4;i++) {fTPCPoints[i]=0;}
ab37ab1e 599 for (i=0;i<3;i++) {fTOFLabel[i]=-1;}
562dd0b4 600 for (i=0;i<10;i++) {fTOFInfo[i]=0;}
89f1b176 601 for (i=0;i<12;i++) {fITSModule[i]=-1;}
49edfa08 602
603 // Calculate the AliExternalTrackParam content
604
605 Double_t xref;
606 Double_t alpha;
607 Double_t param[5];
608 Double_t covar[15];
609
610 // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
611 alpha = part->Phi()*180./TMath::Pi();
612 if (alpha<0) alpha+= 360.;
613 if (alpha>360) alpha -= 360.;
614
615 Int_t sector = (Int_t)(alpha/20.);
616 alpha = 10. + 20.*sector;
617 alpha /= 180;
618 alpha *= TMath::Pi();
619
620 // Covariance matrix: no errors, the parameters are exact
6c27b212 621 for (i=0; i<15; i++) covar[i]=0.;
49edfa08 622
623 // Get the vertex of origin and the momentum
624 TVector3 ver(part->Vx(),part->Vy(),part->Vz());
625 TVector3 mom(part->Px(),part->Py(),part->Pz());
626
627 // Rotate to the local coordinate system (TPC sector)
628 ver.RotateZ(-alpha);
629 mom.RotateZ(-alpha);
630
631 // X of the referense plane
632 xref = ver.X();
633
634 Int_t pdgCode = part->GetPdgCode();
635
636 Double_t charge =
637 TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
638
639 param[0] = ver.Y();
640 param[1] = ver.Z();
641 param[2] = TMath::Sin(mom.Phi());
642 param[3] = mom.Pz()/mom.Pt();
643 param[4] = TMath::Sign(1/mom.Pt(),charge);
644
645 // Set AliExternalTrackParam
646 Set(xref, alpha, param, covar);
647
648 // Set the PID
649 Int_t indexPID = 99;
650
651 switch (TMath::Abs(pdgCode)) {
652
653 case 11: // electron
654 indexPID = 0;
655 break;
656
657 case 13: // muon
658 indexPID = 1;
659 break;
660
661 case 211: // pion
662 indexPID = 2;
663 break;
664
665 case 321: // kaon
666 indexPID = 3;
667 break;
668
669 case 2212: // proton
670 indexPID = 4;
671 break;
672
673 default:
674 break;
675 }
676
677 // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0
678 if (indexPID < AliPID::kSPECIES) {
679 fR[indexPID]=1.;
680 fITSr[indexPID]=1.;
681 fTPCr[indexPID]=1.;
682 fTRDr[indexPID]=1.;
683 fTOFr[indexPID]=1.;
f4b3bbb7 684 fHMPIDr[indexPID]=1.;
49edfa08 685
686 }
687 // AliESD track label
688 SetLabel(part->GetUniqueID());
689
690}
691
692//_______________________________________________________________________
c4d11b15 693AliESDtrack::~AliESDtrack(){
694 //
695 // This is destructor according Coding Conventrions
696 //
697 //printf("Delete track\n");
c9ec41e8 698 delete fIp;
4aeb9470 699 delete fTPCInner;
c9ec41e8 700 delete fOp;
c38d443f 701 delete fHMPIDp;
c9ec41e8 702 delete fCp;
15e85efa 703 delete fFriendTrack;
6984f7c1 704 if(fTRDnSlices)
705 delete[] fTRDslices;
c4d11b15 706}
ae982df3 707
732a24fe 708AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source){
709
710
711 if(&source == this) return *this;
712 AliExternalTrackParam::operator=(source);
713
714
715 if(source.fCp){
716 // we have the trackparam: assign or copy construct
717 if(fCp)*fCp = *source.fCp;
718 else fCp = new AliExternalTrackParam(*source.fCp);
719 }
720 else{
721 // no track param delete the old one
722 if(fCp)delete fCp;
723 fCp = 0;
724 }
725
726 if(source.fIp){
727 // we have the trackparam: assign or copy construct
728 if(fIp)*fIp = *source.fIp;
729 else fIp = new AliExternalTrackParam(*source.fIp);
730 }
731 else{
732 // no track param delete the old one
733 if(fIp)delete fIp;
734 fIp = 0;
735 }
736
737
738 if(source.fTPCInner){
739 // we have the trackparam: assign or copy construct
740 if(fTPCInner) *fTPCInner = *source.fTPCInner;
741 else fTPCInner = new AliExternalTrackParam(*source.fTPCInner);
742 }
743 else{
744 // no track param delete the old one
745 if(fTPCInner)delete fTPCInner;
746 fTPCInner = 0;
747 }
748
749
750 if(source.fOp){
751 // we have the trackparam: assign or copy construct
752 if(fOp) *fOp = *source.fOp;
753 else fOp = new AliExternalTrackParam(*source.fOp);
754 }
755 else{
756 // no track param delete the old one
757 if(fOp)delete fOp;
758 fOp = 0;
759 }
760
c38d443f 761
762 if(source.fHMPIDp){
763 // we have the trackparam: assign or copy construct
b01794e9 764 if(fHMPIDp) *fHMPIDp = *source.fHMPIDp;
c38d443f 765 else fHMPIDp = new AliExternalTrackParam(*source.fHMPIDp);
766 }
767 else{
768 // no track param delete the old one
769 if(fHMPIDp)delete fHMPIDp;
770 fHMPIDp = 0;
771 }
772
773
732a24fe 774 // copy also the friend track
775 // use copy constructor
776 if(source.fFriendTrack){
777 // we have the trackparam: assign or copy construct
778 delete fFriendTrack; fFriendTrack=new AliESDfriendTrack(*source.fFriendTrack);
779 }
780 else{
781 // no track param delete the old one
782 delete fFriendTrack; fFriendTrack= 0;
783 }
784
785 fTPCClusterMap = source.fTPCClusterMap;
786 fTPCSharedMap = source.fTPCSharedMap;
787 // the simple stuff
788 fFlags = source.fFlags;
789 fID = source.fID;
790 fLabel = source.fLabel;
791 fITSLabel = source.fITSLabel;
792 for(int i = 0; i< 12;++i){
793 fITSModule[i] = source.fITSModule[i];
794 }
795 fTPCLabel = source.fTPCLabel;
796 fTRDLabel = source.fTRDLabel;
797 for(int i = 0; i< 3;++i){
798 fTOFLabel[i] = source.fTOFLabel[i];
799 }
800 fTOFCalChannel = source.fTOFCalChannel;
801 fTOFindex = source.fTOFindex;
802 fHMPIDqn = source.fHMPIDqn;
803 fHMPIDcluIdx = source.fHMPIDcluIdx;
f1cedef3 804 fCaloIndex = source.fCaloIndex;
732a24fe 805
806 for(int i = 0; i< 3;++i){
807 fKinkIndexes[i] = source.fKinkIndexes[i];
808 fV0Indexes[i] = source.fV0Indexes[i];
809 }
810
811 for(int i = 0; i< AliPID::kSPECIES;++i){
812 fR[i] = source.fR[i];
813 fITSr[i] = source.fITSr[i];
814 fTPCr[i] = source.fTPCr[i];
815 fTRDr[i] = source.fTRDr[i];
816 fTOFr[i] = source.fTOFr[i];
817 fHMPIDr[i] = source.fHMPIDr[i];
818 fTrackTime[i] = source.fTrackTime[i];
819 }
820
821 fHMPIDtrkTheta = source.fHMPIDtrkTheta;
822 fHMPIDtrkPhi = source.fHMPIDtrkPhi;
823 fHMPIDsignal = source.fHMPIDsignal;
824
825
826 fTrackLength = source. fTrackLength;
d7ddf1e9 827 fdTPC = source.fdTPC;
828 fzTPC = source.fzTPC;
829 fCddTPC = source.fCddTPC;
830 fCdzTPC = source.fCdzTPC;
831 fCzzTPC = source.fCzzTPC;
436dfe39 832 fCchi2TPC = source.fCchi2TPC;
833
732a24fe 834 fD = source.fD;
835 fZ = source.fZ;
836 fCdd = source.fCdd;
837 fCdz = source.fCdz;
838 fCzz = source.fCzz;
732a24fe 839 fCchi2 = source.fCchi2;
436dfe39 840
732a24fe 841 fITSchi2 = source.fITSchi2;
842 fTPCchi2 = source.fTPCchi2;
949840f6 843 fTPCchi2Iter1 = source.fTPCchi2Iter1;
732a24fe 844 fTRDchi2 = source.fTRDchi2;
845 fTOFchi2 = source.fTOFchi2;
846 fHMPIDchi2 = source.fHMPIDchi2;
847
b5b2b4db 848 fGlobalChi2 = source.fGlobalChi2;
732a24fe 849
850 fITSsignal = source.fITSsignal;
1d4882da 851 for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=source.fITSdEdxSamples[i];}
732a24fe 852 fTPCsignal = source.fTPCsignal;
853 fTPCsignalS = source.fTPCsignalS;
854 for(int i = 0; i< 4;++i){
855 fTPCPoints[i] = source.fTPCPoints[i];
856 }
857 fTRDsignal = source.fTRDsignal;
858
6984f7c1 859 for(int i = 0;i < kTRDnPlanes;++i){
732a24fe 860 fTRDTimBin[i] = source.fTRDTimBin[i];
732a24fe 861 }
6984f7c1 862
863 if(fTRDnSlices)
864 delete[] fTRDslices;
865 fTRDslices=0;
866 fTRDnSlices=source.fTRDnSlices;
867 if (fTRDnSlices) {
868 fTRDslices=new Double32_t[fTRDnSlices];
869 for(int j = 0;j < fTRDnSlices;++j) fTRDslices[j] = source.fTRDslices[j];
870 }
871
732a24fe 872 fTRDQuality = source.fTRDQuality;
873 fTRDBudget = source.fTRDBudget;
874 fTOFsignal = source.fTOFsignal;
875 fTOFsignalToT = source.fTOFsignalToT;
876 fTOFsignalRaw = source.fTOFsignalRaw;
877 fTOFsignalDz = source.fTOFsignalDz;
a5d9ff0f 878 fTOFsignalDx = source.fTOFsignalDx;
d86081b1 879 fTOFdeltaBC = source.fTOFdeltaBC;
880 fTOFl0l1 = source.fTOFl0l1;
881
732a24fe 882 for(int i = 0;i<10;++i){
883 fTOFInfo[i] = source.fTOFInfo[i];
884 }
885
886 fHMPIDtrkX = source.fHMPIDtrkX;
887 fHMPIDtrkY = source.fHMPIDtrkY;
888 fHMPIDmipX = source.fHMPIDmipX;
889 fHMPIDmipY = source.fHMPIDmipY;
890
891 fTPCncls = source.fTPCncls;
892 fTPCnclsF = source.fTPCnclsF;
893 fTPCsignalN = source.fTPCsignalN;
949840f6 894 fTPCnclsIter1 = source.fTPCnclsIter1;
895 fTPCnclsFIter1 = source.fTPCnclsFIter1;
732a24fe 896
897 fITSncls = source.fITSncls;
898 fITSClusterMap = source.fITSClusterMap;
899 fTRDncls = source.fTRDncls;
900 fTRDncls0 = source.fTRDncls0;
ed15ef4f 901 fTRDntracklets = source.fTRDntracklets;
6dc21f57 902 fVertexID = source.fVertexID;
732a24fe 903 return *this;
904}
905
906
907
908void AliESDtrack::Copy(TObject &obj) const {
909
910 // this overwrites the virtual TOBject::Copy()
911 // to allow run time copying without casting
912 // in AliESDEvent
913
914 if(this==&obj)return;
915 AliESDtrack *robj = dynamic_cast<AliESDtrack*>(&obj);
916 if(!robj)return; // not an AliESDtrack
917 *robj = *this;
918
919}
920
921
922
00dce61a 923void AliESDtrack::AddCalibObject(TObject * object){
924 //
925 // add calib object to the list
926 //
927 if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack;
928 fFriendTrack->AddCalibObject(object);
929}
930
931TObject * AliESDtrack::GetCalibObject(Int_t index){
932 //
933 // return calib objct at given position
934 //
935 if (!fFriendTrack) return 0;
936 return fFriendTrack->GetCalibObject(index);
937}
938
939
f12d42ce 940Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){
b9ca886f 941
942 // Fills the information of the TPC-only first reconstruction pass
943 // into the passed ESDtrack object. For consistency fTPCInner is also filled
944 // again
945
5b305f70 946
947
948 // For data produced before r26675
949 // RelateToVertexTPC was not properly called during reco
950 // so you'll have to call it again, before FillTPCOnlyTrack
951 // Float_t p[2],cov[3];
952 // track->GetImpactParametersTPC(p,cov);
953 // if(p[0]==0&&p[1]==0) // <- Default values
954 // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
955
956
b9ca886f 957 if(!fTPCInner)return kFALSE;
958
959 // fill the TPC track params to the global track parameters
960 track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance());
961 track.fD = fdTPC;
962 track.fZ = fzTPC;
963 track.fCdd = fCddTPC;
964 track.fCdz = fCdzTPC;
965 track.fCzz = fCzzTPC;
966
967 // copy the TPCinner parameters
968 if(track.fTPCInner) *track.fTPCInner = *fTPCInner;
969 else track.fTPCInner = new AliExternalTrackParam(*fTPCInner);
970 track.fdTPC = fdTPC;
971 track.fzTPC = fzTPC;
972 track.fCddTPC = fCddTPC;
973 track.fCdzTPC = fCdzTPC;
974 track.fCzzTPC = fCzzTPC;
436dfe39 975 track.fCchi2TPC = fCchi2TPC;
b9ca886f 976
977
978 // copy all other TPC specific parameters
979
980 // replace label by TPC label
981 track.fLabel = fTPCLabel;
982 track.fTPCLabel = fTPCLabel;
983
984 track.fTPCchi2 = fTPCchi2;
949840f6 985 track.fTPCchi2Iter1 = fTPCchi2Iter1;
b9ca886f 986 track.fTPCsignal = fTPCsignal;
987 track.fTPCsignalS = fTPCsignalS;
988 for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i];
989
990 track.fTPCncls = fTPCncls;
991 track.fTPCnclsF = fTPCnclsF;
992 track.fTPCsignalN = fTPCsignalN;
949840f6 993 track.fTPCnclsIter1 = fTPCnclsIter1;
994 track.fTPCnclsFIter1 = fTPCnclsFIter1;
b9ca886f 995
996 // PID
997 for(int i=0;i<AliPID::kSPECIES;++i){
998 track.fTPCr[i] = fTPCr[i];
999 // combined PID is TPC only!
1000 track.fR[i] = fTPCr[i];
1001 }
1002 track.fTPCClusterMap = fTPCClusterMap;
1003 track.fTPCSharedMap = fTPCSharedMap;
1004
1005
1006 // reset the flags
1007 track.fFlags = kTPCin;
1008 track.fID = fID;
1009
b1cfce51 1010 track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag
b9ca886f 1011
1012 for (Int_t i=0;i<3;i++) track.fKinkIndexes[i] = fKinkIndexes[i];
1013
1014 return kTRUE;
1015
1016}
1017
ae982df3 1018//_______________________________________________________________________
9559cbc4 1019void AliESDtrack::MakeMiniESDtrack(){
1020 // Resets everything except
1021 // fFlags: Reconstruction status flags
1022 // fLabel: Track label
1023 // fID: Unique ID of the track
d7ddf1e9 1024 // Impact parameter information
9559cbc4 1025 // fR[AliPID::kSPECIES]: combined "detector response probability"
8497bca0 1026 // Running track parameters in the base class (AliExternalTrackParam)
9559cbc4 1027
1028 fTrackLength = 0;
562dd0b4 1029
9559cbc4 1030 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
9559cbc4 1031
1032 // Reset track parameters constrained to the primary vertex
562dd0b4 1033 delete fCp;fCp = 0;
9559cbc4 1034
1035 // Reset track parameters at the inner wall of TPC
562dd0b4 1036 delete fIp;fIp = 0;
1037 delete fTPCInner;fTPCInner=0;
9559cbc4 1038 // Reset track parameters at the inner wall of the TRD
562dd0b4 1039 delete fOp;fOp = 0;
c38d443f 1040 // Reset track parameters at the HMPID
1041 delete fHMPIDp;fHMPIDp = 0;
562dd0b4 1042
9559cbc4 1043
1044 // Reset ITS track related information
1045 fITSchi2 = 0;
9559cbc4 1046 fITSncls = 0;
62665e7f 1047 fITSClusterMap=0;
9559cbc4 1048 fITSsignal = 0;
1d4882da 1049 for (Int_t i=0;i<4;i++) fITSdEdxSamples[i] = 0.;
ef7253ac 1050 for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
9559cbc4 1051 fITSLabel = 0;
9559cbc4 1052
1053 // Reset TPC related track information
1054 fTPCchi2 = 0;
949840f6 1055 fTPCchi2Iter1 = 0;
9559cbc4 1056 fTPCncls = 0;
e1d4c1b5 1057 fTPCnclsF = 0;
949840f6 1058 fTPCnclsIter1 = 0;
1059 fTPCnclsFIter1 = 0;
9559cbc4 1060 fTPCClusterMap = 0;
eb7f6854 1061 fTPCSharedMap = 0;
9559cbc4 1062 fTPCsignal= 0;
e1d4c1b5 1063 fTPCsignalS= 0;
1064 fTPCsignalN= 0;
9559cbc4 1065 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0;
1066 fTPCLabel=0;
1067 for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
1068 for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
1069 for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
1070
1071 // Reset TRD related track information
1072 fTRDchi2 = 0;
1073 fTRDncls = 0;
1074 fTRDncls0 = 0;
9559cbc4 1075 fTRDsignal = 0;
6984f7c1 1076 for (Int_t i=0;i<kTRDnPlanes;i++) {
6d45eaef 1077 fTRDTimBin[i] = 0;
9559cbc4 1078 }
1079 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
1080 fTRDLabel = 0;
9559cbc4 1081 fTRDQuality = 0;
ed15ef4f 1082 fTRDntracklets = 0;
6984f7c1 1083 if(fTRDnSlices)
1084 delete[] fTRDslices;
1085 fTRDslices=0x0;
1086 fTRDnSlices=0;
23d49657 1087 fTRDBudget = 0;
9559cbc4 1088
1089 // Reset TOF related track information
1090 fTOFchi2 = 0;
ce3f4882 1091 fTOFindex = -1;
ab37ab1e 1092 fTOFsignal = 99999;
1093 fTOFCalChannel = -1;
1094 fTOFsignalToT = 99999;
1095 fTOFsignalRaw = 99999;
1096 fTOFsignalDz = 999;
1097 fTOFsignalDx = 999;
1098 fTOFdeltaBC = 999;
1099 fTOFl0l1 = 999;
9559cbc4 1100 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
ab37ab1e 1101 for (Int_t i=0;i<3;i++) fTOFLabel[i] = -1;
9559cbc4 1102 for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
1103
f4b3bbb7 1104 // Reset HMPID related track information
1105 fHMPIDchi2 = 0;
562dd0b4 1106 fHMPIDqn = 0;
81aa7a0d 1107 fHMPIDcluIdx = -1;
f4b3bbb7 1108 fHMPIDsignal = 0;
1109 for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
562dd0b4 1110 fHMPIDtrkTheta = 0;
1111 fHMPIDtrkPhi = 0;
1112 fHMPIDtrkX = 0;
1113 fHMPIDtrkY = 0;
1114 fHMPIDmipX = 0;
1115 fHMPIDmipY = 0;
f1cedef3 1116 fCaloIndex = kEMCALNoMatch;
9559cbc4 1117
b5b2b4db 1118 // reset global track chi2
1119 fGlobalChi2 = 0;
1120
6dc21f57 1121 fVertexID = -2; // an orphan track
1122
15e85efa 1123 delete fFriendTrack; fFriendTrack = 0;
9559cbc4 1124}
1125//_______________________________________________________________________
4a78b8c5 1126Double_t AliESDtrack::GetMass() const {
4427806c 1127 // Returns the mass of the most probable particle type
ec729fb0 1128
1129 Int_t i;
1130 for (i=0; i<AliPID::kSPECIES-1; i++) {
1131 if (fR[i] != fR[i+1]) break;
1132 }
1133 // If all the probabilities are equal, return the pion mass
1134 if (i == AliPID::kSPECIES-1) return AliPID::ParticleMass(AliPID::kPion);
1135
ae982df3 1136 Float_t max=0.;
1137 Int_t k=-1;
ec729fb0 1138 for (i=0; i<AliPID::kSPECIES; i++) {
ae982df3 1139 if (fR[i]>max) {k=i; max=fR[i];}
1140 }
db3989b3 1141 if (k==0) { // dE/dx "crossing points" in the TPC
1142 Double_t p=GetP();
1143 if ((p>0.38)&&(p<0.48))
304864ab 1144 if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon);
db3989b3 1145 if ((p>0.75)&&(p<0.85))
304864ab 1146 if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton);
db3989b3 1147 return 0.00051;
1148 }
304864ab 1149 if (k==1) return AliPID::ParticleMass(AliPID::kMuon);
1150 if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion);
1151 if (k==3) return AliPID::ParticleMass(AliPID::kKaon);
1152 if (k==4) return AliPID::ParticleMass(AliPID::kProton);
5f7789fc 1153 AliWarning("Undefined mass !");
304864ab 1154 return AliPID::ParticleMass(AliPID::kPion);
ae982df3 1155}
1156
aad8d435 1157//______________________________________________________________________________
6b5b49c9 1158Double_t AliESDtrack::M() const
1159{
2850a7f3 1160 // Returns the assumed mass
1161 // (the pion mass, if the particle can't be identified properly).
6b5b49c9 1162
1163 AliWarning("This is the ESD mass. Use it with care !");
1164 return GetMass();
1165}
1166
1167//______________________________________________________________________________
aad8d435 1168Double_t AliESDtrack::E() const
1169{
1170 // Returns the energy of the particle given its assumed mass.
1171 // Assumes the pion mass if the particle can't be identified properly.
1172
1173 Double_t m = M();
1174 Double_t p = P();
1175 return TMath::Sqrt(p*p + m*m);
1176}
1177
1178//______________________________________________________________________________
1179Double_t AliESDtrack::Y() const
1180{
1181 // Returns the rapidity of a particle given its assumed mass.
1182 // Assumes the pion mass if the particle can't be identified properly.
1183
1184 Double_t e = E();
1185 Double_t pz = Pz();
e03e4544 1186 if (e != TMath::Abs(pz)) { // energy was not equal to pz
aad8d435 1187 return 0.5*TMath::Log((e+pz)/(e-pz));
1188 } else { // energy was equal to pz
1189 return -999.;
1190 }
1191}
1192
ae982df3 1193//_______________________________________________________________________
c9ec41e8 1194Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){
ae982df3 1195 //
1196 // This function updates track's running parameters
1197 //
15614b8b 1198 Bool_t rc=kTRUE;
1199
9b859005 1200 SetStatus(flags);
1201 fLabel=t->GetLabel();
1202
1203 if (t->IsStartedTimeIntegral()) {
1204 SetStatus(kTIME);
1205 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
1206 SetIntegratedLength(t->GetIntegratedLength());
1207 }
1208
6c94f330 1209 Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
ded25cc6 1210 if (flags==kITSout) fFriendTrack->SetITSOut(*t);
1211 if (flags==kTPCout) fFriendTrack->SetTPCOut(*t);
fae4c212 1212 if (flags==kTRDrefit) fFriendTrack->SetTRDIn(*t);
e1d4c1b5 1213
ae982df3 1214 switch (flags) {
ad2f1f2b 1215
9b859005 1216 case kITSin: case kITSout: case kITSrefit:
6d3a7bbf 1217 {
48704648 1218 fITSClusterMap=0;
ae982df3 1219 fITSncls=t->GetNumberOfClusters();
6d3a7bbf 1220 Int_t* indexITS = new Int_t[AliESDfriendTrack::kMaxITScluster];
62665e7f 1221 for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
6d3a7bbf 1222 indexITS[i]=t->GetClusterIndex(i);
1223
62665e7f 1224 if (i<fITSncls) {
6d3a7bbf 1225 Int_t l=(indexITS[i] & 0xf0000000) >> 28;
62665e7f 1226 SETBIT(fITSClusterMap,l);
1227 }
1228 }
6d3a7bbf 1229 fFriendTrack->SetITSIndices(indexITS,AliESDfriendTrack::kMaxITScluster);
1230 delete [] indexITS;
1231
ae982df3 1232 fITSchi2=t->GetChi2();
ae982df3 1233 fITSsignal=t->GetPIDsignal();
6e5b1b04 1234 fITSLabel = t->GetLabel();
57483eb1 1235 // keep in fOp the parameters outside ITS for ITS stand-alone tracks
1236 if (flags==kITSout) {
1237 if (!fOp) fOp=new AliExternalTrackParam(*t);
1238 else
1239 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
ded25cc6 1240 }
6d3a7bbf 1241 }
ae982df3 1242 break;
ad2f1f2b 1243
9b859005 1244 case kTPCin: case kTPCrefit:
6d3a7bbf 1245 {
6e5b1b04 1246 fTPCLabel = t->GetLabel();
949840f6 1247 if (flags==kTPCin) {
1248 fTPCInner=new AliExternalTrackParam(*t);
1249 fTPCnclsIter1=t->GetNumberOfClusters();
1250 fTPCchi2Iter1=t->GetChi2();
1251 }
c9ec41e8 1252 if (!fIp) fIp=new AliExternalTrackParam(*t);
6c94f330 1253 else
1254 fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
6d3a7bbf 1255 }
9b859005 1256 case kTPCout:
6d3a7bbf 1257 {
1258 Int_t* indexTPC = new Int_t[AliESDfriendTrack::kMaxTPCcluster];
1d303a24 1259 if (flags & kTPCout){
1260 if (!fOp) fOp=new AliExternalTrackParam(*t);
6c94f330 1261 else
1262 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1d303a24 1263 }
e1d4c1b5 1264 fTPCncls=t->GetNumberOfClusters();
ae982df3 1265 fTPCchi2=t->GetChi2();
a866ac60 1266
1267 {//prevrow must be declared in separate namespace, otherwise compiler cries:
1268 //"jump to case label crosses initialization of `Int_t prevrow'"
1269 Int_t prevrow = -1;
6e5b1b04 1270 // for (Int_t i=0;i<fTPCncls;i++)
15e85efa 1271 for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
a866ac60 1272 {
6d3a7bbf 1273 indexTPC[i]=t->GetClusterIndex(i);
1274 Int_t idx = indexTPC[i];
a866ac60 1275
15e85efa 1276 if (idx<0) continue;
9fe5b2ff 1277
a866ac60 1278 // Piotr's Cluster Map for HBT
1279 // ### please change accordingly if cluster array is changing
1280 // to "New TPC Tracking" style (with gaps in array)
a866ac60 1281 Int_t sect = (idx&0xff000000)>>24;
1282 Int_t row = (idx&0x00ff0000)>>16;
1283 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
1284
1285 fTPCClusterMap.SetBitNumber(row,kTRUE);
1286
1287 //Fill the gap between previous row and this row with 0 bits
1288 //In case ### pleas change it as well - just set bit 0 in case there
1289 //is no associated clusters for current "i"
1290 if (prevrow < 0)
1291 {
1292 prevrow = row;//if previous bit was not assigned yet == this is the first one
1293 }
1294 else
1295 { //we don't know the order (inner to outer or reverse)
1296 //just to be save in case it is going to change
1297 Int_t n = 0, m = 0;
1298 if (prevrow < row)
1299 {
1300 n = prevrow;
1301 m = row;
1302 }
1303 else
1304 {
1305 n = row;
1306 m = prevrow;
1307 }
1308
1309 for (Int_t j = n+1; j < m; j++)
1310 {
1311 fTPCClusterMap.SetBitNumber(j,kFALSE);
1312 }
1313 prevrow = row;
1314 }
1315 // End Of Piotr's Cluster Map for HBT
1316 }
6d3a7bbf 1317 fFriendTrack->SetTPCIndices(indexTPC,AliESDfriendTrack::kMaxTPCcluster);
1318 delete [] indexTPC;
1319
a866ac60 1320 }
ae982df3 1321 fTPCsignal=t->GetPIDsignal();
6d3a7bbf 1322 }
ae982df3 1323 break;
9b859005 1324
64130601 1325 case kTRDin: case kTRDrefit:
1326 break;
1327 case kTRDout:
6d3a7bbf 1328 {
51ad6848 1329 fTRDLabel = t->GetLabel();
2f83b7a6 1330 fTRDchi2 = t->GetChi2();
1331 fTRDncls = t->GetNumberOfClusters();
6d3a7bbf 1332 Int_t* indexTRD = new Int_t[AliESDfriendTrack::kMaxTRDcluster];
1333 for (Int_t i=0;i<AliESDfriendTrack::kMaxTRDcluster;i++) indexTRD[i]=-2;
1334 for (Int_t i=0;i<6;i++) indexTRD[i]=t->GetTrackletIndex(i);
1335 fFriendTrack->SetTRDIndices(indexTRD,AliESDfriendTrack::kMaxTRDcluster);
1336 delete [] indexTRD;
1337
5bc3e158 1338
79e94bf8 1339 fTRDsignal=t->GetPIDsignal();
6d3a7bbf 1340 }
79e94bf8 1341 break;
c4d11b15 1342 case kTRDbackup:
c9ec41e8 1343 if (!fOp) fOp=new AliExternalTrackParam(*t);
6c94f330 1344 else
1345 fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
c4d11b15 1346 fTRDncls0 = t->GetNumberOfClusters();
1347 break;
1348 case kTOFin:
1349 break;
1350 case kTOFout:
1351 break;
d0862fea 1352 case kTRDStop:
1353 break;
c38d443f 1354 case kHMPIDout:
1355 if (!fHMPIDp) fHMPIDp=new AliExternalTrackParam(*t);
1356 else
1357 fHMPIDp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1358 break;
ae982df3 1359 default:
5f7789fc 1360 AliError("Wrong flag !");
ae982df3 1361 return kFALSE;
1362 }
1363
15614b8b 1364 return rc;
ae982df3 1365}
1366
1367//_______________________________________________________________________
1368void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
1369 //---------------------------------------------------------------------
1370 // This function returns external representation of the track parameters
1371 //---------------------------------------------------------------------
c9ec41e8 1372 x=GetX();
1373 for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
15614b8b 1374}
1375
67c3dcbe 1376//_______________________________________________________________________
a866ac60 1377void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
67c3dcbe 1378 //---------------------------------------------------------------------
1379 // This function returns external representation of the cov. matrix
1380 //---------------------------------------------------------------------
c9ec41e8 1381 for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
67c3dcbe 1382}
1383
67c3dcbe 1384//_______________________________________________________________________
c0b978f0 1385Bool_t AliESDtrack::GetConstrainedExternalParameters
1386 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
67c3dcbe 1387 //---------------------------------------------------------------------
1388 // This function returns the constrained external track parameters
1389 //---------------------------------------------------------------------
c0b978f0 1390 if (!fCp) return kFALSE;
1391 alpha=fCp->GetAlpha();
c9ec41e8 1392 x=fCp->GetX();
1393 for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
c0b978f0 1394 return kTRUE;
67c3dcbe 1395}
c9ec41e8 1396
67c3dcbe 1397//_______________________________________________________________________
c0b978f0 1398Bool_t
67c3dcbe 1399AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const {
1400 //---------------------------------------------------------------------
1401 // This function returns the constrained external cov. matrix
1402 //---------------------------------------------------------------------
c0b978f0 1403 if (!fCp) return kFALSE;
c9ec41e8 1404 for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
c0b978f0 1405 return kTRUE;
67c3dcbe 1406}
1407
c0b978f0 1408Bool_t
1409AliESDtrack::GetInnerExternalParameters
1410 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1411 //---------------------------------------------------------------------
c9ec41e8 1412 // This function returns external representation of the track parameters
1413 // at the inner layer of TPC
9b859005 1414 //---------------------------------------------------------------------
c0b978f0 1415 if (!fIp) return kFALSE;
1416 alpha=fIp->GetAlpha();
c9ec41e8 1417 x=fIp->GetX();
1418 for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
c0b978f0 1419 return kTRUE;
9b859005 1420}
1421
c0b978f0 1422Bool_t
1423AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const {
c9ec41e8 1424 //---------------------------------------------------------------------
1425 // This function returns external representation of the cov. matrix
1426 // at the inner layer of TPC
1427 //---------------------------------------------------------------------
c0b978f0 1428 if (!fIp) return kFALSE;
c9ec41e8 1429 for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
c0b978f0 1430 return kTRUE;
9b859005 1431}
1432
d61ca12d 1433void
1434AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) {
1435 //
1436 // This is a direct setter for the outer track parameters
1437 //
1438 SetStatus(flags);
1439 if (fOp) delete fOp;
1440 fOp=new AliExternalTrackParam(*p);
1441}
1442
c38d443f 1443void
1444AliESDtrack::SetOuterHmpParam(const AliExternalTrackParam *p, ULong_t flags) {
1445 //
1446 // This is a direct setter for the outer track parameters
1447 //
1448 SetStatus(flags);
1449 if (fHMPIDp) delete fHMPIDp;
1450 fHMPIDp=new AliExternalTrackParam(*p);
1451}
1452
c0b978f0 1453Bool_t
1454AliESDtrack::GetOuterExternalParameters
1455 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1456 //---------------------------------------------------------------------
c9ec41e8 1457 // This function returns external representation of the track parameters
1458 // at the inner layer of TRD
a866ac60 1459 //---------------------------------------------------------------------
c0b978f0 1460 if (!fOp) return kFALSE;
1461 alpha=fOp->GetAlpha();
c9ec41e8 1462 x=fOp->GetX();
1463 for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
c0b978f0 1464 return kTRUE;
a866ac60 1465}
c9ec41e8 1466
c0b978f0 1467Bool_t
c38d443f 1468AliESDtrack::GetOuterHmpExternalParameters
1469 (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1470 //---------------------------------------------------------------------
1471 // This function returns external representation of the track parameters
1472 // at the inner layer of TRD
1473 //---------------------------------------------------------------------
1474 if (!fHMPIDp) return kFALSE;
1475 alpha=fHMPIDp->GetAlpha();
1476 x=fHMPIDp->GetX();
1477 for (Int_t i=0; i<5; i++) p[i]=fHMPIDp->GetParameter()[i];
1478 return kTRUE;
1479}
1480
1481Bool_t
c0b978f0 1482AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const {
a866ac60 1483 //---------------------------------------------------------------------
c9ec41e8 1484 // This function returns external representation of the cov. matrix
1485 // at the inner layer of TRD
a866ac60 1486 //---------------------------------------------------------------------
c0b978f0 1487 if (!fOp) return kFALSE;
c9ec41e8 1488 for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
c0b978f0 1489 return kTRUE;
a866ac60 1490}
1491
c38d443f 1492Bool_t
1493AliESDtrack::GetOuterHmpExternalCovariance(Double_t cov[15]) const {
1494 //---------------------------------------------------------------------
1495 // This function returns external representation of the cov. matrix
1496 // at the inner layer of TRD
1497 //---------------------------------------------------------------------
1498 if (!fHMPIDp) return kFALSE;
1499 for (Int_t i=0; i<15; i++) cov[i]=fHMPIDp->GetCovariance()[i];
1500 return kTRUE;
1501}
1502
98937d93 1503Int_t AliESDtrack::GetNcls(Int_t idet) const
1504{
1505 // Get number of clusters by subdetector index
1506 //
1507 Int_t ncls = 0;
1508 switch(idet){
1509 case 0:
1510 ncls = fITSncls;
1511 break;
1512 case 1:
1513 ncls = fTPCncls;
1514 break;
1515 case 2:
1516 ncls = fTRDncls;
1517 break;
1518 case 3:
ce3f4882 1519 if (fTOFindex != -1)
98937d93 1520 ncls = 1;
1521 break;
81aa7a0d 1522 case 4: //PHOS
1523 break;
1524 case 5: //HMPID
1525 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1526 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1527 ncls = 1;
1528 }
1529 }
1530 break;
98937d93 1531 default:
1532 break;
1533 }
1534 return ncls;
1535}
1536
ef7253ac 1537Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
98937d93 1538{
1539 // Get cluster index array by subdetector index
1540 //
1541 Int_t ncls = 0;
1542 switch(idet){
1543 case 0:
1544 ncls = GetITSclusters(idx);
1545 break;
1546 case 1:
ef7253ac 1547 ncls = GetTPCclusters(idx);
98937d93 1548 break;
1549 case 2:
1550 ncls = GetTRDclusters(idx);
1551 break;
1552 case 3:
ce3f4882 1553 if (fTOFindex != -1) {
1554 idx[0] = fTOFindex;
98937d93 1555 ncls = 1;
1556 }
1557 break;
313af949 1558 case 4: //PHOS
1559 break;
1560 case 5:
81aa7a0d 1561 if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1562 if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1563 idx[0] = GetHMPIDcluIdx();
1564 ncls = 1;
1565 }
313af949 1566 }
1567 break;
1568 case 6: //EMCAL
1569 break;
98937d93 1570 default:
1571 break;
1572 }
1573 return ncls;
1574}
1575
ae982df3 1576//_______________________________________________________________________
ae982df3 1577void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
4427806c 1578 // Returns the array with integrated times for each particle hypothesis
304864ab 1579 for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i];
ae982df3 1580}
1581
1582//_______________________________________________________________________
1583void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
4427806c 1584 // Sets the array with integrated times for each particle hypotesis
304864ab 1585 for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i];
ae982df3 1586}
1587
1588//_______________________________________________________________________
4427806c 1589void AliESDtrack::SetITSpid(const Double_t *p) {
1590 // Sets values for the probability of each particle type (in ITS)
d27bbc79 1591 SetPIDValues(fITSr,p,AliPID::kSPECIES);
c630aafd 1592 SetStatus(AliESDtrack::kITSpid);
1593}
1594
1595//_______________________________________________________________________
1596void AliESDtrack::GetITSpid(Double_t *p) const {
4427806c 1597 // Gets the probability of each particle type (in ITS)
304864ab 1598 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i];
c630aafd 1599}
1600
1601//_______________________________________________________________________
562dd0b4 1602Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
ae982df3 1603 //---------------------------------------------------------------------
1604 // This function returns indices of the assgined ITS clusters
1605 //---------------------------------------------------------------------
6d3a7bbf 1606 if (idx) {
1607 Int_t *index=fFriendTrack->GetITSindices();
1608 for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) {
1609 if ( (i>=fITSncls) && (i<6) ) idx[i]=-1;
1610 else {
1611 if (index) {
1612 idx[i]=index[i];
1613 }
1614 else idx[i]= -2;
1615 }
1616 }
15e85efa 1617 }
ae982df3 1618 return fITSncls;
1619}
1620
1621//_______________________________________________________________________
89f1b176 1622Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
1623 Float_t &xloc,Float_t &zloc) const {
1624 //----------------------------------------------------------------------
1625 // This function encodes in the module number also the status of cluster association
1626 // "status" can have the following values:
1627 // 1 "found" (cluster is associated),
1628 // 2 "dead" (module is dead from OCDB),
1629 // 3 "skipped" (module or layer forced to be skipped),
1630 // 4 "outinz" (track out of z acceptance),
1631 // 5 "nocls" (no clusters in the road),
1632 // 6 "norefit" (cluster rejected during refit),
1633 // 7 "deadzspd" (holes in z in SPD)
1634 // Also given are the coordinates of the crossing point of track and module
1635 // (in the local module ref. system)
1636 // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
1637 //----------------------------------------------------------------------
1638
1639 if(fITSModule[ilayer]==-1) {
89f1b176 1640 idet = -1;
1641 status=0;
1642 xloc=-99.; zloc=-99.;
1643 return kFALSE;
1644 }
1645
1646 Int_t module = fITSModule[ilayer];
1647
1648 idet = Int_t(module/1000000);
1649
1650 module -= idet*1000000;
1651
1652 status = Int_t(module/100000);
1653
1654 module -= status*100000;
1655
1656 Int_t signs = Int_t(module/10000);
1657
1658 module-=signs*10000;
1659
1660 Int_t xInt = Int_t(module/100);
1661 module -= xInt*100;
1662
1663 Int_t zInt = module;
1664
1665 if(signs==1) { xInt*=1; zInt*=1; }
1666 if(signs==2) { xInt*=1; zInt*=-1; }
1667 if(signs==3) { xInt*=-1; zInt*=1; }
1668 if(signs==4) { xInt*=-1; zInt*=-1; }
1669
1670 xloc = 0.1*(Float_t)xInt;
1671 zloc = 0.1*(Float_t)zInt;
1672
1673 if(status==4) idet = -1;
1674
1675 return kTRUE;
1676}
1677
1678//_______________________________________________________________________
562dd0b4 1679UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
ae982df3 1680 //---------------------------------------------------------------------
1681 // This function returns indices of the assgined ITS clusters
1682 //---------------------------------------------------------------------
6d3a7bbf 1683 if (idx) {
15e85efa 1684 Int_t *index=fFriendTrack->GetTPCindices();
6d3a7bbf 1685
1686 if (index){
1687 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
1688 }
1689 else {
1690 for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=-2;
1691 }
15e85efa 1692 }
ae982df3 1693 return fTPCncls;
1694}
8c6a71ab 1695
6a6f0c1f 1696//_______________________________________________________________________
1697Float_t AliESDtrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/) const
1698{
1699 //
1700 // TPC cluster information
1701 // type 0: get fraction of found/findable clusters with neighbourhood definition
1702 // 1: findable clusters with neighbourhood definition
1703 // 2: found clusters
1704 //
1705 // definition of findable clusters:
1706 // a cluster is defined as findable if there is another cluster
1707 // within +- nNeighbours pad rows. The idea is to overcome threshold
1708 // effects with a very simple algorithm.
1709 //
1710
1711 if (type==2) return fTPCClusterMap.CountBits();
1712
1713 Int_t found=0;
1714 Int_t findable=0;
1715 Int_t last=-nNeighbours;
1716
1717 for (Int_t i=0; i<159; ++i){
1718 //look to current row
1719 if (fTPCClusterMap[i]) {
1720 last=i;
1721 ++found;
1722 ++findable;
1723 continue;
1724 }
1725 //look to nNeighbours before
1726 if ((i-last)<=nNeighbours) {
1727 ++findable;
1728 continue;
1729 }
1730 //look to nNeighbours after
1731 for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
1732 if (fTPCClusterMap[j]){
1733 ++findable;
1734 break;
1735 }
1736 }
1737 }
1738
1739 Float_t fraction=0;
1740 if (type==0){
1741 if (findable>0) fraction=(Float_t)found/(Float_t)findable;
1742 } else {
1743 fraction=findable;
1744 }
1745 return findable;
1746}
1747
1748//_______________________________________________________________________
562dd0b4 1749Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
81e97e0d 1750 //
1751 // GetDensity of the clusters on given region between row0 and row1
1752 // Dead zone effect takin into acoount
1753 //
1754 Int_t good = 0;
1755 Int_t found = 0;
1756 //
15e85efa 1757 Int_t *index=fFriendTrack->GetTPCindices();
81e97e0d 1758 for (Int_t i=row0;i<=row1;i++){
15e85efa 1759 Int_t idx = index[i];
1760 if (idx!=-1) good++; // track outside of dead zone
1761 if (idx>0) found++;
81e97e0d 1762 }
1763 Float_t density=0.5;
1764 if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good);
1765 return density;
1766}
c84a5e9e 1767
8c6a71ab 1768//_______________________________________________________________________
1769void AliESDtrack::SetTPCpid(const Double_t *p) {
4427806c 1770 // Sets values for the probability of each particle type (in TPC)
d27bbc79 1771 SetPIDValues(fTPCr,p,AliPID::kSPECIES);
8c6a71ab 1772 SetStatus(AliESDtrack::kTPCpid);
1773}
1774
1775//_______________________________________________________________________
1776void AliESDtrack::GetTPCpid(Double_t *p) const {
4427806c 1777 // Gets the probability of each particle type (in TPC)
304864ab 1778 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i];
8c6a71ab 1779}
1780
1781//_______________________________________________________________________
562dd0b4 1782UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
bb2ceb1f 1783 //---------------------------------------------------------------------
1784 // This function returns indices of the assgined TRD clusters
1785 //---------------------------------------------------------------------
6d3a7bbf 1786 if (idx) {
1787 Int_t *index=fFriendTrack->GetTRDindices();
1788
1789 if (index) {
1790 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
1791 }
1792 else {
1793 for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=-2;
1794 }
15e85efa 1795 }
bb2ceb1f 1796 return fTRDncls;
1797}
1798
1799//_______________________________________________________________________
5bc3e158 1800UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
0ad488b0 1801//
1802// This function returns the number of TRD tracklets used in tracking
1803// and it fills the indices of these tracklets in the array "idx" as they
1804// are registered in the TRD track list.
1805//
1806// Caution :
1807// 1. The idx array has to be allocated with a size >= AliESDtrack::kTRDnPlanes
1808// 2. The idx array store not only the index but also the layer of the tracklet.
1809// Therefore tracks with TRD gaps contain default values for indices [-1]
1810
1811 if (!idx) return GetTRDntracklets();
6d3a7bbf 1812 Int_t *index=fFriendTrack->GetTRDindices();
1813 Int_t n = 0;
0ad488b0 1814 for (Int_t i=0; i<kTRDnPlanes; i++){
6d3a7bbf 1815 if (index){
1816 if(index[i]>=0) n++;
1817 idx[i]=index[i];
1818 }
1819 else idx[i] = -2;
5bc3e158 1820 }
0ad488b0 1821 return n;
5bc3e158 1822}
1823
1824//_______________________________________________________________________
c630aafd 1825void AliESDtrack::SetTRDpid(const Double_t *p) {
4427806c 1826 // Sets values for the probability of each particle type (in TRD)
d27bbc79 1827 SetPIDValues(fTRDr,p,AliPID::kSPECIES);
c630aafd 1828 SetStatus(AliESDtrack::kTRDpid);
1829}
1830
1831//_______________________________________________________________________
1832void AliESDtrack::GetTRDpid(Double_t *p) const {
4427806c 1833 // Gets the probability of each particle type (in TRD)
304864ab 1834 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i];
c630aafd 1835}
1836
1837//_______________________________________________________________________
79e94bf8 1838void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
1839{
4427806c 1840 // Sets the probability of particle type iSpecies to p (in TRD)
79e94bf8 1841 fTRDr[iSpecies] = p;
1842}
1843
562dd0b4 1844Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
79e94bf8 1845{
4427806c 1846 // Returns the probability of particle type iSpecies (in TRD)
79e94bf8 1847 return fTRDr[iSpecies];
1848}
1849
fae4c212 1850//____________________________________________________
1851Int_t AliESDtrack::GetNumberOfTRDslices() const
1852{
1853 // built in backward compatibility
1854 Int_t idx = fTRDnSlices - (kTRDnPlanes<<1);
1855 return idx<18 ? fTRDnSlices/kTRDnPlanes : idx/kTRDnPlanes;
1856}
1857
1858//____________________________________________________
1859Double_t AliESDtrack::GetTRDmomentum(Int_t plane, Double_t *sp) const
1860{
1861//Returns momentum estimation and optional its error (sp)
1862// in TRD layer "plane".
1863
1864 if (!fTRDnSlices) {
ba8cee18 1865 AliDebug(2, "No TRD info allocated for this track.");
fae4c212 1866 return -1.;
1867 }
1868 if ((plane<0) || (plane>=kTRDnPlanes)) {
ba8cee18 1869 AliWarning(Form("Request for TRD plane[%d] outside range.", plane));
fae4c212 1870 return -1.;
1871 }
1872
1873 Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
1874 // Protection for backward compatibility
1875 if(idx<(GetNumberOfTRDslices()*kTRDnPlanes)) return -1.;
1876
1877 if(sp) (*sp) = fTRDslices[idx+kTRDnPlanes];
1878 return fTRDslices[idx];
1879}
1880
1881//____________________________________________________
1882Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const {
1883 //Gets the charge from the slice of the plane
1884
1885 if(!fTRDslices) {
1886 //AliError("No TRD slices allocated for this track !");
1887 return -1.;
1888 }
1889 if ((plane<0) || (plane>=kTRDnPlanes)) {
1890 AliError("Info for TRD plane not available !");
1891 return -1.;
1892 }
1893 Int_t ns=GetNumberOfTRDslices();
1894 if ((slice<-1) || (slice>=ns)) {
1895 //AliError("Wrong TRD slice !");
1896 return -1.;
1897 }
1898
1899 if(slice>=0) return fTRDslices[plane*ns + slice];
1900
1901 // return average of the dEdx measurements
1902 Double_t q=0.; Double32_t *s = &fTRDslices[plane*ns];
1903 for (Int_t i=0; i<ns; i++, s++) if((*s)>0.) q+=(*s);
1904 return q/ns;
1905}
1906
1907//____________________________________________________
6984f7c1 1908void AliESDtrack::SetNumberOfTRDslices(Int_t n) {
1909 //Sets the number of slices used for PID
fae4c212 1910 if (fTRDnSlices) return;
1911
1912 fTRDnSlices=n;
6984f7c1 1913 fTRDslices=new Double32_t[fTRDnSlices];
fae4c212 1914
1915 // set-up correctly the allocated memory
1916 memset(fTRDslices, 0, n*sizeof(Double32_t));
1917 for (Int_t i=GetNumberOfTRDslices(); i--;) fTRDslices[i]=-1.;
6984f7c1 1918}
1919
fae4c212 1920//____________________________________________________
6984f7c1 1921void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) {
1922 //Sets the charge q in the slice of the plane
fae4c212 1923 if(!fTRDslices) {
6984f7c1 1924 AliError("No TRD slices allocated for this track !");
1925 return;
1926 }
6984f7c1 1927 if ((plane<0) || (plane>=kTRDnPlanes)) {
fae4c212 1928 AliError("Info for TRD plane not allocated !");
6984f7c1 1929 return;
1930 }
fae4c212 1931 Int_t ns=GetNumberOfTRDslices();
6984f7c1 1932 if ((slice<0) || (slice>=ns)) {
1933 AliError("Wrong TRD slice !");
1934 return;
1935 }
1936 Int_t n=plane*ns + slice;
1937 fTRDslices[n]=q;
1938}
1939
6984f7c1 1940
fae4c212 1941//____________________________________________________
1942void AliESDtrack::SetTRDmomentum(Double_t p, Int_t plane, Double_t *sp)
1943{
1944 if(!fTRDslices) {
1945 AliError("No TRD slices allocated for this track !");
1946 return;
6984f7c1 1947 }
fae4c212 1948 if ((plane<0) || (plane>=kTRDnPlanes)) {
1949 AliError("Info for TRD plane not allocated !");
1950 return;
6984f7c1 1951 }
1952
fae4c212 1953 Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
1954 // Protection for backward compatibility
1955 if(idx<GetNumberOfTRDslices()*kTRDnPlanes) return;
6984f7c1 1956
fae4c212 1957 if(sp) fTRDslices[idx+kTRDnPlanes] = (*sp);
1958 fTRDslices[idx] = p;
6984f7c1 1959}
1960
1961
79e94bf8 1962//_______________________________________________________________________
c630aafd 1963void AliESDtrack::SetTOFpid(const Double_t *p) {
4427806c 1964 // Sets the probability of each particle type (in TOF)
d27bbc79 1965 SetPIDValues(fTOFr,p,AliPID::kSPECIES);
c630aafd 1966 SetStatus(AliESDtrack::kTOFpid);
1967}
1968
1969//_______________________________________________________________________
51ad6848 1970void AliESDtrack::SetTOFLabel(const Int_t *p) {
1971 // Sets (in TOF)
1972 for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
1973}
1974
1975//_______________________________________________________________________
c630aafd 1976void AliESDtrack::GetTOFpid(Double_t *p) const {
4427806c 1977 // Gets probabilities of each particle type (in TOF)
304864ab 1978 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i];
c630aafd 1979}
1980
51ad6848 1981//_______________________________________________________________________
1982void AliESDtrack::GetTOFLabel(Int_t *p) const {
1983 // Gets (in TOF)
1984 for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
1985}
1986
1987//_______________________________________________________________________
1988void AliESDtrack::GetTOFInfo(Float_t *info) const {
1989 // Gets (in TOF)
1990 for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
1991}
1992
1993//_______________________________________________________________________
1994void AliESDtrack::SetTOFInfo(Float_t*info) {
1995 // Gets (in TOF)
1996 for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
1997}
1998
4a78b8c5 1999
2000
2001//_______________________________________________________________________
f4b3bbb7 2002void AliESDtrack::SetHMPIDpid(const Double_t *p) {
2003 // Sets the probability of each particle type (in HMPID)
2004 SetPIDValues(fHMPIDr,p,AliPID::kSPECIES);
2005 SetStatus(AliESDtrack::kHMPIDpid);
4a78b8c5 2006}
2007
2008//_______________________________________________________________________
f4b3bbb7 2009void AliESDtrack::GetHMPIDpid(Double_t *p) const {
2010 // Gets probabilities of each particle type (in HMPID)
2011 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fHMPIDr[i];
4a78b8c5 2012}
2013
2014
2015
c630aafd 2016//_______________________________________________________________________
8c6a71ab 2017void AliESDtrack::SetESDpid(const Double_t *p) {
4427806c 2018 // Sets the probability of each particle type for the ESD track
d27bbc79 2019 SetPIDValues(fR,p,AliPID::kSPECIES);
8c6a71ab 2020 SetStatus(AliESDtrack::kESDpid);
2021}
2022
2023//_______________________________________________________________________
2024void AliESDtrack::GetESDpid(Double_t *p) const {
4427806c 2025 // Gets probability of each particle type for the ESD track
304864ab 2026 for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i];
8c6a71ab 2027}
2028
ac2f7574 2029//_______________________________________________________________________
436dfe39 2030Bool_t AliESDtrack::RelateToVertexTPC(const AliESDVertex *vtx,
2031Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
d7ddf1e9 2032 //
436dfe39 2033 // Try to relate the TPC-only track parameters to the vertex "vtx",
d7ddf1e9 2034 // if the (rough) transverse impact parameter is not bigger then "maxd".
2035 // Magnetic field is "b" (kG).
2036 //
2037 // a) The TPC-only paramters are extapolated to the DCA to the vertex.
2038 // b) The impact parameters and their covariance matrix are calculated.
436dfe39 2039 // c) An attempt to constrain the TPC-only params to the vertex is done.
2040 // The constrained params are returned via "cParam".
d7ddf1e9 2041 //
436dfe39 2042 // In the case of success, the returned value is kTRUE
2043 // otherwise, it's kFALSE)
2044 //
d7ddf1e9 2045
2046 if (!fTPCInner) return kFALSE;
2047 if (!vtx) return kFALSE;
2048
2049 Double_t dz[2],cov[3];
2050 if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
2051
2052 fdTPC = dz[0];
2053 fzTPC = dz[1];
2054 fCddTPC = cov[0];
2055 fCdzTPC = cov[1];
2056 fCzzTPC = cov[2];
2057
436dfe39 2058 Double_t covar[6]; vtx->GetCovMatrix(covar);
2059 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2060 Double_t c[3]={covar[2],0.,covar[5]};
2061
2062 Double_t chi2=GetPredictedChi2(p,c);
2063 if (chi2>kVeryBig) return kFALSE;
2064
2065 fCchi2TPC=chi2;
2066
2067 if (!cParam) return kTRUE;
2068
2069 *cParam = *fTPCInner;
2070 if (!cParam->Update(p,c)) return kFALSE;
2071
d7ddf1e9 2072 return kTRUE;
2073}
2074
2075//_______________________________________________________________________
266a0f9b 2076Bool_t AliESDtrack::RelateToVertexTPCBxByBz(const AliESDVertex *vtx,
2077Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) {
2078 //
2079 // Try to relate the TPC-only track parameters to the vertex "vtx",
2080 // if the (rough) transverse impact parameter is not bigger then "maxd".
2081 //
2082 // All three components of the magnetic field ,"b[3]" (kG),
2083 // are taken into account.
2084 //
2085 // a) The TPC-only paramters are extapolated to the DCA to the vertex.
2086 // b) The impact parameters and their covariance matrix are calculated.
2087 // c) An attempt to constrain the TPC-only params to the vertex is done.
2088 // The constrained params are returned via "cParam".
2089 //
2090 // In the case of success, the returned value is kTRUE
2091 // otherwise, it's kFALSE)
2092 //
2093
2094 if (!fTPCInner) return kFALSE;
2095 if (!vtx) return kFALSE;
2096
2097 Double_t dz[2],cov[3];
2098 if (!fTPCInner->PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE;
2099
2100 fdTPC = dz[0];
2101 fzTPC = dz[1];
2102 fCddTPC = cov[0];
2103 fCdzTPC = cov[1];
2104 fCzzTPC = cov[2];
2105
2106 Double_t covar[6]; vtx->GetCovMatrix(covar);
2107 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2108 Double_t c[3]={covar[2],0.,covar[5]};
2109
2110 Double_t chi2=GetPredictedChi2(p,c);
2111 if (chi2>kVeryBig) return kFALSE;
2112
2113 fCchi2TPC=chi2;
2114
2115 if (!cParam) return kTRUE;
2116
2117 *cParam = *fTPCInner;
2118 if (!cParam->Update(p,c)) return kFALSE;
2119
2120 return kTRUE;
2121}
2122
2123//_______________________________________________________________________
436dfe39 2124Bool_t AliESDtrack::RelateToVertex(const AliESDVertex *vtx,
2125Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
49d13e89 2126 //
2127 // Try to relate this track to the vertex "vtx",
2128 // if the (rough) transverse impact parameter is not bigger then "maxd".
2129 // Magnetic field is "b" (kG).
2130 //
2131 // a) The track gets extapolated to the DCA to the vertex.
2132 // b) The impact parameters and their covariance matrix are calculated.
2133 // c) An attempt to constrain this track to the vertex is done.
436dfe39 2134 // The constrained params are returned via "cParam".
49d13e89 2135 //
436dfe39 2136 // In the case of success, the returned value is kTRUE
2137 // (otherwise, it's kFALSE)
49d13e89 2138 //
b5d34a4c 2139
2140 if (!vtx) return kFALSE;
2141
e99a34df 2142 Double_t dz[2],cov[3];
2143 if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
2144
2145 fD = dz[0];
2146 fZ = dz[1];
2147 fCdd = cov[0];
2148 fCdz = cov[1];
2149 fCzz = cov[2];
49d13e89 2150
e99a34df 2151 Double_t covar[6]; vtx->GetCovMatrix(covar);
2152 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2153 Double_t c[3]={covar[2],0.,covar[5]};
3231f9e5 2154
e99a34df 2155 Double_t chi2=GetPredictedChi2(p,c);
436dfe39 2156 if (chi2>kVeryBig) return kFALSE;
2157
2158 fCchi2=chi2;
49d13e89 2159
436dfe39 2160
2161 //--- Could now these lines be removed ? ---
e99a34df 2162 delete fCp;
2163 fCp=new AliExternalTrackParam(*this);
49d13e89 2164
e99a34df 2165 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
266a0f9b 2166 //----------------------------------------
2167
2168 fVertexID = vtx->GetID();
2169
2170 if (!cParam) return kTRUE;
2171
2172 *cParam = *this;
2173 if (!cParam->Update(p,c)) return kFALSE;
2174
2175 return kTRUE;
2176}
2177
2178//_______________________________________________________________________
2179Bool_t AliESDtrack::RelateToVertexBxByBz(const AliESDVertex *vtx,
2180Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) {
2181 //
2182 // Try to relate this track to the vertex "vtx",
2183 // if the (rough) transverse impact parameter is not bigger then "maxd".
2184 // Magnetic field is "b" (kG).
2185 //
2186 // a) The track gets extapolated to the DCA to the vertex.
2187 // b) The impact parameters and their covariance matrix are calculated.
2188 // c) An attempt to constrain this track to the vertex is done.
2189 // The constrained params are returned via "cParam".
2190 //
2191 // In the case of success, the returned value is kTRUE
2192 // (otherwise, it's kFALSE)
2193 //
2194
2195 if (!vtx) return kFALSE;
2196
2197 Double_t dz[2],cov[3];
2198 if (!PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE;
2199
2200 fD = dz[0];
2201 fZ = dz[1];
2202 fCdd = cov[0];
2203 fCdz = cov[1];
2204 fCzz = cov[2];
2205
2206 Double_t covar[6]; vtx->GetCovMatrix(covar);
2207 Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2208 Double_t c[3]={covar[2],0.,covar[5]};
2209
2210 Double_t chi2=GetPredictedChi2(p,c);
2211 if (chi2>kVeryBig) return kFALSE;
2212
2213 fCchi2=chi2;
2214
2215
2216 //--- Could now these lines be removed ? ---
2217 delete fCp;
2218 fCp=new AliExternalTrackParam(*this);
2219
2220 if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
436dfe39 2221 //----------------------------------------
2222
6dc21f57 2223 fVertexID = vtx->GetID();
436dfe39 2224
2225 if (!cParam) return kTRUE;
2226
2227 *cParam = *this;
2228 if (!cParam->Update(p,c)) return kFALSE;
2229
49d13e89 2230 return kTRUE;
2231}
2232
2233//_______________________________________________________________________
ac2f7574 2234void AliESDtrack::Print(Option_t *) const {
2235 // Prints info on the track
b9ca886f 2236 AliExternalTrackParam::Print();
5f7789fc 2237 printf("ESD track info\n") ;
304864ab 2238 Double_t p[AliPID::kSPECIESN] ;
ac2f7574 2239 Int_t index = 0 ;
2240 if( IsOn(kITSpid) ){
2241 printf("From ITS: ") ;
2242 GetITSpid(p) ;
304864ab 2243 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 2244 printf("%f, ", p[index]) ;
2245 printf("\n signal = %f\n", GetITSsignal()) ;
2246 }
2247 if( IsOn(kTPCpid) ){
2248 printf("From TPC: ") ;
2249 GetTPCpid(p) ;
304864ab 2250 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 2251 printf("%f, ", p[index]) ;
2252 printf("\n signal = %f\n", GetTPCsignal()) ;
2253 }
2254 if( IsOn(kTRDpid) ){
2255 printf("From TRD: ") ;
2256 GetTRDpid(p) ;
304864ab 2257 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 2258 printf("%f, ", p[index]) ;
6984f7c1 2259 printf("\n signal = %f\n", GetTRDsignal()) ;
ac2f7574 2260 }
2261 if( IsOn(kTOFpid) ){
2262 printf("From TOF: ") ;
2263 GetTOFpid(p) ;
304864ab 2264 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 2265 printf("%f, ", p[index]) ;
2266 printf("\n signal = %f\n", GetTOFsignal()) ;
2267 }
f4b3bbb7 2268 if( IsOn(kHMPIDpid) ){
2269 printf("From HMPID: ") ;
2270 GetHMPIDpid(p) ;
304864ab 2271 for(index = 0 ; index < AliPID::kSPECIES; index++)
ac2f7574 2272 printf("%f, ", p[index]) ;
f4b3bbb7 2273 printf("\n signal = %f\n", GetHMPIDsignal()) ;
ac2f7574 2274 }
ac2f7574 2275}
6c94f330 2276
0c19adf7 2277
2278//
2279// Draw functionality
2280// Origin: Marian Ivanov, Marian.Ivanov@cern.ch
2281//
2282void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
2283 //
2284 // Fill points in the polymarker
2285 //
2286 TObjArray arrayRef;
2287 arrayRef.AddLast(new AliExternalTrackParam(*this));
2288 if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
2289 if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
c38d443f 2290 if (fHMPIDp) arrayRef.AddLast(new AliExternalTrackParam(*fHMPIDp));
0c19adf7 2291 //
2292 Double_t mpos[3]={0,0,0};
2293 Int_t entries=arrayRef.GetEntries();
2294 for (Int_t i=0;i<entries;i++){
2295 Double_t pos[3];
2296 ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
2297 mpos[0]+=pos[0]/entries;
2298 mpos[1]+=pos[1]/entries;
2299 mpos[2]+=pos[2]/entries;
2300 }
2301 // Rotate to the mean position
2302 //
2303 Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
2304 for (Int_t i=0;i<entries;i++){
2305 Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
2306 if (!res) delete arrayRef.RemoveAt(i);
2307 }
2308 Int_t counter=0;
2309 for (Double_t r=minR; r<maxR; r+=stepR){
2310 Double_t sweight=0;
2311 Double_t mlpos[3]={0,0,0};
2312 for (Int_t i=0;i<entries;i++){
2313 Double_t point[3]={0,0,0};
2314 AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
2315 if (!param) continue;
2316 if (param->GetXYZAt(r,magF,point)){
2317 Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
2318 sweight+=weight;
2319 mlpos[0]+=point[0]*weight;
2320 mlpos[1]+=point[1]*weight;
2321 mlpos[2]+=point[2]*weight;
2322 }
2323 }
2324 if (sweight>0){
2325 mlpos[0]/=sweight;
2326 mlpos[1]/=sweight;
2327 mlpos[2]/=sweight;
2328 pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
2329 printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);
2330 counter++;
2331 }
2332 }
2333}
1d4882da 2334
2335//_______________________________________________________________________
2336void AliESDtrack::SetITSdEdxSamples(const Double_t s[4]) {
2337 //
2338 // Store the dE/dx samples measured by the two SSD and two SDD layers.
2339 // These samples are corrected for the track segment length.
2340 //
2341 for (Int_t i=0; i<4; i++) fITSdEdxSamples[i]=s[i];
2342}
2343
2344//_______________________________________________________________________
2345void AliESDtrack::GetITSdEdxSamples(Double_t *s) const {
2346 //
2347 // Get the dE/dx samples measured by the two SSD and two SDD layers.
2348 // These samples are corrected for the track segment length.
2349 //
2350 for (Int_t i=0; i<4; i++) s[i]=fITSdEdxSamples[i];
2351}
949840f6 2352
2353
2354UShort_t AliESDtrack::GetTPCnclsS(Int_t i0,Int_t i1) const{
2355 //
2356 // get number of shared clusters
2357 //
2358 return fTPCSharedMap.CountBits(i0)-fTPCSharedMap.CountBits(i1);
2359}