Returned to old version where parameters are given at first point.
[u/mrichter/AliRoot.git] / JETAN / AliJet.cxx
1 // $Id$
2
3 //__________________________________________________________
4 ///////////////////////////////////////////////////////////////////
5 //
6 // class AliJet
7 //
8 // loizides@ikf.uni-frankfurt.de
9 //
10 ///////////////////////////////////////////////////////////////////
11
12 #include <Riostream.h>
13 #include <TClonesArray.h>
14 #include "AliJetParticle.h"
15 #include "AliJet.h"
16
17 ClassImp(AliJet)
18
19 #if 0
20 /**************************************************************************/ 
21  
22 AliJetEvent::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  
34 AliJetEvent::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
52 AliJetEvent::~AliJetEvent()
53 {
54   //destructor   
55   Reset();
56   delete fParticles;
57 }
58
59
60 /**************************************************************************/ 
61
62 void  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
73 void AliJetEvent::AddParticle(AliJetParticle* part)
74 {
75   //Adds new particle to the event
76   fParticles->AddAt(part,fNParticles++);
77 }
78
79 /**************************************************************************/ 
80
81 void AliJetEvent::AddParticle(const AliJetParticle* part)
82 {
83   //Adds new particle to the event
84   fParticles->AddAt(new AliJetParticle(*part),fNParticles++); 
85 }
86
87 /**************************************************************************/ 
88
89 void 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
97 void 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
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)
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
116 const 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
125 void 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