1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////
20 // Handling of the attributes of a reconstructed particle track.
25 // Float_t a[4]={195.,1.2,-0.04,8.5};
27 // pmu.SetVector(a,"car");
29 // t1.Set4Momentum(pmu);
31 // Float_t b[3]={1.2,-0.04,8.5};
33 // p.SetVector(b,"car");
35 // t2.Set3Momentum(p);
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
47 // t2.Decay(m1,m2,thcms,phicms); // Track t2 decay : Lambda -> proton + pion
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
55 // AliSignal s1,s2,s3,s4;
57 // .... // Code (e.g. detector readout) to fill AliSignal data
59 // AliTrack trec; // Track which will be reconstructed from signals
60 // trec.AddSignal(s1);
61 // trec.AddSignal(s3);
62 // trec.AddSignal(s4);
67 // ... // Code which accesses signals from trec and reconstructs
68 // 3-momentum P, charge Q, mass M etc...
70 // trec.Set3Momentum(P);
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);
86 // Note : All quantities are in GeV, GeV/c or GeV/c**2
88 //--- Author: Nick van Eijndhoven 10-jul-1997 UU-SAP Utrecht
89 //- Modified: NvE $Date$ UU-SAP Utrecht
90 ///////////////////////////////////////////////////////////////////////////
93 #include "Riostream.h"
95 ClassImp(AliTrack) // Class implementation to enable ROOT I/O
97 AliTrack::AliTrack() : TNamed(),Ali4Vector()
99 // Default constructor
100 // All variables initialised to 0
104 ///////////////////////////////////////////////////////////////////////////
105 void AliTrack::Init()
107 // Initialisation of pointers etc...
122 ///////////////////////////////////////////////////////////////////////////
123 AliTrack::~AliTrack()
125 // Destructor to delete memory allocated for decay tracks array.
126 // This destructor automatically cleares the pointer of this AliTrack
127 // from all the link slots of the related AliSignal objects.
128 Int_t nsig=GetNsignals();
129 for (Int_t i=1; i<=nsig; i++)
131 AliSignal* s=GetSignal(i);
132 if (s) s->ResetLinks(this);
197 ///////////////////////////////////////////////////////////////////////////
198 AliTrack::AliTrack(const AliTrack& t) : TNamed(t),Ali4Vector(t)
205 if (t.fBegin) fBegin=new AliPositionObj(*(t.fBegin));
206 if (t.fEnd) fEnd=new AliPositionObj(*(t.fEnd));
207 if (t.fRef) fRef=new AliPositionObj(*(t.fRef));
208 if (t.fImpactXY) fImpactXY=new AliPositionObj(*(t.fImpactXY));
209 if (t.fImpactXZ) fImpactXZ=new AliPositionObj(*(t.fImpactXZ));
210 if (t.fImpactYZ) fImpactYZ=new AliPositionObj(*(t.fImpactYZ));
211 if (t.fClosest) fClosest=new AliPositionObj(*(t.fClosest));
212 if (t.fFit) fFit=t.fFit->Clone();
213 if (t.fTstamp) fTstamp=new AliTimestamp(*(t.fTstamp));
220 Int_t ndec=t.GetNdecay();
223 fDecays=new TObjArray(ndec);
225 for (Int_t it=1; it<=ndec; it++)
227 AliTrack* tx=t.GetDecayTrack(it);
228 fDecays->Add(new AliTrack(*tx));
232 Int_t nsig=t.GetNsignals();
235 fSignals=new TObjArray(nsig);
236 for (Int_t is=1; is<=nsig; is++)
238 AliSignal* sx=t.GetSignal(is);
243 Int_t nhyp=t.GetNhypotheses();
246 fHypotheses=new TObjArray(nhyp);
247 fHypotheses->SetOwner();
248 for (Int_t ih=1; ih<=nhyp; ih++)
250 AliTrack* tx=t.GetTrackHypothesis(ih);
251 fHypotheses->Add(new AliTrack(*tx));
255 ///////////////////////////////////////////////////////////////////////////
256 void AliTrack::Reset()
258 // Reset all variables to 0 and delete all auto-generated decay tracks.
265 Double_t a[4]={0,0,0,0};
330 ///////////////////////////////////////////////////////////////////////////
331 void AliTrack::Set3Momentum(Ali3Vector& p)
333 // Set the track parameters according to the 3-momentum p.
334 // In case the mass was not yet set, the energy is set to correspond to m=0.
336 Double_t inv=GetInvariant();
337 if (inv<0) SetMass(0.);
339 ///////////////////////////////////////////////////////////////////////////
340 void AliTrack::Set4Momentum(Ali4Vector& p)
342 // Set the track parameters according to the 4-momentum p
343 Double_t E=p.GetScalar();
344 Double_t dE=p.GetResultError();
345 Ali3Vector pv=p.Get3Vector();
349 ///////////////////////////////////////////////////////////////////////////
350 void AliTrack::SetMass(Double_t m,Double_t dm)
352 // Set the particle mass
353 // The default value for the error dm is 0.
354 Double_t inv=pow(m,2);
355 Double_t dinv=fabs(2.*m*dm);
356 SetInvariant(inv,dinv);
358 ///////////////////////////////////////////////////////////////////////////
359 void AliTrack::SetCharge(Float_t q)
361 // Set the particle charge
364 ///////////////////////////////////////////////////////////////////////////
365 void AliTrack::Data(TString f,TString u)
367 // Provide track information within the coordinate frame f
369 // The string argument "u" allows to choose between different angular units
370 // in case e.g. a spherical frame is selected.
371 // u = "rad" : angles provided in radians
372 // "deg" : angles provided in degrees
374 // The defaults are f="car" and u="rad".
376 Double_t m=GetMass();
377 Double_t dm=GetResultError();
378 const char* name=GetName();
379 const char* title=GetTitle();
381 cout << " *" << ClassName() << "::Data*";
382 if (strlen(name)) cout << " Name : " << name;
383 if (strlen(title)) cout << " Title : " << title;
385 if (fTstamp) fTstamp->Date(1);
386 cout << " Id : " << fUserId << " Code : " << fCode
387 << " m : " << m << " dm : " << dm << " Charge : " << fQ
388 << " p : " << GetMomentum() << endl;
389 cout << " Nhypotheses : " << GetNhypotheses() << " Ndecay-tracks : " << GetNdecay()
390 << " Nsignals : " << GetNsignals() << endl;
393 cout << " Parent track Id : " << fParent->GetId() << " Code : " << fParent->GetParticleCode()
394 << " m : " << fParent->GetMass() << " Q : " << fParent->GetCharge()
395 << " p : " << fParent->GetMomentum();
396 const char* pname=fParent->GetName();
397 const char* ptitle=fParent->GetTitle();
398 if (strlen(pname)) cout << " Name : " << pname;
399 if (strlen(ptitle)) cout << " Title : " << ptitle;
404 cout << " Fit details present in object of class " << fFit->ClassName() << endl;
405 if (fFit->InheritsFrom("AliSignal")) ((AliSignal*)fFit)->List(-1);
407 Ali4Vector::Data(f,u);
409 ///////////////////////////////////////////////////////////////////////////
410 void AliTrack::List(TString f,TString u)
412 // Provide current track and decay level 1 information within coordinate frame f
414 // The string argument "u" allows to choose between different angular units
415 // in case e.g. a spherical frame is selected.
416 // u = "rad" : angles provided in radians
417 // "deg" : angles provided in degrees
419 // The defaults are f="car" and u="rad".
421 Data(f,u); // Information of the current track
423 // Decay products of this track
425 for (Int_t id=1; id<=GetNdecay(); id++)
427 td=GetDecayTrack(id);
430 cout << " ---Level 1 sec. track no. " << id << endl;
435 cout << " *AliTrack::List* Error : Empty decay track slot." << endl;
439 ///////////////////////////////////////////////////////////////////////////
440 void AliTrack::ListAll(TString f,TString u)
442 // Provide complete track and decay information within the coordinate frame f
444 // The string argument "u" allows to choose between different angular units
445 // in case e.g. a spherical frame is selected.
446 // u = "rad" : angles provided in radians
447 // "deg" : angles provided in degrees
449 // The defaults are f="car" and u="rad".
451 Data(f,u); // Information of the current track
452 if (fBegin) { cout << " Begin-point :"; fBegin->Data(f); }
453 if (fEnd) { cout << " End-point :"; fEnd->Data(f); }
454 if (fRef) { cout << " Ref-point :"; fRef->Data(f); }
456 Int_t nhyp=GetNhypotheses();
459 cout << " List of the " << nhyp << " track hypotheses : " << endl;
460 for (Int_t ih=1; ih<=nhyp; ih++)
462 AliTrack* tx=GetTrackHypothesis(ih);
463 if (tx) tx->Data(f,u);
467 Int_t nsig=GetNsignals();
470 cout << " List of the corresponding slots for the " << nsig
471 << " related signals : " << endl;
475 for (Int_t is=1; is<=nsig; is++)
477 AliSignal* sx=GetSignal(is);
480 nrefs=sx->GetIndices(this,slotarr,0);
481 for (Int_t jref=0; jref<nrefs; jref++)
483 jslot=slotarr.At(jref);
494 Dumps(t,1,f,u); // Information of all decay products
496 //////////////////////////////////////////////////////////////////////////
497 void AliTrack::Dumps(AliTrack* t,Int_t n,TString f,TString u)
499 // Recursively provide the info of all decay levels of this track
501 for (Int_t id=1; id<=t->GetNdecay(); id++)
503 td=t->GetDecayTrack(id);
506 cout << " ---Level " << n << " sec. track no. " << id << endl;
509 Int_t nhyp=td->GetNhypotheses();
512 cout << " List of the " << nhyp << " track hypotheses : " << endl;
513 for (Int_t ih=1; ih<=nhyp; ih++)
515 AliTrack* tx=td->GetTrackHypothesis(ih);
516 if (tx) tx->Data(f,u);
520 Int_t nsig=td->GetNsignals();
523 cout << " List of the " << nsig << " related signals : " << endl;
524 for (Int_t is=1; is<=nsig; is++)
526 AliSignal* sx=td->GetSignal(is);
527 if (sx) sx->Data(f,u);
531 // Go for next decay level of this decay track recursively
536 cout << " *AliTrack::Dumps* Error : Empty decay track slot." << endl;
540 //////////////////////////////////////////////////////////////////////////
541 Double_t AliTrack::GetMomentum()
543 // Provide the value of the track 3-momentum.
544 // The error can be obtained by invoking GetResultError() after
545 // invokation of GetMomentum().
546 Double_t norm=fV.GetNorm();
547 fDresult=fV.GetResultError();
550 ///////////////////////////////////////////////////////////////////////////
551 Ali3Vector AliTrack::Get3Momentum() const
553 // Provide the track 3-momentum
554 return (Ali3Vector)Get3Vector();
556 ///////////////////////////////////////////////////////////////////////////
557 Double_t AliTrack::GetMass()
559 // Provide the particle mass.
560 // The error can be obtained by invoking GetResultError() after
561 // invokation of GetMass().
562 Double_t inv=GetInvariant();
563 Double_t dinv=GetResultError();
567 Double_t m=sqrt(inv);
568 if (m) dm=dinv/(2.*m);
574 cout << "*AliTrack::GetMass* Unphysical situation m**2 = " << inv << endl;
575 cout << " Value 0 will be returned." << endl;
580 ///////////////////////////////////////////////////////////////////////////
581 Float_t AliTrack::GetCharge() const
583 // Provide the particle charge
586 ///////////////////////////////////////////////////////////////////////////
587 Double_t AliTrack::GetEnergy()
589 // Provide the particle's energy.
590 // The error can be obtained by invoking GetResultError() after
591 // invokation of GetEnergy().
592 Double_t E=GetScalar();
599 cout << "*AliTrack::GetEnergy* Unphysical situation E = " << E << endl;
600 cout << " Value 0 will be returned." << endl;
604 ///////////////////////////////////////////////////////////////////////////
605 void AliTrack::Decay(Double_t m1,Double_t m2,Double_t thcms,Double_t phicms)
607 // Perform 2-body decay of current track
608 // m1 : mass of decay product 1
609 // m2 : mass of decay product 2
610 // thcms : cms theta decay angle (in rad.) of m1
611 // phicms : cms phi decay angle (in rad.) of m1
613 Double_t M=GetMass();
615 // Compute the 4-momenta of the decay products in the cms
616 // Note : p2=p1=pnorm for a 2-body decay
618 if (M) e1=((M*M)+(m1*m1)-(m2*m2))/(2.*M);
620 if (M) e2=((M*M)+(m2*m2)-(m1*m1))/(2.*M);
621 Double_t pnorm=(e1*e1)-(m1*m1);
636 p.SetVector(a,"sph");
639 pprim1.SetVector(e1,p);
640 pprim1.SetInvariant(m1*m1);
644 pprim2.SetVector(e2,p);
645 pprim2.SetInvariant(m2*m2);
647 // Determine boost parameters from the parent particle
648 Double_t E=GetEnergy();
656 Ali4Vector p1=q.Inverse(pprim1); // Boost decay product 1
657 Ali4Vector p2=q.Inverse(pprim2); // Boost decay product 2
659 // Enter the boosted data into the decay tracks array
665 fDecays=new TObjArray(2);
668 fDecays->Add(new AliTrack);
669 ((AliTrack*)fDecays->At(0))->Set4Momentum(p1);
670 ((AliTrack*)fDecays->At(0))->SetMass(m1);
671 fDecays->Add(new AliTrack);
672 ((AliTrack*)fDecays->At(1))->Set4Momentum(p2);
673 ((AliTrack*)fDecays->At(1))->SetMass(m2);
675 ///////////////////////////////////////////////////////////////////////////
676 Int_t AliTrack::GetNdecay() const
678 // Provide the number of decay produced tracks
680 if (fDecays) ndec=fDecays->GetEntries();
683 ///////////////////////////////////////////////////////////////////////////
684 AliTrack* AliTrack::GetDecayTrack(Int_t j) const
686 // Provide decay produced track number j
687 // Note : j=1 denotes the first decay track
690 cout << " *AliTrack::GetDecayTrack* No tracks present." << endl;
695 if ((j >= 1) && (j <= GetNdecay()))
697 return (AliTrack*)fDecays->At(j-1);
701 cout << " *AliTrack* decay track number : " << j << " out of range."
702 << " Ndec = " << GetNdecay() << endl;
707 ///////////////////////////////////////////////////////////////////////////
708 void AliTrack::RemoveDecays()
710 // Remove all decay tracks from this track.
717 ///////////////////////////////////////////////////////////////////////////
718 void AliTrack::AddSignal(AliSignal& s)
720 // Relate an AliSignal object to this track.
721 if (!fSignals) fSignals=new TObjArray(1);
723 // Check if this signal is already stored for this track
724 Int_t nsig=GetNsignals();
725 for (Int_t i=0; i<nsig; i++)
727 if (&s==fSignals->At(i)) return;
732 ///////////////////////////////////////////////////////////////////////////
733 void AliTrack::RemoveSignal(AliSignal& s)
735 // Remove related AliSignal object from this track.
738 AliSignal* test=(AliSignal*)fSignals->Remove(&s);
739 if (test) fSignals->Compress();
742 ///////////////////////////////////////////////////////////////////////////
743 void AliTrack::RemoveSignals()
745 // Remove all related AliSignal objects from this track.
753 ///////////////////////////////////////////////////////////////////////////
754 Int_t AliTrack::GetNsignals() const
756 // Provide the number of related AliSignals.
758 if (fSignals) nsig=fSignals->GetEntries();
761 ///////////////////////////////////////////////////////////////////////////
762 AliSignal* AliTrack::GetSignal(Int_t j) const
764 // Provide the related AliSignal number j.
765 // Note : j=1 denotes the first signal.
768 cout << " *AliTrack::GetSignal* No signals present." << endl;
773 if ((j >= 1) && (j <= GetNsignals()))
775 return (AliSignal*)fSignals->At(j-1);
779 cout << " *AliTrack* signal number : " << j << " out of range."
780 << " Nsig = " << GetNsignals() << endl;
785 ///////////////////////////////////////////////////////////////////////////
786 void AliTrack::AddTrackHypothesis(AliTrack& t)
788 // Relate a track hypothesis to this track.
789 // Note : a private copy of the input track will be made via the Clone()
793 fHypotheses=new TObjArray(1);
794 fHypotheses->SetOwner();
796 fHypotheses->Add(t.Clone());
798 ///////////////////////////////////////////////////////////////////////////
799 void AliTrack::AddTrackHypothesis(Double_t prob,Double_t m,Double_t dm)
801 // Add a track hypothesis by explicitly setting the mass and probability.
802 // This will affect e.g. the hypothesis track's energy, since the momentum
803 // and all other attributes will be copied from the current track.
807 // prob=probalility m=mass value dm=error on the mass value.
808 // The default value for the mass error dm is 0.
812 t.RemoveTrackHypotheses();
814 t.SetTitle("Mass hypothesis");
817 AddTrackHypothesis(t);
819 ///////////////////////////////////////////////////////////////////////////
820 void AliTrack::RemoveTrackHypothesis(AliTrack& t)
822 // Remove the specified track hypothesis from this track.
825 AliTrack* test=(AliTrack*)fHypotheses->Remove(&t);
826 if (test) fHypotheses->Compress();
829 ///////////////////////////////////////////////////////////////////////////
830 void AliTrack::RemoveTrackHypotheses()
832 // Remove all track hypotheses from this track.
839 ///////////////////////////////////////////////////////////////////////////
840 Int_t AliTrack::GetNhypotheses() const
842 // Provide the number of track hypotheses.
844 if (fHypotheses) nhyp=fHypotheses->GetEntries();
847 ///////////////////////////////////////////////////////////////////////////
848 AliTrack* AliTrack::GetTrackHypothesis(Int_t j) const
850 // Provide the j-th track hypothesis.
851 // Note : j=1 denotes the first hypothesis.
852 // Default : j=0 ==> Hypothesis with highest probability.
854 if (!fHypotheses) return 0;
856 Int_t nhyp=GetNhypotheses();
858 // Check validity of index j
861 cout << " *AliTrack* hypothesis number : " << j << " out of range."
862 << " Nhyp = " << nhyp << endl;
868 if (j==0) // Provide track hypothesis with highest probability
871 t=(AliTrack*)fHypotheses->At(0);
872 if (t) prob=t->GetProb();
874 for (Int_t ih=1; ih<nhyp; ih++)
876 AliTrack* tx=(AliTrack*)fHypotheses->At(ih);
880 if (probx > prob) t=tx;
885 else // Provide requested j-th track hypothesis
887 return (AliTrack*)fHypotheses->At(j-1);
890 ///////////////////////////////////////////////////////////////////////////
891 void AliTrack::SetBeginPoint(AliPosition& p)
893 // Store the position of the track begin-point.
894 if (fBegin) delete fBegin;
895 fBegin=new AliPositionObj(p);
897 ///////////////////////////////////////////////////////////////////////////
898 AliPosition* AliTrack::GetBeginPoint()
900 // Provide the position of the track begin-point.
903 ///////////////////////////////////////////////////////////////////////////
904 void AliTrack::SetEndPoint(AliPosition& p)
906 // Store the position of the track end-point.
907 if (fEnd) delete fEnd;
908 fEnd=new AliPositionObj(p);
910 ///////////////////////////////////////////////////////////////////////////
911 AliPosition* AliTrack::GetEndPoint()
913 // Provide the position of the track end-point.
916 ///////////////////////////////////////////////////////////////////////////
917 void AliTrack::SetReferencePoint(AliPosition& p)
919 // Store the position of the track reference-point.
920 // The reference-point is the point on the track in which the
921 // 3-momentum vector components have been defined.
922 // This reference point is the preferable point to start track extrapolations
923 // etc... which are sensitive to the components of the 3-momentum vector.
924 if (fRef) delete fRef;
925 fRef=new AliPositionObj(p);
927 ///////////////////////////////////////////////////////////////////////////
928 AliPosition* AliTrack::GetReferencePoint()
930 // Provide the position of the track reference-point.
931 // The reference-point is the point on the track in which the
932 // 3-momentum vector components have been defined.
933 // This reference point is the preferable point to start track extrapolations
934 // etc... which are sensitive to the components of the 3-momentum vector.
937 ///////////////////////////////////////////////////////////////////////////
938 void AliTrack::SetMass()
940 // Set the mass and error to the value of the hypothesis with highest prob.
944 // Select mass hypothesis with highest probability
945 AliTrack* t=GetTrackHypothesis(0);
949 dm=t->GetResultError();
954 cout << " *AliTrack::SetMass()* No hypothesis present => No action." << endl;
957 ///////////////////////////////////////////////////////////////////////////
958 Double_t AliTrack::GetPt()
960 // Provide trans. momentum value w.r.t. z-axis.
961 // The error on the value can be obtained by GetResultError()
962 // after invokation of GetPt().
965 Double_t norm=v.GetNorm();
966 fDresult=v.GetResultError();
970 ///////////////////////////////////////////////////////////////////////////
971 Double_t AliTrack::GetPl()
973 // Provide long. momentum value w.r.t. z-axis.
974 // Note : the returned value can also be negative.
975 // The error on the value can be obtained by GetResultError()
976 // after invokation of GetPl().
980 Double_t pl=v.GetNorm();
981 fDresult=v.GetResultError();
984 v.GetVector(a,"sph");
985 if (cos(a[1])<0) pl=-pl;
989 ///////////////////////////////////////////////////////////////////////////
990 Double_t AliTrack::GetEt()
992 // Provide trans. energy value w.r.t. z-axis.
993 // The error on the value can be obtained by GetResultError()
994 // after invokation of GetEt().
995 Double_t et=GetScaTrans();
999 ///////////////////////////////////////////////////////////////////////////
1000 Double_t AliTrack::GetEl()
1002 // Provide long. energy value w.r.t. z-axis.
1003 // Note : the returned value can also be negative.
1004 // The error on the value can be obtained by GetResultError()
1005 // after invokation of GetEl().
1006 Double_t el=GetScaLong();
1010 ///////////////////////////////////////////////////////////////////////////
1011 Double_t AliTrack::GetMt()
1013 // Provide transverse mass value w.r.t. z-axis.
1014 // The error on the value can be obtained by GetResultError()
1015 // after invokation of GetMt().
1016 Double_t pt=GetPt();
1017 Double_t dpt=GetResultError();
1018 Double_t m=GetMass();
1019 Double_t dm=GetResultError();
1021 Double_t mt=sqrt(pt*pt+m*m);
1023 if (mt) dmt2=(pow((pt*dpt),2)+pow((m*dm),2))/(mt*mt);
1025 fDresult=sqrt(dmt2);
1028 ///////////////////////////////////////////////////////////////////////////
1029 Double_t AliTrack::GetRapidity()
1031 // Provide rapidity value w.r.t. z-axis.
1032 // The error on the value can be obtained by GetResultError()
1033 // after invokation of GetRapidity().
1034 // Note : Also GetPseudoRapidity() is available since this class is
1035 // derived from Ali4Vector.
1036 Double_t e=GetEnergy();
1037 Double_t de=GetResultError();
1038 Double_t pl=GetPl();
1039 Double_t dpl=GetResultError();
1043 Double_t y=9999,dy2=0;
1044 if (sum && dif) y=0.5*log(sum/dif);
1046 if (sum*dif) dy2=(1./(sum*dif))*(pow((pl*de),2)+pow((e*dpl),2));
1051 ///////////////////////////////////////////////////////////////////////////
1052 void AliTrack::SetImpactPoint(AliPosition& p,TString q)
1054 // Store the position of the impact-point in the plane "q=0".
1055 // Here q denotes one of the axes X, Y or Z.
1056 // Note : The character to denote the axis may be entered in lower or
1059 if (q=="x" || q=="X") axis=1;
1060 if (q=="y" || q=="Y") axis=2;
1061 if (q=="z" || q=="Z") axis=3;
1065 case 1: // Impact-point in the plane X=0
1066 if (fImpactYZ) delete fImpactYZ;
1067 fImpactYZ=new AliPositionObj(p);
1070 case 2: // Impact-point in the plane Y=0
1071 if (fImpactXZ) delete fImpactXZ;
1072 fImpactXZ=new AliPositionObj(p);
1075 case 3: // Impact-point in the plane Z=0
1076 if (fImpactXY) delete fImpactXY;
1077 fImpactXY=new AliPositionObj(p);
1080 default: // Unsupported axis
1081 cout << "*AliTrack::SetImpactPoint* Unsupported axis : " << q << endl
1082 << " Possible axes are 'X', 'Y' and 'Z'." << endl;
1086 ///////////////////////////////////////////////////////////////////////////
1087 AliPosition* AliTrack::GetImpactPoint(TString q)
1089 // Provide the position of the impact-point in the plane "q=0".
1090 // Here q denotes one of the axes X, Y or Z.
1091 // Note : The character to denote the axis may be entered in lower or
1094 if (q=="x" || q=="X") axis=1;
1095 if (q=="y" || q=="Y") axis=2;
1096 if (q=="z" || q=="Z") axis=3;
1100 case 1: // Impact-point in the plane X=0
1103 case 2: // Impact-point in the plane Y=0
1106 case 3: // Impact-point in the plane Z=0
1109 default: // Unsupported axis
1110 cout << "*AliTrack::GetImpactPoint* Unsupported axis : " << q << endl
1111 << " Possible axes are 'X', 'Y' and 'Z'." << endl;
1115 ///////////////////////////////////////////////////////////////////////////
1116 void AliTrack::SetId(Int_t id)
1118 // Set a user defined unique identifier for this track.
1121 ///////////////////////////////////////////////////////////////////////////
1122 Int_t AliTrack::GetId() const
1124 // Provide the user defined unique identifier of this track.
1127 ///////////////////////////////////////////////////////////////////////////
1128 void AliTrack::SetClosestPoint(AliPosition& p)
1130 // Set position p as the point of closest approach w.r.t. some reference
1131 if (fClosest) delete fClosest;
1132 fClosest=new AliPositionObj(p);
1134 ///////////////////////////////////////////////////////////////////////////
1135 AliPosition* AliTrack::GetClosestPoint()
1137 // Provide the point of closest approach w.r.t. some reference
1140 ///////////////////////////////////////////////////////////////////////////
1141 void AliTrack::SetChi2(Float_t chi2)
1143 // Set the chi-squared value of the track fit.
1146 cout << " *AliTrack::SetChi2* Invalid chi2 value : " << chi2 << endl;
1153 ///////////////////////////////////////////////////////////////////////////
1154 void AliTrack::SetNdf(Int_t ndf)
1156 // Set the number of degrees of freedom for the track fit.
1159 cout << " *AliTrack::SetNdf* Invalid ndf value : " << ndf << endl;
1166 ///////////////////////////////////////////////////////////////////////////
1167 Float_t AliTrack::GetChi2() const
1169 // Provide the chi-squared value of the track fit.
1172 ///////////////////////////////////////////////////////////////////////////
1173 Int_t AliTrack::GetNdf() const
1175 // Provide the number of degrees of freedom for the track fit.
1178 ///////////////////////////////////////////////////////////////////////////
1179 void AliTrack::SetParticleCode(Int_t code)
1181 // Set the user defined particle id code (e.g. the PDF convention).
1184 ///////////////////////////////////////////////////////////////////////////
1185 Int_t AliTrack::GetParticleCode() const
1187 // Provide the user defined particle id code.
1190 ///////////////////////////////////////////////////////////////////////////
1191 void AliTrack::SetParentTrack(AliTrack* t)
1193 // Set pointer to the parent track.
1196 ///////////////////////////////////////////////////////////////////////////
1197 AliTrack* AliTrack::GetParentTrack()
1199 // Provide pointer to the parent track.
1202 ///////////////////////////////////////////////////////////////////////////
1203 void AliTrack::SetProb(Double_t prob)
1205 // Set hypothesis probability for this track.
1208 ///////////////////////////////////////////////////////////////////////////
1209 Float_t AliTrack::GetProb() const
1211 // Provide the hypothesis probability for this track.
1214 ///////////////////////////////////////////////////////////////////////////
1215 void AliTrack::SetFitDetails(TObject* obj)
1217 // Enter the object containing the fit details.
1218 // In case an object to hold fit details was already present, this
1219 // will be deleted first before the new one is stored.
1220 // This means that SetFitDetails(0) can be used to just remove the
1221 // existing object with the fit details.
1222 // All objects derived from TObject can be entered in this way.
1223 // Obvious candidates for objects containing detailed fit information
1224 // are functions (e.g. TF1) and histograms (e.g. TH1F).
1225 // However, using an AliDevice object provides a very versatile facility
1226 // to store the parameters of various fit procedures.
1227 // In such a case the AliDevice can be used to provide the various fit
1228 // definitions and the corresponding fit parameters can be entered as
1229 // separate AliSignal objects which are stored as hits to the AliDevice.
1230 // In addition various functions and histograms can be linked to the
1231 // various AliSignal instances
1232 // The latter procedure is based on the original idea of Adam Bouchta.
1234 // Note : The entered object is owned by this AliTrack instance.
1235 // As such, a private copy of obj will be stored using the Clone()
1237 // In case the entered object contains pointers to other objects,
1238 // the user has to provide the appropriate Clone() memberfunction
1239 // for the class to which the entered object belongs.
1240 // An example can be seen from AliTrack::Clone().
1248 if (obj) fFit=obj->Clone();
1250 ///////////////////////////////////////////////////////////////////////////
1251 TObject* AliTrack::GetFitDetails()
1253 // Provide the pointer to the object containing the fit details.
1256 ///////////////////////////////////////////////////////////////////////////
1257 void AliTrack::SetTimestamp(AliTimestamp& t)
1259 // Store the timestamp for this track.
1260 if (fTstamp) delete fTstamp;
1261 fTstamp=new AliTimestamp(t);
1263 ///////////////////////////////////////////////////////////////////////////
1264 AliTimestamp* AliTrack::GetTimestamp()
1266 // Provide the timestamp of this track.
1269 ///////////////////////////////////////////////////////////////////////////
1270 void AliTrack::RemoveTimestamp()
1272 // Remove the timestamp from this track.
1279 ///////////////////////////////////////////////////////////////////////////
1280 TObject* AliTrack::Clone(const char* name) const
1282 // Make a deep copy of the current object and provide the pointer to the copy.
1283 // This memberfunction enables automatic creation of new objects of the
1284 // correct type depending on the object type, a feature which may be very useful
1285 // for containers when adding objects in case the container owns the objects.
1286 // This feature allows e.g. AliJet to store either AliTrack objects or
1287 // objects derived from AliTrack via the AddTrack memberfunction, provided
1288 // these derived classes also have a proper Clone memberfunction.
1290 AliTrack* trk=new AliTrack(*this);
1293 if (strlen(name)) trk->SetName(name);
1297 ///////////////////////////////////////////////////////////////////////////