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 Revision 1.2 1999/09/29 09:24:28 fca
19 Introduction of the Copyright and cvs Log
23 ///////////////////////////////////////////////////////////////////////////
25 // Creation and investigation of a jet of particle tracks.
26 // An AliJet can be constructed by adding AliTracks.
28 // Coding example to make 2 jets j1 and j2.
29 // ----------------------------------------
30 // j1 contains the AliTracks 1 and 2
31 // j2 contains the AliTracks 3 and 4
33 // AliTrack t1,t2,t3,t4;
35 // ... // code to fill the AliTrack data
47 // Float_t e1=j1.GetEnergy();
48 // Float_t pnorm=j1->GetMomentum();
49 // Ali3Vector p=j1->Get3Momentum();
50 // Float_t m=j1.GetInvmass();
51 // Int_t ntk=j1.GetNtracks();
52 // AliTrack* tj=j1.GetTrack(1);
54 // Note : All quantities are in GeV, GeV/c or GeV/c**2
56 //--- Author: Nick van Eijndhoven 10-jul-1997 UU-SAP Utrecht
57 //- Modified: NvE 06-apr-1999 UU-SAP Utrecht to inherit from Ali4Vector
58 ///////////////////////////////////////////////////////////////////////////
62 ClassImp(AliJet) // Class implementation to enable ROOT I/O
66 // Default constructor
67 // All variables initialised to 0
68 // Initial maximum number of tracks is set to the default value
74 ///////////////////////////////////////////////////////////////////////////
75 AliJet::AliJet(Int_t n)
77 // Create a jet to hold initially a maximum of n tracks
78 // All variables initialised to 0
89 cout << " *AliJet* Initial max. number of tracks entered : " << n << endl;
90 cout << " This is invalid. Default initial maximum will be used." << endl;
95 ///////////////////////////////////////////////////////////////////////////
99 if (fTracks) delete fTracks;
102 ///////////////////////////////////////////////////////////////////////////
103 void AliJet::SetNtinit(Int_t n)
105 // Set the initial maximum number of tracks for this jet
108 if (fTracks) delete fTracks;
109 fTracks=new TObjArray(fNtmax);
111 ///////////////////////////////////////////////////////////////////////////
114 // Reset all variables to 0
115 // The max. number of tracks is set to the initial value again
118 Double_t a[4]={0,0,0,0};
120 if (fNtinit > 0) SetNtinit(fNtinit);
122 ///////////////////////////////////////////////////////////////////////////
123 void AliJet::Add(AliTrack& t)
125 // Add a track to the jet
126 // In case the maximum number of tracks has been reached
127 // space will be extended to hold an additional amount of tracks as
128 // was initially reserved
129 if (fNtrk == fNtmax) // Check if maximum track number is reached
132 fTracks->Expand(fNtmax);
135 // Add the track to this jet
138 (*this)+=(Ali4Vector&)t;
141 ///////////////////////////////////////////////////////////////////////////
142 void AliJet::Info(TString f)
144 // Provide jet information within the coordinate frame f
145 cout << " *AliJet::Info* Invmass : " << GetInvmass() << " Charge : " << fQ
146 << " Momentum : " << GetMomentum() << " Ntracks : " << fNtrk << endl;
150 ///////////////////////////////////////////////////////////////////////////
151 void AliJet::List(TString f)
153 // Provide jet and primary track information within the coordinate frame f
155 Info(f); // Information of the current jet
157 // The tracks of this jet
159 for (Int_t it=1; it<=fNtrk; it++)
164 cout << " ---Track no. " << it << endl;
170 cout << " *AliJet::List* Error : No track present." << endl;
174 ///////////////////////////////////////////////////////////////////////////
175 void AliJet::ListAll(TString f)
177 // Provide jet and prim.+sec. track information within the coordinate frame f
179 Info(f); // Information of the current jet
181 // The tracks of this jet
183 for (Int_t it=1; it<=fNtrk; it++)
188 cout << " ---Track no. " << it << endl;
194 cout << " *AliJet::List* Error : No track present." << endl;
198 ///////////////////////////////////////////////////////////////////////////
199 Int_t AliJet::GetNtracks()
201 // Return the current number of tracks of this jet
204 ///////////////////////////////////////////////////////////////////////////
205 Double_t AliJet::GetEnergy()
207 // Return the total energy of the jet
210 ///////////////////////////////////////////////////////////////////////////
211 Double_t AliJet::GetMomentum()
213 // Return the value of the total jet 3-momentum
214 Ali3Vector p=Get3Vector();
215 Double_t p2=p.Dot(p);
218 ///////////////////////////////////////////////////////////////////////////
219 Ali3Vector AliJet::Get3Momentum()
221 // Return the the total jet 3-momentum
222 Ali3Vector p=Get3Vector();
225 ///////////////////////////////////////////////////////////////////////////
226 Double_t AliJet::GetInvmass()
228 // Return the invariant mass of the jet
229 Double_t m2=Dot(*this);
239 ///////////////////////////////////////////////////////////////////////////
240 Float_t AliJet::GetCharge()
242 // Return the total charge of the jet
245 ///////////////////////////////////////////////////////////////////////////
246 AliTrack* AliJet::GetTrack(Int_t i)
248 // Return the i-th track of this jet
249 return (AliTrack*)fTracks->At(i-1);
251 ///////////////////////////////////////////////////////////////////////////