]>
Commit | Line | Data |
---|---|---|
93fc2389 | 1 | |
d9950a5a | 2 | /************************************************************************** |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
17 | /* $Id$ */ | |
18 | ||
203967fc | 19 | #include "AliLog.h" |
eb38ed55 | 20 | #include "AliESDtrack.h" |
41880fac | 21 | #include "AliTracker.h" |
eb38ed55 | 22 | |
d9950a5a | 23 | #include "AliTRDtrackV1.h" |
24 | #include "AliTRDcluster.h" | |
25 | #include "AliTRDcalibDB.h" | |
3afdab72 | 26 | #include "AliTRDReconstructor.h" |
9dcc64cc | 27 | #include "AliTRDPIDResponse.h" |
d9950a5a | 28 | #include "AliTRDrecoParam.h" |
29 | ||
d9950a5a | 30 | ClassImp(AliTRDtrackV1) |
31 | ||
0906e73e | 32 | /////////////////////////////////////////////////////////////////////////////// |
33 | // // | |
34 | // Represents a reconstructed TRD track // | |
35 | // Local TRD Kalman track // | |
36 | // // | |
37 | // Authors: // | |
38 | // Alex Bercuci <A.Bercuci@gsi.de> // | |
39 | // Markus Fasel <M.Fasel@gsi.de> // | |
40 | // // | |
41 | /////////////////////////////////////////////////////////////////////////////// | |
d9950a5a | 42 | |
43 | //_______________________________________________________________ | |
3b57a3f7 | 44 | AliTRDtrackV1::AliTRDtrackV1() : AliKalmanTrack() |
eb2b4f91 | 45 | ,fStatus(0) |
352cef8f | 46 | ,fESDid(0) |
3b57a3f7 | 47 | ,fDE(0.) |
4d6aee34 | 48 | ,fkReconstructor(NULL) |
49 | ,fBackupTrack(NULL) | |
50 | ,fTrackLow(NULL) | |
51 | ,fTrackHigh(NULL) | |
0906e73e | 52 | { |
d9950a5a | 53 | // |
54 | // Default constructor | |
55 | // | |
6e49cfdb | 56 | //printf("AliTRDtrackV1::AliTRDtrackV1()\n"); |
e44586fb | 57 | |
3b57a3f7 | 58 | for(int i =0; i<3; i++) fBudget[i] = 0.; |
59 | ||
60 | Float_t pid = 1./AliPID::kSPECIES; | |
61 | for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid; | |
62 | ||
63 | for(int ip=0; ip<kNplane; ip++){ | |
17896e82 | 64 | fTrackletIndex[ip] = -1; |
4d6aee34 | 65 | fTracklet[ip] = NULL; |
3b57a3f7 | 66 | } |
d9950a5a | 67 | } |
68 | ||
69 | //_______________________________________________________________ | |
3b57a3f7 | 70 | AliTRDtrackV1::AliTRDtrackV1(const AliTRDtrackV1 &ref) : AliKalmanTrack(ref) |
eb2b4f91 | 71 | ,fStatus(ref.fStatus) |
352cef8f | 72 | ,fESDid(ref.fESDid) |
3b57a3f7 | 73 | ,fDE(ref.fDE) |
4d6aee34 | 74 | ,fkReconstructor(ref.fkReconstructor) |
75 | ,fBackupTrack(NULL) | |
76 | ,fTrackLow(NULL) | |
77 | ,fTrackHigh(NULL) | |
d9950a5a | 78 | { |
79 | // | |
3b57a3f7 | 80 | // Copy constructor |
d9950a5a | 81 | // |
82 | ||
6e49cfdb | 83 | //printf("AliTRDtrackV1::AliTRDtrackV1(const AliTRDtrackV1 &)\n"); |
29b87567 | 84 | SetBit(kOwner, kFALSE); |
3b57a3f7 | 85 | for(int ip=0; ip<kNplane; ip++){ |
86 | fTrackletIndex[ip] = ref.fTrackletIndex[ip]; | |
87 | fTracklet[ip] = ref.fTracklet[ip]; | |
88 | } | |
e3cf3d02 | 89 | if(ref.fTrackLow) fTrackLow = new AliExternalTrackParam(*ref.fTrackLow); |
90 | if(ref.fTrackHigh) fTrackHigh = new AliExternalTrackParam(*ref.fTrackHigh); | |
91 | ||
3b57a3f7 | 92 | for (Int_t i = 0; i < 3;i++) fBudget[i] = ref.fBudget[i]; |
93 | ||
94 | for(Int_t is = 0; is<AliPID::kSPECIES; is++) fPID[is] = ref.fPID[is]; | |
95 | ||
96 | AliKalmanTrack::SetNumberOfClusters(ref.GetNumberOfClusters()); | |
d9950a5a | 97 | } |
98 | ||
99 | //_______________________________________________________________ | |
3b57a3f7 | 100 | AliTRDtrackV1::AliTRDtrackV1(const AliESDtrack &t) : AliKalmanTrack() |
eb2b4f91 | 101 | ,fStatus(0) |
352cef8f | 102 | ,fESDid(0) |
3b57a3f7 | 103 | ,fDE(0.) |
4d6aee34 | 104 | ,fkReconstructor(NULL) |
105 | ,fBackupTrack(NULL) | |
106 | ,fTrackLow(NULL) | |
107 | ,fTrackHigh(NULL) | |
d9950a5a | 108 | { |
109 | // | |
3b57a3f7 | 110 | // Constructor from AliESDtrack |
d9950a5a | 111 | // |
112 | ||
352cef8f | 113 | SetESDid(t.GetID()); |
3b57a3f7 | 114 | SetLabel(t.GetLabel()); |
115 | SetChi2(0.0); | |
0b433f72 | 116 | |
35315297 | 117 | SetMass(t.GetMass(kTRUE)); |
3b57a3f7 | 118 | AliKalmanTrack::SetNumberOfClusters(t.GetTRDncls()); |
17896e82 | 119 | Int_t ti[]={-1, -1, -1, -1, -1, -1}; t.GetTRDtracklets(&ti[0]); |
3b57a3f7 | 120 | for(int ip=0; ip<kNplane; ip++){ |
17896e82 | 121 | fTrackletIndex[ip] = ti[ip]; |
4d6aee34 | 122 | fTracklet[ip] = NULL; |
3b57a3f7 | 123 | } |
124 | for(int i =0; i<3; i++) fBudget[i] = 0.; | |
125 | ||
126 | Float_t pid = 1./AliPID::kSPECIES; | |
127 | for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid; | |
128 | ||
129 | const AliExternalTrackParam *par = &t; | |
130 | if (t.GetStatus() & AliESDtrack::kTRDbackup) { | |
131 | par = t.GetOuterParam(); | |
132 | if (!par) { | |
133 | AliError("No backup info!"); | |
134 | par = &t; | |
135 | } | |
136 | } | |
137 | Set(par->GetX() | |
138 | ,par->GetAlpha() | |
139 | ,par->GetParameter() | |
140 | ,par->GetCovariance()); | |
141 | ||
142 | if(t.GetStatus() & AliESDtrack::kTIME) { | |
143 | StartTimeIntegral(); | |
144 | Double_t times[10]; | |
145 | t.GetIntegratedTimes(times); | |
146 | SetIntegratedTimes(times); | |
147 | SetIntegratedLength(t.GetIntegratedLength()); | |
148 | } | |
d9950a5a | 149 | } |
150 | ||
d9950a5a | 151 | //_______________________________________________________________ |
e17f4785 | 152 | AliTRDtrackV1::AliTRDtrackV1(AliTRDseedV1 * const trklts, const Double_t p[5], const Double_t cov[15] |
3b57a3f7 | 153 | , Double_t x, Double_t alpha) : AliKalmanTrack() |
eb2b4f91 | 154 | ,fStatus(0) |
352cef8f | 155 | ,fESDid(0) |
3b57a3f7 | 156 | ,fDE(0.) |
4d6aee34 | 157 | ,fkReconstructor(NULL) |
158 | ,fBackupTrack(NULL) | |
159 | ,fTrackLow(NULL) | |
160 | ,fTrackHigh(NULL) | |
d9950a5a | 161 | { |
0906e73e | 162 | // |
163 | // The stand alone tracking constructor | |
164 | // TEMPORARY !!!!!!!!!!! | |
165 | // to check : | |
166 | // 1. covariance matrix | |
167 | // 2. dQdl calculation | |
168 | // | |
d9950a5a | 169 | |
68f9b6bd | 170 | Double_t b(GetBz()); |
171 | Double_t cnv = (TMath::Abs(b) < 1.e-5) ? 1.e5 : 1./GetBz()/kB2C; | |
172 | ||
d9950a5a | 173 | Double_t pp[5] = { p[0] |
68f9b6bd | 174 | , p[1] |
175 | , p[2] | |
176 | , p[3] | |
177 | , p[4]*cnv }; | |
178 | ||
d9950a5a | 179 | Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[ 5]; |
180 | Double_t c32 = x*cov[13] - cov[ 8]; | |
181 | Double_t c20 = x*cov[10] - cov[ 3]; | |
182 | Double_t c21 = x*cov[11] - cov[ 4]; | |
183 | Double_t c42 = x*cov[14] - cov[12]; | |
68f9b6bd | 184 | |
d9950a5a | 185 | Double_t cc[15] = { cov[ 0] |
186 | , cov[ 1], cov[ 2] | |
187 | , c20, c21, c22 | |
188 | , cov[ 6], cov[ 7], c32, cov[ 9] | |
189 | , cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv }; | |
68f9b6bd | 190 | |
ae3fbe1f | 191 | Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt(); |
192 | Double_t p0=TMath::Sign(1/mostProbablePt,pp[4]); | |
193 | Double_t w0=cc[14]/(cc[14] + p0*p0), w1=p0*p0/(cc[14] + p0*p0); | |
68f9b6bd | 194 | AliDebug(3, Form("Pt mixing : w0[%4.2f] pt0[%5.3f] w1[%4.2f] pt[%5.3f]", w0, 1./p0, w1, 1./pp[4])); |
195 | ||
ae3fbe1f | 196 | pp[4] = w0*p0 + w1*pp[4]; |
197 | cc[10]*=w1; cc[11]*=w1; cc[12]*=w1; cc[13]*=w1; cc[14]*=w1; | |
68f9b6bd | 198 | Set(x,alpha,pp,cc); |
0217fcd0 | 199 | AliDebug(2, Form("Init @ x[%6.2f] pt[%5.3f]", x, 1./pp[4])); |
41702fec | 200 | Int_t ncls = 0; |
68f9b6bd | 201 | for(int iplane=0; iplane<kNplane; iplane++){ |
17896e82 | 202 | fTrackletIndex[iplane] = -1; |
68f9b6bd | 203 | if(!trklts[iplane].IsOK()) fTracklet[iplane] = NULL; |
41702fec | 204 | else{ |
e17f4785 | 205 | fTracklet[iplane] = &trklts[iplane]; |
41702fec | 206 | ncls += fTracklet[iplane]->GetN(); |
207 | } | |
68f9b6bd | 208 | } |
41702fec | 209 | AliKalmanTrack::SetNumberOfClusters(ncls); |
210 | for(int i =0; i<3; i++) fBudget[i] = 0.; | |
211 | ||
212 | Float_t pid = 1./AliPID::kSPECIES; | |
213 | for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid; | |
d9950a5a | 214 | } |
215 | ||
bb56afff | 216 | //_______________________________________________________________ |
3b57a3f7 | 217 | AliTRDtrackV1::~AliTRDtrackV1() |
bb56afff | 218 | { |
4d8f1bd9 | 219 | // Clean up all objects allocated by the track during its lifetime. |
220 | AliDebug(2, Form("Deleting track[%d]\n fBackupTrack[%p] fTrackLow[%p] fTrackHigh[%p] Owner[%c].", fESDid, (void*)fBackupTrack, (void*)fTrackLow, (void*)fTrackHigh, TestBit(kOwner)?'y':'n')); | |
76b60503 | 221 | |
4d6aee34 | 222 | if(fBackupTrack) delete fBackupTrack; fBackupTrack = NULL; |
e3cf3d02 | 223 | |
4d6aee34 | 224 | if(fTrackLow) delete fTrackLow; fTrackLow = NULL; |
225 | if(fTrackHigh) delete fTrackHigh; fTrackHigh = NULL; | |
bb56afff | 226 | |
76b60503 | 227 | for(Int_t ip=0; ip<kNplane; ip++){ |
228 | if(TestBit(kOwner) && fTracklet[ip]) delete fTracklet[ip]; | |
4d6aee34 | 229 | fTracklet[ip] = NULL; |
17896e82 | 230 | fTrackletIndex[ip] = -1; |
3b57a3f7 | 231 | } |
232 | } | |
233 | ||
e08a5492 | 234 | //_______________________________________________________________ |
235 | AliTRDtrackV1 &AliTRDtrackV1::operator=(const AliTRDtrackV1 &t) | |
236 | { | |
237 | // | |
238 | // Assignment operator | |
239 | // | |
240 | ||
241 | if (this != &t) { | |
5c5d503a | 242 | AliKalmanTrack::operator=(t); |
e08a5492 | 243 | ((AliTRDtrackV1 &) t).Copy(*this); |
244 | } | |
245 | ||
246 | return *this; | |
247 | ||
248 | } | |
249 | ||
250 | //_____________________________________________________________________________ | |
251 | void AliTRDtrackV1::Copy(TObject &t) const | |
252 | { | |
253 | // | |
254 | // Copy function | |
255 | // | |
256 | ||
257 | ((AliTRDtrackV1 &) t).fStatus = fStatus; | |
258 | ((AliTRDtrackV1 &) t).fESDid = fESDid; | |
259 | ((AliTRDtrackV1 &) t).fDE = fDE; | |
260 | ((AliTRDtrackV1 &) t).fkReconstructor = fkReconstructor; | |
261 | ((AliTRDtrackV1 &) t).fBackupTrack = 0x0; | |
262 | ((AliTRDtrackV1 &) t).fTrackLow = 0x0; | |
263 | ((AliTRDtrackV1 &) t).fTrackHigh = 0x0; | |
264 | ||
265 | for(Int_t ip = 0; ip < kNplane; ip++) { | |
266 | ((AliTRDtrackV1 &) t).fTrackletIndex[ip] = fTrackletIndex[ip]; | |
267 | ((AliTRDtrackV1 &) t).fTracklet[ip] = fTracklet[ip]; | |
268 | } | |
269 | if (fTrackLow) { | |
270 | ((AliTRDtrackV1 &) t).fTrackLow = new AliExternalTrackParam(*fTrackLow); | |
271 | } | |
272 | if (fTrackHigh){ | |
273 | ((AliTRDtrackV1 &) t).fTrackHigh = new AliExternalTrackParam(*fTrackHigh); | |
274 | } | |
275 | ||
276 | for (Int_t i = 0; i < 3; i++) { | |
277 | ((AliTRDtrackV1 &) t).fBudget[i] = fBudget[i]; | |
278 | } | |
279 | for (Int_t is = 0; is < AliPID::kSPECIES; is++) { | |
280 | ((AliTRDtrackV1 &) t).fPID[is] = fPID[is]; | |
281 | } | |
282 | ||
283 | } | |
284 | ||
3b57a3f7 | 285 | //_______________________________________________________________ |
e73baf29 | 286 | Int_t AliTRDtrackV1::CookLabel(Float_t wrong, Int_t *labs, Float_t *freq) |
3b57a3f7 | 287 | { |
e73baf29 | 288 | // Set MC label for this track |
289 | // On demand i.e. if arrays "labs" and "freq" are allocated by user returns : | |
290 | // nlabs = the no of distinct labels | |
291 | // labs = array of distinct labels in decreasing order of frequency | |
292 | // freq = frequency of each label in decreasing order | |
bb2db46c | 293 | |
e73baf29 | 294 | Int_t ncl(0); |
295 | if(!(ncl = GetNumberOfClusters())) return 0; | |
296 | ||
297 | Int_t s[2][kMAXCLUSTERSPERTRACK]; | |
bb56afff | 298 | for (Int_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) { |
e73baf29 | 299 | s[0][i] = -1; |
300 | s[1][i] = 0; | |
bb56afff | 301 | } |
e73baf29 | 302 | |
303 | Int_t label(-123456789), nlabels(0); | |
304 | AliTRDcluster *c(NULL); | |
305 | for (Int_t ip(0); ip < AliTRDgeometry::kNlayer; ip++) { | |
68f9b6bd | 306 | if(fTrackletIndex[ip]<0 || !fTracklet[ip]) continue; |
e73baf29 | 307 | for (Int_t ic(0); ic < AliTRDseedV1::kNclusters; ic++) { |
3b57a3f7 | 308 | if(!(c = fTracklet[ip]->GetClusters(ic))) continue; |
e73baf29 | 309 | for (Int_t k(0); k < 3; k++) { |
310 | if ((label = c->GetLabel(k)) < 0) continue; | |
311 | Int_t j(0); | |
312 | while(j < kMAXCLUSTERSPERTRACK){ | |
313 | if(s[0][j]!=label && s[1][j]!=0){j++; continue;} | |
314 | if(!s[1][j]) nlabels++; | |
315 | s[0][j] = label; s[1][j]++; | |
316 | break; | |
3b57a3f7 | 317 | } |
318 | } | |
319 | } | |
320 | } | |
e73baf29 | 321 | //printf(" Found %4d labels\n", nlabels); |
322 | Float_t prob(1.); | |
323 | if(!nlabels){ | |
324 | AliError(Form("No MC labels found for track %d.", fESDid)); | |
325 | return 0; | |
326 | } else if(nlabels==1) { | |
327 | label = s[0][0]; | |
328 | if(labs && freq){labs[0]=label; freq[0]=1.;} | |
329 | } else { | |
330 | Int_t idx[kMAXCLUSTERSPERTRACK]; | |
331 | TMath::Sort(nlabels, s[1], idx); | |
332 | label = s[0][idx[0]]; prob = s[1][idx[0]]/Float_t(ncl); | |
333 | if(labs && freq){ | |
334 | for (Int_t i(0); i<nlabels; i++){ | |
335 | labs[i] = s[0][idx[i]]; | |
336 | freq[i] = s[1][idx[i]]/Float_t(ncl); | |
337 | } | |
338 | } | |
bb56afff | 339 | } |
e73baf29 | 340 | SetLabel((1.-prob > wrong)?-label:label); |
341 | return nlabels; | |
bb56afff | 342 | } |
343 | ||
d9950a5a | 344 | //_______________________________________________________________ |
345 | Bool_t AliTRDtrackV1::CookPID() | |
346 | { | |
2a3191bb | 347 | // |
348 | // Cook the PID information for the track by delegating the omonim function of the tracklets. | |
349 | // Computes the number of tracklets used. The tracklet information are considered independent. | |
350 | // For the moment no global track measurement of PID is performed as for example to estimate | |
351 | // bremsstrahlung probability based on global chi2 of the track. | |
352 | // | |
353 | // The status bit AliESDtrack::kTRDpid is set during the call of AliTRDtrackV1::UpdateESDtrack().The PID performance of the | |
354 | //TRD for tracks with 6 tacklets is displayed below. | |
355 | //Begin_Html | |
356 | //<img src="TRD/trackPID.gif"> | |
357 | //End_Html | |
358 | // | |
9dcc64cc | 359 | const AliTRDPIDResponse *pidResponse = AliTRDcalibDB::Instance()->GetPIDResponse(fkReconstructor->GetRecoParam()->GetPIDmethod()); |
360 | if(!pidResponse){ | |
361 | AliError("PID Response not available"); | |
eb2b4f91 | 362 | return kFALSE; |
3b57a3f7 | 363 | } |
9dcc64cc | 364 | Int_t nslices = pidResponse->GetNumberOfSlices(); |
365 | Double_t dEdx[kNplane * (Int_t)AliTRDPIDResponse::kNslicesNN]; | |
366 | Float_t trackletP[kNplane]; | |
367 | memset(dEdx, 0, sizeof(Double_t) * kNplane * (Int_t)AliTRDPIDResponse::kNslicesNN); | |
368 | memset(trackletP, 0, sizeof(Float_t)*kNplane); | |
369 | for(Int_t iseed = 0; iseed < kNplane; iseed++){ | |
370 | if(!fTracklet[iseed]) continue; | |
371 | trackletP[iseed] = fTracklet[iseed]->GetMomentum(); | |
3335de10 | 372 | fTracklet[iseed]->SetPID(); |
9dcc64cc | 373 | if(pidResponse->GetPIDmethod() == AliTRDPIDResponse::kLQ1D){ |
374 | dEdx[iseed] = fTracklet[iseed]->GetdQdl(); | |
375 | } else { | |
93fc2389 | 376 | fTracklet[iseed]->CookdEdx(nslices); |
9dcc64cc | 377 | const Float_t *trackletdEdx = fTracklet[iseed]->GetdEdx(); |
378 | for(Int_t islice = 0; islice < nslices; islice++){ | |
379 | dEdx[iseed*nslices + islice] = trackletdEdx[islice]; | |
380 | } | |
9dcc64cc | 381 | } |
382 | } | |
383 | pidResponse->GetResponse(nslices, dEdx, trackletP, fPID); | |
eb2b4f91 | 384 | return kTRUE; |
385 | } | |
386 | ||
387 | //___________________________________________________________ | |
388 | UChar_t AliTRDtrackV1::GetNumberOfTrackletsPID() const | |
389 | { | |
390 | // Retrieve number of tracklets used for PID calculation. | |
391 | ||
e20bef2b | 392 | UChar_t nPID = 0; |
3b57a3f7 | 393 | for(int ip=0; ip<kNplane; ip++){ |
68f9b6bd | 394 | if(fTrackletIndex[ip]<0 || !fTracklet[ip]) continue; |
3b57a3f7 | 395 | if(!fTracklet[ip]->IsOK()) continue; |
3b57a3f7 | 396 | |
e20bef2b | 397 | nPID++; |
0906e73e | 398 | } |
e20bef2b | 399 | return nPID; |
eb2b4f91 | 400 | } |
401 | ||
0349cc67 | 402 | //_______________________________________________________________ |
403 | AliTRDcluster* AliTRDtrackV1::GetCluster(Int_t id) | |
404 | { | |
4d6aee34 | 405 | // Get the cluster at a certain position in the track |
0349cc67 | 406 | Int_t n = 0; |
407 | for(Int_t ip=0; ip<kNplane; ip++){ | |
408 | if(!fTracklet[ip]) continue; | |
409 | if(n+fTracklet[ip]->GetN() <= id){ | |
410 | n+=fTracklet[ip]->GetN(); | |
411 | continue; | |
412 | } | |
4d6aee34 | 413 | AliTRDcluster *c = NULL; |
8d2bec9e | 414 | for(Int_t ic=AliTRDseedV1::kNclusters; ic--;){ |
0349cc67 | 415 | if(!(c = fTracklet[ip]->GetClusters(ic))) continue; |
416 | ||
417 | if(n<id){n++; continue;} | |
418 | return c; | |
419 | } | |
420 | } | |
4d6aee34 | 421 | return NULL; |
0349cc67 | 422 | } |
423 | ||
3b57a3f7 | 424 | //_______________________________________________________________ |
425 | Int_t AliTRDtrackV1::GetClusterIndex(Int_t id) const | |
426 | { | |
4d6aee34 | 427 | // Get the cluster index at a certain position in the track |
3b57a3f7 | 428 | Int_t n = 0; |
429 | for(Int_t ip=0; ip<kNplane; ip++){ | |
430 | if(!fTracklet[ip]) continue; | |
76b60503 | 431 | if(n+fTracklet[ip]->GetN() <= id){ |
3b57a3f7 | 432 | n+=fTracklet[ip]->GetN(); |
433 | continue; | |
434 | } | |
8d2bec9e | 435 | for(Int_t ic=AliTRDseedV1::kNclusters; ic--;){ |
87f70a90 | 436 | if(!(fTracklet[ip]->GetClusters(ic))) continue; |
76b60503 | 437 | if(n<id){n++; continue;} |
3b57a3f7 | 438 | return fTracklet[ip]->GetIndexes(ic); |
439 | } | |
440 | } | |
441 | return -1; | |
0906e73e | 442 | } |
d9950a5a | 443 | |
444 | //_______________________________________________________________ | |
b72f4eaf | 445 | Double_t AliTRDtrackV1::GetPredictedChi2(const AliTRDseedV1 *trklt, Double_t *cov) const |
d9950a5a | 446 | { |
ed15ef4f | 447 | // Compute chi2 between tracklet and track. The value is calculated at the radial position of the track |
448 | // equal to the reference radial position of the tracklet (see AliTRDseedV1) | |
449 | // | |
450 | // The chi2 estimator is computed according to the following formula | |
451 | // BEGIN_LATEX | |
452 | // #chi^{2}=(X_{trklt}-X_{track})(C_{trklt}+C_{track})^{-1}(X_{trklt}-X_{track})^{T} | |
453 | // END_LATEX | |
454 | // where X=(y z), the position of the track/tracklet in the yz plane | |
455 | // | |
456 | ||
b72f4eaf | 457 | Double_t p[2] = { trklt->GetY(), trklt->GetZ()}; |
458 | trklt->GetCovAt(trklt->GetX(), cov); | |
ed15ef4f | 459 | return AliExternalTrackParam::GetPredictedChi2(p, cov); |
3b57a3f7 | 460 | } |
d9950a5a | 461 | |
eb2b4f91 | 462 | //_______________________________________________________________ |
463 | Int_t AliTRDtrackV1::GetSector() const | |
464 | { | |
465 | return Int_t(GetAlpha()/AliTRDgeometry::GetAlpha() + (GetAlpha()>0. ? 0 : AliTRDgeometry::kNsector)); | |
466 | } | |
467 | ||
203967fc | 468 | //_______________________________________________________________ |
469 | Bool_t AliTRDtrackV1::IsEqual(const TObject *o) const | |
470 | { | |
4d6aee34 | 471 | // Checks whether two tracks are equal |
203967fc | 472 | if (!o) return kFALSE; |
473 | const AliTRDtrackV1 *inTrack = dynamic_cast<const AliTRDtrackV1*>(o); | |
474 | if (!inTrack) return kFALSE; | |
475 | ||
eb2b4f91 | 476 | //if ( fPIDquality != inTrack->GetPIDquality() ) return kFALSE; |
203967fc | 477 | |
d8069611 | 478 | if(memcmp(fPID, inTrack->fPID, AliPID::kSPECIES*sizeof(Double32_t))) return kFALSE; |
479 | if(memcmp(fBudget, inTrack->fBudget, 3*sizeof(Double32_t))) return kFALSE; | |
480 | if(memcmp(&fDE, &inTrack->fDE, sizeof(Double32_t))) return kFALSE; | |
481 | if(memcmp(&fFakeRatio, &inTrack->fFakeRatio, sizeof(Double32_t))) return kFALSE; | |
482 | if(memcmp(&fChi2, &inTrack->fChi2, sizeof(Double32_t))) return kFALSE; | |
483 | if(memcmp(&fMass, &inTrack->fMass, sizeof(Double32_t))) return kFALSE; | |
484 | if( fLab != inTrack->fLab ) return kFALSE; | |
485 | if( fN != inTrack->fN ) return kFALSE; | |
486 | Double32_t l(0.), in(0.); | |
487 | l = GetIntegratedLength(); in = inTrack->GetIntegratedLength(); | |
488 | if(memcmp(&l, &in, sizeof(Double32_t))) return kFALSE; | |
489 | l=GetX(); in=inTrack->GetX(); | |
490 | if(memcmp(&l, &in, sizeof(Double32_t))) return kFALSE; | |
491 | l = GetAlpha(); in = inTrack->GetAlpha(); | |
492 | if(memcmp(&l, &in, sizeof(Double32_t))) return kFALSE; | |
493 | if(memcmp(GetParameter(), inTrack->GetParameter(), 5*sizeof(Double32_t))) return kFALSE; | |
494 | if(memcmp(GetCovariance(), inTrack->GetCovariance(), 15*sizeof(Double32_t))) return kFALSE; | |
203967fc | 495 | |
496 | for (Int_t iTracklet = 0; iTracklet < kNplane; iTracklet++){ | |
497 | AliTRDseedV1 *curTracklet = fTracklet[iTracklet]; | |
498 | AliTRDseedV1 *inTracklet = inTrack->GetTracklet(iTracklet); | |
499 | if (curTracklet && inTracklet){ | |
500 | if (! curTracklet->IsEqual(inTracklet) ) { | |
501 | curTracklet->Print(); | |
502 | inTracklet->Print(); | |
503 | return kFALSE; | |
504 | } | |
505 | } else { | |
506 | // if one tracklet exists, and corresponding | |
507 | // in other track doesn't - return kFALSE | |
508 | if(inTracklet || curTracklet) return kFALSE; | |
509 | } | |
510 | } | |
511 | ||
512 | return kTRUE; | |
513 | } | |
514 | ||
22a4ab0c | 515 | //_______________________________________________________________ |
516 | Bool_t AliTRDtrackV1::IsElectron() const | |
517 | { | |
4d6aee34 | 518 | if(GetPID(0) > fkReconstructor->GetRecoParam()->GetPIDThreshold(GetP())) return kTRUE; |
22a4ab0c | 519 | return kFALSE; |
520 | } | |
521 | ||
3b57a3f7 | 522 | |
523 | //_____________________________________________________________________________ | |
b453ef55 | 524 | Int_t AliTRDtrackV1::MakeBackupTrack() |
3b57a3f7 | 525 | { |
b453ef55 | 526 | // |
527 | // Creates a backup track | |
528 | // TO DO update quality check of the track. | |
529 | // | |
530 | ||
531 | Float_t occupancy(0.); Int_t n(0), ncls(0); | |
532 | for(Int_t il(AliTRDgeometry::kNlayer); il--;){ | |
533 | if(!fTracklet[il]) continue; | |
534 | n++; | |
5c5d503a | 535 | occupancy+=fTracklet[il]->GetTBoccupancy()/AliTRDseedV1::kNtb; |
b453ef55 | 536 | ncls += fTracklet[il]->GetN(); |
537 | } | |
538 | if(!n) return -1; | |
539 | occupancy/=n; | |
540 | ||
541 | //Float_t ratio1 = Float_t(t.GetNumberOfClusters()+1) / Float_t(t.GetNExpected()+1); | |
542 | ||
543 | Int_t failedCutId(0); | |
544 | if(GetChi2()/n > 5.0) failedCutId=1; | |
545 | if(occupancy < 0.7) failedCutId=2; | |
546 | //if(ratio1 > 0.6) && | |
547 | //if(ratio0+ratio1 > 1.5) && | |
548 | if(GetNCross() != 0) failedCutId=3; | |
549 | if(TMath::Abs(GetSnp()) > 0.85) failedCutId=4; | |
550 | if(ncls < 20) failedCutId=5; | |
551 | ||
552 | if(failedCutId){ | |
553 | AliDebug(2, Form("\n" | |
554 | "chi2/tracklet < 5.0 [%c] %5.2f\n" | |
555 | "occupancy > 0.7 [%c] %4.2f\n" | |
556 | "NCross == 0 [%c] %d\n" | |
557 | "Abs(snp) < 0.85 [%c] %4.2f\n" | |
558 | "NClusters > 20 [%c] %d" | |
559 | ,(GetChi2()/n<5.0)?'y':'n', GetChi2()/n | |
560 | ,(occupancy>0.7)?'y':'n', occupancy | |
561 | ,(GetNCross()==0)?'y':'n', GetNCross() | |
562 | ,(TMath::Abs(GetSnp())<0.85)?'y':'n', TMath::Abs(GetSnp()) | |
563 | ,(ncls>20)?'y':'n', ncls | |
564 | )); | |
565 | return failedCutId; | |
566 | } | |
3b57a3f7 | 567 | |
568 | if(fBackupTrack) { | |
569 | fBackupTrack->~AliTRDtrackV1(); | |
570 | new(fBackupTrack) AliTRDtrackV1((AliTRDtrackV1&)(*this)); | |
b453ef55 | 571 | return 0; |
3b57a3f7 | 572 | } |
573 | fBackupTrack = new AliTRDtrackV1((AliTRDtrackV1&)(*this)); | |
b453ef55 | 574 | return 0; |
d9950a5a | 575 | } |
576 | ||
3b57a3f7 | 577 | //_____________________________________________________________________________ |
f8a9723f | 578 | Int_t AliTRDtrackV1::GetProlongation(Double_t xk, Double_t &y, Double_t &z) const |
3b57a3f7 | 579 | { |
580 | // | |
581 | // Find a prolongation at given x | |
530fb4e2 | 582 | // Return -1 if it does not exist |
3b57a3f7 | 583 | // |
584 | ||
585 | Double_t bz = GetBz(); | |
530fb4e2 | 586 | if (!AliExternalTrackParam::GetYAt(xk,bz,y)) return -1; |
587 | if (!AliExternalTrackParam::GetZAt(xk,bz,z)) return -1; | |
3b57a3f7 | 588 | |
589 | return 1; | |
590 | ||
591 | } | |
592 | ||
593 | //_____________________________________________________________________________ | |
15a2657d | 594 | Bool_t AliTRDtrackV1::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho) |
0906e73e | 595 | { |
596 | // | |
3b57a3f7 | 597 | // Propagates this track to a reference plane defined by "xk" [cm] |
598 | // correcting for the mean crossed material. | |
0906e73e | 599 | // |
3b57a3f7 | 600 | // "xx0" - thickness/rad.length [units of the radiation length] |
601 | // "xrho" - thickness*density [g/cm^2] | |
602 | // | |
0906e73e | 603 | |
952051c5 | 604 | if (TMath::Abs(xk - GetX())<AliTRDReconstructor::GetEpsilon()*0.1) return kTRUE; // 10% of the tracker precision |
dc5e390a | 605 | |
307aac71 | 606 | Double_t xyz0[3] = {GetX(), GetY(), GetZ()}, // track position BEFORE propagation |
dc5e390a | 607 | b[3]; // magnetic field |
307aac71 | 608 | GetBxByBz(b); |
dc5e390a | 609 | if(!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE; |
610 | ||
307aac71 | 611 | // local track position AFTER propagation |
612 | Double_t xyz1[3] = {GetX(), GetY(), GetZ()}; | |
2f4384e6 | 613 | // printf("x0[%6.2f] -> x1[%6.2f] dx[%6.2f] rho[%f]\n", xyz0[0], xyz1[0], xyz0[0]-xk, xrho/TMath::Abs(xyz0[0]-xk)); |
dc5e390a | 614 | if(xyz0[0] < xk) { |
5c5d503a | 615 | xrho = -xrho; |
3b57a3f7 | 616 | if (IsStartedTimeIntegral()) { |
dc5e390a | 617 | Double_t l2 = TMath::Sqrt((xyz1[0]-xyz0[0])*(xyz1[0]-xyz0[0]) |
618 | + (xyz1[1]-xyz0[1])*(xyz1[1]-xyz0[1]) | |
619 | + (xyz1[2]-xyz0[2])*(xyz1[2]-xyz0[2])); | |
6790f7d7 | 620 | Double_t crv = AliExternalTrackParam::GetC(b[2]); |
3b57a3f7 | 621 | if (TMath::Abs(l2*crv) > 0.0001) { |
622 | // Make correction for curvature if neccesary | |
dc5e390a | 623 | l2 = 0.5 * TMath::Sqrt((xyz1[0]-xyz0[0])*(xyz1[0]-xyz0[0]) |
624 | + (xyz1[1]-xyz0[1])*(xyz1[1]-xyz0[1])); | |
3b57a3f7 | 625 | l2 = 2.0 * TMath::ASin(l2 * crv) / crv; |
dc5e390a | 626 | l2 = TMath::Sqrt(l2*l2 + (xyz1[2]-xyz0[2])*(xyz1[2]-xyz0[2])); |
3b57a3f7 | 627 | } |
628 | AddTimeStep(l2); | |
629 | } | |
630 | } | |
35315297 | 631 | if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0, xrho, fMass)) return kFALSE; |
fd40f855 | 632 | |
3b57a3f7 | 633 | |
634 | { | |
635 | ||
636 | // Energy losses | |
637 | Double_t p2 = (1.0 + GetTgl()*GetTgl()) / (GetSigned1Pt()*GetSigned1Pt()); | |
35315297 | 638 | Double_t beta2 = p2 / (p2 + fMass*fMass); |
3b57a3f7 | 639 | if ((beta2 < 1.0e-10) || |
640 | ((5940.0 * beta2/(1.0 - beta2 + 1.0e-10) - beta2) < 0.0)) { | |
641 | return kFALSE; | |
642 | } | |
643 | ||
644 | Double_t dE = 0.153e-3 / beta2 | |
645 | * (TMath::Log(5940.0 * beta2/(1.0 - beta2 + 1.0e-10)) - beta2) | |
646 | * xrho; | |
647 | fBudget[0] += xrho; | |
648 | ||
649 | /* | |
650 | // Suspicious part - think about it ? | |
651 | Double_t kinE = TMath::Sqrt(p2); | |
652 | if (dE > 0.8*kinE) dE = 0.8 * kinE; // | |
653 | if (dE < 0) dE = 0.0; // Not valid region for Bethe bloch | |
654 | */ | |
655 | ||
656 | fDE += dE; | |
657 | ||
658 | /* | |
659 | // Suspicious ! I.B. | |
660 | Double_t sigmade = 0.07 * TMath::Sqrt(TMath::Abs(dE)); // Energy loss fluctuation | |
35315297 | 661 | Double_t sigmac2 = sigmade*sigmade*fC*fC*(p2+fMass*fMass)/(p2*p2); |
3b57a3f7 | 662 | fCcc += sigmac2; |
663 | fCee += fX*fX * sigmac2; | |
664 | */ | |
665 | ||
666 | } | |
667 | ||
668 | return kTRUE; | |
0906e73e | 669 | } |
3b57a3f7 | 670 | |
87a7fa94 | 671 | //_____________________________________________________________________________ |
3b57a3f7 | 672 | Int_t AliTRDtrackV1::PropagateToR(Double_t r,Double_t step) |
87a7fa94 | 673 | { |
674 | // | |
3b57a3f7 | 675 | // Propagate track to the radial position |
676 | // Rotation always connected to the last track position | |
87a7fa94 | 677 | // |
678 | ||
3b57a3f7 | 679 | Double_t xyz0[3]; |
680 | Double_t xyz1[3]; | |
681 | Double_t y; | |
682 | Double_t z; | |
683 | ||
684 | Double_t radius = TMath::Sqrt(GetX()*GetX() + GetY()*GetY()); | |
685 | // Direction +- | |
686 | Double_t dir = (radius > r) ? -1.0 : 1.0; | |
687 | ||
688 | for (Double_t x = radius+dir*step; dir*x < dir*r; x += dir*step) { | |
689 | ||
690 | GetXYZ(xyz0); | |
691 | Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]); | |
692 | Rotate(alpha,kTRUE); | |
693 | GetXYZ(xyz0); | |
e20bef2b | 694 | if(GetProlongation(x,y,z)<0) return -1; |
3b57a3f7 | 695 | xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha); |
696 | xyz1[1] = x * TMath::Sin(alpha) - y * TMath::Cos(alpha); | |
697 | xyz1[2] = z; | |
698 | Double_t param[7]; | |
83dea92e | 699 | if(AliTracker::MeanMaterialBudget(xyz0,xyz1,param)<=0.) return -1; |
3b57a3f7 | 700 | if (param[1] <= 0) { |
701 | param[1] = 100000000; | |
702 | } | |
703 | PropagateTo(x,param[1],param[0]*param[4]); | |
704 | ||
705 | } | |
706 | ||
707 | GetXYZ(xyz0); | |
708 | Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]); | |
709 | Rotate(alpha,kTRUE); | |
710 | GetXYZ(xyz0); | |
530fb4e2 | 711 | if(GetProlongation(r,y,z)<0) return -1; |
3b57a3f7 | 712 | xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha); |
713 | xyz1[1] = r * TMath::Sin(alpha) - y * TMath::Cos(alpha); | |
714 | xyz1[2] = z; | |
715 | Double_t param[7]; | |
83dea92e | 716 | if(AliTracker::MeanMaterialBudget(xyz0,xyz1,param) <= 0.) return -1; |
3b57a3f7 | 717 | |
718 | if (param[1] <= 0) { | |
719 | param[1] = 100000000; | |
87a7fa94 | 720 | } |
3b57a3f7 | 721 | PropagateTo(r,param[1],param[0]*param[4]); |
722 | ||
723 | return 0; | |
724 | ||
87a7fa94 | 725 | } |
726 | ||
203967fc | 727 | //_____________________________________________________________________________ |
728 | void AliTRDtrackV1::Print(Option_t *o) const | |
729 | { | |
4d6aee34 | 730 | // Print track status |
eb2b4f91 | 731 | 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])); |
203967fc | 732 | AliInfo(Form("Material[%5.2f %5.2f %5.2f]", fBudget[0], fBudget[1], fBudget[2])); |
733 | ||
734 | AliInfo(Form("x[%7.2f] t[%7.4f] alpha[%f] mass[%f]", GetX(), GetIntegratedLength(), GetAlpha(), fMass)); | |
eb2b4f91 | 735 | AliInfo(Form("Ntr[%1d] NtrPID[%1d] Ncl[%3d] lab[%3d]", GetNumberOfTracklets(), GetNumberOfTrackletsPID(), fN, fLab)); |
203967fc | 736 | |
203967fc | 737 | printf("|X| = ("); |
738 | const Double_t *curP = GetParameter(); | |
739 | for (Int_t i = 0; i < 5; i++) printf("%7.2f ", curP[i]); | |
740 | printf(")\n"); | |
741 | ||
742 | printf("|V| = \n"); | |
743 | const Double_t *curC = GetCovariance(); | |
744 | for (Int_t i = 0, j=4, k=0; i<15; i++, k++){ | |
745 | printf("%7.2f ", curC[i]); | |
746 | if(k==j){ | |
747 | printf("\n"); | |
748 | k=-1; j--; | |
749 | } | |
750 | } | |
0217fcd0 | 751 | if(strcmp(o, "a")!=0) return; |
203967fc | 752 | |
753 | for(Int_t ip=0; ip<kNplane; ip++){ | |
754 | if(!fTracklet[ip]) continue; | |
755 | fTracklet[ip]->Print(o); | |
756 | } | |
757 | } | |
758 | ||
759 | ||
3b57a3f7 | 760 | //_____________________________________________________________________________ |
761 | Bool_t AliTRDtrackV1::Rotate(Double_t alpha, Bool_t absolute) | |
762 | { | |
763 | // | |
764 | // Rotates track parameters in R*phi plane | |
765 | // if absolute rotation alpha is in global system | |
766 | // otherwise alpha rotation is relative to the current rotation angle | |
767 | // | |
768 | ||
769 | if (absolute) alpha -= GetAlpha(); | |
770 | //else fNRotate++; | |
771 | ||
772 | return AliExternalTrackParam::Rotate(GetAlpha()+alpha); | |
773 | } | |
87a7fa94 | 774 | |
eb38ed55 | 775 | //___________________________________________________________ |
776 | void AliTRDtrackV1::SetNumberOfClusters() | |
777 | { | |
778 | // Calculate the number of clusters attached to this track | |
779 | ||
3b57a3f7 | 780 | Int_t ncls = 0; |
781 | for(int ip=0; ip<kNplane; ip++){ | |
68f9b6bd | 782 | if(fTracklet[ip] && fTrackletIndex[ip] >= 0) ncls += fTracklet[ip]->GetN(); |
3b57a3f7 | 783 | } |
784 | AliKalmanTrack::SetNumberOfClusters(ncls); | |
eb38ed55 | 785 | } |
786 | ||
787 | ||
0906e73e | 788 | //_______________________________________________________________ |
3b57a3f7 | 789 | void AliTRDtrackV1::SetOwner() |
0906e73e | 790 | { |
791 | // | |
792 | // Toggle ownership of tracklets | |
793 | // | |
794 | ||
e44586fb | 795 | if(TestBit(kOwner)) return; |
3b57a3f7 | 796 | for (Int_t ip = 0; ip < kNplane; ip++) { |
68f9b6bd | 797 | if(fTrackletIndex[ip]<0 || !fTracklet[ip]) continue; |
3b57a3f7 | 798 | fTracklet[ip] = new AliTRDseedV1(*fTracklet[ip]); |
799 | fTracklet[ip]->SetOwner(); | |
800 | } | |
e44586fb | 801 | SetBit(kOwner); |
0906e73e | 802 | } |
803 | ||
d9950a5a | 804 | //_______________________________________________________________ |
4d6aee34 | 805 | void AliTRDtrackV1::SetTracklet(AliTRDseedV1 *const trklt, Int_t index) |
d9950a5a | 806 | { |
807 | // | |
0906e73e | 808 | // Set the tracklets |
d9950a5a | 809 | // |
3b57a3f7 | 810 | Int_t plane = trklt->GetPlane(); |
76b60503 | 811 | |
3b57a3f7 | 812 | fTracklet[plane] = trklt; |
813 | fTrackletIndex[plane] = index; | |
d9950a5a | 814 | } |
815 | ||
e3cf3d02 | 816 | //_______________________________________________________________ |
a310e49b | 817 | void AliTRDtrackV1::SetTrackIn() |
e3cf3d02 | 818 | { |
fc6d4c2d | 819 | // Save location of birth for the TRD track |
820 | // If the pointer is not valid allocate memory | |
821 | // | |
e3cf3d02 | 822 | const AliExternalTrackParam *op = dynamic_cast<const AliExternalTrackParam*>(this); |
fc6d4c2d | 823 | |
5d4510fe | 824 | //printf("SetTrackIn() : fTrackLow[%p]\n", (void*)fTrackLow); |
fc6d4c2d | 825 | if(fTrackLow){ |
826 | fTrackLow->~AliExternalTrackParam(); | |
827 | new(fTrackLow) AliExternalTrackParam(*op); | |
828 | } else fTrackLow = new AliExternalTrackParam(*op); | |
e3cf3d02 | 829 | } |
830 | ||
831 | //_______________________________________________________________ | |
a310e49b | 832 | void AliTRDtrackV1::SetTrackOut(const AliExternalTrackParam *op) |
e3cf3d02 | 833 | { |
fc6d4c2d | 834 | // Save location of death for the TRD track |
835 | // If the pointer is not valid allocate memory | |
836 | // | |
e3cf3d02 | 837 | if(!op) op = dynamic_cast<const AliExternalTrackParam*>(this); |
fc6d4c2d | 838 | if(fTrackHigh){ |
839 | fTrackHigh->~AliExternalTrackParam(); | |
840 | new(fTrackHigh) AliExternalTrackParam(*op); | |
841 | } else fTrackHigh = new AliExternalTrackParam(*op); | |
e3cf3d02 | 842 | } |
843 | ||
181d2c97 | 844 | //_______________________________________________________________ |
845 | void AliTRDtrackV1::UnsetTracklet(Int_t plane) | |
846 | { | |
87f70a90 | 847 | if(plane<0) return; |
17896e82 | 848 | fTrackletIndex[plane] = -1; |
4d6aee34 | 849 | fTracklet[plane] = NULL; |
181d2c97 | 850 | } |
851 | ||
852 | ||
d9950a5a | 853 | //_______________________________________________________________ |
ef867f55 | 854 | void AliTRDtrackV1::UpdateChi2(Float_t chi2) |
d9950a5a | 855 | { |
ef867f55 | 856 | // Update chi2/track with one tracklet contribution |
b72f4eaf | 857 | SetChi2(GetChi2() + chi2); |
d9950a5a | 858 | } |
859 | ||
860 | //_______________________________________________________________ | |
0906e73e | 861 | void AliTRDtrackV1::UpdateESDtrack(AliESDtrack *track) |
d9950a5a | 862 | { |
863 | // | |
6984f7c1 | 864 | // Update the TRD PID information in the ESD track |
d9950a5a | 865 | // |
6984f7c1 | 866 | |
93fc2389 | 867 | // Int_t nslices = AliTRDcalibDB::Instance()->GetPIDResponse(fkReconstructor->GetRecoParam()->GetPIDmethod())->GetNumberOfSlices(); |
e20bef2b | 868 | // number of tracklets used for PID calculation |
869 | UChar_t nPID = GetNumberOfTrackletsPID(); | |
870 | // number of tracklets attached to the track | |
871 | UChar_t nTrk = GetNumberOfTracklets(); | |
872 | // pack the two numbers together and store them in the ESD | |
873 | track->SetTRDntracklets(nPID | (nTrk<<3)); | |
874 | // allocate space to store raw PID signals dEdx & momentum | |
93fc2389 | 875 | track->SetNumberOfTRDslices((AliTRDPIDResponse::kNslicesNN+3)*AliTRDgeometry::kNlayer); |
e20bef2b | 876 | // store raw signals |
7b23a4e1 | 877 | Float_t p, sp; Double_t spd; |
6984f7c1 | 878 | for (Int_t ip = 0; ip < kNplane; ip++) { |
68f9b6bd | 879 | if(fTrackletIndex[ip]<0 || !fTracklet[ip]) continue; |
e20bef2b | 880 | if(!fTracklet[ip]->HasPID()) continue; |
93fc2389 | 881 | fTracklet[ip]->CookdEdx(AliTRDPIDResponse::kNslicesNN); |
4d6aee34 | 882 | const Float_t *dedx = fTracklet[ip]->GetdEdx(); |
93fc2389 | 883 | for (Int_t js = 0; js < AliTRDPIDResponse::kNslicesNN; js++, dedx++){ |
93fc2389 | 884 | track->SetTRDslice(*dedx, ip, js+1); |
885 | } | |
5554f68d | 886 | p = fTracklet[ip]->GetMomentum(&sp); |
c05ef2e8 | 887 | spd = sp; track->SetTRDmomentum(p, ip, &spd); |
5c5d503a | 888 | // store global quality per tracklet instead of momentum error |
889 | // 26.09.11 A.Bercuci | |
890 | // first implementation store no. of time bins filled in tracklet (5bits see "y" bits) and | |
891 | // no. of double clusters in case of pad row cross (4bits see "x" bits) | |
892 | // bit map for tracklet quality xxxxyyyyy | |
803dc399 | 893 | // 27.10.11 A.Bercuci |
c05ef2e8 | 894 | // add chamber status bit "z" bit |
803dc399 | 895 | // bit map for tracklet quality zxxxxyyyyy |
c05ef2e8 | 896 | // 12.11.11 A.Bercuci |
897 | // fit tracklet quality into the field fTRDTimeBin [Char_t] | |
898 | // bit map for tracklet quality zxxyyyyy | |
5554f68d | 899 | // The information should be retrieved by the following functions of AliESDtrack for each TRD layer |
900 | // GetTRDtrkltOccupancy(layer) -> no of TB filled in tracklet | |
901 | // GetTRDtrkltClCross(layer) -> no of TB filled in crossing pad rows | |
902 | // IsTRDtrkltChmbGood(layer) -> status of the chamber from which the tracklet is found | |
903 | Int_t nCross(fTracklet[ip]->IsRowCross()?fTracklet[ip]->GetTBcross():0); if(nCross>3) nCross = 3; | |
c05ef2e8 | 904 | Char_t trackletQ = Char_t(fTracklet[ip]->GetTBoccupancy() | (nCross<<5) | (fTracklet[ip]->IsChmbGood()<<7)); |
905 | track->SetTRDTimBin(trackletQ, ip); | |
9dcc64cc | 906 | track->SetTRDslice(fTracklet[ip]->GetdQdl(), ip, 0); // Set Summed dEdx into the first slice |
6984f7c1 | 907 | } |
e20bef2b | 908 | // store PID probabilities |
909 | track->SetTRDpid(fPID); | |
d9950a5a | 910 | } |