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 /**************************************************************************/
21 AliJetEventParticles::AliJetEventParticles(Int_t size) :
23 fParticles(new TClonesArray("AliJetParticle",size)),
31 /**************************************************************************/
33 AliJetEventParticles::AliJetEventParticles(const AliJetEventParticles& source) :
35 fNParticles(source.fNParticles),
36 fParticles(new TClonesArray("AliJetEventParticles",source.fNParticles)),
42 for(Int_t i =0; i<fNParticles; i++)
44 const AliJetParticle *kjp=(const AliJetParticle *)source.fParticles->At(i);
45 fParticles->AddAt(new AliJetParticle(*(kjp)),i);
49 /**************************************************************************/
51 AliJetEventParticles::~AliJetEventParticles()
59 /**************************************************************************/
61 void AliJetEventParticles::Reset(Int_t size)
63 //deletes all particles from the event
65 if(fParticles) fParticles->Clear();
66 if(size>=0) fParticles->Expand(size);
70 /**************************************************************************/
72 void AliJetEventParticles::AddParticle(AliJetParticle* part)
74 //Adds new particle to the event
75 fParticles->AddAt(part,fNParticles++);
78 /**************************************************************************/
80 void AliJetEventParticles::AddParticle(const AliJetParticle* part)
82 //Adds new particle to the event
83 new((*fParticles)[fNParticles++]) AliJetParticle(*part);
86 /**************************************************************************/
88 void AliJetEventParticles::AddParticle(const TParticle* part,Int_t idx, Int_t l)
90 //Adds new particle to the event
91 new((*fParticles)[fNParticles++]) AliJetParticle(part,idx,l);
94 /**************************************************************************/
96 void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz,
97 Float_t etot, Int_t idx, Int_t l)
99 //Adds new particle to the event
100 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l);
103 /**************************************************************************/
105 void AliJetEventParticles::AddParticle(Float_t px, Float_t py, Float_t pz, Float_t etot, Int_t idx, Int_t l,
106 Float_t pt, Float_t phi, Float_t eta)
108 //Adds new particle to the event
109 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,pt,phi,eta);
113 /**************************************************************************/
115 const AliJetParticle* AliJetEventParticles::GetParticleSafely(Int_t n)
117 //returns nth particle with range check
118 if( (n<0) || (fNParticles<=n) ) return 0;
119 return (const AliJetParticle*)fParticles->At(n);
122 /**************************************************************************/
124 void AliJetEventParticles::Print(Option_t* /*t*/) const
126 cout << "--- AliJetEventParticles ---" << endl;
127 if(fHeader.Length()) cout << fHeader.Data() << endl;
128 cout << "no of particles: " << fNParticles << endl;