]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtrackV1.cxx
Possibility to specify event selection criteria within the raw-data input URI. The...
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackV1.cxx
CommitLineData
d9950a5a 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 **************************************************************************/
15
16/* $Id$ */
17
eb38ed55 18#include "AliESDtrack.h"
41880fac 19#include "AliTracker.h"
eb38ed55 20
d9950a5a 21#include "AliTRDtrackV1.h"
22#include "AliTRDcluster.h"
23#include "AliTRDcalibDB.h"
3afdab72 24#include "AliTRDReconstructor.h"
d9950a5a 25#include "AliTRDrecoParam.h"
26
d9950a5a 27ClassImp(AliTRDtrackV1)
28
0906e73e 29///////////////////////////////////////////////////////////////////////////////
30// //
31// Represents a reconstructed TRD track //
32// Local TRD Kalman track //
33// //
34// Authors: //
35// Alex Bercuci <A.Bercuci@gsi.de> //
36// Markus Fasel <M.Fasel@gsi.de> //
37// //
38///////////////////////////////////////////////////////////////////////////////
d9950a5a 39
40//_______________________________________________________________
3b57a3f7 41AliTRDtrackV1::AliTRDtrackV1() : AliKalmanTrack()
42 ,fPIDquality(0)
43 ,fDE(0.)
44 ,fBackupTrack(0x0)
0906e73e 45{
d9950a5a 46 //
47 // Default constructor
48 //
3b57a3f7 49 for(int i =0; i<3; i++) fBudget[i] = 0.;
50
51 Float_t pid = 1./AliPID::kSPECIES;
52 for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid;
53
54 for(int ip=0; ip<kNplane; ip++){
55 fTrackletIndex[ip] = 0xffff;
56 fTracklet[ip] = 0x0;
57 }
d9950a5a 58}
59
60//_______________________________________________________________
3b57a3f7 61AliTRDtrackV1::AliTRDtrackV1(const AliTRDtrackV1 &ref) : AliKalmanTrack(ref)
62 ,fPIDquality(ref.fPIDquality)
63 ,fDE(ref.fDE)
64 ,fBackupTrack(0x0)
d9950a5a 65{
66 //
3b57a3f7 67 // Copy constructor
d9950a5a 68 //
69
3b57a3f7 70 for(int ip=0; ip<kNplane; ip++){
71 fTrackletIndex[ip] = ref.fTrackletIndex[ip];
72 fTracklet[ip] = ref.fTracklet[ip];
73 }
74
75 for (Int_t i = 0; i < 3;i++) fBudget[i] = ref.fBudget[i];
76
77 for(Int_t is = 0; is<AliPID::kSPECIES; is++) fPID[is] = ref.fPID[is];
78
79 AliKalmanTrack::SetNumberOfClusters(ref.GetNumberOfClusters());
d9950a5a 80}
81
82//_______________________________________________________________
3b57a3f7 83AliTRDtrackV1::AliTRDtrackV1(const AliESDtrack &t) : AliKalmanTrack()
84 ,fPIDquality(0)
85 ,fDE(0.)
86 ,fBackupTrack(0x0)
d9950a5a 87{
88 //
3b57a3f7 89 // Constructor from AliESDtrack
d9950a5a 90 //
91
3b57a3f7 92 SetLabel(t.GetLabel());
93 SetChi2(0.0);
94 SetMass(t.GetMass());
95 AliKalmanTrack::SetNumberOfClusters(t.GetTRDncls());
96 Int_t ti[kNplane]; t.GetTRDtracklets(&ti[0]);
97 for(int ip=0; ip<kNplane; ip++){
98 fTrackletIndex[ip] = ti[ip] < 0 ? 0xffff : ti[ip];
99 fTracklet[ip] = 0x0;
100 }
101 for(int i =0; i<3; i++) fBudget[i] = 0.;
102
103 Float_t pid = 1./AliPID::kSPECIES;
104 for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid;
105
106 const AliExternalTrackParam *par = &t;
107 if (t.GetStatus() & AliESDtrack::kTRDbackup) {
108 par = t.GetOuterParam();
109 if (!par) {
110 AliError("No backup info!");
111 par = &t;
112 }
113 }
114 Set(par->GetX()
115 ,par->GetAlpha()
116 ,par->GetParameter()
117 ,par->GetCovariance());
118
119 if(t.GetStatus() & AliESDtrack::kTIME) {
120 StartTimeIntegral();
121 Double_t times[10];
122 t.GetIntegratedTimes(times);
123 SetIntegratedTimes(times);
124 SetIntegratedLength(t.GetIntegratedLength());
125 }
d9950a5a 126}
127
d9950a5a 128//_______________________________________________________________
eb38ed55 129AliTRDtrackV1::AliTRDtrackV1(AliTRDseedV1 *trklts, const Double_t p[5], const Double_t cov[15]
3b57a3f7 130 , Double_t x, Double_t alpha) : AliKalmanTrack()
131 ,fPIDquality(0)
132 ,fDE(0.)
133 ,fBackupTrack(0x0)
d9950a5a 134{
0906e73e 135 //
136 // The stand alone tracking constructor
137 // TEMPORARY !!!!!!!!!!!
138 // to check :
139 // 1. covariance matrix
140 // 2. dQdl calculation
141 //
d9950a5a 142
fb17de1f 143 Double_t cnv = GetBz() < 1.e-5 ? 1.e5 : 1.0 / (GetBz() * kB2C);
144 // Double_t cnv = 1.0 / (GetBz() * kB2C);
d9950a5a 145
146 Double_t pp[5] = { p[0]
147 , p[1]
148 , x*p[4] - p[2]
149 , p[3]
150 , p[4]*cnv };
151
152 Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[ 5];
153 Double_t c32 = x*cov[13] - cov[ 8];
154 Double_t c20 = x*cov[10] - cov[ 3];
155 Double_t c21 = x*cov[11] - cov[ 4];
156 Double_t c42 = x*cov[14] - cov[12];
157
158 Double_t cc[15] = { cov[ 0]
159 , cov[ 1], cov[ 2]
160 , c20, c21, c22
161 , cov[ 6], cov[ 7], c32, cov[ 9]
162 , cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv };
ae3fbe1f 163
164 Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt();
165 Double_t p0=TMath::Sign(1/mostProbablePt,pp[4]);
166 Double_t w0=cc[14]/(cc[14] + p0*p0), w1=p0*p0/(cc[14] + p0*p0);
167 pp[4] = w0*p0 + w1*pp[4];
168 cc[10]*=w1; cc[11]*=w1; cc[12]*=w1; cc[13]*=w1; cc[14]*=w1;
169
d9950a5a 170 Set(x,alpha,pp,cc);
41702fec 171 Int_t ncls = 0;
3b57a3f7 172 for(int iplane=0; iplane<kNplane; iplane++){
41702fec 173 fTrackletIndex[iplane] = 0xffff;
174 if(!trklts[iplane].IsOK()) fTracklet[iplane] = 0x0;
175 else{
176 fTracklet[iplane] = new AliTRDseedV1(trklts[iplane]);
177 ncls += fTracklet[iplane]->GetN();
178 }
d9950a5a 179 }
41702fec 180 AliKalmanTrack::SetNumberOfClusters(ncls);
181 for(int i =0; i<3; i++) fBudget[i] = 0.;
182
183 Float_t pid = 1./AliPID::kSPECIES;
184 for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid;
185
d9950a5a 186}
187
bb56afff 188//_______________________________________________________________
3b57a3f7 189AliTRDtrackV1::~AliTRDtrackV1()
bb56afff 190{
3b57a3f7 191 if(fBackupTrack) {
192 delete fBackupTrack;
193 }
194 fBackupTrack = 0x0;
bb56afff 195
3b57a3f7 196 if(TestBit(1)){
197 for(Int_t ip=0; ip<kNplane; ip++){
198 if(fTracklet[ip]) delete fTracklet[ip];
199 fTracklet[ip] = 0x0;
200 }
201 }
202}
203
204//_______________________________________________________________
205Bool_t AliTRDtrackV1::CookLabel(Float_t wrong)
206{
207 // set MC label for this track
208
bb56afff 209 Int_t s[kMAXCLUSTERSPERTRACK][2];
210 for (Int_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
211 s[i][0] = -1;
212 s[i][1] = 0;
213 }
3b57a3f7 214
bb56afff 215 Bool_t labelAdded;
3b57a3f7 216 Int_t label;
217 AliTRDcluster *c = 0x0;
218 for (Int_t ip = 0; ip < kNplane; ip++) {
219 if(fTrackletIndex[ip] == 0xffff) continue;
220 for (Int_t ic = 0; ic < AliTRDseed::knTimebins; ic++) {
221 if(!(c = fTracklet[ip]->GetClusters(ic))) continue;
222 for (Int_t k = 0; k < 3; k++) {
223 label = c->GetLabel(k);
224 labelAdded = kFALSE;
225 Int_t j = 0;
226 if (label >= 0) {
227 while ((!labelAdded) && (j < kMAXCLUSTERSPERTRACK)) {
228 if ((s[j][0] == label) ||
229 (s[j][1] == 0)) {
230 s[j][0] = label;
231 s[j][1]++;
232 labelAdded = kTRUE;
233 }
234 j++;
235 }
236 }
237 }
238 }
239 }
240
bb56afff 241 Int_t max = 0;
242 label = -123456789;
243 for (Int_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
244 if (s[i][1] <= max) continue;
3b57a3f7 245 max = s[i][1];
246 label = s[i][0];
bb56afff 247 }
3b57a3f7 248
bb56afff 249 if ((1. - Float_t(max)/GetNumberOfClusters()) > wrong) label = -label;
3b57a3f7 250
bb56afff 251 SetLabel(label);
3b57a3f7 252
253 return kTRUE;
bb56afff 254}
255
d9950a5a 256//_______________________________________________________________
257Bool_t AliTRDtrackV1::CookPID()
258{
0906e73e 259 //
260 // Cook the PID information
261 //
3b57a3f7 262
263 // Reset the a priori probabilities
264 Double_t pid = 1. / AliPID::kSPECIES;
0906e73e 265 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
3b57a3f7 266 fPID[ispec] = pid;
267 }
268 fPIDquality = 0;
269
270 // steer PID calculation @ tracklet level
271 Double_t *prob = 0x0;
272 for(int ip=0; ip<kNplane; ip++){
273 if(fTrackletIndex[ip] == 0xffff) continue;
274 if(!fTracklet[ip]->IsOK()) continue;
275 if(!(prob = fTracklet[ip]->GetProbability())) return kFALSE;
276
277 Int_t nspec = 0; // quality check of tracklet dEdx
278 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++){
279 if(prob[ispec] < 0.) continue;
280 fPID[ispec] *= prob[ispec];
281 nspec++;
282 }
283 if(!nspec) continue;
284
285 fPIDquality++;
0906e73e 286 }
0906e73e 287
288 // no tracklet found for PID calculations
289 if(!fPIDquality) return kTRUE;
3b57a3f7 290
291 // slot for PID calculation @ track level
292
293
0906e73e 294 // normalize probabilities
295 Double_t probTotal = 0.0;
296 for (Int_t is = 0; is < AliPID::kSPECIES; is++) probTotal += fPID[is];
3b57a3f7 297
298
0906e73e 299 if (probTotal <= 0.0) {
300 AliWarning("The total probability over all species <= 0. This may be caused by some error in the reference data.");
d9950a5a 301 return kFALSE;
302 }
3b57a3f7 303
0906e73e 304 for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) fPID[iSpecies] /= probTotal;
3b57a3f7 305
0906e73e 306 return kTRUE;
d9950a5a 307}
308
3b57a3f7 309//_____________________________________________________________________________
310Double_t AliTRDtrackV1::GetBz() const
0906e73e 311{
312 //
3b57a3f7 313 // Returns Bz component of the magnetic field (kG)
0906e73e 314 //
315
3b57a3f7 316 if (AliTracker::UniformField()) return AliTracker::GetBz();
317
318 Double_t r[3];
319 GetXYZ(r);
320 return AliTracker::GetBz(r);
321}
322
323//_______________________________________________________________
324Int_t AliTRDtrackV1::GetClusterIndex(Int_t id) const
325{
326 Int_t n = 0;
327 for(Int_t ip=0; ip<kNplane; ip++){
328 if(!fTracklet[ip]) continue;
329 if(n+fTracklet[ip]->GetN() < id){
330 n+=fTracklet[ip]->GetN();
331 continue;
332 }
333 for(Int_t ic=34; ic>=0; ic--){
334 if(!fTracklet[ip]->GetClusters(ic)) continue;
335 n++;
336 if(n<id) continue;
337 return fTracklet[ip]->GetIndexes(ic);
338 }
339 }
340 return -1;
0906e73e 341}
d9950a5a 342
343//_______________________________________________________________
344Double_t AliTRDtrackV1::GetPredictedChi2(const AliTRDseedV1 *trklt) const
345{
346 //
0906e73e 347 // Get the predicted chi2
d9950a5a 348 //
3b57a3f7 349
d9950a5a 350 Double_t x = trklt->GetX0();
351 Double_t p[2] = { trklt->GetYat(x)
352 , trklt->GetZat(x) };
353 Double_t cov[3];
3b57a3f7 354 trklt->GetCovAt(x, cov);
355
d9950a5a 356 return AliExternalTrackParam::GetPredictedChi2(p, cov);
3b57a3f7 357}
d9950a5a 358
3b57a3f7 359
360//_____________________________________________________________________________
361void AliTRDtrackV1::MakeBackupTrack()
362{
363 //
364 // Creates a backup track
365 //
366
367 if(fBackupTrack) {
368 fBackupTrack->~AliTRDtrackV1();
369 new(fBackupTrack) AliTRDtrackV1((AliTRDtrackV1&)(*this));
592fdd48 370 return;
3b57a3f7 371 }
372 fBackupTrack = new AliTRDtrackV1((AliTRDtrackV1&)(*this));
d9950a5a 373}
374
3b57a3f7 375//_____________________________________________________________________________
376Int_t AliTRDtrackV1::GetProlongation(Double_t xk, Double_t &y, Double_t &z)
377{
378 //
379 // Find a prolongation at given x
380 // Return 0 if it does not exist
381 //
382
383 Double_t bz = GetBz();
384 if (!AliExternalTrackParam::GetYAt(xk,bz,y)) return 0;
385 if (!AliExternalTrackParam::GetZAt(xk,bz,z)) return 0;
386
387 return 1;
388
389}
390
391//_____________________________________________________________________________
392Bool_t AliTRDtrackV1::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
0906e73e 393{
394 //
3b57a3f7 395 // Propagates this track to a reference plane defined by "xk" [cm]
396 // correcting for the mean crossed material.
0906e73e 397 //
3b57a3f7 398 // "xx0" - thickness/rad.length [units of the radiation length]
399 // "xrho" - thickness*density [g/cm^2]
400 //
0906e73e 401
3b57a3f7 402 if (xk == GetX()) {
403 return kTRUE;
404 }
405
406 Double_t oldX = GetX();
407 Double_t oldY = GetY();
408 Double_t oldZ = GetZ();
409
410 Double_t bz = GetBz();
411
412 if (!AliExternalTrackParam::PropagateTo(xk,bz)) {
413 return kFALSE;
414 }
415
416 Double_t x = GetX();
417 Double_t y = GetY();
418 Double_t z = GetZ();
419
420 if (oldX < xk) {
421 xrho = -xrho;
422 if (IsStartedTimeIntegral()) {
423 Double_t l2 = TMath::Sqrt((x-oldX)*(x-oldX)
424 + (y-oldY)*(y-oldY)
425 + (z-oldZ)*(z-oldZ));
426 Double_t crv = AliExternalTrackParam::GetC(bz);
427 if (TMath::Abs(l2*crv) > 0.0001) {
428 // Make correction for curvature if neccesary
429 l2 = 0.5 * TMath::Sqrt((x-oldX)*(x-oldX)
430 + (y-oldY)*(y-oldY));
431 l2 = 2.0 * TMath::ASin(l2 * crv) / crv;
432 l2 = TMath::Sqrt(l2*l2 + (z-oldZ)*(z-oldZ));
433 }
434 AddTimeStep(l2);
435 }
436 }
437
438 if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0,xrho,GetMass())) {
439 return kFALSE;
440 }
441
442 {
443
444 // Energy losses
445 Double_t p2 = (1.0 + GetTgl()*GetTgl()) / (GetSigned1Pt()*GetSigned1Pt());
446 Double_t beta2 = p2 / (p2 + GetMass()*GetMass());
447 if ((beta2 < 1.0e-10) ||
448 ((5940.0 * beta2/(1.0 - beta2 + 1.0e-10) - beta2) < 0.0)) {
449 return kFALSE;
450 }
451
452 Double_t dE = 0.153e-3 / beta2
453 * (TMath::Log(5940.0 * beta2/(1.0 - beta2 + 1.0e-10)) - beta2)
454 * xrho;
455 fBudget[0] += xrho;
456
457 /*
458 // Suspicious part - think about it ?
459 Double_t kinE = TMath::Sqrt(p2);
460 if (dE > 0.8*kinE) dE = 0.8 * kinE; //
461 if (dE < 0) dE = 0.0; // Not valid region for Bethe bloch
462 */
463
464 fDE += dE;
465
466 /*
467 // Suspicious ! I.B.
468 Double_t sigmade = 0.07 * TMath::Sqrt(TMath::Abs(dE)); // Energy loss fluctuation
469 Double_t sigmac2 = sigmade*sigmade*fC*fC*(p2+GetMass()*GetMass())/(p2*p2);
470 fCcc += sigmac2;
471 fCee += fX*fX * sigmac2;
472 */
473
474 }
475
476 return kTRUE;
0906e73e 477}
3b57a3f7 478
87a7fa94 479//_____________________________________________________________________________
3b57a3f7 480Int_t AliTRDtrackV1::PropagateToR(Double_t r,Double_t step)
87a7fa94 481{
482 //
3b57a3f7 483 // Propagate track to the radial position
484 // Rotation always connected to the last track position
87a7fa94 485 //
486
3b57a3f7 487 Double_t xyz0[3];
488 Double_t xyz1[3];
489 Double_t y;
490 Double_t z;
491
492 Double_t radius = TMath::Sqrt(GetX()*GetX() + GetY()*GetY());
493 // Direction +-
494 Double_t dir = (radius > r) ? -1.0 : 1.0;
495
496 for (Double_t x = radius+dir*step; dir*x < dir*r; x += dir*step) {
497
498 GetXYZ(xyz0);
499 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
500 Rotate(alpha,kTRUE);
501 GetXYZ(xyz0);
502 GetProlongation(x,y,z);
503 xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha);
504 xyz1[1] = x * TMath::Sin(alpha) - y * TMath::Cos(alpha);
505 xyz1[2] = z;
506 Double_t param[7];
507 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
508 if (param[1] <= 0) {
509 param[1] = 100000000;
510 }
511 PropagateTo(x,param[1],param[0]*param[4]);
512
513 }
514
515 GetXYZ(xyz0);
516 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
517 Rotate(alpha,kTRUE);
518 GetXYZ(xyz0);
519 GetProlongation(r,y,z);
520 xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha);
521 xyz1[1] = r * TMath::Sin(alpha) - y * TMath::Cos(alpha);
522 xyz1[2] = z;
523 Double_t param[7];
524 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
525
526 if (param[1] <= 0) {
527 param[1] = 100000000;
87a7fa94 528 }
3b57a3f7 529 PropagateTo(r,param[1],param[0]*param[4]);
530
531 return 0;
532
87a7fa94 533}
534
3b57a3f7 535//_____________________________________________________________________________
536Bool_t AliTRDtrackV1::Rotate(Double_t alpha, Bool_t absolute)
537{
538 //
539 // Rotates track parameters in R*phi plane
540 // if absolute rotation alpha is in global system
541 // otherwise alpha rotation is relative to the current rotation angle
542 //
543
544 if (absolute) alpha -= GetAlpha();
545 //else fNRotate++;
546
547 return AliExternalTrackParam::Rotate(GetAlpha()+alpha);
548}
87a7fa94 549
eb38ed55 550//___________________________________________________________
551void AliTRDtrackV1::SetNumberOfClusters()
552{
553// Calculate the number of clusters attached to this track
554
3b57a3f7 555 Int_t ncls = 0;
556 for(int ip=0; ip<kNplane; ip++){
557 if(fTracklet[ip] && fTrackletIndex[ip] != 0xffff) ncls += fTracklet[ip]->GetN();
558 }
559 AliKalmanTrack::SetNumberOfClusters(ncls);
eb38ed55 560}
561
562
0906e73e 563//_______________________________________________________________
3b57a3f7 564void AliTRDtrackV1::SetOwner()
0906e73e 565{
566 //
567 // Toggle ownership of tracklets
568 //
569
3b57a3f7 570 if(TestBit(1)) return;
571 for (Int_t ip = 0; ip < kNplane; ip++) {
572 if(fTrackletIndex[ip] == 0xffff) continue;
573 fTracklet[ip] = new AliTRDseedV1(*fTracklet[ip]);
574 fTracklet[ip]->SetOwner();
575 }
576 SetBit(1);
0906e73e 577}
578
d9950a5a 579//_______________________________________________________________
3b57a3f7 580void AliTRDtrackV1::SetTracklet(AliTRDseedV1 *trklt, Int_t index)
d9950a5a 581{
582 //
0906e73e 583 // Set the tracklets
d9950a5a 584 //
3b57a3f7 585 Int_t plane = trklt->GetPlane();
41702fec 586 if(fTrackletIndex[plane]==0xffff && fTracklet[plane]){
587 delete fTracklet[plane];
588 }
3b57a3f7 589 fTracklet[plane] = trklt;
590 fTrackletIndex[plane] = index;
d9950a5a 591}
592
593//_______________________________________________________________
0906e73e 594Bool_t AliTRDtrackV1::Update(AliTRDseedV1 *trklt, Double_t chisq)
d9950a5a 595{
596 //
3b57a3f7 597 // Update track and tracklet parameters
d9950a5a 598 //
3b57a3f7 599
0906e73e 600 Double_t x = trklt->GetX0();
d9950a5a 601 Double_t p[2] = { trklt->GetYat(x)
602 , trklt->GetZat(x) };
603 Double_t cov[3];
3b57a3f7 604 trklt->GetCovAt(x, cov);
605
3afdab72 606 // insert systematic uncertainties calibration and misalignment
607 Double_t sys[15];
608 AliTRDReconstructor::RecoParam()->GetSysCovMatrix(sys);
609 cov[0] += (sys[0]*sys[0]);
610 cov[2] += (sys[1]*sys[1]);
611
d9950a5a 612 if(!AliExternalTrackParam::Update(p, cov)) return kFALSE;
3b57a3f7 613
614 AliTRDcluster *c = 0x0;
615 Int_t ic = 0; while(!(c = trklt->GetClusters(ic))) ic++;
616 AliTracker::FillResiduals(this, p, cov, c->GetVolumeId());
617
618
d9950a5a 619 // Register info to track
3b57a3f7 620 SetNumberOfClusters();
d9950a5a 621 SetChi2(GetChi2() + chisq);
3b57a3f7 622
623 // update tracklet
624 trklt->SetMomentum(GetP());
625 trklt->SetSnp(GetSnp());
626 trklt->SetTgl(GetTgl());
627 return kTRUE;
d9950a5a 628}
629
630//_______________________________________________________________
0906e73e 631void AliTRDtrackV1::UpdateESDtrack(AliESDtrack *track)
d9950a5a 632{
633 //
6984f7c1 634 // Update the TRD PID information in the ESD track
d9950a5a 635 //
6984f7c1 636
637 track->SetNumberOfTRDslices(kNslice);
3b57a3f7 638
6984f7c1 639 for (Int_t ip = 0; ip < kNplane; ip++) {
3b57a3f7 640 if(fTrackletIndex[ip] == 0xffff) continue;
641 fTracklet[ip]->CookdEdx(kNslice);
642 Float_t *dedx = fTracklet[ip]->GetdEdx();
643 for (Int_t js = 0; js < kNslice; js++) track->SetTRDslice(dedx[js], ip, js);
6984f7c1 644 }
0906e73e 645
6984f7c1 646 // copy PID to ESD
647 track->SetTRDpid(fPID);
648 track->SetTRDpidQuality(fPIDquality);
d9950a5a 649}