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