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::AddSignal(const AliJetEventParticles& source)
125 { //mark signal particles and add them to TClonesArray
126 //note that fNParticles still keeps only background particles
128 Int_t nSignalParts=source.GetNParticles();
129 for(Int_t i=0; i<nSignalParts; i++)
131 const AliJetParticle *kjp=source.GetParticle(i);
133 AliJetParticle *ap=new((*fParticles)[fNParticles+i]) AliJetParticle(*(kjp));
134 ap->SetType(-123); //mark pythia particle
136 for(Int_t i=nSignalParts+fNParticles;i<fParticles->GetEntriesFast();i++)
137 fParticles->RemoveAt(i);
138 //cout << fParticles->GetEntries() << " " << fNParticles << " " << nSignalParts << endl;
140 /* should we transform the vertex???
141 fVertexX=source.GetVertexX();
142 fVertexY=source.GetVertexY();
143 fVertexZ=source.GetVertexZ();
145 fTrials=source.Trials();
146 fNJets=source.NTriggerJets();
147 fNUQJets=source.NUQTriggerJets();
148 fXJet=source.GetXJet();
149 fYJet=source.GetXJet();
152 for (Int_t i = 0; i < 4; i++) fZquench[i] = 0.;
153 for (Int_t i = 0; i < 10; i++)
154 for (Int_t j = 0; j < 4; j++) {
155 fJets[j][i]=0; // Trigger jets
156 fUQJets[j][i]=0; // Unquenched trigger jets
158 source.GetZQuench(fZquench);
159 for (Int_t i = 0; i < NTriggerJets(); i++){
160 source.TriggerJet(i,fJets[0][i],fJets[1][i],fJets[2][i],fJets[3][i]);
162 for (Int_t i = 0; i < NUQTriggerJets(); i++){
163 source.UQJet(i,fUQJets[0][i],fUQJets[1][i],fUQJets[2][i],fUQJets[3][i]);
165 source.Hard(0,fHard[0][0],fHard[1][0],fHard[2][0],fHard[3][0],fHard[4][0]);
166 source.Hard(1,fHard[0][1],fHard[1][1],fHard[2][1],fHard[3][1],fHard[4][1]);
169 void AliJetEventParticles::AddParticle(AliJetParticle* part)
171 //Adds new particle to the event
172 fParticles->AddAt(part,fNParticles++);
175 void AliJetEventParticles::AddParticle(const AliJetParticle* part)
177 //Adds new particle to the event
178 new((*fParticles)[fNParticles++]) AliJetParticle(*part);
181 void AliJetEventParticles::AddParticle(const TParticle* part,Int_t idx, Int_t l, Int_t ncl)
183 //Adds new particle to the event
184 new((*fParticles)[fNParticles++]) AliJetParticle(part,idx,l,ncl);
187 void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz,
188 Float_t etot, Int_t idx, Int_t l, Int_t ncl)
190 //Adds new particle to the event
191 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,ncl);
194 void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
195 Int_t ncl, Float_t pt, Float_t phi, Float_t eta)
197 //Adds new particle to the event
198 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,ncl,pt,phi,eta);
201 const AliJetParticle* AliJetEventParticles::GetParticleSafely(Int_t n)
203 //returns nth particle with range check
204 if( (n<0) || (fNParticles<=n) ) return 0;
205 return (const AliJetParticle*)fParticles->At(n);
208 void AliJetEventParticles::AddJet(Float_t px, Float_t py, Float_t pz, Float_t e)
214 fJets[0][fNJets] = px;
215 fJets[1][fNJets] = py;
216 fJets[2][fNJets] = pz;
217 fJets[3][fNJets] = e;
220 printf("\nWarning: More than 10 jets triggered !!\n");
224 void AliJetEventParticles::AddJet(Float_t p[4])
230 fJets[0][fNJets] = p[0];
231 fJets[1][fNJets] = p[1];
232 fJets[2][fNJets] = p[2];
233 fJets[3][fNJets] = p[3];
236 printf("\nWarning: More than 10 jets triggered !!\n");
240 void AliJetEventParticles::AddUQJet(Float_t px, Float_t py, Float_t pz, Float_t e)
246 fUQJets[0][fNUQJets] = px;
247 fUQJets[1][fNUQJets] = py;
248 fUQJets[2][fNUQJets] = pz;
249 fUQJets[3][fNUQJets] = e;
252 printf("\nWarning: More than 10 jets triggered !!\n");
256 void AliJetEventParticles::AddUQJet(Float_t p[4])
262 fUQJets[0][fNUQJets] = p[0];
263 fUQJets[1][fNUQJets] = p[1];
264 fUQJets[2][fNUQJets] = p[2];
265 fUQJets[3][fNUQJets] = p[3];
268 printf("\nWarning: More than 10 jets triggered !!\n");
272 void AliJetEventParticles::AddHard(Int_t i,Float_t px, Float_t py, Float_t pz, Float_t e, Float_t type)
284 printf("\nWarning: More than 2 partons !!\n");
288 void AliJetEventParticles::SetZQuench(Double_t z[4])
291 // Set quenching fraction
293 for (Int_t i = 0; i < 4; i++) fZquench[i] = z[i];
296 void AliJetEventParticles::GetZQuench(Double_t z[4]) const
299 // Get quenching fraction
301 for (Int_t i = 0; i < 4; i++) z[i] = fZquench[i];
304 void AliJetEventParticles::TriggerJet(Int_t i, Float_t p[4]) const
310 printf("\nWarning: TriggerJet, index out of Range!!\n");
319 void AliJetEventParticles::TriggerJet(Int_t i, Float_t &p1, Float_t &p2, Float_t &p3, Float_t &E) const
325 printf("\nWarning: TriggerJet, index out of Range!!\n");
334 void AliJetEventParticles::UQJet(Int_t i, Float_t p[4]) const
340 printf("\nWarning: Unquenched Jets, index out of Range!!\n");
342 p[0] = fUQJets[0][i];
343 p[1] = fUQJets[1][i];
344 p[2] = fUQJets[2][i];
345 p[3] = fUQJets[3][i];
349 void AliJetEventParticles::UQJet(Int_t i, Float_t &p1, Float_t &p2, Float_t &p3, Float_t &E) const
355 printf("\nWarning: Unquenched Jets, index out of Range!!\n");
364 void AliJetEventParticles::Hard(Int_t i, Float_t &p1, Float_t &p2, Float_t &p3, Float_t &E, Float_t &type) const
370 printf("\nWarning: Hard partons, index out of Range!!\n");
380 void AliJetEventParticles::Hard(Int_t i, Float_t p[4], Float_t &type) const
386 printf("\nWarning: Hard partons, index out of Range!!\n");
396 void AliJetEventParticles::SetXYJet(Double_t x, Double_t y)
399 // Add jet production point
405 void AliJetEventParticles::Print(Option_t* /*t*/) const
407 cout << "--- AliJetEventParticles ---" << endl;
408 if(fHeader.Length()) cout << fHeader.Data() << endl;
409 cout << "Particles in Event: " << fNParticles << endl;
411 cout << "Unquenched Jets: " << fNUQJets << endl;
412 for(Int_t i = 0; i<fNUQJets; i++){
413 Float_t x=fUQJets[0][i];
414 Float_t y=fUQJets[1][i];
415 Float_t z=fUQJets[2][i];
416 Float_t e=fUQJets[3][i];
417 Float_t ptj=TMath::Sqrt(x*x+y*y);
418 Float_t thj=TMath::ATan2(ptj,z);
419 Float_t etaj=-TMath::Log(TMath::Tan(thj/2));
420 Float_t phj=TMath::Pi()+TMath::ATan2(-y,-x);
421 Float_t et=e*TMath::Sin(thj);
422 cout << i << " " << et << " " << etaj << " " << phj << endl;
426 cout << "Triggered Jets: " << fNJets << endl;
427 for(Int_t i = 0; i<fNJets; i++){
428 Float_t x=fJets[0][i];
429 Float_t y=fJets[1][i];
430 Float_t z=fJets[2][i];
431 Float_t e=fJets[3][i];
432 Float_t ptj=TMath::Sqrt(x*x+y*y);
433 Float_t thj=TMath::ATan2(ptj,z);
434 Float_t etaj=-TMath::Log(TMath::Tan(thj/2));
435 Float_t phj=TMath::Pi()+TMath::ATan2(-y,-x);
436 Float_t et=e*TMath::Sin(thj);
437 cout << i << " " << et << " " << etaj << " " << phj << endl;