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