3 //__________________________________________________________
4 ///////////////////////////////////////////////////////////////////
8 // loizides@ikf.uni-frankfurt.de
10 ///////////////////////////////////////////////////////////////////
12 #include <Riostream.h>
13 #include <TClonesArray.h>
14 #include "AliJetParticle.h"
15 #include "AliJetEvent.h"
20 /**************************************************************************/
22 AliJetEvent::AliJetEvent(Int_t size) :
24 fParticles(new TClonesArray("AliJetParticle",size)),
32 /**************************************************************************/
34 AliJetEvent::AliJetEvent(const AliJetEvent& source) :
36 fNParticles(source.fNParticles),
37 fParticles(new TClonesArray("AliJetEvent",source.fNParticles)),
43 for(Int_t i =0; i<fNParticles; i++)
45 const AliJetParticle *kjp=(const AliJetParticle *)source.fParticles->At(i);
46 fParticles->AddAt(new AliJetParticle(*(kjp)),i);
50 /**************************************************************************/
52 AliJetEvent::~AliJetEvent()
60 /**************************************************************************/
62 void AliJetEvent::Reset(Int_t size)
64 //deletes all particles from the event
66 if(fParticles) fParticles->Clear();
67 if(size>=0) fParticles->Expand(size);
71 /**************************************************************************/
73 void AliJetEvent::AddParticle(AliJetParticle* part)
75 //Adds new particle to the event
76 fParticles->AddAt(part,fNParticles++);
79 /**************************************************************************/
81 void AliJetEvent::AddParticle(const AliJetParticle* part)
83 //Adds new particle to the event
84 fParticles->AddAt(new AliJetParticle(*part),fNParticles++);
87 /**************************************************************************/
89 void AliJetEvent::AddParticle(const TParticle* part,Int_t idx, Int_t l)
91 //Adds new particle to the event
92 new((*fParticles)[fNParticles++]) AliJetParticle(part,idx,l);
95 /**************************************************************************/
97 void AliJetEvent::AddParticle(Float_t px, Float_t py, Float_t pz,
98 Float_t etot, Int_t idx, Int_t l)
100 //Adds new particle to the event
101 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l);
104 /**************************************************************************/
106 void AliJetEvent::AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
107 Float_t pt, Float_t phi, Float_t eta)
109 //Adds new particle to the event
110 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,pt,phi,eta);
114 /**************************************************************************/
116 const AliJetParticle* AliJetEvent::GetParticleSafely(Int_t n)
118 //returns nth particle with range check
119 if( (n<0) || (fNParticles<=n) ) return 0;
120 return (const AliJetParticle*)fParticles->At(n);
123 /**************************************************************************/
125 void AliJetEvent::Print(Option_t* /*t*/) const
127 if(fHeader.Length()) cout << fHeader.Data() << endl;
128 cout << "no of particles: " << fNParticles << endl;