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