]>
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 | // | |
39 | // t1.Info(); | |
40 | // t2.Info(); | |
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" |
93 | ||
94 | ClassImp(AliTrack) // Class implementation to enable ROOT I/O | |
95 | ||
96 | AliTrack::AliTrack() | |
97 | { | |
98 | // Default constructor | |
99 | // All variables initialised to 0 | |
100 | fDecays=0; | |
959fbac5 | 101 | fSignals=0; |
f531a546 | 102 | fMasses=0; |
103 | fDmasses=0; | |
104 | fPmasses=0; | |
d88f97cc | 105 | Reset(); |
106 | } | |
107 | /////////////////////////////////////////////////////////////////////////// | |
108 | AliTrack::~AliTrack() | |
109 | { | |
110 | // Destructor to delete memory allocated for decay tracks array | |
111 | if (fDecays) | |
112 | { | |
113 | fDecays->Delete(); | |
114 | delete fDecays; | |
115 | fDecays=0; | |
116 | } | |
959fbac5 | 117 | if (fSignals) |
118 | { | |
119 | fSignals->Clear(); | |
120 | delete fSignals; | |
121 | fSignals=0; | |
122 | } | |
d88f97cc | 123 | } |
124 | /////////////////////////////////////////////////////////////////////////// | |
125 | void AliTrack::Reset() | |
126 | { | |
35044448 | 127 | // Reset all variables to 0 and delete all auto-generated decay tracks. |
d88f97cc | 128 | fQ=0; |
43bfa5be | 129 | fUserId=0; |
d88f97cc | 130 | fNdec=0; |
959fbac5 | 131 | fNsig=0; |
f531a546 | 132 | fNmasses=0; |
d88f97cc | 133 | Double_t a[4]={0,0,0,0}; |
134 | SetVector(a,"sph"); | |
135 | if (fDecays) | |
136 | { | |
137 | fDecays->Delete(); | |
138 | delete fDecays; | |
139 | fDecays=0; | |
140 | } | |
959fbac5 | 141 | if (fSignals) |
142 | { | |
143 | fSignals->Clear(); | |
144 | delete fSignals; | |
145 | fSignals=0; | |
146 | } | |
147 | Double_t b[3]={0,0,0}; | |
148 | fBegin.SetPosition(b,"sph"); | |
149 | fEnd.SetPosition(b,"sph"); | |
43bfa5be | 150 | fImpactXY.SetPosition(b,"sph"); |
151 | fImpactXZ.SetPosition(b,"sph"); | |
152 | fImpactYZ.SetPosition(b,"sph"); | |
153 | fClosest.SetPosition(b,"sph"); | |
f531a546 | 154 | if (fMasses) |
155 | { | |
156 | delete fMasses; | |
157 | fMasses=0; | |
158 | } | |
159 | if (fDmasses) | |
160 | { | |
161 | delete fDmasses; | |
162 | fDmasses=0; | |
163 | } | |
164 | if (fPmasses) | |
165 | { | |
166 | delete fPmasses; | |
167 | fPmasses=0; | |
168 | } | |
d88f97cc | 169 | } |
170 | /////////////////////////////////////////////////////////////////////////// | |
171 | void AliTrack::Set3Momentum(Ali3Vector& p) | |
172 | { | |
173 | // Set the track parameters according to the 3-momentum p | |
959fbac5 | 174 | Set3Vector(p); |
d88f97cc | 175 | } |
176 | /////////////////////////////////////////////////////////////////////////// | |
177 | void AliTrack::Set4Momentum(Ali4Vector& p) | |
178 | { | |
179 | // Set the track parameters according to the 4-momentum p | |
180 | Double_t E=p.GetScalar(); | |
959fbac5 | 181 | Double_t dE=p.GetResultError(); |
d88f97cc | 182 | Ali3Vector pv=p.Get3Vector(); |
183 | SetVector(E,pv); | |
959fbac5 | 184 | SetScalarError(dE); |
d88f97cc | 185 | } |
186 | /////////////////////////////////////////////////////////////////////////// | |
959fbac5 | 187 | void AliTrack::SetMass(Double_t m,Double_t dm) |
d88f97cc | 188 | { |
189 | // Set the particle mass | |
959fbac5 | 190 | // The default value for the error dm is 0. |
191 | Double_t inv=pow(m,2); | |
192 | Double_t dinv=fabs(2.*m*dm); | |
193 | SetInvariant(inv,dinv); | |
d88f97cc | 194 | } |
195 | /////////////////////////////////////////////////////////////////////////// | |
196 | void AliTrack::SetCharge(Float_t q) | |
197 | { | |
198 | // Set the particle charge | |
199 | fQ=q; | |
200 | } | |
201 | /////////////////////////////////////////////////////////////////////////// | |
202 | void AliTrack::Info(TString f) | |
203 | { | |
204 | // Provide track information within the coordinate frame f | |
959fbac5 | 205 | Double_t m=GetMass(); |
206 | Double_t dm=GetResultError(); | |
43bfa5be | 207 | cout << " *AliTrack::Info* Id : " << fUserId << " Mass : " << m |
959fbac5 | 208 | << " error : " << dm << " Charge : " << fQ |
f531a546 | 209 | << " Momentum : " << GetMomentum() << " Nmass hyp. : " << fNmasses |
210 | << " Ntracks : " << fNdec << " Nsignals : " << fNsig << endl; | |
211 | for (Int_t i=0; i<fNmasses; i++) | |
212 | { | |
213 | cout << " Mass hypothesis " << (i+1) << " Mass : " << fMasses->At(i) | |
214 | << " error : " << fDmasses->At(i) << " prob. : " << fPmasses->At(i) | |
215 | << endl; | |
216 | } | |
d88f97cc | 217 | Ali4Vector::Info(f); |
218 | } | |
219 | /////////////////////////////////////////////////////////////////////////// | |
220 | void AliTrack::List(TString f) | |
221 | { | |
222 | // Provide current track and decay level 1 information within coordinate frame f | |
223 | ||
224 | Info(f); // Information of the current track | |
225 | ||
226 | // Decay products of this track | |
227 | AliTrack* td; | |
228 | for (Int_t id=1; id<=fNdec; id++) | |
229 | { | |
230 | td=GetDecayTrack(id); | |
231 | if (td) | |
232 | { | |
233 | cout << " ---Level 1 sec. track no. " << id << endl; | |
d88f97cc | 234 | td->Info(f); |
235 | } | |
236 | else | |
237 | { | |
238 | cout << " *AliTrack::List* Error : No decay track present." << endl; | |
239 | } | |
240 | } | |
241 | } | |
242 | /////////////////////////////////////////////////////////////////////////// | |
243 | void AliTrack::ListAll(TString f) | |
244 | { | |
245 | // Provide complete track and decay information within the coordinate frame f | |
246 | ||
247 | Info(f); // Information of the current track | |
959fbac5 | 248 | cout << " Begin-point :"; fBegin.Info(f); |
249 | cout << " End-point :"; fEnd.Info(f); | |
250 | for (Int_t is=1; is<=GetNsignals(); is++) | |
251 | { | |
252 | ((AliSignal*)GetSignal(is))->Info(f); | |
253 | } | |
d88f97cc | 254 | |
255 | AliTrack* t=this; | |
256 | Dump(t,1,f); // Information of all decay products | |
257 | } | |
258 | ////////////////////////////////////////////////////////////////////////// | |
259 | void AliTrack::Dump(AliTrack* t,Int_t n,TString f) | |
260 | { | |
261 | // Recursively provide the info of all decay levels of this track | |
262 | AliTrack* td; | |
263 | for (Int_t id=1; id<=t->GetNdecay(); id++) | |
264 | { | |
265 | td=t->GetDecayTrack(id); | |
266 | if (td) | |
267 | { | |
268 | cout << " ---Level " << n << " sec. track no. " << id << endl; | |
d88f97cc | 269 | td->Info(f); |
959fbac5 | 270 | for (Int_t is=1; is<=td->GetNsignals(); is++) |
271 | { | |
272 | ((AliSignal*)td->GetSignal(is))->Info(f); | |
273 | } | |
d88f97cc | 274 | |
275 | // Go for next decay level of this decay track recursively | |
276 | Dump(td,n+1,f); | |
277 | } | |
278 | else | |
279 | { | |
280 | cout << " *AliTrack::Dump* Error : No decay track present." << endl; | |
281 | } | |
282 | } | |
283 | } | |
284 | ////////////////////////////////////////////////////////////////////////// | |
285 | Double_t AliTrack::GetMomentum() | |
286 | { | |
959fbac5 | 287 | // Provide the value of the track 3-momentum. |
288 | // The error can be obtained by invoking GetResultError() after | |
289 | // invokation of GetMomentum(). | |
959fbac5 | 290 | Double_t norm=fV.GetNorm(); |
d071d629 | 291 | fDresult=fV.GetResultError(); |
959fbac5 | 292 | return norm; |
d88f97cc | 293 | } |
294 | /////////////////////////////////////////////////////////////////////////// | |
295 | Ali3Vector AliTrack::Get3Momentum() | |
296 | { | |
297 | // Provide the track 3-momentum | |
298 | return (Ali3Vector)Get3Vector(); | |
299 | } | |
300 | /////////////////////////////////////////////////////////////////////////// | |
301 | Double_t AliTrack::GetMass() | |
302 | { | |
959fbac5 | 303 | // Provide the particle mass. |
304 | // The error can be obtained by invoking GetResultError() after | |
305 | // invokation of GetMass(). | |
306 | Double_t inv=GetInvariant(); | |
307 | Double_t dinv=GetResultError(); | |
308 | Double_t dm=0; | |
309 | if (inv >= 0) | |
310 | { | |
311 | Double_t m=sqrt(inv); | |
312 | if (m) dm=dinv/(2.*m); | |
313 | fDresult=dm; | |
314 | return m; | |
315 | } | |
316 | else | |
317 | { | |
318 | cout << "*AliTrack::GetMass* Unphysical situation m**2 = " << inv << endl; | |
319 | cout << " Value 0 will be returned." << endl; | |
320 | fDresult=dm; | |
321 | return 0; | |
322 | } | |
d88f97cc | 323 | } |
324 | /////////////////////////////////////////////////////////////////////////// | |
325 | Float_t AliTrack::GetCharge() | |
326 | { | |
327 | // Provide the particle charge | |
328 | return fQ; | |
329 | } | |
330 | /////////////////////////////////////////////////////////////////////////// | |
331 | Double_t AliTrack::GetEnergy() | |
332 | { | |
959fbac5 | 333 | // Provide the particle's energy. |
334 | // The error can be obtained by invoking GetResultError() after | |
335 | // invokation of GetEnergy(). | |
336 | Double_t E=GetScalar(); | |
337 | if (E>0) | |
338 | { | |
339 | return E; | |
340 | } | |
341 | else | |
342 | { | |
343 | cout << "*AliTrack::GetEnergy* Unphysical situation E = " << E << endl; | |
344 | cout << " Value 0 will be returned." << endl; | |
345 | return 0; | |
346 | } | |
d88f97cc | 347 | } |
348 | /////////////////////////////////////////////////////////////////////////// | |
349 | void AliTrack::Decay(Double_t m1,Double_t m2,Double_t thcms,Double_t phicms) | |
350 | { | |
351 | // Perform 2-body decay of current track | |
352 | // m1 : mass of decay product 1 | |
353 | // m2 : mass of decay product 2 | |
354 | // thcms : cms theta decay angle (in rad.) of m1 | |
355 | // phicms : cms phi decay angle (in rad.) of m1 | |
356 | ||
357 | fNdec=2; // it's a 2-body decay | |
959fbac5 | 358 | |
359 | Double_t M=GetMass(); | |
d88f97cc | 360 | |
361 | // Compute the 4-momenta of the decay products in the cms | |
362 | // Note : p2=p1=pnorm for a 2-body decay | |
959fbac5 | 363 | Double_t e1=0; |
364 | if (M) e1=((M*M)+(m1*m1)-(m2*m2))/(2.*M); | |
365 | Double_t e2=0; | |
366 | if (M) e2=((M*M)+(m2*m2)-(m1*m1))/(2.*M); | |
d88f97cc | 367 | Double_t pnorm=(e1*e1)-(m1*m1); |
368 | if (pnorm>0.) | |
369 | { | |
370 | pnorm=sqrt(pnorm); | |
371 | } | |
372 | else | |
373 | { | |
374 | pnorm=0; | |
375 | } | |
376 | ||
377 | Double_t a[3]; | |
378 | a[0]=pnorm; | |
379 | a[1]=thcms; | |
380 | a[2]=phicms; | |
381 | Ali3Vector p; | |
382 | p.SetVector(a,"sph"); | |
383 | ||
384 | Ali4Vector pprim1; | |
385 | pprim1.SetVector(e1,p); | |
959fbac5 | 386 | pprim1.SetInvariant(m1*m1); |
d88f97cc | 387 | |
388 | Ali4Vector pprim2; | |
389 | p*=-1; | |
390 | pprim2.SetVector(e2,p); | |
959fbac5 | 391 | pprim2.SetInvariant(m2*m2); |
d88f97cc | 392 | |
393 | // Determine boost parameters from the parent particle | |
959fbac5 | 394 | Double_t E=GetEnergy(); |
d88f97cc | 395 | p=Get3Vector(); |
396 | Ali4Vector pmu; | |
397 | pmu.SetVector(E,p); | |
398 | ||
399 | AliBoost q; | |
400 | q.Set4Momentum(pmu); | |
401 | ||
402 | Ali4Vector p1=q.Inverse(pprim1); // Boost decay product 1 | |
403 | Ali4Vector p2=q.Inverse(pprim2); // Boost decay product 2 | |
404 | ||
405 | // Enter the boosted data into the decay tracks array | |
406 | if (fDecays) | |
407 | { | |
408 | fDecays->Delete(); | |
409 | delete fDecays; | |
410 | } | |
411 | fDecays=new TObjArray(); | |
412 | ||
413 | fDecays->Add(new AliTrack); | |
414 | ((AliTrack*)fDecays->At(0))->Set4Momentum(p1); | |
959fbac5 | 415 | ((AliTrack*)fDecays->At(0))->SetMass(m1); |
d88f97cc | 416 | fDecays->Add(new AliTrack); |
417 | ((AliTrack*)fDecays->At(1))->Set4Momentum(p2); | |
d88f97cc | 418 | ((AliTrack*)fDecays->At(1))->SetMass(m2); |
419 | } | |
420 | /////////////////////////////////////////////////////////////////////////// | |
421 | Int_t AliTrack::GetNdecay() | |
422 | { | |
423 | // Provide the number of decay produced tracks | |
424 | return fNdec; | |
425 | } | |
426 | /////////////////////////////////////////////////////////////////////////// | |
427 | AliTrack* AliTrack::GetDecayTrack(Int_t j) | |
428 | { | |
429 | // Provide decay produced track number j | |
430 | // Note : j=1 denotes the first decay track | |
431 | if ((j >= 1) && (j <= fNdec)) | |
432 | { | |
433 | return (AliTrack*)fDecays->At(j-1); | |
434 | } | |
435 | else | |
436 | { | |
437 | cout << " *AliTrack* decay track number : " << j << " out of range." << endl; | |
438 | cout << " -- Decay track number 1 (if any) returned." << endl; | |
439 | return (AliTrack*)fDecays->At(0); | |
440 | } | |
441 | } | |
442 | /////////////////////////////////////////////////////////////////////////// | |
959fbac5 | 443 | void AliTrack::AddSignal(AliSignal& s) |
444 | { | |
445 | // Relate an AliSignal object to this track. | |
446 | if (!fSignals) fSignals=new TObjArray(); | |
447 | fNsig++; | |
448 | fSignals->Add(&s); | |
449 | } | |
450 | /////////////////////////////////////////////////////////////////////////// | |
451 | void AliTrack::RemoveSignal(AliSignal& s) | |
452 | { | |
453 | // Remove related AliSignal object to this track. | |
454 | if (fSignals) | |
455 | { | |
456 | AliSignal* test=(AliSignal*)fSignals->Remove(&s); | |
457 | if (test) | |
458 | { | |
459 | fNsig--; | |
460 | fSignals->Compress(); | |
461 | } | |
462 | } | |
463 | } | |
464 | /////////////////////////////////////////////////////////////////////////// | |
465 | Int_t AliTrack::GetNsignals() | |
466 | { | |
467 | // Provide the number of related AliSignals. | |
468 | return fNsig; | |
469 | } | |
470 | /////////////////////////////////////////////////////////////////////////// | |
471 | AliSignal* AliTrack::GetSignal(Int_t j) | |
472 | { | |
473 | // Provide the related AliSignal number j. | |
474 | // Note : j=1 denotes the first signal. | |
475 | if ((j >= 1) && (j <= fNsig)) | |
476 | { | |
477 | return (AliSignal*)fSignals->At(j-1); | |
478 | } | |
479 | else | |
480 | { | |
481 | cout << " *AliTrack* signal number : " << j << " out of range." << endl; | |
482 | cout << " -- Signal number 1 (if any) returned." << endl; | |
483 | return (AliSignal*)fDecays->At(0); | |
484 | } | |
485 | } | |
486 | /////////////////////////////////////////////////////////////////////////// | |
487 | void AliTrack::SetBeginPoint(AliPosition p) | |
488 | { | |
489 | // Store the position of the track begin-point. | |
490 | fBegin=p; | |
491 | } | |
492 | /////////////////////////////////////////////////////////////////////////// | |
493 | AliPosition AliTrack::GetBeginPoint() | |
494 | { | |
495 | // Provide the position of the track begin-point. | |
496 | return fBegin; | |
497 | } | |
498 | /////////////////////////////////////////////////////////////////////////// | |
499 | void AliTrack::SetEndPoint(AliPosition p) | |
500 | { | |
501 | // Store the position of the track end-point. | |
502 | fEnd=p; | |
503 | } | |
504 | /////////////////////////////////////////////////////////////////////////// | |
505 | AliPosition AliTrack::GetEndPoint() | |
506 | { | |
507 | // Provide the position of the track end-point. | |
508 | return fEnd; | |
509 | } | |
510 | /////////////////////////////////////////////////////////////////////////// | |
f531a546 | 511 | void AliTrack::AddMassHypothesis(Double_t prob,Double_t m,Double_t dm) |
512 | { | |
513 | // Add a mass hypothesis for this current track. | |
514 | // prob=probalility m=mass value dm=error on the mass value. | |
515 | // The default value for the mass error dm is 0. | |
516 | if (!fMasses) fMasses=new TArrayD(); | |
517 | if (!fDmasses) fDmasses=new TArrayD(); | |
518 | if (!fPmasses) fPmasses=new TArrayD(); | |
519 | ||
520 | fNmasses++; | |
521 | fMasses->Set(fNmasses); | |
522 | fDmasses->Set(fNmasses); | |
523 | fPmasses->Set(fNmasses); | |
524 | ||
525 | fMasses->AddAt(m,fNmasses-1); | |
526 | fDmasses->AddAt(dm,fNmasses-1); | |
527 | fPmasses->AddAt(prob,fNmasses-1); | |
528 | } | |
529 | /////////////////////////////////////////////////////////////////////////// | |
530 | Int_t AliTrack::GetNMassHypotheses() | |
531 | { | |
532 | // Provide the number of mass hypotheses for this track. | |
533 | return fNmasses; | |
534 | } | |
535 | /////////////////////////////////////////////////////////////////////////// | |
536 | Double_t AliTrack::GetMassHypothesis(Int_t j) | |
537 | { | |
538 | // Provide the mass of the jth hypothesis for this track. | |
539 | // Note : the first hypothesis is indicated by j=1. | |
540 | // Default : j=0 ==> Hypothesis with highest probability. | |
541 | // The error on the mass can be obtained by invoking GetResultError() | |
542 | // after invokation of GetMassHypothesis(j). | |
543 | ||
544 | Double_t m=0,dm=0,prob=0; | |
545 | ||
546 | // Check validity of index j | |
547 | if (j<0 || j>fNmasses) | |
548 | { | |
549 | cout << " *AliTrack::GetMassHypothesis* Invalid index j : " << j | |
550 | << " Number of mass hypotheses : " << fNmasses << endl; | |
551 | fDresult=0; | |
552 | return 0; | |
553 | } | |
554 | ||
555 | // Select mass hypothesis with highest probability | |
556 | if (j==0) | |
557 | { | |
558 | if (fNmasses) | |
559 | { | |
560 | m=fMasses->At(0); | |
561 | dm=fDmasses->At(0); | |
562 | prob=fPmasses->At(0); | |
563 | for (Int_t i=1; i<fNmasses; i++) | |
564 | { | |
565 | if (fPmasses->At(i)>prob) | |
566 | { | |
567 | m=fMasses->At(i); | |
568 | dm=fDmasses->At(i); | |
569 | } | |
570 | } | |
571 | } | |
572 | fDresult=dm; | |
573 | return m; | |
574 | } | |
575 | ||
576 | // Provide data of requested mass hypothesis | |
577 | m=fMasses->At(j-1); | |
578 | fDresult=fDmasses->At(j-1); | |
579 | return m; | |
580 | } | |
581 | /////////////////////////////////////////////////////////////////////////// | |
582 | Double_t AliTrack::GetMassHypothesisProb(Int_t j) | |
583 | { | |
584 | // Provide the probability of the jth hypothesis for this track. | |
585 | // Note : the first hypothesis is indicated by j=1. | |
586 | // Default : j=0 ==> Hypothesis with highest probability. | |
587 | ||
588 | Double_t prob=0; | |
589 | ||
590 | // Check validity of index j | |
591 | if (j<0 || j>fNmasses) | |
592 | { | |
593 | cout << " *AliTrack::GetMassHypothesisProb* Invalid index j : " << j | |
594 | << " Number of mass hypotheses : " << fNmasses << endl; | |
595 | return 0; | |
596 | } | |
597 | ||
598 | // Select mass hypothesis with highest probability | |
599 | if (j==0) | |
600 | { | |
601 | if (fNmasses) | |
602 | { | |
603 | prob=fPmasses->At(0); | |
604 | for (Int_t i=1; i<fNmasses; i++) | |
605 | { | |
606 | if (fPmasses->At(i)>prob) prob=fPmasses->At(i); | |
607 | } | |
608 | } | |
609 | return prob; | |
610 | } | |
611 | ||
612 | // Provide probability of requested mass hypothesis | |
613 | prob=fPmasses->At(j-1); | |
614 | return prob; | |
615 | } | |
616 | /////////////////////////////////////////////////////////////////////////// | |
617 | void AliTrack::SetMass() | |
618 | { | |
619 | // Set the mass and error to the value of the hypothesis with highest prob. | |
620 | ||
621 | Double_t m=0,dm=0,prob=0; | |
622 | ||
623 | // Select mass hypothesis with highest probability | |
624 | if (fNmasses) | |
625 | { | |
626 | m=fMasses->At(0); | |
627 | dm=fDmasses->At(0); | |
628 | prob=fPmasses->At(0); | |
629 | for (Int_t i=1; i<fNmasses; i++) | |
630 | { | |
631 | if (fPmasses->At(i)>prob) | |
632 | { | |
633 | m=fMasses->At(i); | |
634 | dm=fDmasses->At(i); | |
635 | } | |
636 | } | |
637 | SetMass(m,dm); | |
638 | } | |
639 | else | |
640 | { | |
641 | cout << " *AliTrack::SetMass()* No hypothesis present => No action." << endl; | |
642 | } | |
643 | } | |
644 | /////////////////////////////////////////////////////////////////////////// | |
645 | void AliTrack::RemoveMassHypothesis(Int_t j) | |
646 | { | |
647 | // Remove the jth mass hypothesis for this track. | |
648 | // Note : the first hypothesis is indicated by j=1. | |
649 | ||
650 | if (j<=0 || j>fNmasses) // Check validity of index j | |
651 | { | |
652 | cout << " *AliTrack::RemoveMassHypothesis* Invalid index j : " << j | |
653 | << " Number of mass hypotheses : " << fNmasses << endl; | |
654 | } | |
655 | else | |
656 | { | |
657 | if (j != fNmasses) | |
658 | { | |
659 | fMasses->AddAt(fMasses->At(fNmasses-1),j-1); | |
660 | fDmasses->AddAt(fDmasses->At(fNmasses-1),j-1); | |
661 | fPmasses->AddAt(fPmasses->At(fNmasses-1),j-1); | |
662 | } | |
663 | fMasses->AddAt(0,fNmasses-1); | |
664 | fDmasses->AddAt(0,fNmasses-1); | |
665 | fPmasses->AddAt(0,fNmasses-1); | |
666 | fNmasses--; | |
667 | fMasses->Set(fNmasses); | |
668 | fDmasses->Set(fNmasses); | |
669 | fPmasses->Set(fNmasses); | |
670 | } | |
671 | } | |
672 | /////////////////////////////////////////////////////////////////////////// | |
d071d629 | 673 | Double_t AliTrack::GetPt() |
674 | { | |
675 | // Provide trans. momentum value w.r.t. z-axis. | |
676 | // The error on the value can be obtained by GetResultError() | |
677 | // after invokation of GetPt(). | |
678 | Ali3Vector v; | |
679 | v=GetVecTrans(); | |
680 | Double_t norm=v.GetNorm(); | |
681 | fDresult=v.GetResultError(); | |
682 | ||
683 | return norm; | |
684 | } | |
685 | /////////////////////////////////////////////////////////////////////////// | |
686 | Double_t AliTrack::GetPl() | |
687 | { | |
688 | // Provide long. momentum value w.r.t. z-axis. | |
8adaf597 | 689 | // Note : the returned value can also be negative. |
d071d629 | 690 | // The error on the value can be obtained by GetResultError() |
691 | // after invokation of GetPl(). | |
692 | Ali3Vector v; | |
693 | v=GetVecLong(); | |
8adaf597 | 694 | |
695 | Double_t pl=v.GetNorm(); | |
d071d629 | 696 | fDresult=v.GetResultError(); |
697 | ||
8adaf597 | 698 | Double_t a[3]; |
699 | v.GetVector(a,"sph"); | |
700 | if (cos(a[1])<0) pl=-pl; | |
701 | ||
702 | return pl; | |
d071d629 | 703 | } |
704 | /////////////////////////////////////////////////////////////////////////// | |
705 | Double_t AliTrack::GetEt() | |
706 | { | |
707 | // Provide trans. energy value w.r.t. z-axis. | |
708 | // The error on the value can be obtained by GetResultError() | |
709 | // after invokation of GetEt(). | |
710 | Double_t et=GetScaTrans(); | |
711 | ||
712 | return et; | |
713 | } | |
714 | /////////////////////////////////////////////////////////////////////////// | |
715 | Double_t AliTrack::GetEl() | |
716 | { | |
717 | // Provide long. energy value w.r.t. z-axis. | |
8adaf597 | 718 | // Note : the returned value can also be negative. |
d071d629 | 719 | // The error on the value can be obtained by GetResultError() |
720 | // after invokation of GetEl(). | |
721 | Double_t el=GetScaLong(); | |
722 | ||
723 | return el; | |
724 | } | |
725 | /////////////////////////////////////////////////////////////////////////// | |
726 | Double_t AliTrack::GetMt() | |
727 | { | |
728 | // Provide transverse mass value w.r.t. z-axis. | |
729 | // The error on the value can be obtained by GetResultError() | |
730 | // after invokation of GetMt(). | |
731 | Double_t pt=GetPt(); | |
732 | Double_t dpt=GetResultError(); | |
733 | Double_t m=GetMass(); | |
734 | Double_t dm=GetResultError(); | |
735 | ||
736 | Double_t mt=sqrt(pt*pt+m*m); | |
737 | Double_t dmt2=0; | |
738 | if (mt) dmt2=(pow((pt*dpt),2)+pow((m*dm),2))/(mt*mt); | |
739 | ||
740 | fDresult=sqrt(dmt2); | |
741 | return mt; | |
742 | } | |
743 | /////////////////////////////////////////////////////////////////////////// | |
744 | Double_t AliTrack::GetMt(Int_t j) | |
745 | { | |
746 | // Provide transverse mass value w.r.t. z-axis and jth mass hypothesis. | |
747 | // Note : the first hypothesis is indicated by j=1. | |
748 | // j=0 ==> Hypothesis with highest probability. | |
749 | // The error on the value can be obtained by GetResultError() | |
750 | // after invokation of GetMt(j). | |
751 | Double_t pt=GetPt(); | |
752 | Double_t dpt=GetResultError(); | |
753 | Double_t m=GetMassHypothesis(j); | |
754 | Double_t dm=GetResultError(); | |
755 | ||
756 | Double_t mt=sqrt(pt*pt+m*m); | |
757 | Double_t dmt2=0; | |
758 | if (mt) dmt2=(pow((pt*dpt),2)+pow((m*dm),2))/(mt*mt); | |
759 | ||
760 | fDresult=sqrt(dmt2); | |
761 | return mt; | |
762 | } | |
763 | /////////////////////////////////////////////////////////////////////////// | |
8adaf597 | 764 | Double_t AliTrack::GetRapidity() |
765 | { | |
766 | // Provide rapidity value w.r.t. z-axis. | |
767 | // The error on the value can be obtained by GetResultError() | |
768 | // after invokation of GetRapidity(). | |
769 | // Note : Also GetPseudoRapidity() is available since this class is | |
770 | // derived from Ali4Vector. | |
771 | Double_t e=GetEnergy(); | |
772 | Double_t de=GetResultError(); | |
773 | Double_t pl=GetPl(); | |
774 | Double_t dpl=GetResultError(); | |
775 | Double_t sum=e+pl; | |
776 | Double_t dif=e-pl; | |
777 | ||
778 | Double_t y=9999,dy2=0; | |
779 | if (sum && dif) y=0.5*log(sum/dif); | |
780 | ||
781 | if (sum*dif) dy2=(1./(sum*dif))*(pow((pl*de),2)+pow((e*dpl),2)); | |
782 | ||
783 | fDresult=sqrt(dy2); | |
784 | return y; | |
785 | } | |
786 | /////////////////////////////////////////////////////////////////////////// | |
43bfa5be | 787 | void AliTrack::SetImpactPoint(AliPosition p,TString q) |
788 | { | |
789 | // Store the position of the impact-point in the plane "q=0". | |
790 | // Here q denotes one of the axes X, Y or Z. | |
791 | // Note : The character to denote the axis may be entered in lower or | |
792 | // in uppercase. | |
793 | Int_t axis=0; | |
794 | if (q=="x" || q=="X") axis=1; | |
795 | if (q=="y" || q=="Y") axis=2; | |
796 | if (q=="z" || q=="Z") axis=3; | |
797 | ||
798 | switch (axis) | |
799 | { | |
800 | case 1: // Impact-point in the plane X=0 | |
801 | fImpactYZ=p; | |
802 | break; | |
803 | ||
804 | case 2: // Impact-point in the plane Y=0 | |
805 | fImpactXZ=p; | |
806 | break; | |
807 | ||
808 | case 3: // Impact-point in the plane Z=0 | |
809 | fImpactXY=p; | |
810 | break; | |
811 | ||
812 | default: // Unsupported axis | |
813 | cout << "*AliTrack::SetImpactPoint* Unsupported axis : " << q << endl | |
814 | << " Possible axes are 'X', 'Y' and 'Z'." << endl; | |
815 | break; | |
816 | } | |
817 | } | |
818 | /////////////////////////////////////////////////////////////////////////// | |
819 | AliPosition AliTrack::GetImpactPoint(TString q) | |
820 | { | |
821 | // Provide the position of the impact-point in the plane "q=0". | |
822 | // Here q denotes one of the axes X, Y or Z. | |
823 | // Note : The character to denote the axis may be entered in lower or | |
824 | // in uppercase. | |
825 | AliPosition dummy; | |
826 | Int_t axis=0; | |
827 | if (q=="x" || q=="X") axis=1; | |
828 | if (q=="y" || q=="Y") axis=2; | |
829 | if (q=="z" || q=="Z") axis=3; | |
830 | ||
831 | switch (axis) | |
832 | { | |
833 | case 1: // Impact-point in the plane X=0 | |
834 | return fImpactYZ; | |
835 | ||
836 | case 2: // Impact-point in the plane Y=0 | |
837 | return fImpactXZ; | |
838 | ||
839 | case 3: // Impact-point in the plane Z=0 | |
840 | return fImpactXY; | |
841 | ||
842 | default: // Unsupported axis | |
843 | cout << "*AliTrack::GetImpactPoint* Unsupported axis : " << q << endl | |
844 | << " Possible axes are 'X', 'Y' and 'Z'." << endl; | |
845 | return dummy; | |
846 | } | |
847 | } | |
848 | /////////////////////////////////////////////////////////////////////////// | |
849 | void AliTrack::SetId(Int_t id) | |
850 | { | |
851 | // Set a user defined identifier for this track. | |
852 | fUserId=id; | |
853 | } | |
854 | /////////////////////////////////////////////////////////////////////////// | |
855 | Int_t AliTrack::GetId() | |
856 | { | |
857 | // Provide the user defined identifier of this track. | |
858 | return fUserId; | |
859 | } | |
860 | /////////////////////////////////////////////////////////////////////////// | |
861 | void AliTrack::SetClosestPoint(AliPosition p) | |
862 | { | |
863 | // Set position p as the point of closest approach w.r.t. some reference | |
864 | fClosest=p; | |
865 | } | |
866 | /////////////////////////////////////////////////////////////////////////// | |
867 | AliPosition AliTrack::GetClosestPoint() | |
868 | { | |
869 | // Provide the point of closest approach w.r.t. some reference | |
870 | return fClosest; | |
871 | } | |
872 | /////////////////////////////////////////////////////////////////////////// |