3 //__________________________________________________________
4 ///////////////////////////////////////////////////////////////////
6 // class AliJetEventParticles
8 // loizides@ikf.uni-frankfurt.de
10 ///////////////////////////////////////////////////////////////////
12 #include <Riostream.h>
13 #include <TClonesArray.h>
14 #include "AliJetParticle.h"
15 #include "AliJetEventParticles.h"
17 ClassImp(AliJetEventParticles)
19 AliJetEventParticles::AliJetEventParticles(Int_t size) :
21 fParticles(new TClonesArray("AliJetParticle",size)),
31 // Default Constructor
32 for (Int_t i = 0; i < 4; i++) fZquench[i] = 0.;
33 for (Int_t i = 0; i < 10; i++)
34 for (Int_t j = 0; j < 4; j++) {
35 fJets[j][i]=0; // Trigger jets
36 fUQJets[j][i]=0; // Unquenched trigger jets
38 for (Int_t i = 0; i < 5; i++){
44 AliJetEventParticles::AliJetEventParticles(const AliJetEventParticles& source) :
46 fNParticles(source.fNParticles),
47 fParticles(new TClonesArray("AliJetParticle",source.fNParticles)),
48 fVertexX(source.GetVertexX()),
49 fVertexY(source.GetVertexY()),
50 fVertexZ(source.GetVertexZ()),
51 fTrials(source.Trials()),
52 fNJets(source.NTriggerJets()),
53 fNUQJets(source.NUQTriggerJets()),
54 fXJet(source.GetXJet()),
55 fYJet(source.GetXJet())
58 for(Int_t i =0; i<fNParticles; i++)
60 const AliJetParticle *kjp=(const AliJetParticle *)source.fParticles->At(i);
61 new((*fParticles)[i]) AliJetParticle(*(kjp));
63 for (Int_t i = 0; i < 4; i++) fZquench[i] = 0.;
64 for (Int_t i = 0; i < 10; i++)
65 for (Int_t j = 0; j < 4; j++) {
66 fJets[j][i]=0; // Trigger jets
67 fUQJets[j][i]=0; // Unquenched trigger jets
69 source.GetZQuench(fZquench);
70 for (Int_t i = 0; i < NTriggerJets(); i++){
71 source.TriggerJet(i,fJets[0][i],fJets[1][i],fJets[2][i],fJets[3][i]);
73 for (Int_t i = 0; i < NUQTriggerJets(); i++){
74 source.UQJet(i,fUQJets[0][i],fUQJets[1][i],fUQJets[2][i],fUQJets[3][i]);
77 source.Hard(0,fHard[0][0],fHard[1][0],fHard[2][0],fHard[3][0],fHard[4][0]);
78 source.Hard(1,fHard[0][1],fHard[1][1],fHard[2][1],fHard[3][1],fHard[4][1]);
81 AliJetEventParticles::~AliJetEventParticles()
88 void AliJetEventParticles::Reset(Int_t size)
90 //deletes all particles from the event
91 if(fParticles) fParticles->Clear();
92 if(size>=0) fParticles->Expand(size);
103 for (Int_t i = 0; i < 4; i++) fZquench[i] = 0.;
104 for (Int_t i = 0; i < 10; i++)
105 for (Int_t j = 0; j < 4; j++) {
106 fJets[j][i]=0; // Trigger jets
107 fUQJets[j][i]=0; // Unquenched trigger jets
109 for (Int_t i = 0; i < 5; i++){
115 void AliJetEventParticles::AddParticle(AliJetParticle* part)
117 //Adds new particle to the event
118 fParticles->AddAt(part,fNParticles++);
121 void AliJetEventParticles::AddParticle(const AliJetParticle* part)
123 //Adds new particle to the event
124 new((*fParticles)[fNParticles++]) AliJetParticle(*part);
127 void AliJetEventParticles::AddParticle(const TParticle* part,Int_t idx, Int_t l)
129 //Adds new particle to the event
130 new((*fParticles)[fNParticles++]) AliJetParticle(part,idx,l);
133 void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz,
134 Float_t etot, Int_t idx, Int_t l)
136 //Adds new particle to the event
137 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l);
140 void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
141 Float_t pt, Float_t phi, Float_t eta)
143 //Adds new particle to the event
144 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,pt,phi,eta);
147 const AliJetParticle* AliJetEventParticles::GetParticleSafely(Int_t n)
149 //returns nth particle with range check
150 if( (n<0) || (fNParticles<=n) ) return 0;
151 return (const AliJetParticle*)fParticles->At(n);
154 void AliJetEventParticles::AddJet(Float_t px, Float_t py, Float_t pz, Float_t e)
160 fJets[0][fNJets] = px;
161 fJets[1][fNJets] = py;
162 fJets[2][fNJets] = pz;
163 fJets[3][fNJets] = e;
166 printf("\nWarning: More than 10 jets triggered !!\n");
170 void AliJetEventParticles::AddJet(Float_t p[4])
176 fJets[0][fNJets] = p[0];
177 fJets[1][fNJets] = p[1];
178 fJets[2][fNJets] = p[2];
179 fJets[3][fNJets] = p[3];
182 printf("\nWarning: More than 10 jets triggered !!\n");
186 void AliJetEventParticles::AddUQJet(Float_t px, Float_t py, Float_t pz, Float_t e)
192 fUQJets[0][fNUQJets] = px;
193 fUQJets[1][fNUQJets] = py;
194 fUQJets[2][fNUQJets] = pz;
195 fUQJets[3][fNUQJets] = e;
198 printf("\nWarning: More than 10 jets triggered !!\n");
202 void AliJetEventParticles::AddUQJet(Float_t p[4])
208 fUQJets[0][fNUQJets] = p[0];
209 fUQJets[1][fNUQJets] = p[1];
210 fUQJets[2][fNUQJets] = p[2];
211 fUQJets[3][fNUQJets] = p[3];
214 printf("\nWarning: More than 10 jets triggered !!\n");
218 void AliJetEventParticles::AddHard(Int_t i,Float_t px, Float_t py, Float_t pz, Float_t e, Float_t type)
230 printf("\nWarning: More than 2 partons !!\n");
234 void AliJetEventParticles::SetZQuench(Double_t z[4])
237 // Set quenching fraction
239 for (Int_t i = 0; i < 4; i++) fZquench[i] = z[i];
242 void AliJetEventParticles::GetZQuench(Double_t z[4]) const
245 // Get quenching fraction
247 for (Int_t i = 0; i < 4; i++) z[i] = fZquench[i];
250 void AliJetEventParticles::TriggerJet(Int_t i, Float_t p[4]) const
256 printf("\nWarning: TriggerJet, index out of Range!!\n");
265 void AliJetEventParticles::TriggerJet(Int_t i, Float_t &p1, Float_t &p2, Float_t &p3, Float_t &E) const
271 printf("\nWarning: TriggerJet, index out of Range!!\n");
280 void AliJetEventParticles::UQJet(Int_t i, Float_t p[4]) const
286 printf("\nWarning: Unquenched Jets, index out of Range!!\n");
288 p[0] = fUQJets[0][i];
289 p[1] = fUQJets[1][i];
290 p[2] = fUQJets[2][i];
291 p[3] = fUQJets[3][i];
295 void AliJetEventParticles::UQJet(Int_t i, Float_t &p1, Float_t &p2, Float_t &p3, Float_t &E) const
301 printf("\nWarning: Unquenched Jets, index out of Range!!\n");
310 void AliJetEventParticles::Hard(Int_t i, Float_t &p1, Float_t &p2, Float_t &p3, Float_t &E, Float_t &type) const
316 printf("\nWarning: Hard partons, index out of Range!!\n");
326 void AliJetEventParticles::SetXYJet(Double_t x, Double_t y)
329 // Add jet production point
335 void AliJetEventParticles::Print(Option_t* /*t*/) const
337 cout << "--- AliJetEventParticles ---" << endl;
338 if(fHeader.Length()) cout << fHeader.Data() << endl;
339 cout << "Particles in Event: " << fNParticles << endl;
341 cout << "Unquenched Jets: " << fNUQJets << endl;
342 for(Int_t i = 0; i<fNUQJets; i++){
343 Float_t x=fUQJets[0][i];
344 Float_t y=fUQJets[1][i];
345 Float_t z=fUQJets[2][i];
346 Float_t e=fUQJets[3][i];
347 Float_t ptj=TMath::Sqrt(x*x+y*y);
348 Float_t thj=TMath::ATan2(ptj,z);
349 Float_t etaj=-TMath::Log(TMath::Tan(thj/2));
350 Float_t phj=TMath::Pi()+TMath::ATan2(-y,-x);
351 Float_t et=e*TMath::Sin(thj);
352 cout << i << " " << et << " " << etaj << " " << phj << endl;
356 cout << "Triggered Jets: " << fNJets << endl;
357 for(Int_t i = 0; i<fNJets; i++){
358 Float_t x=fJets[0][i];
359 Float_t y=fJets[1][i];
360 Float_t z=fJets[2][i];
361 Float_t e=fJets[3][i];
362 Float_t ptj=TMath::Sqrt(x*x+y*y);
363 Float_t thj=TMath::ATan2(ptj,z);
364 Float_t etaj=-TMath::Log(TMath::Tan(thj/2));
365 Float_t phj=TMath::Pi()+TMath::ATan2(-y,-x);
366 Float_t et=e*TMath::Sin(thj);
367 cout << i << " " << et << " " << etaj << " " << phj << endl;