1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 #include "AliESDtrack.h"
20 #include "AliTracker.h"
22 #include "AliTRDtrackV1.h"
23 #include "AliTRDcluster.h"
24 #include "AliTRDcalibDB.h"
25 #include "AliTRDReconstructor.h"
26 #include "AliTRDrecoParam.h"
28 ClassImp(AliTRDtrackV1)
30 ///////////////////////////////////////////////////////////////////////////////
32 // Represents a reconstructed TRD track //
33 // Local TRD Kalman track //
36 // Alex Bercuci <A.Bercuci@gsi.de> //
37 // Markus Fasel <M.Fasel@gsi.de> //
39 ///////////////////////////////////////////////////////////////////////////////
41 //_______________________________________________________________
42 AliTRDtrackV1::AliTRDtrackV1() : AliKalmanTrack()
45 ,fkReconstructor(NULL)
51 // Default constructor
53 //printf("AliTRDtrackV1::AliTRDtrackV1()\n");
55 for(int i =0; i<3; i++) fBudget[i] = 0.;
57 Float_t pid = 1./AliPID::kSPECIES;
58 for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid;
60 for(int ip=0; ip<kNplane; ip++){
61 fTrackletIndex[ip] = 0xffff;
66 //_______________________________________________________________
67 AliTRDtrackV1::AliTRDtrackV1(const AliTRDtrackV1 &ref) : AliKalmanTrack(ref)
70 ,fkReconstructor(ref.fkReconstructor)
79 //printf("AliTRDtrackV1::AliTRDtrackV1(const AliTRDtrackV1 &)\n");
80 SetBit(kOwner, kFALSE);
81 for(int ip=0; ip<kNplane; ip++){
82 fTrackletIndex[ip] = ref.fTrackletIndex[ip];
83 fTracklet[ip] = ref.fTracklet[ip];
85 if(ref.fTrackLow) fTrackLow = new AliExternalTrackParam(*ref.fTrackLow);
86 if(ref.fTrackHigh) fTrackHigh = new AliExternalTrackParam(*ref.fTrackHigh);
88 for (Int_t i = 0; i < 3;i++) fBudget[i] = ref.fBudget[i];
90 for(Int_t is = 0; is<AliPID::kSPECIES; is++) fPID[is] = ref.fPID[is];
92 AliKalmanTrack::SetNumberOfClusters(ref.GetNumberOfClusters());
95 //_______________________________________________________________
96 AliTRDtrackV1::AliTRDtrackV1(const AliESDtrack &t) : AliKalmanTrack()
99 ,fkReconstructor(NULL)
105 // Constructor from AliESDtrack
108 SetLabel(t.GetLabel());
111 SetMass(t.GetMass()/*0.000510*/);
112 AliKalmanTrack::SetNumberOfClusters(t.GetTRDncls());
113 Int_t ti[kNplane]; t.GetTRDtracklets(&ti[0]);
114 for(int ip=0; ip<kNplane; ip++){
115 fTrackletIndex[ip] = ti[ip] < 0 ? 0xffff : ti[ip];
116 fTracklet[ip] = NULL;
118 for(int i =0; i<3; i++) fBudget[i] = 0.;
120 Float_t pid = 1./AliPID::kSPECIES;
121 for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid;
123 const AliExternalTrackParam *par = &t;
124 if (t.GetStatus() & AliESDtrack::kTRDbackup) {
125 par = t.GetOuterParam();
127 AliError("No backup info!");
134 ,par->GetCovariance());
136 if(t.GetStatus() & AliESDtrack::kTIME) {
139 t.GetIntegratedTimes(times);
140 SetIntegratedTimes(times);
141 SetIntegratedLength(t.GetIntegratedLength());
145 //_______________________________________________________________
146 AliTRDtrackV1::AliTRDtrackV1(const AliTRDseedV1 * const trklts, const Double_t p[5], const Double_t cov[15]
147 , Double_t x, Double_t alpha) : AliKalmanTrack()
150 ,fkReconstructor(NULL)
156 // The stand alone tracking constructor
157 // TEMPORARY !!!!!!!!!!!
159 // 1. covariance matrix
160 // 2. dQdl calculation
163 Double_t cnv = GetBz() < 1.e-5 ? 1.e5 : 1.0 / (GetBz() * kB2C);
164 // Double_t cnv = 1.0 / (GetBz() * kB2C);
166 Double_t pp[5] = { p[0]
172 Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[ 5];
173 Double_t c32 = x*cov[13] - cov[ 8];
174 Double_t c20 = x*cov[10] - cov[ 3];
175 Double_t c21 = x*cov[11] - cov[ 4];
176 Double_t c42 = x*cov[14] - cov[12];
178 Double_t cc[15] = { cov[ 0]
181 , cov[ 6], cov[ 7], c32, cov[ 9]
182 , cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv };
184 Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt();
185 Double_t p0=TMath::Sign(1/mostProbablePt,pp[4]);
186 Double_t w0=cc[14]/(cc[14] + p0*p0), w1=p0*p0/(cc[14] + p0*p0);
187 pp[4] = w0*p0 + w1*pp[4];
188 cc[10]*=w1; cc[11]*=w1; cc[12]*=w1; cc[13]*=w1; cc[14]*=w1;
192 for(int iplane=0; iplane<kNplane; iplane++){
193 fTrackletIndex[iplane] = 0xffff;
194 if(!trklts[iplane].IsOK()) fTracklet[iplane] = NULL;
196 fTracklet[iplane] = const_cast<AliTRDseedV1 *>(&trklts[iplane]);
197 ncls += fTracklet[iplane]->GetN();
200 AliKalmanTrack::SetNumberOfClusters(ncls);
201 for(int i =0; i<3; i++) fBudget[i] = 0.;
203 Float_t pid = 1./AliPID::kSPECIES;
204 for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid;
208 //_______________________________________________________________
209 AliTRDtrackV1::~AliTRDtrackV1()
212 //printf("I-AliTRDtrackV1::~AliTRDtrackV1() : Owner[%s]\n", TestBit(kOwner)?"YES":"NO");
214 if(fBackupTrack) delete fBackupTrack; fBackupTrack = NULL;
216 if(fTrackLow) delete fTrackLow; fTrackLow = NULL;
217 if(fTrackHigh) delete fTrackHigh; fTrackHigh = NULL;
219 for(Int_t ip=0; ip<kNplane; ip++){
220 if(TestBit(kOwner) && fTracklet[ip]) delete fTracklet[ip];
221 fTracklet[ip] = NULL;
222 fTrackletIndex[ip] = 0xffff;
226 //_______________________________________________________________
227 Bool_t AliTRDtrackV1::CookLabel(Float_t wrong)
229 // set MC label for this track
230 if(!GetNumberOfClusters()) return kFALSE;
232 Int_t s[kMAXCLUSTERSPERTRACK][2];
233 for (Int_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
240 AliTRDcluster *c = NULL;
241 for (Int_t ip = 0; ip < kNplane; ip++) {
242 if(fTrackletIndex[ip] == 0xffff) continue;
243 for (Int_t ic = 0; ic < AliTRDseedV1::kNclusters; ic++) {
244 if(!(c = fTracklet[ip]->GetClusters(ic))) continue;
245 for (Int_t k = 0; k < 3; k++) {
246 label = c->GetLabel(k);
250 while ((!labelAdded) && (j < kMAXCLUSTERSPERTRACK)) {
251 if ((s[j][0] == label) ||
266 for (Int_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
267 if (s[i][1] <= max) continue;
271 if ((1. - Float_t(max)/GetNumberOfClusters()) > wrong) label = -label;
278 //_______________________________________________________________
279 Bool_t AliTRDtrackV1::CookPID()
282 // Cook the PID information for the track by delegating the omonim function of the tracklets.
283 // Computes the number of tracklets used. The tracklet information are considered independent.
284 // For the moment no global track measurement of PID is performed as for example to estimate
285 // bremsstrahlung probability based on global chi2 of the track.
287 // The status bit AliESDtrack::kTRDpid is set during the call of AliTRDtrackV1::UpdateESDtrack().The PID performance of the
288 //TRD for tracks with 6 tacklets is displayed below.
290 //<img src="TRD/trackPID.gif">
294 /*Reset the a priori probabilities*/
295 Double_t pid = 1. / AliPID::kSPECIES;
296 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) fPID[ispec] = pid;
298 UChar_t fPIDquality = SetNumberOfTrackletsPID(kTRUE);
299 // no tracklet found for PID calculations
300 if(!fPIDquality) return kFALSE;
302 // slot for PID calculation @ track level for bremsstrahlung TODO
304 // normalize probabilities
305 Double_t probTotal = 0.0;
306 for (Int_t is = 0; is < AliPID::kSPECIES; is++) probTotal += fPID[is];
309 if (probTotal <= 0.0) {
310 AliWarning("The total probability over all species <= 0. This may be caused by some error in the reference data.");
314 for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) fPID[iSpecies] /= probTotal;
319 //___________________________________________________________
320 UChar_t AliTRDtrackV1::GetNumberOfTrackletsPID() const
322 // Retrieve number of tracklets used for PID calculation.
325 Float_t *prob = NULL;
326 for(int ip=0; ip<kNplane; ip++){
327 if(fTrackletIndex[ip] == 0xffff) continue;
328 if(!fTracklet[ip]->IsOK()) continue;
329 if(!(prob = fTracklet[ip]->GetProbability(kFALSE))) continue;
331 Int_t nspec = 0; // quality check of tracklet dEdx
332 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++){
333 if(prob[ispec] < 0.) continue;
338 fTracklet[ip]->SetPID();
344 //___________________________________________________________
345 UChar_t AliTRDtrackV1::SetNumberOfTrackletsPID(Bool_t recalc)
347 // Retrieve number of tracklets used for PID calculation. // Recalculated PID at tracklet level by quering the PID DB.
349 UChar_t fPIDquality = 0;
351 // steer PID calculation @ tracklet level
352 Float_t *prob = NULL;
353 for(int ip=0; ip<kNplane; ip++){
354 if(fTrackletIndex[ip] == 0xffff) continue;
355 if(!fTracklet[ip]->IsOK()) continue;
356 if(!(prob = fTracklet[ip]->GetProbability(recalc))) return 0;
358 Int_t nspec = 0; // quality check of tracklet dEdx
359 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++){
360 if(prob[ispec] < 0.) continue;
361 fPID[ispec] *= prob[ispec];
371 //_______________________________________________________________
372 AliTRDcluster* AliTRDtrackV1::GetCluster(Int_t id)
374 // Get the cluster at a certain position in the track
376 for(Int_t ip=0; ip<kNplane; ip++){
377 if(!fTracklet[ip]) continue;
378 if(n+fTracklet[ip]->GetN() <= id){
379 n+=fTracklet[ip]->GetN();
382 AliTRDcluster *c = NULL;
383 for(Int_t ic=AliTRDseedV1::kNclusters; ic--;){
384 if(!(c = fTracklet[ip]->GetClusters(ic))) continue;
386 if(n<id){n++; continue;}
393 //_______________________________________________________________
394 Int_t AliTRDtrackV1::GetClusterIndex(Int_t id) const
396 // Get the cluster index at a certain position in the track
398 for(Int_t ip=0; ip<kNplane; ip++){
399 if(!fTracklet[ip]) continue;
400 if(n+fTracklet[ip]->GetN() <= id){
401 n+=fTracklet[ip]->GetN();
404 AliTRDcluster *c = NULL;
405 for(Int_t ic=AliTRDseedV1::kNclusters; ic--;){
406 if(!(c = fTracklet[ip]->GetClusters(ic))) continue;
408 if(n<id){n++; continue;}
409 return fTracklet[ip]->GetIndexes(ic);
415 //_______________________________________________________________
416 Double_t AliTRDtrackV1::GetPredictedChi2(const AliTRDseedV1 *trklt, Double_t *cov) const
418 // Compute chi2 between tracklet and track. The value is calculated at the radial position of the track
419 // equal to the reference radial position of the tracklet (see AliTRDseedV1)
421 // The chi2 estimator is computed according to the following formula
423 // #chi^{2}=(X_{trklt}-X_{track})(C_{trklt}+C_{track})^{-1}(X_{trklt}-X_{track})^{T}
425 // where X=(y z), the position of the track/tracklet in the yz plane
428 Double_t p[2] = { trklt->GetY(), trklt->GetZ()};
429 trklt->GetCovAt(trklt->GetX(), cov);
430 return AliExternalTrackParam::GetPredictedChi2(p, cov);
433 //_______________________________________________________________
434 Int_t AliTRDtrackV1::GetSector() const
436 return Int_t(GetAlpha()/AliTRDgeometry::GetAlpha() + (GetAlpha()>0. ? 0 : AliTRDgeometry::kNsector));
439 //_______________________________________________________________
440 Bool_t AliTRDtrackV1::IsEqual(const TObject *o) const
442 // Checks whether two tracks are equal
443 if (!o) return kFALSE;
444 const AliTRDtrackV1 *inTrack = dynamic_cast<const AliTRDtrackV1*>(o);
445 if (!inTrack) return kFALSE;
447 //if ( fPIDquality != inTrack->GetPIDquality() ) return kFALSE;
449 for(Int_t i = 0; i < AliPID::kSPECIES; i++){
450 if ( fPID[i] != inTrack->GetPID(i) ) return kFALSE;
453 for (Int_t i = 0; i < 3; i++){
454 if ( fBudget[i] != inTrack->GetBudget(i) ) return kFALSE;
456 if ( fDE != inTrack->GetEdep() ) return kFALSE;
457 if ( fFakeRatio != inTrack->GetFakeRatio() ) return kFALSE;
458 if ( fChi2 != inTrack->GetChi2() ) return kFALSE;
459 if ( fMass != inTrack->GetMass() ) return kFALSE;
460 if ( fLab != inTrack->GetLabel() ) return kFALSE;
461 if ( fN != inTrack->GetNumberOfClusters() ) return kFALSE;
462 if ( AliKalmanTrack::GetIntegratedLength() != inTrack->GetIntegratedLength() ) return kFALSE;
464 if ( GetX() != inTrack->GetX() ) return kFALSE;
465 if ( GetAlpha() != inTrack->GetAlpha() ) return kFALSE;
466 const Double_t *inP = inTrack->GetParameter();
467 const Double_t *curP = GetParameter();
468 for (Int_t i = 0; i < 5; i++){
469 if ( curP[i] != inP[i]) return kFALSE;
471 const Double_t *inC = inTrack->GetCovariance();
472 const Double_t *curC = GetCovariance();
473 for (Int_t i = 0; i < 15; i++){
474 if ( curC[i] != inC[i]) return kFALSE;
477 for (Int_t iTracklet = 0; iTracklet < kNplane; iTracklet++){
478 AliTRDseedV1 *curTracklet = fTracklet[iTracklet];
479 AliTRDseedV1 *inTracklet = inTrack->GetTracklet(iTracklet);
480 if (curTracklet && inTracklet){
481 if (! curTracklet->IsEqual(inTracklet) ) {
482 curTracklet->Print();
487 // if one tracklet exists, and corresponding
488 // in other track doesn't - return kFALSE
489 if(inTracklet || curTracklet) return kFALSE;
496 //_______________________________________________________________
497 Bool_t AliTRDtrackV1::IsElectron() const
499 if(GetPID(0) > fkReconstructor->GetRecoParam()->GetPIDThreshold(GetP())) return kTRUE;
504 //_____________________________________________________________________________
505 void AliTRDtrackV1::MakeBackupTrack()
508 // Creates a backup track
512 fBackupTrack->~AliTRDtrackV1();
513 new(fBackupTrack) AliTRDtrackV1((AliTRDtrackV1&)(*this));
516 fBackupTrack = new AliTRDtrackV1((AliTRDtrackV1&)(*this));
519 //_____________________________________________________________________________
520 Int_t AliTRDtrackV1::GetProlongation(Double_t xk, Double_t &y, Double_t &z)
523 // Find a prolongation at given x
524 // Return -1 if it does not exist
527 Double_t bz = GetBz();
528 if (!AliExternalTrackParam::GetYAt(xk,bz,y)) return -1;
529 if (!AliExternalTrackParam::GetZAt(xk,bz,z)) return -1;
535 //_____________________________________________________________________________
536 Bool_t AliTRDtrackV1::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
539 // Propagates this track to a reference plane defined by "xk" [cm]
540 // correcting for the mean crossed material.
542 // "xx0" - thickness/rad.length [units of the radiation length]
543 // "xrho" - thickness*density [g/cm^2]
550 Double_t oldX = GetX();
551 Double_t oldY = GetY();
552 Double_t oldZ = GetZ();
554 Double_t bz = GetBz();
556 if (!AliExternalTrackParam::PropagateTo(xk,bz)) {
566 if (IsStartedTimeIntegral()) {
567 Double_t l2 = TMath::Sqrt((x-oldX)*(x-oldX)
569 + (z-oldZ)*(z-oldZ));
570 Double_t crv = AliExternalTrackParam::GetC(bz);
571 if (TMath::Abs(l2*crv) > 0.0001) {
572 // Make correction for curvature if neccesary
573 l2 = 0.5 * TMath::Sqrt((x-oldX)*(x-oldX)
574 + (y-oldY)*(y-oldY));
575 l2 = 2.0 * TMath::ASin(l2 * crv) / crv;
576 l2 = TMath::Sqrt(l2*l2 + (z-oldZ)*(z-oldZ));
582 if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0, xrho, GetMass())) return kFALSE;
588 Double_t p2 = (1.0 + GetTgl()*GetTgl()) / (GetSigned1Pt()*GetSigned1Pt());
589 Double_t beta2 = p2 / (p2 + GetMass()*GetMass());
590 if ((beta2 < 1.0e-10) ||
591 ((5940.0 * beta2/(1.0 - beta2 + 1.0e-10) - beta2) < 0.0)) {
595 Double_t dE = 0.153e-3 / beta2
596 * (TMath::Log(5940.0 * beta2/(1.0 - beta2 + 1.0e-10)) - beta2)
601 // Suspicious part - think about it ?
602 Double_t kinE = TMath::Sqrt(p2);
603 if (dE > 0.8*kinE) dE = 0.8 * kinE; //
604 if (dE < 0) dE = 0.0; // Not valid region for Bethe bloch
611 Double_t sigmade = 0.07 * TMath::Sqrt(TMath::Abs(dE)); // Energy loss fluctuation
612 Double_t sigmac2 = sigmade*sigmade*fC*fC*(p2+GetMass()*GetMass())/(p2*p2);
614 fCee += fX*fX * sigmac2;
622 //_____________________________________________________________________________
623 Int_t AliTRDtrackV1::PropagateToR(Double_t r,Double_t step)
626 // Propagate track to the radial position
627 // Rotation always connected to the last track position
635 Double_t radius = TMath::Sqrt(GetX()*GetX() + GetY()*GetY());
637 Double_t dir = (radius > r) ? -1.0 : 1.0;
639 for (Double_t x = radius+dir*step; dir*x < dir*r; x += dir*step) {
642 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
645 if(GetProlongation(x,y,z)<0) return -1;
646 xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha);
647 xyz1[1] = x * TMath::Sin(alpha) - y * TMath::Cos(alpha);
650 if(AliTracker::MeanMaterialBudget(xyz0,xyz1,param)<=0.) return -1;
652 param[1] = 100000000;
654 PropagateTo(x,param[1],param[0]*param[4]);
659 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
662 if(GetProlongation(r,y,z)<0) return -1;
663 xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha);
664 xyz1[1] = r * TMath::Sin(alpha) - y * TMath::Cos(alpha);
667 if(AliTracker::MeanMaterialBudget(xyz0,xyz1,param) <= 0.) return -1;
670 param[1] = 100000000;
672 PropagateTo(r,param[1],param[0]*param[4]);
678 //_____________________________________________________________________________
679 void AliTRDtrackV1::Print(Option_t *o) const
681 // Print track status
682 AliInfo(Form("PID [%4.1f %4.1f %4.1f %4.1f %4.1f]", 1.E2*fPID[0], 1.E2*fPID[1], 1.E2*fPID[2], 1.E2*fPID[3], 1.E2*fPID[4]));
683 AliInfo(Form("Material[%5.2f %5.2f %5.2f]", fBudget[0], fBudget[1], fBudget[2]));
685 AliInfo(Form("x[%7.2f] t[%7.4f] alpha[%f] mass[%f]", GetX(), GetIntegratedLength(), GetAlpha(), fMass));
686 AliInfo(Form("Ntr[%1d] NtrPID[%1d] Ncl[%3d] lab[%3d]", GetNumberOfTracklets(), GetNumberOfTrackletsPID(), fN, fLab));
688 if(strcmp(o, "a")!=0) return;
690 const Double_t *curP = GetParameter();
691 for (Int_t i = 0; i < 5; i++) printf("%7.2f ", curP[i]);
695 const Double_t *curC = GetCovariance();
696 for (Int_t i = 0, j=4, k=0; i<15; i++, k++){
697 printf("%7.2f ", curC[i]);
704 for(Int_t ip=0; ip<kNplane; ip++){
705 if(!fTracklet[ip]) continue;
706 fTracklet[ip]->Print(o);
711 //_____________________________________________________________________________
712 Bool_t AliTRDtrackV1::Rotate(Double_t alpha, Bool_t absolute)
715 // Rotates track parameters in R*phi plane
716 // if absolute rotation alpha is in global system
717 // otherwise alpha rotation is relative to the current rotation angle
720 if (absolute) alpha -= GetAlpha();
723 return AliExternalTrackParam::Rotate(GetAlpha()+alpha);
726 //___________________________________________________________
727 void AliTRDtrackV1::SetNumberOfClusters()
729 // Calculate the number of clusters attached to this track
732 for(int ip=0; ip<kNplane; ip++){
733 if(fTracklet[ip] && fTrackletIndex[ip] != 0xffff) ncls += fTracklet[ip]->GetN();
735 AliKalmanTrack::SetNumberOfClusters(ncls);
739 //_______________________________________________________________
740 void AliTRDtrackV1::SetOwner()
743 // Toggle ownership of tracklets
746 if(TestBit(kOwner)) return;
747 for (Int_t ip = 0; ip < kNplane; ip++) {
748 if(fTrackletIndex[ip] == 0xffff) continue;
749 fTracklet[ip] = new AliTRDseedV1(*fTracklet[ip]);
750 fTracklet[ip]->SetOwner();
755 //_______________________________________________________________
756 void AliTRDtrackV1::SetTracklet(AliTRDseedV1 *const trklt, Int_t index)
761 Int_t plane = trklt->GetPlane();
763 fTracklet[plane] = trklt;
764 fTrackletIndex[plane] = index;
767 //_______________________________________________________________
768 void AliTRDtrackV1::SetTrackLow()
770 const AliExternalTrackParam *op = dynamic_cast<const AliExternalTrackParam*>(this);
771 fTrackLow = fTrackLow ? new(fTrackLow) AliExternalTrackParam(*op) : new AliExternalTrackParam(*op);
774 //_______________________________________________________________
775 void AliTRDtrackV1::SetTrackHigh(const AliExternalTrackParam *op)
777 if(!op) op = dynamic_cast<const AliExternalTrackParam*>(this);
778 fTrackHigh = fTrackHigh ? new(fTrackHigh) AliExternalTrackParam(*op) : new AliExternalTrackParam(*op);
781 //_______________________________________________________________
782 void AliTRDtrackV1::UnsetTracklet(Int_t plane)
784 if(plane<0 && plane >= kNplane) return;
785 fTrackletIndex[plane] = 0xffff;
786 fTracklet[plane] = NULL;
790 //_______________________________________________________________
791 Bool_t AliTRDtrackV1::Update(Double_t *p, Double_t *cov, Double_t chi2)
796 if(!AliExternalTrackParam::Update(p, cov)) return kFALSE;
798 // Register info to track
799 SetNumberOfClusters();
800 SetChi2(GetChi2() + chi2);
804 //_______________________________________________________________
805 void AliTRDtrackV1::UpdateESDtrack(AliESDtrack *track)
808 // Update the TRD PID information in the ESD track
811 Int_t nslices = fkReconstructor->IsEightSlices() ? (Int_t)AliTRDpidUtil::kNNslices : (Int_t)AliTRDpidUtil::kLQslices;
812 // number of tracklets used for PID calculation
813 UChar_t nPID = GetNumberOfTrackletsPID();
814 // number of tracklets attached to the track
815 UChar_t nTrk = GetNumberOfTracklets();
816 // pack the two numbers together and store them in the ESD
817 track->SetTRDntracklets(nPID | (nTrk<<3));
818 // allocate space to store raw PID signals dEdx & momentum
819 track->SetNumberOfTRDslices((nslices+2)*AliTRDgeometry::kNlayer);
821 Float_t p, sp; Double_t spd;
822 for (Int_t ip = 0; ip < kNplane; ip++) {
823 if(fTrackletIndex[ip] == 0xffff) continue;
824 if(!fTracklet[ip]->HasPID()) continue;
825 const Float_t *dedx = fTracklet[ip]->GetdEdx();
826 for (Int_t js = 0; js < nslices; js++, dedx++) track->SetTRDslice(*dedx, ip, js);
827 p = fTracklet[ip]->GetMomentum(&sp); spd = sp;
828 track->SetTRDmomentum(p, ip, &spd);
830 // store PID probabilities
831 track->SetTRDpid(fPID);