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>
42 // Default constructor
43 fJets = new TClonesArray("TLorentzVector",1000);
48 fPtFromSignal = TArrayF();
49 fMultiplicities = TArrayI();
53 ////////////////////////////////////////////////////////////////////////
64 ////////////////////////////////////////////////////////////////////////
66 Bool_t AliJet::OutOfRange(Int_t i, const char *s) const
68 // checks if i is a valid index. s = name of calling method
69 if (i >= fNJets || i < 0) {
70 cout << s << " Index " << i << " out of range" << endl;
76 ////////////////////////////////////////////////////////////////////////
78 TLorentzVector* AliJet::GetJet(Int_t i)
81 if (OutOfRange(i, "AliJet::GetJet:")) return 0;
82 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
86 ////////////////////////////////////////////////////////////////////////
88 Int_t AliJet::GetMultiplicity(Int_t i) const
90 // gets multiplicity of i-jet
91 if (OutOfRange(i, "AliJet::GetMultiplicity:")) return 0;
92 return fMultiplicities[i];
95 ////////////////////////////////////////////////////////////////////////
97 Int_t AliJet::GetNCell(Int_t i) const
99 // gets number of cell of i-jet
100 if (OutOfRange(i, "AliJet::GetNCell:")) return 0;
104 ////////////////////////////////////////////////////////////////////////
106 Double_t AliJet::GetPx(Int_t i)
108 // Get Px component of jet i
109 if (OutOfRange(i, "AliJet::GetPx:")) return -1e30;
110 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
114 ////////////////////////////////////////////////////////////////////////
116 Double_t AliJet::GetPy(Int_t i)
118 // Get Py component of jet i
119 if (OutOfRange(i, "AliJet::GetPy:")) return -1e30;
120 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
124 ////////////////////////////////////////////////////////////////////////
126 Double_t AliJet::GetPz(Int_t i)
128 // Get Pz component of jet i
129 if (OutOfRange(i, "AliJet::GetPz:")) return -1e30;
130 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
134 ////////////////////////////////////////////////////////////////////////
136 Double_t AliJet::GetP(Int_t i)
138 // Get momentum of jet i
139 if (OutOfRange(i, "AliJet::GetP:")) return -1e30;
140 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
144 ////////////////////////////////////////////////////////////////////////
146 Double_t AliJet::GetE(Int_t i)
148 // Get energy of jet i
149 if (OutOfRange(i, "AliJet::GetE:")) return -1e30;
150 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
154 ////////////////////////////////////////////////////////////////////////
156 Double_t AliJet::GetPt(Int_t i)
158 // Get transverse momentum of jet i
159 if (OutOfRange(i, "AliJet::GetPt:")) return -1e30;
160 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
164 ////////////////////////////////////////////////////////////////////////
166 Double_t AliJet::GetEta(Int_t i)
169 if (OutOfRange(i, "AliJet::GetEta:")) return -1e30;
170 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
174 ////////////////////////////////////////////////////////////////////////
176 Double_t AliJet::GetPhi(Int_t i)
179 if (OutOfRange(i, "AliJet::GetPhi:")) return -1e30;
180 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
181 return ( (lv->Phi() < 0) ? (lv->Phi()) + 2. * TMath::Pi() : lv->Phi());
184 ////////////////////////////////////////////////////////////////////////
186 Double_t AliJet::GetTheta(Int_t i)
188 // Get theta of jet i
189 if (OutOfRange(i, "AliJet::GetTheta:")) return -1e30;
190 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
194 ////////////////////////////////////////////////////////////////////////
196 Double_t AliJet::GetMass(Int_t i)
198 // Get invariant mass of jet i
199 if (OutOfRange(i, "AliJet::GetMass:")) return -1e30;
200 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
204 ////////////////////////////////////////////////////////////////////////
207 void AliJet::AddJet(Double_t px, Double_t py, Double_t pz, Double_t e)
209 // Add new jet to the list
210 new ((*fJets)[fNJets++]) TLorentzVector(px,py,pz,e);
213 ////////////////////////////////////////////////////////////////////////
215 void AliJet::SetInJet(Int_t* j)
217 // set information of which input object belongs
218 // to each jet. If zero, object was not assigned to
219 // a jet, if n,positive, it was assiged to jet n
220 // if n, negative, it is within cone of jet n, but
221 // it did not passed the user cuts. filled in by AliJetFinder
222 if (fNInput>0) fInJet.Set(fNInput, j);
225 ////////////////////////////////////////////////////////////////////////
227 void AliJet::SetEtaIn(Float_t* r)
229 if (fNInput>0) fEtaIn.Set(fNInput, r);
232 ////////////////////////////////////////////////////////////////////////
234 void AliJet::SetPtIn(Float_t* pt)
236 if (fNInput>0) fPtIn.Set(fNInput, pt);
239 ////////////////////////////////////////////////////////////////////////
241 void AliJet::SetPhiIn(Float_t* x)
243 if (fNInput>0) fPhiIn.Set(fNInput, x);
246 ////////////////////////////////////////////////////////////////////////
248 void AliJet::SetPtFromSignal(Float_t* p)
250 // set information of percentage of pt of jets
251 // coming from signal (ie Pythia)
252 if (fNJets>0) fPtFromSignal.Set(fNJets, p);
255 ////////////////////////////////////////////////////////////////////////
257 void AliJet::SetMultiplicities(Int_t* m)
259 // set information of jet multiplicities
260 // filled in by AliJetFinder
261 if (fNJets>0) fMultiplicities.Set(fNJets, m);
264 ////////////////////////////////////////////////////////////////////////
266 void AliJet::SetNCells(Int_t* n)
268 if (fNJets>0) fNCells.Set(fNJets, n);
271 ////////////////////////////////////////////////////////////////////////
273 void AliJet::ClearJets(Option_t *option)
276 fJets->Clear(option);
279 fMultiplicities.Set(0);
281 fPtFromSignal.Set(0);
288 ////////////////////////////////////////////////////////////////////////
290 void AliJet::PrintJets()
292 // Print jet information
294 cout << " AliJet::PrintJets: There are no jets in this event " << endl;
297 cout << " AliJet::PrintJets: There are " << fNJets
298 << " jets in this event" << endl;
299 for(Int_t i=0;i<fNJets;i++) {
300 cout << " Jet " << i << " (px,py,pz,en)=(" << GetPx(i)
305 cout << " (pt,eta,phi)=(" << GetPt(i)
307 << "," << GetPhi(i) << ")" << endl;
308 cout << " # of tracks =" << GetMultiplicity(i) << endl;