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