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 // Creation and investigation of a jet of particle tracks.
21 // An AliJet can be constructed by adding AliTracks.
23 // Coding example to make 2 jets j1 and j2.
24 // ----------------------------------------
25 // j1 contains the AliTracks 1 and 2
26 // j2 contains the AliTracks 3 and 4
28 // AliTrack t1,t2,t3,t4;
30 // ... // code to fill the AliTrack data
42 // Float_t e1=j1.GetEnergy();
43 // Float_t pnorm=j1->GetMomentum();
44 // Ali3Vector p=j1->Get3Momentum();
45 // Float_t m=j1.GetInvmass();
46 // Int_t ntk=j1.GetNtracks();
47 // AliTrack* tj=j1.GetTrack(1);
49 // Note : All quantities are in GeV, GeV/c or GeV/c**2
51 //--- Author: Nick van Eijndhoven 10-jul-1997 UU-SAP Utrecht
52 //- Modified: NvE $Date$ UU-SAP Utrecht
53 ///////////////////////////////////////////////////////////////////////////
57 ClassImp(AliJet) // Class implementation to enable ROOT I/O
61 // Default constructor
62 // All variables initialised to 0
63 // Initial maximum number of tracks is set to the default value
69 ///////////////////////////////////////////////////////////////////////////
70 AliJet::AliJet(Int_t n)
72 // Create a jet to hold initially a maximum of n tracks
73 // All variables initialised to 0
84 cout << " *AliJet* Initial max. number of tracks entered : " << n << endl;
85 cout << " This is invalid. Default initial maximum will be used." << endl;
90 ///////////////////////////////////////////////////////////////////////////
94 if (fTracks) delete fTracks;
97 ///////////////////////////////////////////////////////////////////////////
98 void AliJet::SetNtinit(Int_t n)
100 // Set the initial maximum number of tracks for this jet
103 if (fTracks) delete fTracks;
104 fTracks=new TObjArray(fNtmax);
106 ///////////////////////////////////////////////////////////////////////////
109 // Reset all variables to 0
110 // The max. number of tracks is set to the initial value again
113 Double_t a[4]={0,0,0,0};
115 if (fNtinit > 0) SetNtinit(fNtinit);
117 ///////////////////////////////////////////////////////////////////////////
118 void AliJet::AddTrack(AliTrack& t)
120 // Add a track to the jet
121 // In case the maximum number of tracks has been reached
122 // space will be extended to hold an additional amount of tracks as
123 // was initially reserved
124 if (fNtrk == fNtmax) // Check if maximum track number is reached
127 fTracks->Expand(fNtmax);
130 // Add the track to this jet
133 (*this)+=(Ali4Vector&)t;
136 ///////////////////////////////////////////////////////////////////////////
137 void AliJet::Info(TString f)
139 // Provide jet information within the coordinate frame f
140 cout << " *AliJet::Info* Invmass : " << GetInvmass() << " Charge : " << fQ
141 << " Momentum : " << GetMomentum() << " Ntracks : " << fNtrk << endl;
145 ///////////////////////////////////////////////////////////////////////////
146 void AliJet::List(TString f)
148 // Provide jet and primary track information within the coordinate frame f
150 Info(f); // Information of the current jet
152 // The tracks of this jet
154 for (Int_t it=1; it<=fNtrk; it++)
159 cout << " ---Track no. " << it << endl;
165 cout << " *AliJet::List* Error : No track present." << endl;
169 ///////////////////////////////////////////////////////////////////////////
170 void AliJet::ListAll(TString f)
172 // Provide jet and prim.+sec. track information within the coordinate frame f
174 Info(f); // Information of the current jet
176 // The tracks of this jet
178 for (Int_t it=1; it<=fNtrk; it++)
183 cout << " ---Track no. " << it << endl;
189 cout << " *AliJet::List* Error : No track present." << endl;
193 ///////////////////////////////////////////////////////////////////////////
194 Int_t AliJet::GetNtracks()
196 // Return the current number of tracks of this jet
199 ///////////////////////////////////////////////////////////////////////////
200 Double_t AliJet::GetEnergy()
202 // Return the total energy of the jet
205 ///////////////////////////////////////////////////////////////////////////
206 Double_t AliJet::GetMomentum()
208 // Return the value of the total jet 3-momentum
209 Ali3Vector p=Get3Vector();
210 Double_t p2=p.Dot(p);
213 ///////////////////////////////////////////////////////////////////////////
214 Ali3Vector AliJet::Get3Momentum()
216 // Return the the total jet 3-momentum
217 Ali3Vector p=Get3Vector();
220 ///////////////////////////////////////////////////////////////////////////
221 Double_t AliJet::GetInvmass()
223 // Return the invariant mass of the jet
224 Double_t m2=Dot(*this);
234 ///////////////////////////////////////////////////////////////////////////
235 Float_t AliJet::GetCharge()
237 // Return the total charge of the jet
240 ///////////////////////////////////////////////////////////////////////////
241 AliTrack* AliJet::GetTrack(Int_t i)
243 // Return the i-th track of this jet
244 return (AliTrack*)fTracks->At(i-1);
246 ///////////////////////////////////////////////////////////////////////////