]>
Commit | Line | Data |
---|---|---|
1 | /************************************************************************** | |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // $Id$ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////// | |
19 | // Class AliTrack | |
20 | // Handling of the attributes of a reconstructed particle track. | |
21 | // | |
22 | // Coding example : | |
23 | // ---------------- | |
24 | // | |
25 | // Float_t a[4]={195.,1.2,-0.04,8.5}; | |
26 | // Ali4Vector pmu; | |
27 | // pmu.SetVector(a,"car"); | |
28 | // AliTrack t1; | |
29 | // t1.Set4Momentum(pmu); | |
30 | // | |
31 | // Float_t b[3]={1.2,-0.04,8.5}; | |
32 | // Ali3Vector p; | |
33 | // p.SetVector(b,"car"); | |
34 | // AliTrack t2; | |
35 | // t2.Set3Momentum(p); | |
36 | // t2.SetCharge(0); | |
37 | // t2.SetMass(1.115); | |
38 | // | |
39 | // t1.Data(); | |
40 | // t2.Data(); | |
41 | // | |
42 | // Float_t pi=acos(-1.); | |
43 | // Float_t thcms=0.2*pi; // decay theta angle in cms | |
44 | // Float_t phicms=pi/4.; // decay theta angle in cms | |
45 | // Float_t m1=0.938; | |
46 | // Float_t m2=0.140; | |
47 | // t2.Decay(m1,m2,thcms,phicms); // Track t2 decay : Lambda -> proton + pion | |
48 | // | |
49 | // t2.List(); | |
50 | // | |
51 | // Int_t ndec=t2.GetNdecay(); | |
52 | // AliTrack* d1=t2.GetDecayTrack(1); // Access to decay track number 1 | |
53 | // AliTrack* d2=t2.GetDecayTrack(2); // Access to decay track number 2 | |
54 | // | |
55 | // AliSignal s1,s2,s3,s4; | |
56 | // | |
57 | // .... // Code (e.g. detector readout) to fill AliSignal data | |
58 | // | |
59 | // AliTrack trec; // Track which will be reconstructed from signals | |
60 | // trec.AddSignal(s1); | |
61 | // trec.AddSignal(s3); | |
62 | // trec.AddSignal(s4); | |
63 | // | |
64 | // Ali3Vector P; | |
65 | // Float_t Q,M; | |
66 | // | |
67 | // ... // Code which accesses signals from trec and reconstructs | |
68 | // 3-momentum P, charge Q, mass M etc... | |
69 | // | |
70 | // trec.Set3Momentum(P); | |
71 | // trec.SetCharge(Q); | |
72 | // trec.SetMass(M); | |
73 | // | |
74 | // Float_t r1[3]={1.6,-3.8,25.7}; | |
75 | // Float_t er1[3]={0.2,0.5,1.8}; | |
76 | // Float_t r2[3]={8.6,23.8,-6.7}; | |
77 | // Float_t er2[3]={0.93,1.78,0.8}; | |
78 | // AliPosition begin,end; | |
79 | // begin.SetPosition(r1,"car"); | |
80 | // begin.SetPositionErrors(er1,"car"); | |
81 | // end.SetPosition(r2,"car"); | |
82 | // end.SetPositionErrors(er2,"car"); | |
83 | // trec.SetBeginPoint(begin); | |
84 | // trec.SetEndPoint(end); | |
85 | // | |
86 | // Note : All quantities are in GeV, GeV/c or GeV/c**2 | |
87 | // | |
88 | //--- Author: Nick van Eijndhoven 10-jul-1997 UU-SAP Utrecht | |
89 | //- Modified: NvE $Date$ UU-SAP Utrecht | |
90 | /////////////////////////////////////////////////////////////////////////// | |
91 | ||
92 | #include "AliTrack.h" | |
93 | #include "Riostream.h" | |
94 | ||
95 | ClassImp(AliTrack) // Class implementation to enable ROOT I/O | |
96 | ||
97 | AliTrack::AliTrack() : TNamed(),Ali4Vector() | |
98 | { | |
99 | // Default constructor | |
100 | // All variables initialised to 0 | |
101 | Init(); | |
102 | Reset(); | |
103 | } | |
104 | /////////////////////////////////////////////////////////////////////////// | |
105 | void AliTrack::Init() | |
106 | { | |
107 | // Initialisation of pointers etc... | |
108 | fDecays=0; | |
109 | fSignals=0; | |
110 | fHypotheses=0; | |
111 | fBegin=0; | |
112 | fEnd=0; | |
113 | fRef=0; | |
114 | fImpactXY=0; | |
115 | fImpactXZ=0; | |
116 | fImpactYZ=0; | |
117 | fClosest=0; | |
118 | fParent=0; | |
119 | fFit=0; | |
120 | fTstamp=0; | |
121 | } | |
122 | /////////////////////////////////////////////////////////////////////////// | |
123 | AliTrack::~AliTrack() | |
124 | { | |
125 | // Destructor to delete memory allocated for decay tracks array. | |
126 | // This destructor automatically cleares the pointer of this AliTrack | |
127 | // from all the link slots of the related AliSignal objects. | |
128 | Int_t nsig=GetNsignals(); | |
129 | for (Int_t i=1; i<=nsig; i++) | |
130 | { | |
131 | AliSignal* s=GetSignal(i); | |
132 | if (s) s->ResetLinks(this); | |
133 | } | |
134 | ||
135 | if (fDecays) | |
136 | { | |
137 | delete fDecays; | |
138 | fDecays=0; | |
139 | } | |
140 | if (fSignals) | |
141 | { | |
142 | fSignals->Clear(); | |
143 | delete fSignals; | |
144 | fSignals=0; | |
145 | } | |
146 | if (fHypotheses) | |
147 | { | |
148 | delete fHypotheses; | |
149 | fHypotheses=0; | |
150 | } | |
151 | if (fBegin) | |
152 | { | |
153 | delete fBegin; | |
154 | fBegin=0; | |
155 | } | |
156 | if (fEnd) | |
157 | { | |
158 | delete fEnd; | |
159 | fEnd=0; | |
160 | } | |
161 | if (fRef) | |
162 | { | |
163 | delete fRef; | |
164 | fRef=0; | |
165 | } | |
166 | if (fImpactXY) | |
167 | { | |
168 | delete fImpactXY; | |
169 | fImpactXY=0; | |
170 | } | |
171 | if (fImpactXZ) | |
172 | { | |
173 | delete fImpactXZ; | |
174 | fImpactXZ=0; | |
175 | } | |
176 | if (fImpactYZ) | |
177 | { | |
178 | delete fImpactYZ; | |
179 | fImpactYZ=0; | |
180 | } | |
181 | if (fClosest) | |
182 | { | |
183 | delete fClosest; | |
184 | fClosest=0; | |
185 | } | |
186 | if (fFit) | |
187 | { | |
188 | delete fFit; | |
189 | fFit=0; | |
190 | } | |
191 | if (fTstamp) | |
192 | { | |
193 | delete fTstamp; | |
194 | fTstamp=0; | |
195 | } | |
196 | } | |
197 | /////////////////////////////////////////////////////////////////////////// | |
198 | AliTrack::AliTrack(const AliTrack& t) : TNamed(t),Ali4Vector(t) | |
199 | { | |
200 | // Copy constructor | |
201 | Init(); | |
202 | ||
203 | fQ=t.fQ; | |
204 | fProb=t.fProb; | |
205 | if (t.fBegin) fBegin=new AliPositionObj(*(t.fBegin)); | |
206 | if (t.fEnd) fEnd=new AliPositionObj(*(t.fEnd)); | |
207 | if (t.fRef) fRef=new AliPositionObj(*(t.fRef)); | |
208 | if (t.fImpactXY) fImpactXY=new AliPositionObj(*(t.fImpactXY)); | |
209 | if (t.fImpactXZ) fImpactXZ=new AliPositionObj(*(t.fImpactXZ)); | |
210 | if (t.fImpactYZ) fImpactYZ=new AliPositionObj(*(t.fImpactYZ)); | |
211 | if (t.fClosest) fClosest=new AliPositionObj(*(t.fClosest)); | |
212 | if (t.fFit) fFit=t.fFit->Clone(); | |
213 | if (t.fTstamp) fTstamp=new AliTimestamp(*(t.fTstamp)); | |
214 | fUserId=t.fUserId; | |
215 | fChi2=t.fChi2; | |
216 | fNdf=t.fNdf; | |
217 | fCode=t.fCode; | |
218 | fParent=t.fParent; | |
219 | ||
220 | Int_t ndec=t.GetNdecay(); | |
221 | if (ndec) | |
222 | { | |
223 | fDecays=new TObjArray(ndec); | |
224 | fDecays->SetOwner(); | |
225 | for (Int_t it=1; it<=ndec; it++) | |
226 | { | |
227 | AliTrack* tx=t.GetDecayTrack(it); | |
228 | fDecays->Add(new AliTrack(*tx)); | |
229 | } | |
230 | } | |
231 | ||
232 | Int_t nsig=t.GetNsignals(); | |
233 | if (nsig) | |
234 | { | |
235 | fSignals=new TObjArray(nsig); | |
236 | for (Int_t is=1; is<=nsig; is++) | |
237 | { | |
238 | AliSignal* sx=t.GetSignal(is); | |
239 | fSignals->Add(sx); | |
240 | } | |
241 | } | |
242 | ||
243 | Int_t nhyp=t.GetNhypotheses(); | |
244 | if (nhyp) | |
245 | { | |
246 | fHypotheses=new TObjArray(nhyp); | |
247 | fHypotheses->SetOwner(); | |
248 | for (Int_t ih=1; ih<=nhyp; ih++) | |
249 | { | |
250 | AliTrack* tx=t.GetTrackHypothesis(ih); | |
251 | fHypotheses->Add(new AliTrack(*tx)); | |
252 | } | |
253 | } | |
254 | } | |
255 | /////////////////////////////////////////////////////////////////////////// | |
256 | void AliTrack::Reset() | |
257 | { | |
258 | // Reset all variables to 0 and delete all auto-generated decay tracks. | |
259 | fQ=0; | |
260 | fChi2=0; | |
261 | fNdf=0; | |
262 | fUserId=0; | |
263 | fCode=0; | |
264 | fProb=0; | |
265 | Double_t a[4]={0,0,0,0}; | |
266 | SetVector(a,"sph"); | |
267 | fParent=0; | |
268 | if (fDecays) | |
269 | { | |
270 | delete fDecays; | |
271 | fDecays=0; | |
272 | } | |
273 | if (fSignals) | |
274 | { | |
275 | fSignals->Clear(); | |
276 | delete fSignals; | |
277 | fSignals=0; | |
278 | } | |
279 | if (fHypotheses) | |
280 | { | |
281 | delete fHypotheses; | |
282 | fHypotheses=0; | |
283 | } | |
284 | if (fBegin) | |
285 | { | |
286 | delete fBegin; | |
287 | fBegin=0; | |
288 | } | |
289 | if (fEnd) | |
290 | { | |
291 | delete fEnd; | |
292 | fEnd=0; | |
293 | } | |
294 | if (fRef) | |
295 | { | |
296 | delete fRef; | |
297 | fRef=0; | |
298 | } | |
299 | if (fImpactXY) | |
300 | { | |
301 | delete fImpactXY; | |
302 | fImpactXY=0; | |
303 | } | |
304 | if (fImpactXZ) | |
305 | { | |
306 | delete fImpactXZ; | |
307 | fImpactXZ=0; | |
308 | } | |
309 | if (fImpactYZ) | |
310 | { | |
311 | delete fImpactYZ; | |
312 | fImpactYZ=0; | |
313 | } | |
314 | if (fClosest) | |
315 | { | |
316 | delete fClosest; | |
317 | fClosest=0; | |
318 | } | |
319 | if (fFit) | |
320 | { | |
321 | delete fFit; | |
322 | fFit=0; | |
323 | } | |
324 | if (fTstamp) | |
325 | { | |
326 | delete fTstamp; | |
327 | fTstamp=0; | |
328 | } | |
329 | } | |
330 | /////////////////////////////////////////////////////////////////////////// | |
331 | void AliTrack::Set3Momentum(Ali3Vector& p) | |
332 | { | |
333 | // Set the track parameters according to the 3-momentum p. | |
334 | // In case the mass was not yet set, the energy is set to correspond to m=0. | |
335 | Set3Vector(p); | |
336 | Double_t inv=GetInvariant(); | |
337 | if (inv<0) SetMass(0.); | |
338 | } | |
339 | /////////////////////////////////////////////////////////////////////////// | |
340 | void AliTrack::Set4Momentum(Ali4Vector& p) | |
341 | { | |
342 | // Set the track parameters according to the 4-momentum p | |
343 | Double_t E=p.GetScalar(); | |
344 | Double_t dE=p.GetResultError(); | |
345 | Ali3Vector pv=p.Get3Vector(); | |
346 | SetVector(E,pv); | |
347 | SetScalarError(dE); | |
348 | } | |
349 | /////////////////////////////////////////////////////////////////////////// | |
350 | void AliTrack::SetMass(Double_t m,Double_t dm) | |
351 | { | |
352 | // Set the particle mass | |
353 | // The default value for the error dm is 0. | |
354 | Double_t inv=pow(m,2); | |
355 | Double_t dinv=fabs(2.*m*dm); | |
356 | SetInvariant(inv,dinv); | |
357 | } | |
358 | /////////////////////////////////////////////////////////////////////////// | |
359 | void AliTrack::SetCharge(Float_t q) | |
360 | { | |
361 | // Set the particle charge | |
362 | fQ=q; | |
363 | } | |
364 | /////////////////////////////////////////////////////////////////////////// | |
365 | void AliTrack::Data(TString f,TString u) | |
366 | { | |
367 | // Provide track information within the coordinate frame f | |
368 | // | |
369 | // The string argument "u" allows to choose between different angular units | |
370 | // in case e.g. a spherical frame is selected. | |
371 | // u = "rad" : angles provided in radians | |
372 | // "deg" : angles provided in degrees | |
373 | // | |
374 | // The defaults are f="car" and u="rad". | |
375 | ||
376 | Double_t m=GetMass(); | |
377 | Double_t dm=GetResultError(); | |
378 | const char* name=GetName(); | |
379 | const char* title=GetTitle(); | |
380 | ||
381 | cout << " *" << ClassName() << "::Data*"; | |
382 | if (strlen(name)) cout << " Name : " << name; | |
383 | if (strlen(title)) cout << " Title : " << title; | |
384 | cout << endl; | |
385 | if (fTstamp) fTstamp->Date(1); | |
386 | cout << " Id : " << fUserId << " Code : " << fCode | |
387 | << " m : " << m << " dm : " << dm << " Charge : " << fQ | |
388 | << " p : " << GetMomentum() << endl; | |
389 | cout << " Nhypotheses : " << GetNhypotheses() << " Ndecay-tracks : " << GetNdecay() | |
390 | << " Nsignals : " << GetNsignals() << endl; | |
391 | if (fParent) | |
392 | { | |
393 | cout << " Parent track Id : " << fParent->GetId() << " Code : " << fParent->GetParticleCode() | |
394 | << " m : " << fParent->GetMass() << " Q : " << fParent->GetCharge() | |
395 | << " p : " << fParent->GetMomentum(); | |
396 | const char* pname=fParent->GetName(); | |
397 | const char* ptitle=fParent->GetTitle(); | |
398 | if (strlen(pname)) cout << " Name : " << pname; | |
399 | if (strlen(ptitle)) cout << " Title : " << ptitle; | |
400 | cout << endl; | |
401 | } | |
402 | if (fFit) | |
403 | { | |
404 | cout << " Fit details present in object of class " << fFit->ClassName() << endl; | |
405 | if (fFit->InheritsFrom("AliSignal")) ((AliSignal*)fFit)->List(-1); | |
406 | } | |
407 | Ali4Vector::Data(f,u); | |
408 | } | |
409 | /////////////////////////////////////////////////////////////////////////// | |
410 | void AliTrack::List(TString f,TString u) | |
411 | { | |
412 | // Provide current track and decay level 1 information within coordinate frame f | |
413 | // | |
414 | // The string argument "u" allows to choose between different angular units | |
415 | // in case e.g. a spherical frame is selected. | |
416 | // u = "rad" : angles provided in radians | |
417 | // "deg" : angles provided in degrees | |
418 | // | |
419 | // The defaults are f="car" and u="rad". | |
420 | ||
421 | Data(f,u); // Information of the current track | |
422 | if (fBegin) { cout << " Begin-point :"; fBegin->Data(f,u); } | |
423 | if (fEnd) { cout << " End-point :"; fEnd->Data(f,u); } | |
424 | if (fRef) { cout << " Ref-point :"; fRef->Data(f,u); } | |
425 | ||
426 | // Decay products of this track | |
427 | AliTrack* td; | |
428 | for (Int_t id=1; id<=GetNdecay(); id++) | |
429 | { | |
430 | td=GetDecayTrack(id); | |
431 | if (td) | |
432 | { | |
433 | cout << " ---Level 1 sec. track no. " << id << endl; | |
434 | td->Data(f,u); | |
435 | } | |
436 | else | |
437 | { | |
438 | cout << " *AliTrack::List* Error : Empty decay track slot." << endl; | |
439 | } | |
440 | } | |
441 | } | |
442 | /////////////////////////////////////////////////////////////////////////// | |
443 | void AliTrack::ListAll(TString f,TString u) | |
444 | { | |
445 | // Provide complete track and decay information within the coordinate frame f | |
446 | // | |
447 | // The string argument "u" allows to choose between different angular units | |
448 | // in case e.g. a spherical frame is selected. | |
449 | // u = "rad" : angles provided in radians | |
450 | // "deg" : angles provided in degrees | |
451 | // | |
452 | // The defaults are f="car" and u="rad". | |
453 | ||
454 | Data(f,u); // Information of the current track | |
455 | if (fBegin) { cout << " Begin-point :"; fBegin->Data(f,u); } | |
456 | if (fEnd) { cout << " End-point :"; fEnd->Data(f,u); } | |
457 | if (fRef) { cout << " Ref-point :"; fRef->Data(f,u); } | |
458 | ||
459 | Int_t nhyp=GetNhypotheses(); | |
460 | if (nhyp) | |
461 | { | |
462 | cout << " List of the " << nhyp << " track hypotheses : " << endl; | |
463 | for (Int_t ih=1; ih<=nhyp; ih++) | |
464 | { | |
465 | AliTrack* tx=GetTrackHypothesis(ih); | |
466 | if (tx) tx->Data(f,u); | |
467 | } | |
468 | } | |
469 | ||
470 | Int_t nsig=GetNsignals(); | |
471 | if (nsig) | |
472 | { | |
473 | cout << " List of the corresponding slots for the " << nsig | |
474 | << " related signals : " << endl; | |
475 | AliPosition r; | |
476 | Int_t nrefs,jslot; | |
477 | TArrayI slotarr; | |
478 | for (Int_t is=1; is<=nsig; is++) | |
479 | { | |
480 | AliSignal* sx=GetSignal(is); | |
481 | if (sx) | |
482 | { | |
483 | nrefs=sx->GetIndices(this,slotarr,0); | |
484 | for (Int_t jref=0; jref<nrefs; jref++) | |
485 | { | |
486 | jslot=slotarr.At(jref); | |
487 | sx->List(jslot); | |
488 | } | |
489 | r=sx->GetPosition(); | |
490 | cout << " Position"; | |
491 | r.Data(f,u); | |
492 | } | |
493 | } | |
494 | } | |
495 | ||
496 | AliTrack* t=this; | |
497 | Dumps(t,1,f,u); // Information of all decay products | |
498 | } | |
499 | ////////////////////////////////////////////////////////////////////////// | |
500 | void AliTrack::Dumps(AliTrack* t,Int_t n,TString f,TString u) | |
501 | { | |
502 | // Recursively provide the info of all decay levels of this track | |
503 | AliTrack* td; | |
504 | for (Int_t id=1; id<=t->GetNdecay(); id++) | |
505 | { | |
506 | td=t->GetDecayTrack(id); | |
507 | if (td) | |
508 | { | |
509 | cout << " ---Level " << n << " sec. track no. " << id << endl; | |
510 | td->Data(f,u); | |
511 | ||
512 | Int_t nhyp=td->GetNhypotheses(); | |
513 | if (nhyp) | |
514 | { | |
515 | cout << " List of the " << nhyp << " track hypotheses : " << endl; | |
516 | for (Int_t ih=1; ih<=nhyp; ih++) | |
517 | { | |
518 | AliTrack* tx=td->GetTrackHypothesis(ih); | |
519 | if (tx) tx->Data(f,u); | |
520 | } | |
521 | } | |
522 | ||
523 | Int_t nsig=td->GetNsignals(); | |
524 | if (nsig) | |
525 | { | |
526 | cout << " List of the " << nsig << " related signals : " << endl; | |
527 | for (Int_t is=1; is<=nsig; is++) | |
528 | { | |
529 | AliSignal* sx=td->GetSignal(is); | |
530 | if (sx) sx->Data(f,u); | |
531 | } | |
532 | } | |
533 | ||
534 | // Go for next decay level of this decay track recursively | |
535 | Dumps(td,n+1,f,u); | |
536 | } | |
537 | else | |
538 | { | |
539 | cout << " *AliTrack::Dumps* Error : Empty decay track slot." << endl; | |
540 | } | |
541 | } | |
542 | } | |
543 | ////////////////////////////////////////////////////////////////////////// | |
544 | Double_t AliTrack::GetMomentum() | |
545 | { | |
546 | // Provide the value of the track 3-momentum. | |
547 | // The error can be obtained by invoking GetResultError() after | |
548 | // invokation of GetMomentum(). | |
549 | Double_t norm=fV.GetNorm(); | |
550 | fDresult=fV.GetResultError(); | |
551 | return norm; | |
552 | } | |
553 | /////////////////////////////////////////////////////////////////////////// | |
554 | Ali3Vector AliTrack::Get3Momentum() const | |
555 | { | |
556 | // Provide the track 3-momentum | |
557 | return (Ali3Vector)Get3Vector(); | |
558 | } | |
559 | /////////////////////////////////////////////////////////////////////////// | |
560 | Double_t AliTrack::GetMass() | |
561 | { | |
562 | // Provide the particle mass. | |
563 | // The error can be obtained by invoking GetResultError() after | |
564 | // invokation of GetMass(). | |
565 | Double_t inv=GetInvariant(); | |
566 | Double_t dinv=GetResultError(); | |
567 | Double_t dm=0; | |
568 | if (inv >= 0) | |
569 | { | |
570 | Double_t m=sqrt(inv); | |
571 | if (m) dm=dinv/(2.*m); | |
572 | fDresult=dm; | |
573 | return m; | |
574 | } | |
575 | else | |
576 | { | |
577 | cout << "*AliTrack::GetMass* Unphysical situation m**2 = " << inv << endl; | |
578 | cout << " Value 0 will be returned." << endl; | |
579 | fDresult=dm; | |
580 | return 0; | |
581 | } | |
582 | } | |
583 | /////////////////////////////////////////////////////////////////////////// | |
584 | Float_t AliTrack::GetCharge() const | |
585 | { | |
586 | // Provide the particle charge | |
587 | return fQ; | |
588 | } | |
589 | /////////////////////////////////////////////////////////////////////////// | |
590 | Double_t AliTrack::GetEnergy() | |
591 | { | |
592 | // Provide the particle's energy. | |
593 | // The error can be obtained by invoking GetResultError() after | |
594 | // invokation of GetEnergy(). | |
595 | Double_t E=GetScalar(); | |
596 | if (E>0) | |
597 | { | |
598 | return E; | |
599 | } | |
600 | else | |
601 | { | |
602 | cout << "*AliTrack::GetEnergy* Unphysical situation E = " << E << endl; | |
603 | cout << " Value 0 will be returned." << endl; | |
604 | return 0; | |
605 | } | |
606 | } | |
607 | /////////////////////////////////////////////////////////////////////////// | |
608 | void AliTrack::Decay(Double_t m1,Double_t m2,Double_t thcms,Double_t phicms) | |
609 | { | |
610 | // Perform 2-body decay of current track | |
611 | // m1 : mass of decay product 1 | |
612 | // m2 : mass of decay product 2 | |
613 | // thcms : cms theta decay angle (in rad.) of m1 | |
614 | // phicms : cms phi decay angle (in rad.) of m1 | |
615 | ||
616 | Double_t M=GetMass(); | |
617 | ||
618 | // Compute the 4-momenta of the decay products in the cms | |
619 | // Note : p2=p1=pnorm for a 2-body decay | |
620 | Double_t e1=0; | |
621 | if (M) e1=((M*M)+(m1*m1)-(m2*m2))/(2.*M); | |
622 | Double_t e2=0; | |
623 | if (M) e2=((M*M)+(m2*m2)-(m1*m1))/(2.*M); | |
624 | Double_t pnorm=(e1*e1)-(m1*m1); | |
625 | if (pnorm>0.) | |
626 | { | |
627 | pnorm=sqrt(pnorm); | |
628 | } | |
629 | else | |
630 | { | |
631 | pnorm=0; | |
632 | } | |
633 | ||
634 | Double_t a[3]; | |
635 | a[0]=pnorm; | |
636 | a[1]=thcms; | |
637 | a[2]=phicms; | |
638 | Ali3Vector p; | |
639 | p.SetVector(a,"sph"); | |
640 | ||
641 | Ali4Vector pprim1; | |
642 | pprim1.SetVector(e1,p); | |
643 | pprim1.SetInvariant(m1*m1); | |
644 | ||
645 | Ali4Vector pprim2; | |
646 | p*=-1; | |
647 | pprim2.SetVector(e2,p); | |
648 | pprim2.SetInvariant(m2*m2); | |
649 | ||
650 | // Determine boost parameters from the parent particle | |
651 | Double_t E=GetEnergy(); | |
652 | p=Get3Vector(); | |
653 | Ali4Vector pmu; | |
654 | pmu.SetVector(E,p); | |
655 | ||
656 | AliBoost q; | |
657 | q.Set4Momentum(pmu); | |
658 | ||
659 | Ali4Vector p1=q.Inverse(pprim1); // Boost decay product 1 | |
660 | Ali4Vector p2=q.Inverse(pprim2); // Boost decay product 2 | |
661 | ||
662 | // Enter the boosted data into the decay tracks array | |
663 | if (fDecays) | |
664 | { | |
665 | delete fDecays; | |
666 | fDecays=0; | |
667 | } | |
668 | fDecays=new TObjArray(2); | |
669 | fDecays->SetOwner(); | |
670 | ||
671 | fDecays->Add(new AliTrack); | |
672 | ((AliTrack*)fDecays->At(0))->Set4Momentum(p1); | |
673 | ((AliTrack*)fDecays->At(0))->SetMass(m1); | |
674 | fDecays->Add(new AliTrack); | |
675 | ((AliTrack*)fDecays->At(1))->Set4Momentum(p2); | |
676 | ((AliTrack*)fDecays->At(1))->SetMass(m2); | |
677 | } | |
678 | /////////////////////////////////////////////////////////////////////////// | |
679 | Int_t AliTrack::GetNdecay() const | |
680 | { | |
681 | // Provide the number of decay produced tracks | |
682 | Int_t ndec=0; | |
683 | if (fDecays) ndec=fDecays->GetEntries(); | |
684 | return ndec; | |
685 | } | |
686 | /////////////////////////////////////////////////////////////////////////// | |
687 | AliTrack* AliTrack::GetDecayTrack(Int_t j) const | |
688 | { | |
689 | // Provide decay produced track number j | |
690 | // Note : j=1 denotes the first decay track | |
691 | if (!fDecays) | |
692 | { | |
693 | cout << " *AliTrack::GetDecayTrack* No tracks present." << endl; | |
694 | return 0; | |
695 | } | |
696 | else | |
697 | { | |
698 | if ((j >= 1) && (j <= GetNdecay())) | |
699 | { | |
700 | return (AliTrack*)fDecays->At(j-1); | |
701 | } | |
702 | else | |
703 | { | |
704 | cout << " *AliTrack* decay track number : " << j << " out of range." | |
705 | << " Ndec = " << GetNdecay() << endl; | |
706 | return 0; | |
707 | } | |
708 | } | |
709 | } | |
710 | /////////////////////////////////////////////////////////////////////////// | |
711 | void AliTrack::RemoveDecays() | |
712 | { | |
713 | // Remove all decay tracks from this track. | |
714 | if (fDecays) | |
715 | { | |
716 | delete fDecays; | |
717 | fDecays=0; | |
718 | } | |
719 | } | |
720 | /////////////////////////////////////////////////////////////////////////// | |
721 | void AliTrack::AddSignal(AliSignal& s) | |
722 | { | |
723 | // Relate an AliSignal object to this track. | |
724 | if (!fSignals) fSignals=new TObjArray(1); | |
725 | ||
726 | // Check if this signal is already stored for this track | |
727 | Int_t nsig=GetNsignals(); | |
728 | for (Int_t i=0; i<nsig; i++) | |
729 | { | |
730 | if (&s==fSignals->At(i)) return; | |
731 | } | |
732 | ||
733 | fSignals->Add(&s); | |
734 | } | |
735 | /////////////////////////////////////////////////////////////////////////// | |
736 | void AliTrack::RemoveSignal(AliSignal& s) | |
737 | { | |
738 | // Remove related AliSignal object from this track. | |
739 | if (fSignals) | |
740 | { | |
741 | AliSignal* test=(AliSignal*)fSignals->Remove(&s); | |
742 | if (test) fSignals->Compress(); | |
743 | } | |
744 | } | |
745 | /////////////////////////////////////////////////////////////////////////// | |
746 | void AliTrack::RemoveSignals() | |
747 | { | |
748 | // Remove all related AliSignal objects from this track. | |
749 | if (fSignals) | |
750 | { | |
751 | fSignals->Clear(); | |
752 | delete fSignals; | |
753 | fSignals=0; | |
754 | } | |
755 | } | |
756 | /////////////////////////////////////////////////////////////////////////// | |
757 | Int_t AliTrack::GetNsignals() const | |
758 | { | |
759 | // Provide the number of related AliSignals. | |
760 | Int_t nsig=0; | |
761 | if (fSignals) nsig=fSignals->GetEntries(); | |
762 | return nsig; | |
763 | } | |
764 | /////////////////////////////////////////////////////////////////////////// | |
765 | AliSignal* AliTrack::GetSignal(Int_t j) const | |
766 | { | |
767 | // Provide the related AliSignal number j. | |
768 | // Note : j=1 denotes the first signal. | |
769 | if (!fSignals) | |
770 | { | |
771 | cout << " *AliTrack::GetSignal* No signals present." << endl; | |
772 | return 0; | |
773 | } | |
774 | else | |
775 | { | |
776 | if ((j >= 1) && (j <= GetNsignals())) | |
777 | { | |
778 | return (AliSignal*)fSignals->At(j-1); | |
779 | } | |
780 | else | |
781 | { | |
782 | cout << " *AliTrack* signal number : " << j << " out of range." | |
783 | << " Nsig = " << GetNsignals() << endl; | |
784 | return 0; | |
785 | } | |
786 | } | |
787 | } | |
788 | /////////////////////////////////////////////////////////////////////////// | |
789 | void AliTrack::AddTrackHypothesis(AliTrack& t) | |
790 | { | |
791 | // Relate a track hypothesis to this track. | |
792 | // Note : a private copy of the input track will be made via the Clone() | |
793 | // facility. | |
794 | if (!fHypotheses) | |
795 | { | |
796 | fHypotheses=new TObjArray(1); | |
797 | fHypotheses->SetOwner(); | |
798 | } | |
799 | fHypotheses->Add(t.Clone()); | |
800 | } | |
801 | /////////////////////////////////////////////////////////////////////////// | |
802 | void AliTrack::AddTrackHypothesis(Double_t prob,Double_t m,Double_t dm) | |
803 | { | |
804 | // Add a track hypothesis by explicitly setting the mass and probability. | |
805 | // This will affect e.g. the hypothesis track's energy, since the momentum | |
806 | // and all other attributes will be copied from the current track. | |
807 | // | |
808 | // Input arguments : | |
809 | // ----------------- | |
810 | // prob=probalility m=mass value dm=error on the mass value. | |
811 | // The default value for the mass error dm is 0. | |
812 | ||
813 | AliTrack t(*this); | |
814 | t.RemoveDecays(); | |
815 | t.RemoveTrackHypotheses(); | |
816 | t.RemoveSignals(); | |
817 | t.SetTitle("Mass hypothesis"); | |
818 | t.SetMass(m,dm); | |
819 | t.SetProb(prob); | |
820 | AddTrackHypothesis(t); | |
821 | } | |
822 | /////////////////////////////////////////////////////////////////////////// | |
823 | void AliTrack::RemoveTrackHypothesis(AliTrack& t) | |
824 | { | |
825 | // Remove the specified track hypothesis from this track. | |
826 | if (fHypotheses) | |
827 | { | |
828 | AliTrack* test=(AliTrack*)fHypotheses->Remove(&t); | |
829 | if (test) fHypotheses->Compress(); | |
830 | } | |
831 | } | |
832 | /////////////////////////////////////////////////////////////////////////// | |
833 | void AliTrack::RemoveTrackHypotheses() | |
834 | { | |
835 | // Remove all track hypotheses from this track. | |
836 | if (fHypotheses) | |
837 | { | |
838 | delete fHypotheses; | |
839 | fHypotheses=0; | |
840 | } | |
841 | } | |
842 | /////////////////////////////////////////////////////////////////////////// | |
843 | Int_t AliTrack::GetNhypotheses() const | |
844 | { | |
845 | // Provide the number of track hypotheses. | |
846 | Int_t nhyp=0; | |
847 | if (fHypotheses) nhyp=fHypotheses->GetEntries(); | |
848 | return nhyp; | |
849 | } | |
850 | /////////////////////////////////////////////////////////////////////////// | |
851 | AliTrack* AliTrack::GetTrackHypothesis(Int_t j) const | |
852 | { | |
853 | // Provide the j-th track hypothesis. | |
854 | // Note : j=1 denotes the first hypothesis. | |
855 | // Default : j=0 ==> Hypothesis with highest probability. | |
856 | ||
857 | if (!fHypotheses) return 0; | |
858 | ||
859 | Int_t nhyp=GetNhypotheses(); | |
860 | ||
861 | // Check validity of index j | |
862 | if (j<0 || j>nhyp) | |
863 | { | |
864 | cout << " *AliTrack* hypothesis number : " << j << " out of range." | |
865 | << " Nhyp = " << nhyp << endl; | |
866 | return 0; | |
867 | } | |
868 | ||
869 | AliTrack* t=0; | |
870 | ||
871 | if (j==0) // Provide track hypothesis with highest probability | |
872 | { | |
873 | Float_t prob=0; | |
874 | t=(AliTrack*)fHypotheses->At(0); | |
875 | if (t) prob=t->GetProb(); | |
876 | Float_t probx=0; | |
877 | for (Int_t ih=1; ih<nhyp; ih++) | |
878 | { | |
879 | AliTrack* tx=(AliTrack*)fHypotheses->At(ih); | |
880 | if (tx) | |
881 | { | |
882 | probx=tx->GetProb(); | |
883 | if (probx > prob) t=tx; | |
884 | } | |
885 | } | |
886 | return t; | |
887 | } | |
888 | else // Provide requested j-th track hypothesis | |
889 | { | |
890 | return (AliTrack*)fHypotheses->At(j-1); | |
891 | } | |
892 | } | |
893 | /////////////////////////////////////////////////////////////////////////// | |
894 | void AliTrack::SetBeginPoint(AliPosition& p) | |
895 | { | |
896 | // Store the position of the track begin-point. | |
897 | if (fBegin) delete fBegin; | |
898 | fBegin=new AliPositionObj(p); | |
899 | } | |
900 | /////////////////////////////////////////////////////////////////////////// | |
901 | AliPosition* AliTrack::GetBeginPoint() | |
902 | { | |
903 | // Provide the position of the track begin-point. | |
904 | return fBegin; | |
905 | } | |
906 | /////////////////////////////////////////////////////////////////////////// | |
907 | void AliTrack::SetEndPoint(AliPosition& p) | |
908 | { | |
909 | // Store the position of the track end-point. | |
910 | if (fEnd) delete fEnd; | |
911 | fEnd=new AliPositionObj(p); | |
912 | } | |
913 | /////////////////////////////////////////////////////////////////////////// | |
914 | AliPosition* AliTrack::GetEndPoint() | |
915 | { | |
916 | // Provide the position of the track end-point. | |
917 | return fEnd; | |
918 | } | |
919 | /////////////////////////////////////////////////////////////////////////// | |
920 | void AliTrack::SetReferencePoint(AliPosition& p) | |
921 | { | |
922 | // Store the position of the track reference-point. | |
923 | // The reference-point is the point on the track in which the | |
924 | // 3-momentum vector components have been defined. | |
925 | // This reference point is the preferable point to start track extrapolations | |
926 | // etc... which are sensitive to the components of the 3-momentum vector. | |
927 | if (fRef) delete fRef; | |
928 | fRef=new AliPositionObj(p); | |
929 | } | |
930 | /////////////////////////////////////////////////////////////////////////// | |
931 | AliPosition* AliTrack::GetReferencePoint() | |
932 | { | |
933 | // Provide the position of the track reference-point. | |
934 | // The reference-point is the point on the track in which the | |
935 | // 3-momentum vector components have been defined. | |
936 | // This reference point is the preferable point to start track extrapolations | |
937 | // etc... which are sensitive to the components of the 3-momentum vector. | |
938 | return fRef; | |
939 | } | |
940 | /////////////////////////////////////////////////////////////////////////// | |
941 | void AliTrack::SetMass() | |
942 | { | |
943 | // Set the mass and error to the value of the hypothesis with highest prob. | |
944 | ||
945 | Double_t m=0,dm=0; | |
946 | ||
947 | // Select mass hypothesis with highest probability | |
948 | AliTrack* t=GetTrackHypothesis(0); | |
949 | if (t) | |
950 | { | |
951 | m=t->GetMass(); | |
952 | dm=t->GetResultError(); | |
953 | SetMass(m,dm); | |
954 | } | |
955 | else | |
956 | { | |
957 | cout << " *AliTrack::SetMass()* No hypothesis present => No action." << endl; | |
958 | } | |
959 | } | |
960 | /////////////////////////////////////////////////////////////////////////// | |
961 | Double_t AliTrack::GetPt() | |
962 | { | |
963 | // Provide trans. momentum value w.r.t. z-axis. | |
964 | // The error on the value can be obtained by GetResultError() | |
965 | // after invokation of GetPt(). | |
966 | Ali3Vector v; | |
967 | v=GetVecTrans(); | |
968 | Double_t norm=v.GetNorm(); | |
969 | fDresult=v.GetResultError(); | |
970 | ||
971 | return norm; | |
972 | } | |
973 | /////////////////////////////////////////////////////////////////////////// | |
974 | Double_t AliTrack::GetPl() | |
975 | { | |
976 | // Provide long. momentum value w.r.t. z-axis. | |
977 | // Note : the returned value can also be negative. | |
978 | // The error on the value can be obtained by GetResultError() | |
979 | // after invokation of GetPl(). | |
980 | Ali3Vector v; | |
981 | v=GetVecLong(); | |
982 | ||
983 | Double_t pl=v.GetNorm(); | |
984 | fDresult=v.GetResultError(); | |
985 | ||
986 | Double_t a[3]; | |
987 | v.GetVector(a,"sph"); | |
988 | if (cos(a[1])<0) pl=-pl; | |
989 | ||
990 | return pl; | |
991 | } | |
992 | /////////////////////////////////////////////////////////////////////////// | |
993 | Double_t AliTrack::GetEt() | |
994 | { | |
995 | // Provide trans. energy value w.r.t. z-axis. | |
996 | // The error on the value can be obtained by GetResultError() | |
997 | // after invokation of GetEt(). | |
998 | Double_t et=GetScaTrans(); | |
999 | ||
1000 | return et; | |
1001 | } | |
1002 | /////////////////////////////////////////////////////////////////////////// | |
1003 | Double_t AliTrack::GetEl() | |
1004 | { | |
1005 | // Provide long. energy value w.r.t. z-axis. | |
1006 | // Note : the returned value can also be negative. | |
1007 | // The error on the value can be obtained by GetResultError() | |
1008 | // after invokation of GetEl(). | |
1009 | Double_t el=GetScaLong(); | |
1010 | ||
1011 | return el; | |
1012 | } | |
1013 | /////////////////////////////////////////////////////////////////////////// | |
1014 | Double_t AliTrack::GetMt() | |
1015 | { | |
1016 | // Provide transverse mass value w.r.t. z-axis. | |
1017 | // The error on the value can be obtained by GetResultError() | |
1018 | // after invokation of GetMt(). | |
1019 | Double_t pt=GetPt(); | |
1020 | Double_t dpt=GetResultError(); | |
1021 | Double_t m=GetMass(); | |
1022 | Double_t dm=GetResultError(); | |
1023 | ||
1024 | Double_t mt=sqrt(pt*pt+m*m); | |
1025 | Double_t dmt2=0; | |
1026 | if (mt) dmt2=(pow((pt*dpt),2)+pow((m*dm),2))/(mt*mt); | |
1027 | ||
1028 | fDresult=sqrt(dmt2); | |
1029 | return mt; | |
1030 | } | |
1031 | /////////////////////////////////////////////////////////////////////////// | |
1032 | Double_t AliTrack::GetRapidity() | |
1033 | { | |
1034 | // Provide rapidity value w.r.t. z-axis. | |
1035 | // The error on the value can be obtained by GetResultError() | |
1036 | // after invokation of GetRapidity(). | |
1037 | // Note : Also GetPseudoRapidity() is available since this class is | |
1038 | // derived from Ali4Vector. | |
1039 | Double_t e=GetEnergy(); | |
1040 | Double_t de=GetResultError(); | |
1041 | Double_t pl=GetPl(); | |
1042 | Double_t dpl=GetResultError(); | |
1043 | Double_t sum=e+pl; | |
1044 | Double_t dif=e-pl; | |
1045 | ||
1046 | Double_t y=9999,dy2=0; | |
1047 | if (sum && dif) y=0.5*log(sum/dif); | |
1048 | ||
1049 | if (sum*dif) dy2=(1./(sum*dif))*(pow((pl*de),2)+pow((e*dpl),2)); | |
1050 | ||
1051 | fDresult=sqrt(dy2); | |
1052 | return y; | |
1053 | } | |
1054 | /////////////////////////////////////////////////////////////////////////// | |
1055 | void AliTrack::SetImpactPoint(AliPosition& p,TString q) | |
1056 | { | |
1057 | // Store the position of the impact-point in the plane "q=0". | |
1058 | // Here q denotes one of the axes X, Y or Z. | |
1059 | // Note : The character to denote the axis may be entered in lower or | |
1060 | // in uppercase. | |
1061 | Int_t axis=0; | |
1062 | if (q=="x" || q=="X") axis=1; | |
1063 | if (q=="y" || q=="Y") axis=2; | |
1064 | if (q=="z" || q=="Z") axis=3; | |
1065 | ||
1066 | switch (axis) | |
1067 | { | |
1068 | case 1: // Impact-point in the plane X=0 | |
1069 | if (fImpactYZ) delete fImpactYZ; | |
1070 | fImpactYZ=new AliPositionObj(p); | |
1071 | break; | |
1072 | ||
1073 | case 2: // Impact-point in the plane Y=0 | |
1074 | if (fImpactXZ) delete fImpactXZ; | |
1075 | fImpactXZ=new AliPositionObj(p); | |
1076 | break; | |
1077 | ||
1078 | case 3: // Impact-point in the plane Z=0 | |
1079 | if (fImpactXY) delete fImpactXY; | |
1080 | fImpactXY=new AliPositionObj(p); | |
1081 | break; | |
1082 | ||
1083 | default: // Unsupported axis | |
1084 | cout << "*AliTrack::SetImpactPoint* Unsupported axis : " << q << endl | |
1085 | << " Possible axes are 'X', 'Y' and 'Z'." << endl; | |
1086 | break; | |
1087 | } | |
1088 | } | |
1089 | /////////////////////////////////////////////////////////////////////////// | |
1090 | AliPosition* AliTrack::GetImpactPoint(TString q) | |
1091 | { | |
1092 | // Provide the position of the impact-point in the plane "q=0". | |
1093 | // Here q denotes one of the axes X, Y or Z. | |
1094 | // Note : The character to denote the axis may be entered in lower or | |
1095 | // in uppercase. | |
1096 | Int_t axis=0; | |
1097 | if (q=="x" || q=="X") axis=1; | |
1098 | if (q=="y" || q=="Y") axis=2; | |
1099 | if (q=="z" || q=="Z") axis=3; | |
1100 | ||
1101 | switch (axis) | |
1102 | { | |
1103 | case 1: // Impact-point in the plane X=0 | |
1104 | return fImpactYZ; | |
1105 | ||
1106 | case 2: // Impact-point in the plane Y=0 | |
1107 | return fImpactXZ; | |
1108 | ||
1109 | case 3: // Impact-point in the plane Z=0 | |
1110 | return fImpactXY; | |
1111 | ||
1112 | default: // Unsupported axis | |
1113 | cout << "*AliTrack::GetImpactPoint* Unsupported axis : " << q << endl | |
1114 | << " Possible axes are 'X', 'Y' and 'Z'." << endl; | |
1115 | return 0; | |
1116 | } | |
1117 | } | |
1118 | /////////////////////////////////////////////////////////////////////////// | |
1119 | void AliTrack::SetId(Int_t id) | |
1120 | { | |
1121 | // Set a user defined unique identifier for this track. | |
1122 | fUserId=id; | |
1123 | } | |
1124 | /////////////////////////////////////////////////////////////////////////// | |
1125 | Int_t AliTrack::GetId() const | |
1126 | { | |
1127 | // Provide the user defined unique identifier of this track. | |
1128 | return fUserId; | |
1129 | } | |
1130 | /////////////////////////////////////////////////////////////////////////// | |
1131 | void AliTrack::SetClosestPoint(AliPosition& p) | |
1132 | { | |
1133 | // Set position p as the point of closest approach w.r.t. some reference | |
1134 | if (fClosest) delete fClosest; | |
1135 | fClosest=new AliPositionObj(p); | |
1136 | } | |
1137 | /////////////////////////////////////////////////////////////////////////// | |
1138 | AliPosition* AliTrack::GetClosestPoint() | |
1139 | { | |
1140 | // Provide the point of closest approach w.r.t. some reference | |
1141 | return fClosest; | |
1142 | } | |
1143 | /////////////////////////////////////////////////////////////////////////// | |
1144 | void AliTrack::SetChi2(Float_t chi2) | |
1145 | { | |
1146 | // Set the chi-squared value of the track fit. | |
1147 | if (chi2<0) | |
1148 | { | |
1149 | cout << " *AliTrack::SetChi2* Invalid chi2 value : " << chi2 << endl; | |
1150 | } | |
1151 | else | |
1152 | { | |
1153 | fChi2=chi2; | |
1154 | } | |
1155 | } | |
1156 | /////////////////////////////////////////////////////////////////////////// | |
1157 | void AliTrack::SetNdf(Int_t ndf) | |
1158 | { | |
1159 | // Set the number of degrees of freedom for the track fit. | |
1160 | if (ndf<0) | |
1161 | { | |
1162 | cout << " *AliTrack::SetNdf* Invalid ndf value : " << ndf << endl; | |
1163 | } | |
1164 | else | |
1165 | { | |
1166 | fNdf=ndf; | |
1167 | } | |
1168 | } | |
1169 | /////////////////////////////////////////////////////////////////////////// | |
1170 | Float_t AliTrack::GetChi2() const | |
1171 | { | |
1172 | // Provide the chi-squared value of the track fit. | |
1173 | return fChi2; | |
1174 | } | |
1175 | /////////////////////////////////////////////////////////////////////////// | |
1176 | Int_t AliTrack::GetNdf() const | |
1177 | { | |
1178 | // Provide the number of degrees of freedom for the track fit. | |
1179 | return fNdf; | |
1180 | } | |
1181 | /////////////////////////////////////////////////////////////////////////// | |
1182 | void AliTrack::SetParticleCode(Int_t code) | |
1183 | { | |
1184 | // Set the user defined particle id code (e.g. the PDF convention). | |
1185 | fCode=code; | |
1186 | } | |
1187 | /////////////////////////////////////////////////////////////////////////// | |
1188 | Int_t AliTrack::GetParticleCode() const | |
1189 | { | |
1190 | // Provide the user defined particle id code. | |
1191 | return fCode; | |
1192 | } | |
1193 | /////////////////////////////////////////////////////////////////////////// | |
1194 | void AliTrack::SetParentTrack(AliTrack* t) | |
1195 | { | |
1196 | // Set pointer to the parent track. | |
1197 | fParent=t; | |
1198 | } | |
1199 | /////////////////////////////////////////////////////////////////////////// | |
1200 | AliTrack* AliTrack::GetParentTrack() | |
1201 | { | |
1202 | // Provide pointer to the parent track. | |
1203 | return fParent; | |
1204 | } | |
1205 | /////////////////////////////////////////////////////////////////////////// | |
1206 | void AliTrack::SetProb(Double_t prob) | |
1207 | { | |
1208 | // Set hypothesis probability for this track. | |
1209 | fProb=prob; | |
1210 | } | |
1211 | /////////////////////////////////////////////////////////////////////////// | |
1212 | Float_t AliTrack::GetProb() const | |
1213 | { | |
1214 | // Provide the hypothesis probability for this track. | |
1215 | return fProb; | |
1216 | } | |
1217 | /////////////////////////////////////////////////////////////////////////// | |
1218 | void AliTrack::SetFitDetails(TObject* obj) | |
1219 | { | |
1220 | // Enter the object containing the fit details. | |
1221 | // In case an object to hold fit details was already present, this | |
1222 | // will be deleted first before the new one is stored. | |
1223 | // This means that SetFitDetails(0) can be used to just remove the | |
1224 | // existing object with the fit details. | |
1225 | // All objects derived from TObject can be entered in this way. | |
1226 | // Obvious candidates for objects containing detailed fit information | |
1227 | // are functions (e.g. TF1) and histograms (e.g. TH1F). | |
1228 | // However, using an AliDevice object provides a very versatile facility | |
1229 | // to store the parameters of various fit procedures. | |
1230 | // In such a case the AliDevice can be used to provide the various fit | |
1231 | // definitions and the corresponding fit parameters can be entered as | |
1232 | // separate AliSignal objects which are stored as hits to the AliDevice. | |
1233 | // In addition various functions and histograms can be linked to the | |
1234 | // various AliSignal instances | |
1235 | // The latter procedure is based on the original idea of Adam Bouchta. | |
1236 | // | |
1237 | // Note : The entered object is owned by this AliTrack instance. | |
1238 | // As such, a private copy of obj will be stored using the Clone() | |
1239 | // memberfunction. | |
1240 | // In case the entered object contains pointers to other objects, | |
1241 | // the user has to provide the appropriate Clone() memberfunction | |
1242 | // for the class to which the entered object belongs. | |
1243 | // An example can be seen from AliTrack::Clone(). | |
1244 | // | |
1245 | if (fFit) | |
1246 | { | |
1247 | delete fFit; | |
1248 | fFit=0; | |
1249 | } | |
1250 | ||
1251 | if (obj) fFit=obj->Clone(); | |
1252 | } | |
1253 | /////////////////////////////////////////////////////////////////////////// | |
1254 | TObject* AliTrack::GetFitDetails() | |
1255 | { | |
1256 | // Provide the pointer to the object containing the fit details. | |
1257 | return fFit; | |
1258 | } | |
1259 | /////////////////////////////////////////////////////////////////////////// | |
1260 | void AliTrack::SetTimestamp(AliTimestamp& t) | |
1261 | { | |
1262 | // Store the timestamp for this track. | |
1263 | if (fTstamp) delete fTstamp; | |
1264 | fTstamp=new AliTimestamp(t); | |
1265 | } | |
1266 | /////////////////////////////////////////////////////////////////////////// | |
1267 | AliTimestamp* AliTrack::GetTimestamp() | |
1268 | { | |
1269 | // Provide the timestamp of this track. | |
1270 | return fTstamp; | |
1271 | } | |
1272 | /////////////////////////////////////////////////////////////////////////// | |
1273 | void AliTrack::RemoveTimestamp() | |
1274 | { | |
1275 | // Remove the timestamp from this track. | |
1276 | if (fTstamp) | |
1277 | { | |
1278 | delete fTstamp; | |
1279 | fTstamp=0; | |
1280 | } | |
1281 | } | |
1282 | /////////////////////////////////////////////////////////////////////////// | |
1283 | Double_t AliTrack::GetDistance(AliPosition* p) | |
1284 | { | |
1285 | // Provide distance of the current track to the position p. | |
1286 | // The error on the result can be obtained as usual by invoking | |
1287 | // GetResultError() afterwards. | |
1288 | // | |
1289 | // The distance will be provided in the unit scale of the AliPosition p. | |
1290 | // As such it is possible to obtain a correctly computed distance even in case | |
1291 | // the track parameters have a different unit scale. | |
1292 | // However, it is recommended to work always with one single unit scale. | |
1293 | // | |
1294 | // Note : In case of incomplete information, a distance value of -1 is | |
1295 | // returned. | |
1296 | ||
1297 | Double_t dist=-1.; | |
1298 | fDresult=0.; | |
1299 | ||
1300 | if (!p) return dist; | |
1301 | ||
1302 | // Obtain a defined position on this track | |
1303 | AliPosition* rx=fRef; | |
1304 | if (!rx) rx=fBegin; | |
1305 | if (!rx) rx=fEnd; | |
1306 | ||
1307 | if (!rx) return dist; | |
1308 | ||
1309 | Ali3Vector r0=(Ali3Vector)(*rx); | |
1310 | ||
1311 | Float_t tscale=rx->GetUnitScale(); | |
1312 | Float_t pscale=p->GetUnitScale(); | |
1313 | if ((tscale/pscale > 1.1) || (pscale/tscale > 1.1)) r0=r0*(tscale/pscale); | |
1314 | ||
1315 | // Obtain the direction unit vector of this track | |
1316 | Double_t vec[3]; | |
1317 | Double_t err[3]; | |
1318 | Ali3Vector p1=Get3Momentum(); | |
1319 | p1.GetVector(vec,"sph"); | |
1320 | p1.GetErrors(err,"sph"); | |
1321 | vec[0]=1.; | |
1322 | err[0]=0.; | |
1323 | p1.SetVector(vec,"sph"); | |
1324 | p1.SetErrors(err,"sph"); | |
1325 | ||
1326 | Ali3Vector q=(Ali3Vector)(*p); | |
1327 | Ali3Vector r=q-r0; | |
1328 | Ali3Vector d=r.Cross(p1); | |
1329 | dist=d.GetNorm(); | |
1330 | fDresult=d.GetResultError(); | |
1331 | return dist; | |
1332 | } | |
1333 | /////////////////////////////////////////////////////////////////////////// | |
1334 | TObject* AliTrack::Clone(const char* name) const | |
1335 | { | |
1336 | // Make a deep copy of the current object and provide the pointer to the copy. | |
1337 | // This memberfunction enables automatic creation of new objects of the | |
1338 | // correct type depending on the object type, a feature which may be very useful | |
1339 | // for containers when adding objects in case the container owns the objects. | |
1340 | // This feature allows e.g. AliJet to store either AliTrack objects or | |
1341 | // objects derived from AliTrack via the AddTrack memberfunction, provided | |
1342 | // these derived classes also have a proper Clone memberfunction. | |
1343 | ||
1344 | AliTrack* trk=new AliTrack(*this); | |
1345 | if (name) | |
1346 | { | |
1347 | if (strlen(name)) trk->SetName(name); | |
1348 | } | |
1349 | return trk; | |
1350 | } | |
1351 | /////////////////////////////////////////////////////////////////////////// |