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