]>
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 | // | |
01ccc21a | 243 | if(this == &trdInfo) return *this; |
1ee39b3a | 244 | |
245 | fNClusters = trdInfo.fNClusters; | |
1881bb2b | 246 | fESD = trdInfo.fESD; |
1ee39b3a | 247 | |
248 | if(trdInfo.fMC){ | |
2c33fb46 | 249 | if(!fMC) fMC = new AliMCinfo(*trdInfo.fMC); |
250 | else{ | |
251 | fMC->~AliMCinfo(); | |
1ee39b3a | 252 | new(fMC) AliMCinfo(*trdInfo.fMC); |
2c33fb46 | 253 | } |
1881bb2b | 254 | } else {if(fMC) delete fMC; fMC = NULL;} |
1ee39b3a | 255 | |
256 | if(trdInfo.fTRDtrack){ | |
2c33fb46 | 257 | if(!fTRDtrack) fTRDtrack = new AliTRDtrackV1(*trdInfo.fTRDtrack); |
258 | else{ | |
259 | fTRDtrack->~AliTRDtrackV1(); | |
1ee39b3a | 260 | new(fTRDtrack) AliTRDtrackV1(*trdInfo.fTRDtrack); |
2c33fb46 | 261 | } |
1ee39b3a | 262 | if(trdInfo.fTRDtrack->IsOwner()) fTRDtrack->SetOwner(); |
1881bb2b | 263 | } else {if(fTRDtrack) delete fTRDtrack; fTRDtrack = NULL;} |
1ee39b3a | 264 | |
265 | return *this; | |
266 | } | |
267 | ||
268 | //___________________________________________________ | |
269 | AliTRDtrackInfo::AliMCinfo& AliTRDtrackInfo::AliMCinfo::operator=(const AliMCinfo &mc) | |
270 | { | |
271 | // | |
272 | // Assignment operator | |
273 | // | |
274 | ||
01ccc21a | 275 | if(this == &mc) return *this; |
1ee39b3a | 276 | fLabel = mc.fLabel; |
277 | fPDG = mc.fPDG; | |
278 | fNTrackRefs = mc.fNTrackRefs; | |
279 | ||
280 | AliTrackReference **itr = &fTrackRefs[0]; | |
281 | AliTrackReference* const *jtr = &mc.fTrackRefs[0]; | |
282 | for(Int_t ien = 0; ien < 12; ien++, itr++, jtr++){ | |
283 | if((*jtr)){ | |
284 | if(!(*itr)) (*itr) = new AliTrackReference(*(*jtr)); | |
2c33fb46 | 285 | else{ |
286 | (*itr)->~AliTrackReference(); | |
287 | new(&(*itr)) AliTrackReference(*(*jtr)); | |
288 | } | |
1881bb2b | 289 | } else {if((*itr)) delete (*itr); (*itr) = NULL;} |
1ee39b3a | 290 | } |
291 | return *this; | |
292 | } | |
293 | ||
294 | //___________________________________________________ | |
295 | AliTRDtrackInfo::AliESDinfo& AliTRDtrackInfo::AliESDinfo::operator=(const AliESDinfo &esd) | |
296 | { | |
297 | // | |
298 | // Assignment operator | |
299 | // | |
300 | ||
01ccc21a | 301 | if(this == &esd) return *this; |
302 | fHasV0 = esd.fHasV0; | |
1ee39b3a | 303 | fId = esd.fId; |
01ccc21a | 304 | fStatus = esd.fStatus; |
305 | fKinkIndex = esd.fKinkIndex; | |
306 | fTPCncls = esd.fTPCncls; | |
307 | fTOFbc = esd.fTOFbc; | |
308 | fTRDpidQuality= esd.fTRDpidQuality; | |
1ee39b3a | 309 | fTRDnSlices = esd.fTRDnSlices; |
178d284a | 310 | |
1ee39b3a | 311 | memcpy(fTRDr, esd.fTRDr, AliPID::kSPECIES*sizeof(Double32_t)); |
01ccc21a | 312 | memcpy(fTRDv0pid, esd.fTRDv0pid, AliPID::kSPECIES*sizeof(Int_t)); |
1ee39b3a | 313 | |
314 | if(fTRDnSlices){ | |
56838f9d | 315 | if(!fTRDslices) fTRDslices = new Double32_t[fTRDnSlices]; |
1ee39b3a | 316 | memcpy(fTRDslices, esd.fTRDslices, fTRDnSlices*sizeof(Double32_t)); |
317 | } | |
318 | if(esd.fOP){ | |
2c33fb46 | 319 | if(fOP){ |
320 | fOP->~AliExternalTrackParam(); | |
4ec1ca0f | 321 | // RS: Constructor from VTrack was used instead of Constructor from AliExternalTrackParam |
322 | new(fOP) AliExternalTrackParam(*esd.fOP); | |
323 | } else fOP = new AliExternalTrackParam(*esd.fOP); | |
1881bb2b | 324 | } else {if(fOP) delete fOP; fOP = NULL;} |
35983729 | 325 | if(esd.fTPCout){ |
326 | if(fTPCout){ | |
327 | fTPCout->~AliExternalTrackParam(); | |
328 | // RS: Constructor from VTrack was used instead of Constructor from AliExternalTrackParam | |
329 | new(fTPCout) AliExternalTrackParam(*esd.fTPCout); | |
330 | } else fTPCout = new AliExternalTrackParam(*esd.fTPCout); | |
1881bb2b | 331 | } else { if(fTPCout) delete fTPCout; fTPCout = NULL;} |
1ee39b3a | 332 | |
333 | return *this; | |
334 | } | |
335 | ||
336 | //___________________________________________________ | |
337 | void AliTRDtrackInfo::Delete(const Option_t *) | |
338 | { | |
339 | // | |
340 | // Delete | |
341 | // | |
342 | ||
2c33fb46 | 343 | AliDebug(2, Form("track[%p] mc[%p]", (void*)fTRDtrack, (void*)fMC)); |
1ee39b3a | 344 | fNClusters = 0; |
f232df0d | 345 | if(fMC) delete fMC; fMC = NULL; |
8778aca3 | 346 | fESD.Delete(NULL); |
f232df0d | 347 | if(fTRDtrack) delete fTRDtrack; fTRDtrack = NULL; |
1ee39b3a | 348 | } |
349 | ||
350 | //___________________________________________________ | |
351 | void AliTRDtrackInfo::SetTrack(const AliTRDtrackV1 *track) | |
352 | { | |
353 | // | |
354 | // Set the TRD track | |
355 | // | |
356 | ||
2c33fb46 | 357 | if(!fTRDtrack) fTRDtrack = new AliTRDtrackV1(*track); |
358 | else{ | |
359 | fTRDtrack->~AliTRDtrackV1(); | |
360 | new(fTRDtrack) AliTRDtrackV1(*track); | |
361 | } | |
1ee39b3a | 362 | fTRDtrack->SetOwner(); |
363 | // Make a copy for the object in order to avoid ownership problems | |
364 | } | |
365 | ||
366 | //___________________________________________________ | |
367 | void AliTRDtrackInfo::AddTrackRef(const AliTrackReference *tref) | |
368 | { | |
369 | // | |
370 | // Add track reference | |
371 | // | |
372 | ||
1ee39b3a | 373 | if(fMC->fNTrackRefs >= 12){ |
374 | SetCurved(); | |
375 | return; | |
376 | } | |
377 | // Make a copy for the object in order to avoid ownership problems | |
378 | fMC->fTrackRefs[fMC->fNTrackRefs++] = new AliTrackReference(*tref); | |
379 | } | |
380 | ||
381 | //___________________________________________________ | |
382 | AliTrackReference* AliTRDtrackInfo::GetTrackRef(Int_t idx) const | |
383 | { | |
384 | // | |
385 | // Returns a track reference | |
386 | // | |
f232df0d | 387 | if(!fMC) return NULL; |
388 | return (idx>=0 && idx < 12) ? fMC->fTrackRefs[idx] : NULL; | |
1ee39b3a | 389 | } |
390 | ||
391 | //___________________________________________________ | |
61f6b45e | 392 | AliTrackReference* AliTRDtrackInfo::GetTrackRef(const AliTRDseedV1* const tracklet) const |
1ee39b3a | 393 | { |
394 | // | |
395 | // Returns a track reference | |
396 | // | |
f232df0d | 397 | if(!fMC) return NULL; |
1ee39b3a | 398 | Double_t cw = AliTRDgeometry::CamHght() + AliTRDgeometry::CdrHght(); |
399 | AliTrackReference * const* jtr = &(fMC->fTrackRefs[0]); | |
400 | for(Int_t itr = 0; itr < fMC->fNTrackRefs; itr++, ++jtr){ | |
401 | if(!(*jtr)) break; | |
402 | if(TMath::Abs(tracklet->GetX0() - (*jtr)->LocalX()) < cw) return (*jtr); | |
403 | } | |
f232df0d | 404 | return NULL; |
1ee39b3a | 405 | } |
406 | ||
407 | //___________________________________________________ | |
408 | Int_t AliTRDtrackInfo::GetNumberOfClusters() const | |
409 | { | |
410 | // | |
411 | // Returns the number of clusters | |
412 | // | |
413 | ||
414 | Int_t n = 0; | |
415 | if(!fTRDtrack) return 0; | |
416 | if(fTRDtrack->GetNumberOfTracklets() == 0) return n; | |
f232df0d | 417 | AliTRDseedV1 *tracklet = NULL; |
1ee39b3a | 418 | for(Int_t ip=0; ip<6; ip++){ |
419 | if(!(tracklet = const_cast<AliTRDseedV1 *>(fTRDtrack->GetTracklet(ip)))) continue; | |
420 | n+=tracklet->GetN(); | |
421 | } | |
422 | return n; | |
423 | } | |
424 | ||
425 | ||
426 | //___________________________________________________ | |
427 | void AliTRDtrackInfo::SetOuterParam(const AliExternalTrackParam *op) | |
428 | { | |
429 | // | |
430 | // Set outer track parameters | |
431 | // | |
432 | ||
433 | if(!op) return; | |
2c33fb46 | 434 | if(fESD.fOP){ |
435 | fESD.fOP->~AliExternalTrackParam(); | |
436 | new(fESD.fOP) AliExternalTrackParam(*op); | |
437 | } else fESD.fOP = new AliExternalTrackParam(*op); | |
1ee39b3a | 438 | } |
439 | ||
35983729 | 440 | //___________________________________________________ |
441 | void AliTRDtrackInfo::SetTPCoutParam(const AliExternalTrackParam *op) | |
442 | { | |
443 | // | |
444 | // Set TPCout track parameters | |
445 | // | |
446 | ||
447 | if(!op) return; | |
448 | if(fESD.fTPCout){ | |
449 | fESD.fTPCout->~AliExternalTrackParam(); | |
450 | new(fESD.fTPCout) AliExternalTrackParam(*op); | |
451 | } else fESD.fTPCout = new AliExternalTrackParam(*op); | |
452 | } | |
453 | ||
1ee39b3a | 454 | //___________________________________________________ |
455 | Int_t AliTRDtrackInfo::GetNTracklets() const | |
456 | { | |
457 | // | |
458 | // Return the number of tracklets | |
459 | // | |
460 | ||
e2927481 | 461 | if(!fTRDtrack) return 0; |
1ee39b3a | 462 | return fTRDtrack->GetNumberOfTracklets(); |
463 | } | |
464 | ||
465 | //___________________________________________________ | |
466 | void AliTRDtrackInfo::SetSlices(Int_t n, Double32_t *s) | |
467 | { | |
468 | // | |
469 | // Set the slices | |
470 | // | |
1ee39b3a | 471 | if(fESD.fTRDnSlices != n){ |
472 | fESD.fTRDnSlices = 0; | |
473 | delete [] fESD.fTRDslices; | |
f232df0d | 474 | fESD.fTRDslices = NULL; |
1ee39b3a | 475 | } |
476 | ||
477 | if(!fESD.fTRDnSlices){ | |
478 | fESD.fTRDnSlices = n; | |
f232df0d | 479 | fESD.fTRDslices = new Double32_t[fESD.fTRDnSlices]; |
1ee39b3a | 480 | } |
481 | ||
482 | memcpy(fESD.fTRDslices, s, n*sizeof(Double32_t)); | |
483 | } | |
484 | ||
485 | //___________________________________________________ | |
f429b017 | 486 | 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 | 487 | { |
488 | // Check for 2 track ref for the tracklet defined bythe radial position x0 | |
489 | // The "status" is a bit map and gives a more informative output in case of failure: | |
490 | // - 0 : everything is OK | |
491 | // - BIT(0) : 0 track refs found | |
492 | // - BIT(1) : 1 track reference found | |
493 | // - BIT(2) : dx <= 0 between track references | |
494 | // - BIT(3) : dx > 0 && dx < 3.7 - tangent tracks | |
495 | ||
496 | status = 0; | |
497 | Double_t cw = AliTRDgeometry::CamHght() + AliTRDgeometry::CdrHght(); | |
498 | Int_t nFound = 0; | |
f232df0d | 499 | AliTrackReference *tr[2] = {NULL, NULL}; |
1ee39b3a | 500 | AliTrackReference * const* jtr = &fTrackRefs[0]; |
501 | for(Int_t itr = 0; itr < fNTrackRefs; itr++, ++jtr){ | |
502 | if(!(*jtr)) break; | |
503 | /* | |
504 | if(fDebugLevel>=5) printf("\t\tref[%2d] x[%6.3f]\n", itr, (*jtr)->LocalX());*/ | |
505 | if(TMath::Abs(x0 - (*jtr)->LocalX()) > cw) continue; | |
506 | tr[nFound++] = (*jtr); | |
507 | if(nFound == 2) break; | |
508 | } | |
509 | if(nFound < 2){ | |
f429b017 | 510 | AliDebugGeneral("AliTRDtrackInfo::AliMCinfo::GetDirections()", 1, Form("Missing track ref x0[%6.3f] nref[%d]", x0, nFound)); |
1ee39b3a | 511 | if(!nFound) SETBIT(status, 0); |
512 | else SETBIT(status, 1); | |
513 | return kFALSE; | |
514 | } | |
61f6b45e | 515 | pt=tr[1]->Pt(); |
516 | if(pt < 1.e-3) return kFALSE; | |
1ee39b3a | 517 | |
518 | Double_t dx = tr[1]->LocalX() - tr[0]->LocalX(); | |
519 | if(dx <= 0.){ | |
520 | AliWarningGeneral("AliTRDtrackInfo::AliMCinfo::GetDirections()", Form("Track ref with wrong radial distances refX0[%6.3f] refX1[%6.3f]", tr[0]->LocalX(), tr[1]->LocalX())); | |
521 | SETBIT(status, 2); | |
522 | return kFALSE; | |
523 | } | |
524 | if(TMath::Abs(dx-AliTRDgeometry::CamHght()-AliTRDgeometry::CdrHght())>1.E-3) SETBIT(status, 3); | |
525 | ||
526 | dydx = (tr[1]->LocalY() - tr[0]->LocalY()) / dx; | |
527 | dzdx = (tr[1]->Z() - tr[0]->Z()) / dx; | |
528 | //Float_t dx0 = tr[1]->LocalX() - x0; | |
529 | y0 = tr[1]->LocalY()/* - dydx*dx0*/; | |
530 | z0 = tr[1]->Z()/* - dzdx*dx0*/; | |
531 | x0 = tr[1]->LocalX(); | |
3ceb45ae | 532 | eta = -TMath::Log(TMath::Tan(0.5 * tr[1]->Theta())); |
01ccc21a | 533 | phi = TMath::ATan2(tr[1]->Y(), tr[1]->X()); |
1ee39b3a | 534 | return kTRUE; |
535 | } | |
536 | ||
537 | //___________________________________________________ | |
3ceb45ae | 538 | Bool_t AliTRDtrackInfo::AliMCinfo::PropagateKalman( |
539 | TVectorD *x, TVectorD *y, TVectorD *z, | |
540 | TVectorD *dx, TVectorD *dy, TVectorD *dz, | |
541 | TVectorD *pt, TVectorD *dpt, TVectorD *budget, TVectorD *c, Double_t mass) const | |
1ee39b3a | 542 | { |
543 | // Propagate Kalman from the first TRD track reference to | |
544 | // last one and save residuals in the y, z and pt. | |
545 | // | |
546 | // This is to calibrate the dEdx and MS corrections | |
547 | ||
3ceb45ae | 548 | if(!fNTrackRefs) return kFALSE; |
1ee39b3a | 549 | for(Int_t itr=kNTrackRefs; itr--;){ |
3ceb45ae | 550 | (*x)[itr] = 0.;(*y)[itr] = 0.;(*z)[itr] = 0.; |
4226db3e | 551 | (*dx)[itr] = -1.; (*dy)[itr] = 100.; (*dz)[itr] = 100.; (*dpt)[itr] = 100.; |
1ee39b3a | 552 | } |
1ee39b3a | 553 | |
554 | // Initialize TRD track to the first track reference | |
4226db3e | 555 | AliTrackReference *tr(NULL); |
556 | Int_t itr(0); while(!(tr = fTrackRefs[itr])) itr++; | |
3ceb45ae | 557 | if(tr->Pt()<1.e-3) return kFALSE; |
1ee39b3a | 558 | |
559 | AliTRDtrackV1 tt; | |
560 | Double_t xyz[3]={tr->X(),tr->Y(),tr->Z()}; | |
561 | Double_t pxyz[3]={tr->Px(),tr->Py(),tr->Pz()}; | |
562 | Double_t var[6] = {1.e-4, 1.e-4, 1.e-4, 1.e-4, 1.e-4, 1.e-4}; | |
563 | Double_t cov[21]={ | |
564 | var[0], 0., 0., 0., 0., 0., | |
565 | var[1], 0., 0., 0., 0., | |
566 | var[2], 0., 0., 0., | |
567 | var[3], 0., 0., | |
568 | var[4], 0., | |
569 | var[5] | |
570 | }; | |
571 | TDatabasePDG db; | |
572 | const TParticlePDG *pdg=db.GetParticle(fPDG); | |
573 | if(!pdg){ | |
574 | AliWarningGeneral("AliTRDtrackInfo::AliMCinfo::PropagateKalman()", Form("PDG entry missing for code %d. References for track %d", fPDG, fNTrackRefs)); | |
3ceb45ae | 575 | return kFALSE; |
1ee39b3a | 576 | } |
577 | tt.Set(xyz, pxyz, cov, Short_t(pdg->Charge())); | |
3ceb45ae | 578 | if(mass<0){ // mass 0 use PDG |
579 | tt.SetMass(pdg->Mass()); | |
580 | } else { // use rec value | |
581 | tt.SetMass(mass); | |
582 | } | |
583 | ||
584 | // Double_t bg(tr->P()/pdg->Mass()); | |
585 | // printf("\n\nNEW track PDG[%d] bg[%f] x[%f]\n", fPDG, bg, TMath::Log(bg)); | |
4226db3e | 586 | Double_t x0(tr->LocalX()); |
587 | const Double_t *cc(NULL); | |
588 | for(Int_t ip=0; itr<fNTrackRefs; itr++){ | |
589 | if(!(tr = fTrackRefs[itr])) continue; | |
3ceb45ae | 590 | // printf("ip[%d] det[%d]\n", ip, tr->DetectorId()); |
5066aa9a | 591 | if(!AliTRDtrackerV1::PropagateToX(tt, tr->LocalX(), fgKalmanStep)) continue; |
1ee39b3a | 592 | |
593 | //if(update) ... | |
3ceb45ae | 594 | tt.GetXYZ(xyz); |
595 | (*x)[ip] = xyz[0]; | |
596 | (*y)[ip] = xyz[1]; | |
597 | (*z)[ip] = xyz[2]; | |
4226db3e | 598 | (*dx)[ip] = tt.GetX() - x0; |
599 | (*dy)[ip] = tt.GetY() - tr->LocalY(); | |
600 | (*dz)[ip] = tt.GetZ() - tr->Z(); | |
5066aa9a | 601 | (*pt)[ip] = tr->Pt(); |
4226db3e | 602 | (*dpt)[ip] = tt.Pt()- tr->Pt(); |
3ceb45ae | 603 | // printf("pt : kalman[%e] MC[%e]\n", tt.Pt(), tr->Pt()); |
604 | (*budget)[ip] = tt.GetBudget(0); | |
1ee39b3a | 605 | cc = tt.GetCovariance(); |
3ceb45ae | 606 | // printf("dx[%5.2f] sy[%f]\n", (*dx)[ip], TMath::Sqrt(cc[0])); |
607 | for(Int_t ic(0), jp(ip*15); ic<15; ic++, jp++) (*c)[jp]=cc[ic]; | |
1ee39b3a | 608 | ip++; |
609 | } | |
3ceb45ae | 610 | return kTRUE; |
1ee39b3a | 611 | } |