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 **************************************************************************/
16 //---------------------------------------------------------------------
18 // Stores the output of a jet algorithm
19 // Author: jgcn@mda.cinvestav.mx
20 //---------------------------------------------------------------------
22 #include <Riostream.h>
23 #include <TClonesArray.h>
24 #include <TLorentzVector.h>
30 ////////////////////////////////////////////////////////////////////////
37 fJets = new TClonesArray("TLorentzVector",1000);
41 fMultiplicities=TArrayI();
44 ////////////////////////////////////////////////////////////////////////
55 ////////////////////////////////////////////////////////////////////////
57 Bool_t AliJet::OutOfRange(Int_t i, const char *s) const
59 // checks if i is a valid index. s= name of calling method
60 if (i >= fNJets || i < 0) {
61 cout << s << " Index " << i << " out of range" << endl;
67 ////////////////////////////////////////////////////////////////////////
69 TLorentzVector* AliJet::GetJet(Int_t i)
72 if (OutOfRange(i, "AliJet::GetJet:")) return 0;
74 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
78 ////////////////////////////////////////////////////////////////////////
80 Int_t AliJet::GetMultiplicity(Int_t i)
82 // gets multiplicity of i-jet
83 if (OutOfRange(i, "AliJet::GetMultiplicity:")) return 0;
84 return fMultiplicities[i];
87 ////////////////////////////////////////////////////////////////////////
89 Double_t AliJet::GetPx(Int_t i)
91 // Get Px component of jet i
92 if (OutOfRange(i, "AliJet::GetPx:")) return -1e30;
94 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
98 ////////////////////////////////////////////////////////////////////////
100 Double_t AliJet::GetPy(Int_t i)
102 // Get Py component of jet i
103 if (OutOfRange(i, "AliJet::GetPy:")) return -1e30;
105 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
109 ////////////////////////////////////////////////////////////////////////
111 Double_t AliJet::GetPz(Int_t i)
113 // Get Pz component of jet i
114 if (OutOfRange(i, "AliJet::GetPz:")) return -1e30;
116 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
120 ////////////////////////////////////////////////////////////////////////
122 Double_t AliJet::GetP(Int_t i)
124 // Get momentum of jet i
125 if (OutOfRange(i, "AliJet::GetP:")) return -1e30;
127 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
131 ////////////////////////////////////////////////////////////////////////
133 Double_t AliJet::GetE(Int_t i)
135 // Get energy of jet i
136 if (OutOfRange(i, "AliJet::GetE:")) return -1e30;
138 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
142 ////////////////////////////////////////////////////////////////////////
144 Double_t AliJet::GetPt(Int_t i)
146 // Get transverse momentum of jet i
147 if (OutOfRange(i, "AliJet::GetPt:")) return -1e30;
149 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
153 ////////////////////////////////////////////////////////////////////////
155 Double_t AliJet::GetEta(Int_t i)
158 if (OutOfRange(i, "AliJet::GetEta:")) return -1e30;
160 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
164 ////////////////////////////////////////////////////////////////////////
166 Double_t AliJet::GetPhi(Int_t i)
169 if (OutOfRange(i, "AliJet::GetPhi:")) return -1e30;
171 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
172 return ( (lv->Phi() < 0) ? (lv->Phi()) + 2. * TMath::Pi() : lv->Phi());
175 ////////////////////////////////////////////////////////////////////////
177 Double_t AliJet::GetTheta(Int_t i)
179 // Get theta of jet i
180 if (OutOfRange(i, "AliJet::GetTheta:")) return -1e30;
182 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
186 ////////////////////////////////////////////////////////////////////////
188 Double_t AliJet::GetMass(Int_t i)
190 // Get invariant mass of jet i
191 if (OutOfRange(i, "AliJet::GetMass:")) return -1e30;
193 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
197 ////////////////////////////////////////////////////////////////////////
200 void AliJet::AddJet(Double_t px, Double_t py, Double_t pz, Double_t e)
202 // Add new jet to the list
203 new ((*fJets)[fNJets++]) TLorentzVector(px,py,pz,e);
206 ////////////////////////////////////////////////////////////////////////
208 void AliJet::SetInJet(Int_t* j)
210 // set information of which input object belongs
211 // to each jet. filled in by AliJetFinder
212 if (fNInput>0) fInJet.Set(fNInput, j);
215 ////////////////////////////////////////////////////////////////////////
217 void AliJet::SetMultiplicities(Int_t* m)
219 // set information of jet multiplicities
220 // filled in by AliJetFinder
221 if (fNJets>0) fMultiplicities.Set(fNJets, m);
224 ////////////////////////////////////////////////////////////////////////
226 void AliJet::ClearJets(Option_t *option)
229 fJets->Clear(option);
232 fMultiplicities.Set(0);
236 ////////////////////////////////////////////////////////////////////////
238 void AliJet::PrintJets()
240 // Print jet information
242 cout << " AliJet::PrintJets: There are no jets in this event " << endl;
245 cout << " AliJet::PrintJets: There are " << fNJets
246 << " jets in this event" << endl;
247 for(Int_t i=0;i<fNJets;i++) {
248 cout << " Jet " << i << " (px,py,pz,en)=(" << GetPx(i)
253 cout << " (pt,eta,phi)=(" << GetPt(i)
255 << "," << GetPhi(i) << ")" << endl;
256 cout << " # of tracks =" << GetMultiplicity(i) << endl;