]>
Commit | Line | Data |
---|---|---|
1ee39b3a | 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: AliTRDtrackInfo.cxx 27496 2008-07-22 08:35:45Z cblume $ */ | |
17 | ||
18 | //////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Reconstruction QA // | |
21 | // // | |
22 | // Authors: // | |
23 | // Alex Bercuci <A.Bercuci@gsi.de> // | |
24 | // Markus Fasel <M.Fasel@gsi.de> // | |
25 | // // | |
26 | //////////////////////////////////////////////////////////////////////////// | |
27 | ||
28 | #include "TDatabasePDG.h" | |
b9ddd472 | 29 | #include "TPDGCode.h" |
4226db3e | 30 | #include "TVectorT.h" |
1ee39b3a | 31 | |
32 | #include "AliTrackReference.h" | |
33 | #include "AliExternalTrackParam.h" | |
34 | ||
35 | #include "AliTRDseedV1.h" | |
36 | #include "AliTRDtrackV1.h" | |
37 | #include "AliTRDgeometry.h" | |
38 | #include "AliTRDtrackerV1.h" | |
39 | ||
40 | #include "AliTRDtrackInfo.h" | |
41 | ||
42 | ClassImp(AliTRDtrackInfo) | |
43 | ClassImp(AliTRDtrackInfo::AliMCinfo) | |
44 | ClassImp(AliTRDtrackInfo::AliESDinfo) | |
5066aa9a | 45 | Double_t AliTRDtrackInfo::AliMCinfo::fgKalmanStep = 2.; |
3ceb45ae | 46 | Bool_t AliTRDtrackInfo::AliMCinfo::fgKalmanUpdate = kTRUE; |
1ee39b3a | 47 | |
48 | //___________________________________________________ | |
49 | AliTRDtrackInfo::AliTRDtrackInfo(): | |
50 | TObject() | |
51 | ,fNClusters(0) | |
f232df0d | 52 | ,fTRDtrack(NULL) |
53 | ,fMC(NULL) | |
1ee39b3a | 54 | ,fESD() |
55 | { | |
56 | // | |
57 | // Default constructor | |
58 | // | |
59 | } | |
60 | ||
61 | ||
62 | //___________________________________________________ | |
63 | AliTRDtrackInfo::AliTRDtrackInfo(const AliTRDtrackInfo &trdInfo): | |
64 | TObject((const TObject&)trdInfo) | |
65 | ,fNClusters(trdInfo.fNClusters) | |
f232df0d | 66 | ,fTRDtrack(NULL) |
a340fe39 | 67 | ,fMC(NULL) |
1ee39b3a | 68 | ,fESD(trdInfo.fESD) |
69 | { | |
70 | // | |
71 | // copy Entries | |
72 | // | |
73 | ||
74 | if(trdInfo.fMC) fMC = new AliMCinfo(*trdInfo.fMC); | |
75 | ||
76 | if(trdInfo.fTRDtrack){ | |
77 | fTRDtrack = new AliTRDtrackV1(*trdInfo.fTRDtrack); | |
78 | if(trdInfo.fTRDtrack->IsOwner()) fTRDtrack->SetOwner(); | |
79 | } | |
80 | } | |
81 | ||
82 | //___________________________________________________ | |
83 | AliTRDtrackInfo::AliMCinfo::AliMCinfo() | |
84 | :fLabel(0) | |
85 | ,fPDG(0) | |
86 | ,fNTrackRefs(0) | |
87 | { | |
88 | // Set 0-Pointers | |
89 | memset(fTrackRefs, 0, sizeof(AliTrackReference *) * 12); | |
90 | } | |
91 | ||
92 | //___________________________________________________ | |
93 | AliTRDtrackInfo::AliMCinfo::AliMCinfo(const AliMCinfo &mc) | |
94 | :fLabel(mc.fLabel) | |
95 | ,fPDG(mc.fPDG) | |
96 | ,fNTrackRefs(mc.fNTrackRefs) | |
97 | { | |
98 | // | |
99 | // Constructor | |
100 | // | |
101 | ||
102 | memset(fTrackRefs, 0, sizeof(AliTrackReference *) * 12); | |
103 | for(Int_t ien = 0; ien < 12; ien++){ | |
104 | if(mc.fTrackRefs[ien]) | |
105 | fTrackRefs[ien] = new AliTrackReference(*(mc.fTrackRefs[ien])); | |
106 | } | |
107 | } | |
108 | ||
b9ddd472 | 109 | //________________________________________________________ |
110 | Int_t AliTRDtrackInfo::AliMCinfo::GetPID() const | |
111 | { | |
61f6b45e | 112 | // Translate pdg code to PID index |
113 | ||
b9ddd472 | 114 | switch(fPDG){ |
115 | case kElectron: | |
116 | case kPositron: return AliPID::kElectron; | |
117 | case kMuonPlus: | |
118 | case kMuonMinus: return AliPID::kMuon; | |
119 | case kPiPlus: | |
120 | case kPiMinus: return AliPID::kPion; | |
121 | case kKPlus: | |
122 | case kKMinus: return AliPID::kKaon; | |
123 | case kProton: | |
124 | case kProtonBar: return AliPID::kProton; | |
125 | } | |
126 | return -1; | |
127 | } | |
128 | ||
1ee39b3a | 129 | //___________________________________________________ |
130 | AliTRDtrackInfo::AliESDinfo::AliESDinfo() | |
b9ddd472 | 131 | :fHasV0(0) |
132 | ,fId(-1) | |
1ee39b3a | 133 | ,fStatus(0) |
134 | ,fKinkIndex(0) | |
135 | ,fTPCncls(0) | |
3ceb45ae | 136 | ,fTOFbc(0) |
1ee39b3a | 137 | ,fTRDpidQuality(0) |
138 | ,fTRDnSlices(0) | |
f232df0d | 139 | ,fTRDslices(NULL) |
140 | ,fOP(NULL) | |
35983729 | 141 | ,fTPCout(NULL) |
1ee39b3a | 142 | { |
143 | // | |
144 | // Constructor | |
145 | // | |
146 | ||
147 | memset(fTRDr, 0, AliPID::kSPECIES*sizeof(Double32_t)); | |
d80a6a00 | 148 | memset(fTRDv0pid, 0, AliPID::kSPECIES*sizeof(Int_t)); |
1ee39b3a | 149 | } |
150 | ||
151 | //___________________________________________________ | |
152 | AliTRDtrackInfo::AliESDinfo::AliESDinfo(const AliESDinfo &esd) | |
b9ddd472 | 153 | :fHasV0(esd.fHasV0) |
154 | ,fId(esd.fId) | |
1ee39b3a | 155 | ,fStatus(esd.fStatus) |
156 | ,fKinkIndex(esd.fKinkIndex) | |
157 | ,fTPCncls(esd.fTPCncls) | |
3ceb45ae | 158 | ,fTOFbc(esd.fTOFbc) |
1ee39b3a | 159 | ,fTRDpidQuality(esd.fTRDpidQuality) |
160 | ,fTRDnSlices(esd.fTRDnSlices) | |
f232df0d | 161 | ,fTRDslices(NULL) |
162 | ,fOP(NULL) | |
35983729 | 163 | ,fTPCout(NULL) |
1ee39b3a | 164 | { |
165 | // | |
166 | // Constructor | |
167 | // | |
168 | ||
169 | memcpy(fTRDr, esd.fTRDr, AliPID::kSPECIES*sizeof(Double32_t)); | |
d80a6a00 | 170 | memcpy(fTRDv0pid, esd.fTRDv0pid, AliPID::kSPECIES*sizeof(Int_t)); |
1ee39b3a | 171 | |
172 | if(fTRDnSlices){ | |
173 | fTRDslices = new Double32_t[fTRDnSlices]; | |
174 | memcpy(fTRDslices, esd.fTRDslices, fTRDnSlices*sizeof(Double32_t)); | |
175 | } | |
176 | if(esd.fOP) fOP = new AliExternalTrackParam(*esd.fOP); | |
35983729 | 177 | if(esd.fTPCout) fTPCout = new AliExternalTrackParam(*esd.fTPCout); |
1ee39b3a | 178 | } |
179 | ||
180 | ||
181 | //___________________________________________________ | |
182 | AliTRDtrackInfo::~AliTRDtrackInfo() | |
183 | { | |
184 | // | |
185 | // Destructor | |
186 | // | |
187 | ||
188 | if(fMC) delete fMC; | |
189 | if(fTRDtrack) delete fTRDtrack; | |
190 | } | |
191 | ||
192 | //___________________________________________________ | |
193 | AliTRDtrackInfo::AliMCinfo::~AliMCinfo() | |
194 | { | |
195 | // | |
196 | // Destructor | |
197 | // | |
198 | ||
199 | fNTrackRefs = 0; | |
200 | for(Int_t ien = 0; ien < 12; ien++){ | |
201 | if(fTrackRefs[ien]) delete fTrackRefs[ien]; | |
f232df0d | 202 | fTrackRefs[ien] = NULL; |
1ee39b3a | 203 | } |
204 | } | |
205 | ||
206 | //___________________________________________________ | |
207 | AliTRDtrackInfo::AliESDinfo::~AliESDinfo() | |
208 | { | |
209 | // | |
210 | // Destructor | |
211 | // | |
212 | ||
213 | if(fTRDnSlices){ | |
214 | delete [] fTRDslices; | |
f232df0d | 215 | fTRDslices = NULL; |
1ee39b3a | 216 | fTRDnSlices = 0; |
217 | } | |
f232df0d | 218 | if(fOP) delete fOP; fOP = NULL; |
35983729 | 219 | if(fTPCout) delete fTPCout; fTPCout = NULL; |
1ee39b3a | 220 | } |
221 | ||
8778aca3 | 222 | //___________________________________________________ |
223 | void AliTRDtrackInfo::AliESDinfo::Delete(const Option_t *){ | |
224 | // | |
225 | // Delete Pointer members | |
226 | // | |
227 | if(fTRDnSlices){ | |
228 | delete [] fTRDslices; | |
229 | fTRDslices = NULL; | |
230 | fTRDnSlices = 0; | |
231 | } | |
232 | if(fOP) delete fOP; fOP = NULL; | |
35983729 | 233 | if(fTPCout) delete fTPCout; fTPCout = NULL; |
8778aca3 | 234 | } |
235 | ||
1ee39b3a | 236 | |
237 | //___________________________________________________ | |
238 | AliTRDtrackInfo& AliTRDtrackInfo::operator=(const AliTRDtrackInfo &trdInfo) | |
239 | { | |
240 | // | |
241 | // = Operator | |
242 | // | |
243 | ||
244 | fNClusters = trdInfo.fNClusters; | |
245 | fESD = trdInfo.fESD; | |
246 | ||
247 | if(trdInfo.fMC){ | |
2c33fb46 | 248 | if(!fMC) fMC = new AliMCinfo(*trdInfo.fMC); |
249 | else{ | |
250 | fMC->~AliMCinfo(); | |
1ee39b3a | 251 | new(fMC) AliMCinfo(*trdInfo.fMC); |
2c33fb46 | 252 | } |
1ee39b3a | 253 | } |
254 | ||
255 | if(trdInfo.fTRDtrack){ | |
2c33fb46 | 256 | if(!fTRDtrack) fTRDtrack = new AliTRDtrackV1(*trdInfo.fTRDtrack); |
257 | else{ | |
258 | fTRDtrack->~AliTRDtrackV1(); | |
1ee39b3a | 259 | new(fTRDtrack) AliTRDtrackV1(*trdInfo.fTRDtrack); |
2c33fb46 | 260 | } |
1ee39b3a | 261 | if(trdInfo.fTRDtrack->IsOwner()) fTRDtrack->SetOwner(); |
262 | } | |
263 | ||
264 | return *this; | |
265 | } | |
266 | ||
267 | //___________________________________________________ | |
268 | AliTRDtrackInfo::AliMCinfo& AliTRDtrackInfo::AliMCinfo::operator=(const AliMCinfo &mc) | |
269 | { | |
270 | // | |
271 | // Assignment operator | |
272 | // | |
273 | ||
274 | fLabel = mc.fLabel; | |
275 | fPDG = mc.fPDG; | |
276 | fNTrackRefs = mc.fNTrackRefs; | |
277 | ||
278 | AliTrackReference **itr = &fTrackRefs[0]; | |
279 | AliTrackReference* const *jtr = &mc.fTrackRefs[0]; | |
280 | for(Int_t ien = 0; ien < 12; ien++, itr++, jtr++){ | |
281 | if((*jtr)){ | |
282 | if(!(*itr)) (*itr) = new AliTrackReference(*(*jtr)); | |
2c33fb46 | 283 | else{ |
284 | (*itr)->~AliTrackReference(); | |
285 | new(&(*itr)) AliTrackReference(*(*jtr)); | |
286 | } | |
f232df0d | 287 | } else (*itr) = NULL; |
1ee39b3a | 288 | } |
289 | return *this; | |
290 | } | |
291 | ||
292 | //___________________________________________________ | |
293 | AliTRDtrackInfo::AliESDinfo& AliTRDtrackInfo::AliESDinfo::operator=(const AliESDinfo &esd) | |
294 | { | |
295 | // | |
296 | // Assignment operator | |
297 | // | |
298 | ||
299 | fId = esd.fId; | |
300 | fStatus = esd.fStatus; | |
301 | fTRDpidQuality = esd.fTRDpidQuality; | |
302 | fTRDnSlices = esd.fTRDnSlices; | |
f232df0d | 303 | fTRDslices = NULL; |
1ee39b3a | 304 | |
305 | memcpy(fTRDr, esd.fTRDr, AliPID::kSPECIES*sizeof(Double32_t)); | |
306 | ||
307 | if(fTRDnSlices){ | |
308 | fTRDslices = new Double32_t[fTRDnSlices]; | |
309 | memcpy(fTRDslices, esd.fTRDslices, fTRDnSlices*sizeof(Double32_t)); | |
310 | } | |
311 | if(esd.fOP){ | |
2c33fb46 | 312 | if(fOP){ |
313 | fOP->~AliExternalTrackParam(); | |
4ec1ca0f | 314 | // RS: Constructor from VTrack was used instead of Constructor from AliExternalTrackParam |
315 | new(fOP) AliExternalTrackParam(*esd.fOP); | |
316 | } else fOP = new AliExternalTrackParam(*esd.fOP); | |
f232df0d | 317 | } else fOP = NULL; |
35983729 | 318 | if(esd.fTPCout){ |
319 | if(fTPCout){ | |
320 | fTPCout->~AliExternalTrackParam(); | |
321 | // RS: Constructor from VTrack was used instead of Constructor from AliExternalTrackParam | |
322 | new(fTPCout) AliExternalTrackParam(*esd.fTPCout); | |
323 | } else fTPCout = new AliExternalTrackParam(*esd.fTPCout); | |
324 | } else fTPCout = NULL; | |
1ee39b3a | 325 | |
326 | return *this; | |
327 | } | |
328 | ||
329 | //___________________________________________________ | |
330 | void AliTRDtrackInfo::Delete(const Option_t *) | |
331 | { | |
332 | // | |
333 | // Delete | |
334 | // | |
335 | ||
2c33fb46 | 336 | AliDebug(2, Form("track[%p] mc[%p]", (void*)fTRDtrack, (void*)fMC)); |
1ee39b3a | 337 | fNClusters = 0; |
f232df0d | 338 | if(fMC) delete fMC; fMC = NULL; |
8778aca3 | 339 | fESD.Delete(NULL); |
f232df0d | 340 | if(fTRDtrack) delete fTRDtrack; fTRDtrack = NULL; |
1ee39b3a | 341 | } |
342 | ||
343 | //___________________________________________________ | |
344 | void AliTRDtrackInfo::SetTrack(const AliTRDtrackV1 *track) | |
345 | { | |
346 | // | |
347 | // Set the TRD track | |
348 | // | |
349 | ||
2c33fb46 | 350 | if(!fTRDtrack) fTRDtrack = new AliTRDtrackV1(*track); |
351 | else{ | |
352 | fTRDtrack->~AliTRDtrackV1(); | |
353 | new(fTRDtrack) AliTRDtrackV1(*track); | |
354 | } | |
1ee39b3a | 355 | fTRDtrack->SetOwner(); |
356 | // Make a copy for the object in order to avoid ownership problems | |
357 | } | |
358 | ||
359 | //___________________________________________________ | |
360 | void AliTRDtrackInfo::AddTrackRef(const AliTrackReference *tref) | |
361 | { | |
362 | // | |
363 | // Add track reference | |
364 | // | |
365 | ||
1ee39b3a | 366 | if(fMC->fNTrackRefs >= 12){ |
367 | SetCurved(); | |
368 | return; | |
369 | } | |
370 | // Make a copy for the object in order to avoid ownership problems | |
371 | fMC->fTrackRefs[fMC->fNTrackRefs++] = new AliTrackReference(*tref); | |
372 | } | |
373 | ||
374 | //___________________________________________________ | |
375 | AliTrackReference* AliTRDtrackInfo::GetTrackRef(Int_t idx) const | |
376 | { | |
377 | // | |
378 | // Returns a track reference | |
379 | // | |
f232df0d | 380 | if(!fMC) return NULL; |
381 | return (idx>=0 && idx < 12) ? fMC->fTrackRefs[idx] : NULL; | |
1ee39b3a | 382 | } |
383 | ||
384 | //___________________________________________________ | |
61f6b45e | 385 | AliTrackReference* AliTRDtrackInfo::GetTrackRef(const AliTRDseedV1* const tracklet) const |
1ee39b3a | 386 | { |
387 | // | |
388 | // Returns a track reference | |
389 | // | |
f232df0d | 390 | if(!fMC) return NULL; |
1ee39b3a | 391 | Double_t cw = AliTRDgeometry::CamHght() + AliTRDgeometry::CdrHght(); |
392 | AliTrackReference * const* jtr = &(fMC->fTrackRefs[0]); | |
393 | for(Int_t itr = 0; itr < fMC->fNTrackRefs; itr++, ++jtr){ | |
394 | if(!(*jtr)) break; | |
395 | if(TMath::Abs(tracklet->GetX0() - (*jtr)->LocalX()) < cw) return (*jtr); | |
396 | } | |
f232df0d | 397 | return NULL; |
1ee39b3a | 398 | } |
399 | ||
400 | //___________________________________________________ | |
401 | Int_t AliTRDtrackInfo::GetNumberOfClusters() const | |
402 | { | |
403 | // | |
404 | // Returns the number of clusters | |
405 | // | |
406 | ||
407 | Int_t n = 0; | |
408 | if(!fTRDtrack) return 0; | |
409 | if(fTRDtrack->GetNumberOfTracklets() == 0) return n; | |
f232df0d | 410 | AliTRDseedV1 *tracklet = NULL; |
1ee39b3a | 411 | for(Int_t ip=0; ip<6; ip++){ |
412 | if(!(tracklet = const_cast<AliTRDseedV1 *>(fTRDtrack->GetTracklet(ip)))) continue; | |
413 | n+=tracklet->GetN(); | |
414 | } | |
415 | return n; | |
416 | } | |
417 | ||
418 | ||
419 | //___________________________________________________ | |
420 | void AliTRDtrackInfo::SetOuterParam(const AliExternalTrackParam *op) | |
421 | { | |
422 | // | |
423 | // Set outer track parameters | |
424 | // | |
425 | ||
426 | if(!op) return; | |
2c33fb46 | 427 | if(fESD.fOP){ |
428 | fESD.fOP->~AliExternalTrackParam(); | |
429 | new(fESD.fOP) AliExternalTrackParam(*op); | |
430 | } else fESD.fOP = new AliExternalTrackParam(*op); | |
1ee39b3a | 431 | } |
432 | ||
35983729 | 433 | //___________________________________________________ |
434 | void AliTRDtrackInfo::SetTPCoutParam(const AliExternalTrackParam *op) | |
435 | { | |
436 | // | |
437 | // Set TPCout track parameters | |
438 | // | |
439 | ||
440 | if(!op) return; | |
441 | if(fESD.fTPCout){ | |
442 | fESD.fTPCout->~AliExternalTrackParam(); | |
443 | new(fESD.fTPCout) AliExternalTrackParam(*op); | |
444 | } else fESD.fTPCout = new AliExternalTrackParam(*op); | |
445 | } | |
446 | ||
1ee39b3a | 447 | //___________________________________________________ |
448 | Int_t AliTRDtrackInfo::GetNTracklets() const | |
449 | { | |
450 | // | |
451 | // Return the number of tracklets | |
452 | // | |
453 | ||
e2927481 | 454 | if(!fTRDtrack) return 0; |
1ee39b3a | 455 | return fTRDtrack->GetNumberOfTracklets(); |
456 | } | |
457 | ||
458 | //___________________________________________________ | |
459 | void AliTRDtrackInfo::SetSlices(Int_t n, Double32_t *s) | |
460 | { | |
461 | // | |
462 | // Set the slices | |
463 | // | |
1ee39b3a | 464 | if(fESD.fTRDnSlices != n){ |
465 | fESD.fTRDnSlices = 0; | |
466 | delete [] fESD.fTRDslices; | |
f232df0d | 467 | fESD.fTRDslices = NULL; |
1ee39b3a | 468 | } |
469 | ||
470 | if(!fESD.fTRDnSlices){ | |
471 | fESD.fTRDnSlices = n; | |
f232df0d | 472 | fESD.fTRDslices = new Double32_t[fESD.fTRDnSlices]; |
1ee39b3a | 473 | } |
474 | ||
475 | memcpy(fESD.fTRDslices, s, n*sizeof(Double32_t)); | |
476 | } | |
477 | ||
478 | //___________________________________________________ | |
f429b017 | 479 | Bool_t AliTRDtrackInfo::AliMCinfo::GetDirections(Float_t &x0, Float_t &y0, Float_t &z0, Float_t &dydx, Float_t &dzdx, Float_t &pt, Float_t &eta, Float_t &phi, UChar_t &status) const |
1ee39b3a | 480 | { |
481 | // Check for 2 track ref for the tracklet defined bythe radial position x0 | |
482 | // The "status" is a bit map and gives a more informative output in case of failure: | |
483 | // - 0 : everything is OK | |
484 | // - BIT(0) : 0 track refs found | |
485 | // - BIT(1) : 1 track reference found | |
486 | // - BIT(2) : dx <= 0 between track references | |
487 | // - BIT(3) : dx > 0 && dx < 3.7 - tangent tracks | |
488 | ||
489 | status = 0; | |
490 | Double_t cw = AliTRDgeometry::CamHght() + AliTRDgeometry::CdrHght(); | |
491 | Int_t nFound = 0; | |
f232df0d | 492 | AliTrackReference *tr[2] = {NULL, NULL}; |
1ee39b3a | 493 | AliTrackReference * const* jtr = &fTrackRefs[0]; |
494 | for(Int_t itr = 0; itr < fNTrackRefs; itr++, ++jtr){ | |
495 | if(!(*jtr)) break; | |
496 | /* | |
497 | if(fDebugLevel>=5) printf("\t\tref[%2d] x[%6.3f]\n", itr, (*jtr)->LocalX());*/ | |
498 | if(TMath::Abs(x0 - (*jtr)->LocalX()) > cw) continue; | |
499 | tr[nFound++] = (*jtr); | |
500 | if(nFound == 2) break; | |
501 | } | |
502 | if(nFound < 2){ | |
f429b017 | 503 | AliDebugGeneral("AliTRDtrackInfo::AliMCinfo::GetDirections()", 1, Form("Missing track ref x0[%6.3f] nref[%d]", x0, nFound)); |
1ee39b3a | 504 | if(!nFound) SETBIT(status, 0); |
505 | else SETBIT(status, 1); | |
506 | return kFALSE; | |
507 | } | |
61f6b45e | 508 | pt=tr[1]->Pt(); |
509 | if(pt < 1.e-3) return kFALSE; | |
1ee39b3a | 510 | |
511 | Double_t dx = tr[1]->LocalX() - tr[0]->LocalX(); | |
512 | if(dx <= 0.){ | |
513 | AliWarningGeneral("AliTRDtrackInfo::AliMCinfo::GetDirections()", Form("Track ref with wrong radial distances refX0[%6.3f] refX1[%6.3f]", tr[0]->LocalX(), tr[1]->LocalX())); | |
514 | SETBIT(status, 2); | |
515 | return kFALSE; | |
516 | } | |
517 | if(TMath::Abs(dx-AliTRDgeometry::CamHght()-AliTRDgeometry::CdrHght())>1.E-3) SETBIT(status, 3); | |
518 | ||
519 | dydx = (tr[1]->LocalY() - tr[0]->LocalY()) / dx; | |
520 | dzdx = (tr[1]->Z() - tr[0]->Z()) / dx; | |
521 | //Float_t dx0 = tr[1]->LocalX() - x0; | |
522 | y0 = tr[1]->LocalY()/* - dydx*dx0*/; | |
523 | z0 = tr[1]->Z()/* - dzdx*dx0*/; | |
524 | x0 = tr[1]->LocalX(); | |
3ceb45ae | 525 | eta = -TMath::Log(TMath::Tan(0.5 * tr[1]->Theta())); |
f429b017 | 526 | phi = tr[1]->PhiPos(); |
1ee39b3a | 527 | return kTRUE; |
528 | } | |
529 | ||
530 | //___________________________________________________ | |
3ceb45ae | 531 | Bool_t AliTRDtrackInfo::AliMCinfo::PropagateKalman( |
532 | TVectorD *x, TVectorD *y, TVectorD *z, | |
533 | TVectorD *dx, TVectorD *dy, TVectorD *dz, | |
534 | TVectorD *pt, TVectorD *dpt, TVectorD *budget, TVectorD *c, Double_t mass) const | |
1ee39b3a | 535 | { |
536 | // Propagate Kalman from the first TRD track reference to | |
537 | // last one and save residuals in the y, z and pt. | |
538 | // | |
539 | // This is to calibrate the dEdx and MS corrections | |
540 | ||
3ceb45ae | 541 | if(!fNTrackRefs) return kFALSE; |
1ee39b3a | 542 | for(Int_t itr=kNTrackRefs; itr--;){ |
3ceb45ae | 543 | (*x)[itr] = 0.;(*y)[itr] = 0.;(*z)[itr] = 0.; |
4226db3e | 544 | (*dx)[itr] = -1.; (*dy)[itr] = 100.; (*dz)[itr] = 100.; (*dpt)[itr] = 100.; |
1ee39b3a | 545 | } |
1ee39b3a | 546 | |
547 | // Initialize TRD track to the first track reference | |
4226db3e | 548 | AliTrackReference *tr(NULL); |
549 | Int_t itr(0); while(!(tr = fTrackRefs[itr])) itr++; | |
3ceb45ae | 550 | if(tr->Pt()<1.e-3) return kFALSE; |
1ee39b3a | 551 | |
552 | AliTRDtrackV1 tt; | |
553 | Double_t xyz[3]={tr->X(),tr->Y(),tr->Z()}; | |
554 | Double_t pxyz[3]={tr->Px(),tr->Py(),tr->Pz()}; | |
555 | Double_t var[6] = {1.e-4, 1.e-4, 1.e-4, 1.e-4, 1.e-4, 1.e-4}; | |
556 | Double_t cov[21]={ | |
557 | var[0], 0., 0., 0., 0., 0., | |
558 | var[1], 0., 0., 0., 0., | |
559 | var[2], 0., 0., 0., | |
560 | var[3], 0., 0., | |
561 | var[4], 0., | |
562 | var[5] | |
563 | }; | |
564 | TDatabasePDG db; | |
565 | const TParticlePDG *pdg=db.GetParticle(fPDG); | |
566 | if(!pdg){ | |
567 | AliWarningGeneral("AliTRDtrackInfo::AliMCinfo::PropagateKalman()", Form("PDG entry missing for code %d. References for track %d", fPDG, fNTrackRefs)); | |
3ceb45ae | 568 | return kFALSE; |
1ee39b3a | 569 | } |
570 | tt.Set(xyz, pxyz, cov, Short_t(pdg->Charge())); | |
3ceb45ae | 571 | if(mass<0){ // mass 0 use PDG |
572 | tt.SetMass(pdg->Mass()); | |
573 | } else { // use rec value | |
574 | tt.SetMass(mass); | |
575 | } | |
576 | ||
577 | // Double_t bg(tr->P()/pdg->Mass()); | |
578 | // printf("\n\nNEW track PDG[%d] bg[%f] x[%f]\n", fPDG, bg, TMath::Log(bg)); | |
4226db3e | 579 | Double_t x0(tr->LocalX()); |
580 | const Double_t *cc(NULL); | |
581 | for(Int_t ip=0; itr<fNTrackRefs; itr++){ | |
582 | if(!(tr = fTrackRefs[itr])) continue; | |
3ceb45ae | 583 | // printf("ip[%d] det[%d]\n", ip, tr->DetectorId()); |
5066aa9a | 584 | if(!AliTRDtrackerV1::PropagateToX(tt, tr->LocalX(), fgKalmanStep)) continue; |
1ee39b3a | 585 | |
586 | //if(update) ... | |
3ceb45ae | 587 | tt.GetXYZ(xyz); |
588 | (*x)[ip] = xyz[0]; | |
589 | (*y)[ip] = xyz[1]; | |
590 | (*z)[ip] = xyz[2]; | |
4226db3e | 591 | (*dx)[ip] = tt.GetX() - x0; |
592 | (*dy)[ip] = tt.GetY() - tr->LocalY(); | |
593 | (*dz)[ip] = tt.GetZ() - tr->Z(); | |
5066aa9a | 594 | (*pt)[ip] = tr->Pt(); |
4226db3e | 595 | (*dpt)[ip] = tt.Pt()- tr->Pt(); |
3ceb45ae | 596 | // printf("pt : kalman[%e] MC[%e]\n", tt.Pt(), tr->Pt()); |
597 | (*budget)[ip] = tt.GetBudget(0); | |
1ee39b3a | 598 | cc = tt.GetCovariance(); |
3ceb45ae | 599 | // printf("dx[%5.2f] sy[%f]\n", (*dx)[ip], TMath::Sqrt(cc[0])); |
600 | for(Int_t ic(0), jp(ip*15); ic<15; ic++, jp++) (*c)[jp]=cc[ic]; | |
1ee39b3a | 601 | ip++; |
602 | } | |
3ceb45ae | 603 | return kTRUE; |
1ee39b3a | 604 | } |