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 // Stores the output of a jet algorithm
21 // Author: jgcn@mda.cinvestav.mx
22 //---------------------------------------------------------------------
24 #include <Riostream.h>
25 #include <TClonesArray.h>
26 #include <TLorentzVector.h>
44 // Default constructor
45 fJets = new TClonesArray("TLorentzVector",1000);
50 fPtFromSignal = TArrayF();
51 fMultiplicities = TArrayI();
55 ////////////////////////////////////////////////////////////////////////
66 ////////////////////////////////////////////////////////////////////////
68 Bool_t AliJet::OutOfRange(Int_t i, const char *s) const
70 // checks if i is a valid index. s = name of calling method
71 if (i >= fNJets || i < 0) {
72 cout << s << " Index " << i << " out of range" << endl;
78 ////////////////////////////////////////////////////////////////////////
80 TLorentzVector* AliJet::GetJet(Int_t i)
83 if (OutOfRange(i, "AliJet::GetJet:")) return 0;
84 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
88 ////////////////////////////////////////////////////////////////////////
90 Int_t AliJet::GetMultiplicity(Int_t i) const
92 // gets multiplicity of i-jet
93 if (OutOfRange(i, "AliJet::GetMultiplicity:")) return 0;
94 return fMultiplicities[i];
97 ////////////////////////////////////////////////////////////////////////
99 Int_t AliJet::GetNCell(Int_t i) const
101 // gets number of cell of i-jet
102 if (OutOfRange(i, "AliJet::GetNCell:")) return 0;
106 ////////////////////////////////////////////////////////////////////////
108 Double_t AliJet::GetPx(Int_t i)
110 // Get Px component of jet i
111 if (OutOfRange(i, "AliJet::GetPx:")) return -1e30;
112 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
116 ////////////////////////////////////////////////////////////////////////
118 Double_t AliJet::GetPy(Int_t i)
120 // Get Py component of jet i
121 if (OutOfRange(i, "AliJet::GetPy:")) return -1e30;
122 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
126 ////////////////////////////////////////////////////////////////////////
128 Double_t AliJet::GetPz(Int_t i)
130 // Get Pz component of jet i
131 if (OutOfRange(i, "AliJet::GetPz:")) return -1e30;
132 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
136 ////////////////////////////////////////////////////////////////////////
138 Double_t AliJet::GetP(Int_t i)
140 // Get momentum of jet i
141 if (OutOfRange(i, "AliJet::GetP:")) return -1e30;
142 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
146 ////////////////////////////////////////////////////////////////////////
148 Double_t AliJet::GetE(Int_t i)
150 // Get energy of jet i
151 if (OutOfRange(i, "AliJet::GetE:")) return -1e30;
152 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
156 ////////////////////////////////////////////////////////////////////////
158 Double_t AliJet::GetPt(Int_t i)
160 // Get transverse momentum of jet i
161 if (OutOfRange(i, "AliJet::GetPt:")) return -1e30;
162 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
166 ////////////////////////////////////////////////////////////////////////
168 Double_t AliJet::GetEta(Int_t i)
171 if (OutOfRange(i, "AliJet::GetEta:")) return -1e30;
172 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
176 ////////////////////////////////////////////////////////////////////////
178 Double_t AliJet::GetPhi(Int_t i)
181 if (OutOfRange(i, "AliJet::GetPhi:")) return -1e30;
182 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
183 return ( (lv->Phi() < 0) ? (lv->Phi()) + 2. * TMath::Pi() : lv->Phi());
186 ////////////////////////////////////////////////////////////////////////
188 Double_t AliJet::GetTheta(Int_t i)
190 // Get theta of jet i
191 if (OutOfRange(i, "AliJet::GetTheta:")) return -1e30;
192 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
196 ////////////////////////////////////////////////////////////////////////
198 Double_t AliJet::GetMass(Int_t i)
200 // Get invariant mass of jet i
201 if (OutOfRange(i, "AliJet::GetMass:")) return -1e30;
202 TLorentzVector *lv = (TLorentzVector*) fJets->At(i);
206 ////////////////////////////////////////////////////////////////////////
209 void AliJet::AddJet(Double_t px, Double_t py, Double_t pz, Double_t e)
211 // Add new jet to the list
212 new ((*fJets)[fNJets++]) TLorentzVector(px,py,pz,e);
215 ////////////////////////////////////////////////////////////////////////
217 void AliJet::SetInJet(Int_t* j)
219 // set information of which input object belongs
220 // to each jet. If zero, object was not assigned to
221 // a jet, if n,positive, it was assiged to jet n
222 // if n, negative, it is within cone of jet n, but
223 // it did not passed the user cuts. filled in by AliJetFinder
224 if (fNInput>0) fInJet.Set(fNInput, j);
227 ////////////////////////////////////////////////////////////////////////
229 void AliJet::SetEtaIn(Float_t* r)
231 if (fNInput>0) fEtaIn.Set(fNInput, r);
234 ////////////////////////////////////////////////////////////////////////
236 void AliJet::SetPtIn(Float_t* pt)
238 if (fNInput>0) fPtIn.Set(fNInput, pt);
241 ////////////////////////////////////////////////////////////////////////
243 void AliJet::SetPhiIn(Float_t* x)
245 if (fNInput>0) fPhiIn.Set(fNInput, x);
248 ////////////////////////////////////////////////////////////////////////
250 void AliJet::SetPtFromSignal(Float_t* p)
252 // set information of percentage of pt of jets
253 // coming from signal (ie Pythia)
254 if (fNJets>0) fPtFromSignal.Set(fNJets, p);
257 ////////////////////////////////////////////////////////////////////////
259 void AliJet::SetMultiplicities(Int_t* m)
261 // set information of jet multiplicities
262 // filled in by AliJetFinder
263 if (fNJets>0) fMultiplicities.Set(fNJets, m);
266 ////////////////////////////////////////////////////////////////////////
268 void AliJet::SetNCells(Int_t* n)
270 if (fNJets>0) fNCells.Set(fNJets, n);
273 ////////////////////////////////////////////////////////////////////////
275 void AliJet::ClearJets(Option_t *option)
278 fJets->Clear(option);
281 fMultiplicities.Set(0);
283 fPtFromSignal.Set(0);
290 ////////////////////////////////////////////////////////////////////////
292 void AliJet::PrintJets()
294 // Print jet information
296 cout << " AliJet::PrintJets: There are no jets in this event " << endl;
299 cout << " AliJet::PrintJets: There are " << fNJets
300 << " jets in this event" << endl;
301 for(Int_t i=0;i<fNJets;i++) {
302 cout << " Jet " << i << " (px,py,pz,en)=(" << GetPx(i)
307 cout << " (pt,eta,phi)=(" << GetPt(i)
309 << "," << GetPhi(i) << ")" << endl;
310 cout << " # of tracks =" << GetMultiplicity(i) << endl;