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 **************************************************************************/
22 ClassImp(AliTrack) // Class implementation to enable ROOT I/O
26 // Default constructor
27 // All variables initialised to 0
31 ///////////////////////////////////////////////////////////////////////////
34 // Destructor to delete memory allocated for decay tracks array
42 ///////////////////////////////////////////////////////////////////////////
43 void AliTrack::Reset()
45 // Reset all variables to 0
49 Double_t a[4]={0,0,0,0};
58 ///////////////////////////////////////////////////////////////////////////
59 void AliTrack::Set3Momentum(Ali3Vector& p)
61 // Set the track parameters according to the 3-momentum p
62 Double_t E=sqrt(p.Dot(p)+fM*fM);
65 ///////////////////////////////////////////////////////////////////////////
66 void AliTrack::Set4Momentum(Ali4Vector& p)
68 // Set the track parameters according to the 4-momentum p
69 Double_t E=p.GetScalar();
70 Ali3Vector pv=p.Get3Vector();
75 if (m2 > 0.) fM=sqrt(m2);
77 ///////////////////////////////////////////////////////////////////////////
78 void AliTrack::SetMass(Double_t m)
80 // Set the particle mass
82 Ali3Vector p=Get3Vector();
83 Double_t E=sqrt(p.Dot(p)+fM*fM);
86 ///////////////////////////////////////////////////////////////////////////
87 void AliTrack::SetCharge(Float_t q)
89 // Set the particle charge
92 ///////////////////////////////////////////////////////////////////////////
93 void AliTrack::Info(TString f)
95 // Provide track information within the coordinate frame f
96 cout << " *AliTrack::Info* Mass : " << fM << " Charge : " << fQ
97 << " Momentum : " << GetMomentum() << " Ntracks : " << fNdec << endl;
101 ///////////////////////////////////////////////////////////////////////////
102 void AliTrack::List(TString f)
104 // Provide current track and decay level 1 information within coordinate frame f
106 Info(f); // Information of the current track
108 // Decay products of this track
110 for (Int_t id=1; id<=fNdec; id++)
112 td=GetDecayTrack(id);
115 cout << " ---Level 1 sec. track no. " << id << endl;
121 cout << " *AliTrack::List* Error : No decay track present." << endl;
125 ///////////////////////////////////////////////////////////////////////////
126 void AliTrack::ListAll(TString f)
128 // Provide complete track and decay information within the coordinate frame f
130 Info(f); // Information of the current track
133 Dump(t,1,f); // Information of all decay products
135 //////////////////////////////////////////////////////////////////////////
136 void AliTrack::Dump(AliTrack* t,Int_t n,TString f)
138 // Recursively provide the info of all decay levels of this track
140 for (Int_t id=1; id<=t->GetNdecay(); id++)
142 td=t->GetDecayTrack(id);
145 cout << " ---Level " << n << " sec. track no. " << id << endl;
149 // Go for next decay level of this decay track recursively
154 cout << " *AliTrack::Dump* Error : No decay track present." << endl;
158 //////////////////////////////////////////////////////////////////////////
159 Double_t AliTrack::GetMomentum()
161 // Provide the value of the track 3-momentum
162 Ali3Vector p=Get3Vector();
163 return sqrt(p.Dot(p));
165 ///////////////////////////////////////////////////////////////////////////
166 Ali3Vector AliTrack::Get3Momentum()
168 // Provide the track 3-momentum
169 return (Ali3Vector)Get3Vector();
171 ///////////////////////////////////////////////////////////////////////////
172 Double_t AliTrack::GetMass()
174 // Provide the particle mass
177 ///////////////////////////////////////////////////////////////////////////
178 Float_t AliTrack::GetCharge()
180 // Provide the particle charge
183 ///////////////////////////////////////////////////////////////////////////
184 Double_t AliTrack::GetEnergy()
186 // Provide the particle's energy
189 ///////////////////////////////////////////////////////////////////////////
190 void AliTrack::Decay(Double_t m1,Double_t m2,Double_t thcms,Double_t phicms)
192 // Perform 2-body decay of current track
193 // m1 : mass of decay product 1
194 // m2 : mass of decay product 2
195 // thcms : cms theta decay angle (in rad.) of m1
196 // phicms : cms phi decay angle (in rad.) of m1
198 fNdec=2; // it's a 2-body decay
200 // Compute the 4-momenta of the decay products in the cms
201 // Note : p2=p1=pnorm for a 2-body decay
202 Double_t e1=((fM*fM)+(m1*m1)-(m2*m2))/(2.*fM);
203 Double_t e2=((fM*fM)+(m2*m2)-(m1*m1))/(2.*fM);
204 Double_t pnorm=(e1*e1)-(m1*m1);
219 p.SetVector(a,"sph");
222 pprim1.SetVector(e1,p);
226 pprim2.SetVector(e2,p);
228 // Determine boost parameters from the parent particle
229 Double_t E=GetScalar();
237 Ali4Vector p1=q.Inverse(pprim1); // Boost decay product 1
238 Ali4Vector p2=q.Inverse(pprim2); // Boost decay product 2
240 // Enter the boosted data into the decay tracks array
246 fDecays=new TObjArray();
248 fDecays->Add(new AliTrack);
249 ((AliTrack*)fDecays->At(0))->Set4Momentum(p1);
250 fDecays->Add(new AliTrack);
251 ((AliTrack*)fDecays->At(1))->Set4Momentum(p2);
253 // Set the mass values to m1 and m2 to omit roundoff errors
254 ((AliTrack*)fDecays->At(0))->SetMass(m1);
255 ((AliTrack*)fDecays->At(1))->SetMass(m2);
257 ///////////////////////////////////////////////////////////////////////////
258 Int_t AliTrack::GetNdecay()
260 // Provide the number of decay produced tracks
263 ///////////////////////////////////////////////////////////////////////////
264 AliTrack* AliTrack::GetDecayTrack(Int_t j)
266 // Provide decay produced track number j
267 // Note : j=1 denotes the first decay track
268 if ((j >= 1) && (j <= fNdec))
270 return (AliTrack*)fDecays->At(j-1);
274 cout << " *AliTrack* decay track number : " << j << " out of range." << endl;
275 cout << " -- Decay track number 1 (if any) returned." << endl;
276 return (AliTrack*)fDecays->At(0);
279 ///////////////////////////////////////////////////////////////////////////