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(AliJet) // Class implementation to enable ROOT I/O
26 // Default constructor
27 // All variables initialised to 0
28 // Initial maximum number of tracks is set to the default value
34 ///////////////////////////////////////////////////////////////////////////
35 AliJet::AliJet(Int_t n)
37 // Create a jet to hold initially a maximum of n tracks
38 // All variables initialised to 0
49 cout << " *AliJet* Initial max. number of tracks entered : " << n << endl;
50 cout << " This is invalid. Default initial maximum will be used." << endl;
55 ///////////////////////////////////////////////////////////////////////////
59 if (fTracks) delete fTracks;
62 ///////////////////////////////////////////////////////////////////////////
63 void AliJet::SetNtinit(Int_t n)
65 // Set the initial maximum number of tracks for this jet
68 if (fTracks) delete fTracks;
69 fTracks=new TObjArray(fNtmax);
71 ///////////////////////////////////////////////////////////////////////////
74 // Reset all variables to 0
75 // The max. number of tracks is set to the initial value again
78 Double_t a[4]={0,0,0,0};
80 if (fNtinit > 0) SetNtinit(fNtinit);
82 ///////////////////////////////////////////////////////////////////////////
83 void AliJet::Add(AliTrack& t)
85 // Add a track to the jet
86 // In case the maximum number of tracks has been reached
87 // space will be extended to hold an additional amount of tracks as
88 // was initially reserved
89 if (fNtrk == fNtmax) // Check if maximum track number is reached
92 fTracks->Expand(fNtmax);
95 // Add the track to this jet
98 (*this)+=(Ali4Vector&)t;
101 ///////////////////////////////////////////////////////////////////////////
102 void AliJet::Info(TString f)
104 // Provide jet information within the coordinate frame f
105 cout << " *AliJet::Info* Invmass : " << GetInvmass() << " Charge : " << fQ
106 << " Momentum : " << GetMomentum() << " Ntracks : " << fNtrk << endl;
110 ///////////////////////////////////////////////////////////////////////////
111 void AliJet::List(TString f)
113 // Provide jet and primary track information within the coordinate frame f
115 Info(f); // Information of the current jet
117 // The tracks of this jet
119 for (Int_t it=1; it<=fNtrk; it++)
124 cout << " ---Track no. " << it << endl;
130 cout << " *AliJet::List* Error : No track present." << endl;
134 ///////////////////////////////////////////////////////////////////////////
135 void AliJet::ListAll(TString f)
137 // Provide jet and prim.+sec. track information within the coordinate frame f
139 Info(f); // Information of the current jet
141 // The tracks of this jet
143 for (Int_t it=1; it<=fNtrk; it++)
148 cout << " ---Track no. " << it << endl;
154 cout << " *AliJet::List* Error : No track present." << endl;
158 ///////////////////////////////////////////////////////////////////////////
159 Int_t AliJet::GetNtracks()
161 // Return the current number of tracks of this jet
164 ///////////////////////////////////////////////////////////////////////////
165 Double_t AliJet::GetEnergy()
167 // Return the total energy of the jet
170 ///////////////////////////////////////////////////////////////////////////
171 Double_t AliJet::GetMomentum()
173 // Return the value of the total jet 3-momentum
174 Ali3Vector p=Get3Vector();
175 Double_t p2=p.Dot(p);
178 ///////////////////////////////////////////////////////////////////////////
179 Ali3Vector AliJet::Get3Momentum()
181 // Return the the total jet 3-momentum
182 Ali3Vector p=Get3Vector();
185 ///////////////////////////////////////////////////////////////////////////
186 Double_t AliJet::GetInvmass()
188 // Return the invariant mass of the jet
189 Double_t m2=Dot(*this);
199 ///////////////////////////////////////////////////////////////////////////
200 Float_t AliJet::GetCharge()
202 // Return the total charge of the jet
205 ///////////////////////////////////////////////////////////////////////////
206 AliTrack* AliJet::GetTrack(Int_t i)
208 // Return the i-th track of this jet
209 return (AliTrack*)fTracks->At(i-1);
211 ///////////////////////////////////////////////////////////////////////////