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)),
34 // Default Constructor
35 for (Int_t i = 0; i < 4; i++) fZquench[i] = 0.;
36 for (Int_t i = 0; i < 10; i++)
37 for (Int_t j = 0; j < 4; j++) {
38 fJets[j][i]=0; // Trigger jets
39 fUQJets[j][i]=0; // Unquenched trigger jets
41 for (Int_t i = 0; i < 5; i++){
47 AliJetEventParticles::AliJetEventParticles(const AliJetEventParticles& source) :
49 fNParticles(source.fNParticles),
50 fParticles(new TClonesArray("AliJetParticle",source.fNParticles)),
51 fVertexX(source.GetVertexX()),
52 fVertexY(source.GetVertexY()),
53 fVertexZ(source.GetVertexZ()),
54 fTrials(source.Trials()),
55 fNJets(source.NTriggerJets()),
56 fNUQJets(source.NUQTriggerJets()),
57 fXJet(source.GetXJet()),
58 fYJet(source.GetXJet()),
59 fImpact(source.GetImpact()),
60 fNHardScatters(source.GetNhard()),
61 fNwNwColl(source.GetNpart())
64 for(Int_t i =0; i<fNParticles; i++)
66 const AliJetParticle *kjp=(const AliJetParticle *)source.fParticles->At(i);
67 new((*fParticles)[i]) AliJetParticle(*(kjp));
69 for (Int_t i = 0; i < 4; i++) fZquench[i] = 0.;
70 for (Int_t i = 0; i < 10; i++)
71 for (Int_t j = 0; j < 4; j++) {
72 fJets[j][i]=0; // Trigger jets
73 fUQJets[j][i]=0; // Unquenched trigger jets
75 source.GetZQuench(fZquench);
76 for (Int_t i = 0; i < NTriggerJets(); i++){
77 source.TriggerJet(i,fJets[0][i],fJets[1][i],fJets[2][i],fJets[3][i]);
79 for (Int_t i = 0; i < NUQTriggerJets(); i++){
80 source.UQJet(i,fUQJets[0][i],fUQJets[1][i],fUQJets[2][i],fUQJets[3][i]);
83 source.Hard(0,fHard[0][0],fHard[1][0],fHard[2][0],fHard[3][0],fHard[4][0]);
84 source.Hard(1,fHard[0][1],fHard[1][1],fHard[2][1],fHard[3][1],fHard[4][1]);
87 AliJetEventParticles::~AliJetEventParticles()
94 void AliJetEventParticles::Reset(Int_t size)
96 //deletes all particles from the event
97 if(fParticles) fParticles->Clear();
98 if(size>=0) fParticles->Expand(size);
112 for (Int_t i = 0; i < 4; i++) fZquench[i] = 0.;
113 for (Int_t i = 0; i < 10; i++)
114 for (Int_t j = 0; j < 4; j++) {
115 fJets[j][i]=0; // Trigger jets
116 fUQJets[j][i]=0; // Unquenched trigger jets
118 for (Int_t i = 0; i < 5; i++){
124 void AliJetEventParticles::AddParticle(AliJetParticle* part)
126 //Adds new particle to the event
127 fParticles->AddAt(part,fNParticles++);
130 void AliJetEventParticles::AddParticle(const AliJetParticle* part)
132 //Adds new particle to the event
133 new((*fParticles)[fNParticles++]) AliJetParticle(*part);
136 void AliJetEventParticles::AddParticle(const TParticle* part,Int_t idx, Int_t l)
138 //Adds new particle to the event
139 new((*fParticles)[fNParticles++]) AliJetParticle(part,idx,l);
142 void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz,
143 Float_t etot, Int_t idx, Int_t l)
145 //Adds new particle to the event
146 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l);
149 void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
150 Float_t pt, Float_t phi, Float_t eta)
152 //Adds new particle to the event
153 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,pt,phi,eta);
156 const AliJetParticle* AliJetEventParticles::GetParticleSafely(Int_t n)
158 //returns nth particle with range check
159 if( (n<0) || (fNParticles<=n) ) return 0;
160 return (const AliJetParticle*)fParticles->At(n);
163 void AliJetEventParticles::AddJet(Float_t px, Float_t py, Float_t pz, Float_t e)
169 fJets[0][fNJets] = px;
170 fJets[1][fNJets] = py;
171 fJets[2][fNJets] = pz;
172 fJets[3][fNJets] = e;
175 printf("\nWarning: More than 10 jets triggered !!\n");
179 void AliJetEventParticles::AddJet(Float_t p[4])
185 fJets[0][fNJets] = p[0];
186 fJets[1][fNJets] = p[1];
187 fJets[2][fNJets] = p[2];
188 fJets[3][fNJets] = p[3];
191 printf("\nWarning: More than 10 jets triggered !!\n");
195 void AliJetEventParticles::AddUQJet(Float_t px, Float_t py, Float_t pz, Float_t e)
201 fUQJets[0][fNUQJets] = px;
202 fUQJets[1][fNUQJets] = py;
203 fUQJets[2][fNUQJets] = pz;
204 fUQJets[3][fNUQJets] = e;
207 printf("\nWarning: More than 10 jets triggered !!\n");
211 void AliJetEventParticles::AddUQJet(Float_t p[4])
217 fUQJets[0][fNUQJets] = p[0];
218 fUQJets[1][fNUQJets] = p[1];
219 fUQJets[2][fNUQJets] = p[2];
220 fUQJets[3][fNUQJets] = p[3];
223 printf("\nWarning: More than 10 jets triggered !!\n");
227 void AliJetEventParticles::AddHard(Int_t i,Float_t px, Float_t py, Float_t pz, Float_t e, Float_t type)
239 printf("\nWarning: More than 2 partons !!\n");
243 void AliJetEventParticles::SetZQuench(Double_t z[4])
246 // Set quenching fraction
248 for (Int_t i = 0; i < 4; i++) fZquench[i] = z[i];
251 void AliJetEventParticles::GetZQuench(Double_t z[4]) const
254 // Get quenching fraction
256 for (Int_t i = 0; i < 4; i++) z[i] = fZquench[i];
259 void AliJetEventParticles::TriggerJet(Int_t i, Float_t p[4]) const
265 printf("\nWarning: TriggerJet, index out of Range!!\n");
274 void AliJetEventParticles::TriggerJet(Int_t i, Float_t &p1, Float_t &p2, Float_t &p3, Float_t &E) const
280 printf("\nWarning: TriggerJet, index out of Range!!\n");
289 void AliJetEventParticles::UQJet(Int_t i, Float_t p[4]) const
295 printf("\nWarning: Unquenched Jets, index out of Range!!\n");
297 p[0] = fUQJets[0][i];
298 p[1] = fUQJets[1][i];
299 p[2] = fUQJets[2][i];
300 p[3] = fUQJets[3][i];
304 void AliJetEventParticles::UQJet(Int_t i, Float_t &p1, Float_t &p2, Float_t &p3, Float_t &E) const
310 printf("\nWarning: Unquenched Jets, index out of Range!!\n");
319 void AliJetEventParticles::Hard(Int_t i, Float_t &p1, Float_t &p2, Float_t &p3, Float_t &E, Float_t &type) const
325 printf("\nWarning: Hard partons, index out of Range!!\n");
335 void AliJetEventParticles::Hard(Int_t i, Float_t p[4], Float_t &type) const
341 printf("\nWarning: Hard partons, index out of Range!!\n");
351 void AliJetEventParticles::SetXYJet(Double_t x, Double_t y)
354 // Add jet production point
360 void AliJetEventParticles::Print(Option_t* /*t*/) const
362 cout << "--- AliJetEventParticles ---" << endl;
363 if(fHeader.Length()) cout << fHeader.Data() << endl;
364 cout << "Particles in Event: " << fNParticles << endl;
366 cout << "Unquenched Jets: " << fNUQJets << endl;
367 for(Int_t i = 0; i<fNUQJets; i++){
368 Float_t x=fUQJets[0][i];
369 Float_t y=fUQJets[1][i];
370 Float_t z=fUQJets[2][i];
371 Float_t e=fUQJets[3][i];
372 Float_t ptj=TMath::Sqrt(x*x+y*y);
373 Float_t thj=TMath::ATan2(ptj,z);
374 Float_t etaj=-TMath::Log(TMath::Tan(thj/2));
375 Float_t phj=TMath::Pi()+TMath::ATan2(-y,-x);
376 Float_t et=e*TMath::Sin(thj);
377 cout << i << " " << et << " " << etaj << " " << phj << endl;
381 cout << "Triggered Jets: " << fNJets << endl;
382 for(Int_t i = 0; i<fNJets; i++){
383 Float_t x=fJets[0][i];
384 Float_t y=fJets[1][i];
385 Float_t z=fJets[2][i];
386 Float_t e=fJets[3][i];
387 Float_t ptj=TMath::Sqrt(x*x+y*y);
388 Float_t thj=TMath::ATan2(ptj,z);
389 Float_t etaj=-TMath::Log(TMath::Tan(thj/2));
390 Float_t phj=TMath::Pi()+TMath::ATan2(-y,-x);
391 Float_t et=e*TMath::Sin(thj);
392 cout << i << " " << et << " " << etaj << " " << phj << endl;