4 ///////////////////////////////////////////////////////
8 // Class storing and managing set events //
9 // designed for fast acces //
11 // Piotr.Skowronski@cern.ch //
12 // http://aliweb.cern.ch/people/skowron/analyzer //
14 ///////////////////////////////////////////////////////
18 #include <TObjArray.h>
20 class AliVAODParticle;
23 class AliAODRun: public TObject
29 void AddParticle(Int_t event, AliVAODParticle* part); //inerface to AliAOD::AddParticle(AliVAODParticle*)
30 void AddParticle(Int_t event, TParticle* part, Int_t idx);//inerface to AliAOD::AddParticle(TParticle*)
32 //inerface to AliAOD::AddParticle(Int_t.Double_t,Double_t,Double_t,Double_t,Double_t,Double_t,Double_t,Double_t,Double_t)
33 void AddParticle(Int_t event, Int_t pdg, Int_t idx,
34 Double_t px, Double_t py, Double_t pz, Double_t etot,
35 Double_t vx, Double_t vy, Double_t vz, Double_t time);
37 void SetEvent(Int_t number, AliAOD* event);
38 AliVAODParticle* GetParticle(Int_t event, Int_t n); //returns nth particle from event
39 AliAOD* GetEvent(Int_t event) const; //returns AliAOD number "event"
41 Int_t GetNumberOfEvents() const; //returns number of events
42 Int_t GetNumberOfParticlesInEvent(Int_t event) const; //returns number of particles in event number "event"
43 void Reset();//clears all events in the array (deletes)
45 TObjArray* fEvents;//!Array containig AliAODs
53 /**************************************************************************/
56 AliAOD* AliAODRun::GetEvent(Int_t event) const
58 //returns pointer to AliAOD number "event"
59 //check if array is enough big - protect from error massage from array "Out Of Bounds"
60 if (event>=fEvents->GetSize()) return 0x0;//WARNING, that line relies
61 //on index of first object in TObjArray is 0
63 return (AliAOD*)fEvents->At(event);
65 /**************************************************************************/
67 AliVAODParticle* AliAODRun::GetParticle(Int_t event, Int_t n)
69 //returns nth particle from event number event
70 AliAOD* e = GetEvent(event);
71 return (e)?e->GetParticle(n):0x0;
74 /**************************************************************************/
77 Int_t AliAODRun::GetNumberOfEvents() const
79 //returns number of events in collection
81 return fEvents->GetEntriesFast(); //there may be empty slots but we do not care
82 //Analysis checks it if return is not NULL
84 /**************************************************************************/
87 Int_t AliAODRun::GetNumberOfParticlesInEvent(Int_t event) const
89 //returns number of Particles in event
90 AliAOD* e = GetEvent(event);
91 return (e)?e->GetNumberOfParticles():0x0;