]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliJetEvent.cxx
Changes to work with 4 Release.
[u/mrichter/AliRoot.git] / JETAN / AliJetEvent.cxx
CommitLineData
d7c6ab14 1// $Id$
2
3//__________________________________________________________
4///////////////////////////////////////////////////////////////////
5//
6// class AliJetEvent
7//
8// loizides@ikf.uni-frankfurt.de
9//
10///////////////////////////////////////////////////////////////////
11
12#include <Riostream.h>
13#include <TClonesArray.h>
14#include "AliJetParticle.h"
15#include "AliJetEvent.h"
16
17ClassImp(AliJetEvent)
18
19#if 0
20/**************************************************************************/
21
22AliJetEvent::AliJetEvent(Int_t size) :
23 fNParticles(0),
24 fParticles(new TClonesArray("AliJetParticle",size)),
25 fVertexX(0.),
26 fVertexY(0.),
27 fVertexZ(0.)
28{
29 //default constructor
30}
31
32/**************************************************************************/
33
34AliJetEvent::AliJetEvent(const AliJetEvent& source) :
35 TObject(source),
36 fNParticles(source.fNParticles),
37 fParticles(new TClonesArray("AliJetEvent",source.fNParticles)),
38 fVertexX(0.),
39 fVertexY(0.),
40 fVertexZ(0.)
41{
42 //copy constructor
43 for(Int_t i =0; i<fNParticles; i++)
44 {
45 const AliJetParticle *kjp=(const AliJetParticle *)source.fParticles->At(i);
46 fParticles->AddAt(new AliJetParticle(*(kjp)),i);
47 }
48}
49
50/**************************************************************************/
51
52AliJetEvent::~AliJetEvent()
53{
54 //destructor
55 Reset();
56 delete fParticles;
57}
58
59
60/**************************************************************************/
61
62void AliJetEvent::Reset(Int_t size)
63{
64 //deletes all particles from the event
65
66 if(fParticles) fParticles->Clear();
67 if(size>=0) fParticles->Expand(size);
68 fNParticles = 0;
69}
70
71/**************************************************************************/
72
73void AliJetEvent::AddParticle(AliJetParticle* part)
74{
75 //Adds new particle to the event
76 fParticles->AddAt(part,fNParticles++);
77}
78
79/**************************************************************************/
80
81void AliJetEvent::AddParticle(const AliJetParticle* part)
82{
83 //Adds new particle to the event
84 fParticles->AddAt(new AliJetParticle(*part),fNParticles++);
85}
86
87/**************************************************************************/
88
89void AliJetEvent::AddParticle(const TParticle* part,Int_t idx, Int_t l)
90{
91 //Adds new particle to the event
92 new((*fParticles)[fNParticles++]) AliJetParticle(part,idx,l);
93}
94
95/**************************************************************************/
96
97void AliJetEvent::AddParticle(Float_t px, Float_t py, Float_t pz,
98 Float_t etot, Int_t idx, Int_t l)
99{
100 //Adds new particle to the event
101 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l);
102}
103
104/**************************************************************************/
105
106void 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)
108{
109 //Adds new particle to the event
110 new((*fParticles)[fNParticles++]) AliJetParticle(px,py,pz,etot,idx,l,pt,phi,eta);
111}
112
113
114/**************************************************************************/
115
116const AliJetParticle* AliJetEvent::GetParticleSafely(Int_t n)
117{
118 //returns nth particle with range check
119 if( (n<0) || (fNParticles<=n) ) return 0;
120 return (const AliJetParticle*)fParticles->At(n);
121}
122
123/**************************************************************************/
124
125void AliJetEvent::Print(Option_t* /*t*/) const
126{
127 if(fHeader.Length()) cout << fHeader.Data() << endl;
128 cout << "no of particles: " << fNParticles << endl;
129}
130
131#endif