3 ClassImp(AliTrack) // Class implementation to enable ROOT I/O
8 // All variables initialised to 0
12 ///////////////////////////////////////////////////////////////////////////
15 // Destructor to delete memory allocated for decay tracks array
23 ///////////////////////////////////////////////////////////////////////////
24 void AliTrack::Reset()
26 // Reset all variables to 0
30 Double_t a[4]={0,0,0,0};
39 ///////////////////////////////////////////////////////////////////////////
40 void AliTrack::Set3Momentum(Ali3Vector& p)
42 // Set the track parameters according to the 3-momentum p
43 Double_t E=sqrt(p.Dot(p)+fM*fM);
46 ///////////////////////////////////////////////////////////////////////////
47 void AliTrack::Set4Momentum(Ali4Vector& p)
49 // Set the track parameters according to the 4-momentum p
50 Double_t E=p.GetScalar();
51 Ali3Vector pv=p.Get3Vector();
56 if (m2 > 0.) fM=sqrt(m2);
58 ///////////////////////////////////////////////////////////////////////////
59 void AliTrack::SetMass(Double_t m)
61 // Set the particle mass
63 Ali3Vector p=Get3Vector();
64 Double_t E=sqrt(p.Dot(p)+fM*fM);
67 ///////////////////////////////////////////////////////////////////////////
68 void AliTrack::SetCharge(Float_t q)
70 // Set the particle charge
73 ///////////////////////////////////////////////////////////////////////////
74 void AliTrack::Info(TString f)
76 // Provide track information within the coordinate frame f
77 cout << " *AliTrack::Info* Mass : " << fM << " Charge : " << fQ
78 << " Momentum : " << GetMomentum() << " Ntracks : " << fNdec << endl;
82 ///////////////////////////////////////////////////////////////////////////
83 void AliTrack::List(TString f)
85 // Provide current track and decay level 1 information within coordinate frame f
87 Info(f); // Information of the current track
89 // Decay products of this track
91 for (Int_t id=1; id<=fNdec; id++)
96 cout << " ---Level 1 sec. track no. " << id << endl;
102 cout << " *AliTrack::List* Error : No decay track present." << endl;
106 ///////////////////////////////////////////////////////////////////////////
107 void AliTrack::ListAll(TString f)
109 // Provide complete track and decay information within the coordinate frame f
111 Info(f); // Information of the current track
114 Dump(t,1,f); // Information of all decay products
116 //////////////////////////////////////////////////////////////////////////
117 void AliTrack::Dump(AliTrack* t,Int_t n,TString f)
119 // Recursively provide the info of all decay levels of this track
121 for (Int_t id=1; id<=t->GetNdecay(); id++)
123 td=t->GetDecayTrack(id);
126 cout << " ---Level " << n << " sec. track no. " << id << endl;
130 // Go for next decay level of this decay track recursively
135 cout << " *AliTrack::Dump* Error : No decay track present." << endl;
139 //////////////////////////////////////////////////////////////////////////
140 Double_t AliTrack::GetMomentum()
142 // Provide the value of the track 3-momentum
143 Ali3Vector p=Get3Vector();
144 return sqrt(p.Dot(p));
146 ///////////////////////////////////////////////////////////////////////////
147 Ali3Vector AliTrack::Get3Momentum()
149 // Provide the track 3-momentum
150 return (Ali3Vector)Get3Vector();
152 ///////////////////////////////////////////////////////////////////////////
153 Double_t AliTrack::GetMass()
155 // Provide the particle mass
158 ///////////////////////////////////////////////////////////////////////////
159 Float_t AliTrack::GetCharge()
161 // Provide the particle charge
164 ///////////////////////////////////////////////////////////////////////////
165 Double_t AliTrack::GetEnergy()
167 // Provide the particle's energy
170 ///////////////////////////////////////////////////////////////////////////
171 void AliTrack::Decay(Double_t m1,Double_t m2,Double_t thcms,Double_t phicms)
173 // Perform 2-body decay of current track
174 // m1 : mass of decay product 1
175 // m2 : mass of decay product 2
176 // thcms : cms theta decay angle (in rad.) of m1
177 // phicms : cms phi decay angle (in rad.) of m1
179 fNdec=2; // it's a 2-body decay
181 // Compute the 4-momenta of the decay products in the cms
182 // Note : p2=p1=pnorm for a 2-body decay
183 Double_t e1=((fM*fM)+(m1*m1)-(m2*m2))/(2.*fM);
184 Double_t e2=((fM*fM)+(m2*m2)-(m1*m1))/(2.*fM);
185 Double_t pnorm=(e1*e1)-(m1*m1);
200 p.SetVector(a,"sph");
203 pprim1.SetVector(e1,p);
207 pprim2.SetVector(e2,p);
209 // Determine boost parameters from the parent particle
210 Double_t E=GetScalar();
218 Ali4Vector p1=q.Inverse(pprim1); // Boost decay product 1
219 Ali4Vector p2=q.Inverse(pprim2); // Boost decay product 2
221 // Enter the boosted data into the decay tracks array
227 fDecays=new TObjArray();
229 fDecays->Add(new AliTrack);
230 ((AliTrack*)fDecays->At(0))->Set4Momentum(p1);
231 fDecays->Add(new AliTrack);
232 ((AliTrack*)fDecays->At(1))->Set4Momentum(p2);
234 // Set the mass values to m1 and m2 to omit roundoff errors
235 ((AliTrack*)fDecays->At(0))->SetMass(m1);
236 ((AliTrack*)fDecays->At(1))->SetMass(m2);
238 ///////////////////////////////////////////////////////////////////////////
239 Int_t AliTrack::GetNdecay()
241 // Provide the number of decay produced tracks
244 ///////////////////////////////////////////////////////////////////////////
245 AliTrack* AliTrack::GetDecayTrack(Int_t j)
247 // Provide decay produced track number j
248 // Note : j=1 denotes the first decay track
249 if ((j >= 1) && (j <= fNdec))
251 return (AliTrack*)fDecays->At(j-1);
255 cout << " *AliTrack* decay track number : " << j << " out of range." << endl;
256 cout << " -- Decay track number 1 (if any) returned." << endl;
257 return (AliTrack*)fDecays->At(0);
260 ///////////////////////////////////////////////////////////////////////////