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)
367 // Provide track information within the coordinate frame f
368 Double_t m=GetMass();
369 Double_t dm=GetResultError();
370 const char* name=GetName();
371 const char* title=GetTitle();
373 cout << " *" << ClassName() << "::Data*";
374 if (strlen(name)) cout << " Name : " << name;
375 if (strlen(title)) cout << " Title : " << title;
377 if (fTstamp) fTstamp->Date(1);
378 cout << " Id : " << fUserId << " Code : " << fCode
379 << " m : " << m << " dm : " << dm << " Charge : " << fQ
380 << " p : " << GetMomentum() << endl;
381 cout << " Nhypotheses : " << GetNhypotheses() << " Ndecay-tracks : " << GetNdecay()
382 << " Nsignals : " << GetNsignals() << endl;
385 cout << " Parent track Id : " << fParent->GetId() << " Code : " << fParent->GetParticleCode()
386 << " m : " << fParent->GetMass() << " Q : " << fParent->GetCharge()
387 << " p : " << fParent->GetMomentum();
388 const char* pname=fParent->GetName();
389 const char* ptitle=fParent->GetTitle();
390 if (strlen(pname)) cout << " Name : " << pname;
391 if (strlen(ptitle)) cout << " Title : " << ptitle;
396 cout << " Fit details present in object of class " << fFit->ClassName() << endl;
397 if (fFit->InheritsFrom("AliSignal")) ((AliSignal*)fFit)->List(-1);
401 ///////////////////////////////////////////////////////////////////////////
402 void AliTrack::List(TString f)
404 // Provide current track and decay level 1 information within coordinate frame f
406 Data(f); // Information of the current track
408 // Decay products of this track
410 for (Int_t id=1; id<=GetNdecay(); id++)
412 td=GetDecayTrack(id);
415 cout << " ---Level 1 sec. track no. " << id << endl;
420 cout << " *AliTrack::List* Error : Empty decay track slot." << endl;
424 ///////////////////////////////////////////////////////////////////////////
425 void AliTrack::ListAll(TString f)
427 // Provide complete track and decay information within the coordinate frame f
429 Data(f); // Information of the current track
430 if (fBegin) { cout << " Begin-point :"; fBegin->Data(f); }
431 if (fEnd) { cout << " End-point :"; fEnd->Data(f); }
432 if (fRef) { cout << " Ref-point :"; fRef->Data(f); }
434 Int_t nhyp=GetNhypotheses();
437 cout << " List of the " << nhyp << " track hypotheses : " << endl;
438 for (Int_t ih=1; ih<=nhyp; ih++)
440 AliTrack* tx=GetTrackHypothesis(ih);
445 Int_t nsig=GetNsignals();
448 cout << " List of the corresponding slots for the " << nsig
449 << " related signals : " << endl;
453 for (Int_t is=1; is<=nsig; is++)
455 AliSignal* sx=GetSignal(is);
458 nrefs=sx->GetIndices(this,slotarr,0);
459 for (Int_t jref=0; jref<nrefs; jref++)
461 jslot=slotarr.At(jref);
472 Dumps(t,1,f); // Information of all decay products
474 //////////////////////////////////////////////////////////////////////////
475 void AliTrack::Dumps(AliTrack* t,Int_t n,TString f)
477 // Recursively provide the info of all decay levels of this track
479 for (Int_t id=1; id<=t->GetNdecay(); id++)
481 td=t->GetDecayTrack(id);
484 cout << " ---Level " << n << " sec. track no. " << id << endl;
487 Int_t nhyp=td->GetNhypotheses();
490 cout << " List of the " << nhyp << " track hypotheses : " << endl;
491 for (Int_t ih=1; ih<=nhyp; ih++)
493 AliTrack* tx=td->GetTrackHypothesis(ih);
498 Int_t nsig=td->GetNsignals();
501 cout << " List of the " << nsig << " related signals : " << endl;
502 for (Int_t is=1; is<=nsig; is++)
504 AliSignal* sx=td->GetSignal(is);
509 // Go for next decay level of this decay track recursively
514 cout << " *AliTrack::Dumps* Error : Empty decay track slot." << endl;
518 //////////////////////////////////////////////////////////////////////////
519 Double_t AliTrack::GetMomentum()
521 // Provide the value of the track 3-momentum.
522 // The error can be obtained by invoking GetResultError() after
523 // invokation of GetMomentum().
524 Double_t norm=fV.GetNorm();
525 fDresult=fV.GetResultError();
528 ///////////////////////////////////////////////////////////////////////////
529 Ali3Vector AliTrack::Get3Momentum() const
531 // Provide the track 3-momentum
532 return (Ali3Vector)Get3Vector();
534 ///////////////////////////////////////////////////////////////////////////
535 Double_t AliTrack::GetMass()
537 // Provide the particle mass.
538 // The error can be obtained by invoking GetResultError() after
539 // invokation of GetMass().
540 Double_t inv=GetInvariant();
541 Double_t dinv=GetResultError();
545 Double_t m=sqrt(inv);
546 if (m) dm=dinv/(2.*m);
552 cout << "*AliTrack::GetMass* Unphysical situation m**2 = " << inv << endl;
553 cout << " Value 0 will be returned." << endl;
558 ///////////////////////////////////////////////////////////////////////////
559 Float_t AliTrack::GetCharge() const
561 // Provide the particle charge
564 ///////////////////////////////////////////////////////////////////////////
565 Double_t AliTrack::GetEnergy()
567 // Provide the particle's energy.
568 // The error can be obtained by invoking GetResultError() after
569 // invokation of GetEnergy().
570 Double_t E=GetScalar();
577 cout << "*AliTrack::GetEnergy* Unphysical situation E = " << E << endl;
578 cout << " Value 0 will be returned." << endl;
582 ///////////////////////////////////////////////////////////////////////////
583 void AliTrack::Decay(Double_t m1,Double_t m2,Double_t thcms,Double_t phicms)
585 // Perform 2-body decay of current track
586 // m1 : mass of decay product 1
587 // m2 : mass of decay product 2
588 // thcms : cms theta decay angle (in rad.) of m1
589 // phicms : cms phi decay angle (in rad.) of m1
591 Double_t M=GetMass();
593 // Compute the 4-momenta of the decay products in the cms
594 // Note : p2=p1=pnorm for a 2-body decay
596 if (M) e1=((M*M)+(m1*m1)-(m2*m2))/(2.*M);
598 if (M) e2=((M*M)+(m2*m2)-(m1*m1))/(2.*M);
599 Double_t pnorm=(e1*e1)-(m1*m1);
614 p.SetVector(a,"sph");
617 pprim1.SetVector(e1,p);
618 pprim1.SetInvariant(m1*m1);
622 pprim2.SetVector(e2,p);
623 pprim2.SetInvariant(m2*m2);
625 // Determine boost parameters from the parent particle
626 Double_t E=GetEnergy();
634 Ali4Vector p1=q.Inverse(pprim1); // Boost decay product 1
635 Ali4Vector p2=q.Inverse(pprim2); // Boost decay product 2
637 // Enter the boosted data into the decay tracks array
643 fDecays=new TObjArray(2);
646 fDecays->Add(new AliTrack);
647 ((AliTrack*)fDecays->At(0))->Set4Momentum(p1);
648 ((AliTrack*)fDecays->At(0))->SetMass(m1);
649 fDecays->Add(new AliTrack);
650 ((AliTrack*)fDecays->At(1))->Set4Momentum(p2);
651 ((AliTrack*)fDecays->At(1))->SetMass(m2);
653 ///////////////////////////////////////////////////////////////////////////
654 Int_t AliTrack::GetNdecay() const
656 // Provide the number of decay produced tracks
658 if (fDecays) ndec=fDecays->GetEntries();
661 ///////////////////////////////////////////////////////////////////////////
662 AliTrack* AliTrack::GetDecayTrack(Int_t j) const
664 // Provide decay produced track number j
665 // Note : j=1 denotes the first decay track
668 cout << " *AliTrack::GetDecayTrack* No tracks present." << endl;
673 if ((j >= 1) && (j <= GetNdecay()))
675 return (AliTrack*)fDecays->At(j-1);
679 cout << " *AliTrack* decay track number : " << j << " out of range."
680 << " Ndec = " << GetNdecay() << endl;
685 ///////////////////////////////////////////////////////////////////////////
686 void AliTrack::RemoveDecays()
688 // Remove all decay tracks from this track.
695 ///////////////////////////////////////////////////////////////////////////
696 void AliTrack::AddSignal(AliSignal& s)
698 // Relate an AliSignal object to this track.
699 if (!fSignals) fSignals=new TObjArray(1);
701 // Check if this signal is already stored for this track
702 Int_t nsig=GetNsignals();
703 for (Int_t i=0; i<nsig; i++)
705 if (&s==fSignals->At(i)) return;
710 ///////////////////////////////////////////////////////////////////////////
711 void AliTrack::RemoveSignal(AliSignal& s)
713 // Remove related AliSignal object from this track.
716 AliSignal* test=(AliSignal*)fSignals->Remove(&s);
717 if (test) fSignals->Compress();
720 ///////////////////////////////////////////////////////////////////////////
721 void AliTrack::RemoveSignals()
723 // Remove all related AliSignal objects from this track.
731 ///////////////////////////////////////////////////////////////////////////
732 Int_t AliTrack::GetNsignals() const
734 // Provide the number of related AliSignals.
736 if (fSignals) nsig=fSignals->GetEntries();
739 ///////////////////////////////////////////////////////////////////////////
740 AliSignal* AliTrack::GetSignal(Int_t j) const
742 // Provide the related AliSignal number j.
743 // Note : j=1 denotes the first signal.
746 cout << " *AliTrack::GetSignal* No signals present." << endl;
751 if ((j >= 1) && (j <= GetNsignals()))
753 return (AliSignal*)fSignals->At(j-1);
757 cout << " *AliTrack* signal number : " << j << " out of range."
758 << " Nsig = " << GetNsignals() << endl;
763 ///////////////////////////////////////////////////////////////////////////
764 void AliTrack::AddTrackHypothesis(AliTrack& t)
766 // Relate a track hypothesis to this track.
767 // Note : a private copy of the input track will be made via the Clone()
771 fHypotheses=new TObjArray(1);
772 fHypotheses->SetOwner();
774 fHypotheses->Add(t.Clone());
776 ///////////////////////////////////////////////////////////////////////////
777 void AliTrack::AddTrackHypothesis(Double_t prob,Double_t m,Double_t dm)
779 // Add a track hypothesis by explicitly setting the mass and probability.
780 // This will affect e.g. the hypothesis track's energy, since the momentum
781 // and all other attributes will be copied from the current track.
785 // prob=probalility m=mass value dm=error on the mass value.
786 // The default value for the mass error dm is 0.
790 t.RemoveTrackHypotheses();
792 t.SetTitle("Mass hypothesis");
795 AddTrackHypothesis(t);
797 ///////////////////////////////////////////////////////////////////////////
798 void AliTrack::RemoveTrackHypothesis(AliTrack& t)
800 // Remove the specified track hypothesis from this track.
803 AliTrack* test=(AliTrack*)fHypotheses->Remove(&t);
804 if (test) fHypotheses->Compress();
807 ///////////////////////////////////////////////////////////////////////////
808 void AliTrack::RemoveTrackHypotheses()
810 // Remove all track hypotheses from this track.
817 ///////////////////////////////////////////////////////////////////////////
818 Int_t AliTrack::GetNhypotheses() const
820 // Provide the number of track hypotheses.
822 if (fHypotheses) nhyp=fHypotheses->GetEntries();
825 ///////////////////////////////////////////////////////////////////////////
826 AliTrack* AliTrack::GetTrackHypothesis(Int_t j) const
828 // Provide the j-th track hypothesis.
829 // Note : j=1 denotes the first hypothesis.
830 // Default : j=0 ==> Hypothesis with highest probability.
832 if (!fHypotheses) return 0;
834 Int_t nhyp=GetNhypotheses();
836 // Check validity of index j
839 cout << " *AliTrack* hypothesis number : " << j << " out of range."
840 << " Nhyp = " << nhyp << endl;
846 if (j==0) // Provide track hypothesis with highest probability
849 t=(AliTrack*)fHypotheses->At(0);
850 if (t) prob=t->GetProb();
852 for (Int_t ih=1; ih<nhyp; ih++)
854 AliTrack* tx=(AliTrack*)fHypotheses->At(ih);
858 if (probx > prob) t=tx;
863 else // Provide requested j-th track hypothesis
865 return (AliTrack*)fHypotheses->At(j-1);
868 ///////////////////////////////////////////////////////////////////////////
869 void AliTrack::SetBeginPoint(AliPosition& p)
871 // Store the position of the track begin-point.
872 if (fBegin) delete fBegin;
873 fBegin=new AliPositionObj(p);
875 ///////////////////////////////////////////////////////////////////////////
876 AliPosition* AliTrack::GetBeginPoint()
878 // Provide the position of the track begin-point.
881 ///////////////////////////////////////////////////////////////////////////
882 void AliTrack::SetEndPoint(AliPosition& p)
884 // Store the position of the track end-point.
885 if (fEnd) delete fEnd;
886 fEnd=new AliPositionObj(p);
888 ///////////////////////////////////////////////////////////////////////////
889 AliPosition* AliTrack::GetEndPoint()
891 // Provide the position of the track end-point.
894 ///////////////////////////////////////////////////////////////////////////
895 void AliTrack::SetReferencePoint(AliPosition& p)
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) delete fRef;
903 fRef=new AliPositionObj(p);
905 ///////////////////////////////////////////////////////////////////////////
906 AliPosition* AliTrack::GetReferencePoint()
908 // Provide the position of the track reference-point.
909 // The reference-point is the point on the track in which the
910 // 3-momentum vector components have been defined.
911 // This reference point is the preferable point to start track extrapolations
912 // etc... which are sensitive to the components of the 3-momentum vector.
915 ///////////////////////////////////////////////////////////////////////////
916 void AliTrack::SetMass()
918 // Set the mass and error to the value of the hypothesis with highest prob.
922 // Select mass hypothesis with highest probability
923 AliTrack* t=GetTrackHypothesis(0);
927 dm=t->GetResultError();
932 cout << " *AliTrack::SetMass()* No hypothesis present => No action." << endl;
935 ///////////////////////////////////////////////////////////////////////////
936 Double_t AliTrack::GetPt()
938 // Provide trans. momentum value w.r.t. z-axis.
939 // The error on the value can be obtained by GetResultError()
940 // after invokation of GetPt().
943 Double_t norm=v.GetNorm();
944 fDresult=v.GetResultError();
948 ///////////////////////////////////////////////////////////////////////////
949 Double_t AliTrack::GetPl()
951 // Provide long. momentum value w.r.t. z-axis.
952 // Note : the returned value can also be negative.
953 // The error on the value can be obtained by GetResultError()
954 // after invokation of GetPl().
958 Double_t pl=v.GetNorm();
959 fDresult=v.GetResultError();
962 v.GetVector(a,"sph");
963 if (cos(a[1])<0) pl=-pl;
967 ///////////////////////////////////////////////////////////////////////////
968 Double_t AliTrack::GetEt()
970 // Provide trans. energy value w.r.t. z-axis.
971 // The error on the value can be obtained by GetResultError()
972 // after invokation of GetEt().
973 Double_t et=GetScaTrans();
977 ///////////////////////////////////////////////////////////////////////////
978 Double_t AliTrack::GetEl()
980 // Provide long. energy value w.r.t. z-axis.
981 // Note : the returned value can also be negative.
982 // The error on the value can be obtained by GetResultError()
983 // after invokation of GetEl().
984 Double_t el=GetScaLong();
988 ///////////////////////////////////////////////////////////////////////////
989 Double_t AliTrack::GetMt()
991 // Provide transverse mass value w.r.t. z-axis.
992 // The error on the value can be obtained by GetResultError()
993 // after invokation of GetMt().
995 Double_t dpt=GetResultError();
996 Double_t m=GetMass();
997 Double_t dm=GetResultError();
999 Double_t mt=sqrt(pt*pt+m*m);
1001 if (mt) dmt2=(pow((pt*dpt),2)+pow((m*dm),2))/(mt*mt);
1003 fDresult=sqrt(dmt2);
1006 ///////////////////////////////////////////////////////////////////////////
1007 Double_t AliTrack::GetRapidity()
1009 // Provide rapidity value w.r.t. z-axis.
1010 // The error on the value can be obtained by GetResultError()
1011 // after invokation of GetRapidity().
1012 // Note : Also GetPseudoRapidity() is available since this class is
1013 // derived from Ali4Vector.
1014 Double_t e=GetEnergy();
1015 Double_t de=GetResultError();
1016 Double_t pl=GetPl();
1017 Double_t dpl=GetResultError();
1021 Double_t y=9999,dy2=0;
1022 if (sum && dif) y=0.5*log(sum/dif);
1024 if (sum*dif) dy2=(1./(sum*dif))*(pow((pl*de),2)+pow((e*dpl),2));
1029 ///////////////////////////////////////////////////////////////////////////
1030 void AliTrack::SetImpactPoint(AliPosition& p,TString q)
1032 // Store the position of the impact-point in the plane "q=0".
1033 // Here q denotes one of the axes X, Y or Z.
1034 // Note : The character to denote the axis may be entered in lower or
1037 if (q=="x" || q=="X") axis=1;
1038 if (q=="y" || q=="Y") axis=2;
1039 if (q=="z" || q=="Z") axis=3;
1043 case 1: // Impact-point in the plane X=0
1044 if (fImpactYZ) delete fImpactYZ;
1045 fImpactYZ=new AliPositionObj(p);
1048 case 2: // Impact-point in the plane Y=0
1049 if (fImpactXZ) delete fImpactXZ;
1050 fImpactXZ=new AliPositionObj(p);
1053 case 3: // Impact-point in the plane Z=0
1054 if (fImpactXY) delete fImpactXY;
1055 fImpactXY=new AliPositionObj(p);
1058 default: // Unsupported axis
1059 cout << "*AliTrack::SetImpactPoint* Unsupported axis : " << q << endl
1060 << " Possible axes are 'X', 'Y' and 'Z'." << endl;
1064 ///////////////////////////////////////////////////////////////////////////
1065 AliPosition* AliTrack::GetImpactPoint(TString q)
1067 // Provide the position of the impact-point in the plane "q=0".
1068 // Here q denotes one of the axes X, Y or Z.
1069 // Note : The character to denote the axis may be entered in lower or
1072 if (q=="x" || q=="X") axis=1;
1073 if (q=="y" || q=="Y") axis=2;
1074 if (q=="z" || q=="Z") axis=3;
1078 case 1: // Impact-point in the plane X=0
1081 case 2: // Impact-point in the plane Y=0
1084 case 3: // Impact-point in the plane Z=0
1087 default: // Unsupported axis
1088 cout << "*AliTrack::GetImpactPoint* Unsupported axis : " << q << endl
1089 << " Possible axes are 'X', 'Y' and 'Z'." << endl;
1093 ///////////////////////////////////////////////////////////////////////////
1094 void AliTrack::SetId(Int_t id)
1096 // Set a user defined unique identifier for this track.
1099 ///////////////////////////////////////////////////////////////////////////
1100 Int_t AliTrack::GetId() const
1102 // Provide the user defined unique identifier of this track.
1105 ///////////////////////////////////////////////////////////////////////////
1106 void AliTrack::SetClosestPoint(AliPosition& p)
1108 // Set position p as the point of closest approach w.r.t. some reference
1109 if (fClosest) delete fClosest;
1110 fClosest=new AliPositionObj(p);
1112 ///////////////////////////////////////////////////////////////////////////
1113 AliPosition* AliTrack::GetClosestPoint()
1115 // Provide the point of closest approach w.r.t. some reference
1118 ///////////////////////////////////////////////////////////////////////////
1119 void AliTrack::SetChi2(Float_t chi2)
1121 // Set the chi-squared value of the track fit.
1124 cout << " *AliTrack::SetChi2* Invalid chi2 value : " << chi2 << endl;
1131 ///////////////////////////////////////////////////////////////////////////
1132 void AliTrack::SetNdf(Int_t ndf)
1134 // Set the number of degrees of freedom for the track fit.
1137 cout << " *AliTrack::SetNdf* Invalid ndf value : " << ndf << endl;
1144 ///////////////////////////////////////////////////////////////////////////
1145 Float_t AliTrack::GetChi2() const
1147 // Provide the chi-squared value of the track fit.
1150 ///////////////////////////////////////////////////////////////////////////
1151 Int_t AliTrack::GetNdf() const
1153 // Provide the number of degrees of freedom for the track fit.
1156 ///////////////////////////////////////////////////////////////////////////
1157 void AliTrack::SetParticleCode(Int_t code)
1159 // Set the user defined particle id code (e.g. the PDF convention).
1162 ///////////////////////////////////////////////////////////////////////////
1163 Int_t AliTrack::GetParticleCode() const
1165 // Provide the user defined particle id code.
1168 ///////////////////////////////////////////////////////////////////////////
1169 void AliTrack::SetParentTrack(AliTrack* t)
1171 // Set pointer to the parent track.
1174 ///////////////////////////////////////////////////////////////////////////
1175 AliTrack* AliTrack::GetParentTrack()
1177 // Provide pointer to the parent track.
1180 ///////////////////////////////////////////////////////////////////////////
1181 void AliTrack::SetProb(Double_t prob)
1183 // Set hypothesis probability for this track.
1186 ///////////////////////////////////////////////////////////////////////////
1187 Float_t AliTrack::GetProb() const
1189 // Provide the hypothesis probability for this track.
1192 ///////////////////////////////////////////////////////////////////////////
1193 void AliTrack::SetFitDetails(TObject* obj)
1195 // Enter the object containing the fit details.
1196 // In case an object to hold fit details was already present, this
1197 // will be deleted first before the new one is stored.
1198 // This means that SetFitDetails(0) can be used to just remove the
1199 // existing object with the fit details.
1200 // All objects derived from TObject can be entered in this way.
1201 // Obvious candidates for objects containing detailed fit information
1202 // are functions (e.g. TF1) and histograms (e.g. TH1F).
1203 // However, using an AliDevice object provides a very versatile facility
1204 // to store the parameters of various fit procedures.
1205 // In such a case the AliDevice can be used to provide the various fit
1206 // definitions and the corresponding fit parameters can be entered as
1207 // separate AliSignal objects which are stored as hits to the AliDevice.
1208 // In addition various functions and histograms can be linked to the
1209 // various AliSignal instances
1210 // The latter procedure is based on the original idea of Adam Bouchta.
1212 // Note : The entered object is owned by this AliTrack instance.
1213 // As such, a private copy of obj will be stored using the Clone()
1215 // In case the entered object contains pointers to other objects,
1216 // the user has to provide the appropriate Clone() memberfunction
1217 // for the class to which the entered object belongs.
1218 // An example can be seen from AliTrack::Clone().
1226 if (obj) fFit=obj->Clone();
1228 ///////////////////////////////////////////////////////////////////////////
1229 TObject* AliTrack::GetFitDetails()
1231 // Provide the pointer to the object containing the fit details.
1234 ///////////////////////////////////////////////////////////////////////////
1235 void AliTrack::SetTimestamp(AliTimestamp& t)
1237 // Store the timestamp for this track.
1238 if (fTstamp) delete fTstamp;
1239 fTstamp=new AliTimestamp(t);
1241 ///////////////////////////////////////////////////////////////////////////
1242 AliTimestamp* AliTrack::GetTimestamp()
1244 // Provide the timestamp of this track.
1247 ///////////////////////////////////////////////////////////////////////////
1248 void AliTrack::RemoveTimestamp()
1250 // Remove the timestamp from this track.
1257 ///////////////////////////////////////////////////////////////////////////
1258 TObject* AliTrack::Clone(const char* name) const
1260 // Make a deep copy of the current object and provide the pointer to the copy.
1261 // This memberfunction enables automatic creation of new objects of the
1262 // correct type depending on the object type, a feature which may be very useful
1263 // for containers when adding objects in case the container owns the objects.
1264 // This feature allows e.g. AliJet to store either AliTrack objects or
1265 // objects derived from AliTrack via the AddTrack memberfunction, provided
1266 // these derived classes also have a proper Clone memberfunction.
1268 AliTrack* trk=new AliTrack(*this);
1271 if (strlen(name)) trk->SetName(name);
1275 ///////////////////////////////////////////////////////////////////////////