]>
Commit | Line | Data |
---|---|---|
a5556ea5 | 1 | #ifndef ALIAODRUN_H |
2 | #define ALIAODRUN_H | |
3 | //____________________ | |
4 | /////////////////////////////////////////////////////// | |
5 | // // | |
6 | // AliAODRun // | |
7 | // // | |
8 | // Class storing and managing set events // | |
9 | // designed for fast acces // | |
10 | // // | |
11 | // Piotr.Skowronski@cern.ch // | |
c7ffd78f | 12 | // http://aliweb.cern.ch/people/skowron/analyzer // |
a5556ea5 | 13 | // // |
14 | /////////////////////////////////////////////////////// | |
15 | ||
16 | ||
17 | #include "AliAOD.h" | |
18 | #include <TObjArray.h> | |
19 | ||
afa8b37b | 20 | class AliVAODParticle; |
a5556ea5 | 21 | class TParticle; |
22 | ||
23 | class AliAODRun: public TObject | |
24 | { | |
25 | public: | |
26 | AliAODRun(); | |
27 | virtual ~AliAODRun(); | |
28 | ||
afa8b37b | 29 | void AddParticle(Int_t event, AliVAODParticle* part); //inerface to AliAOD::AddParticle(AliVAODParticle*) |
a5556ea5 | 30 | void AddParticle(Int_t event, TParticle* part, Int_t idx);//inerface to AliAOD::AddParticle(TParticle*) |
31 | ||
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); | |
36 | ||
37 | void SetEvent(Int_t number, AliAOD* event); | |
afa8b37b | 38 | AliVAODParticle* GetParticle(Int_t event, Int_t n); //returns nth particle from event |
a5556ea5 | 39 | AliAOD* GetEvent(Int_t event) const; //returns AliAOD number "event" |
40 | ||
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) | |
44 | protected: | |
45 | TObjArray* fEvents;//!Array containig AliAODs | |
46 | private: | |
47 | ||
48 | public: | |
49 | ClassDef(AliAODRun,1) | |
50 | }; | |
51 | ||
52 | ||
53 | /**************************************************************************/ | |
54 | ||
55 | inline | |
56 | AliAOD* AliAODRun::GetEvent(Int_t event) const | |
57 | { | |
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 | |
62 | //== LowerBound = 0 | |
63 | return (AliAOD*)fEvents->At(event); | |
64 | } | |
65 | /**************************************************************************/ | |
66 | inline | |
afa8b37b | 67 | AliVAODParticle* AliAODRun::GetParticle(Int_t event, Int_t n) |
a5556ea5 | 68 | { |
69 | //returns nth particle from event number event | |
70 | AliAOD* e = GetEvent(event); | |
71 | return (e)?e->GetParticle(n):0x0; | |
72 | } | |
73 | ||
74 | /**************************************************************************/ | |
75 | ||
76 | inline | |
77 | Int_t AliAODRun::GetNumberOfEvents() const | |
78 | { | |
79 | //returns number of events in collection | |
80 | ||
81 | return fEvents->GetEntriesFast(); //there may be empty slots but we do not care | |
82 | //Analysis checks it if return is not NULL | |
83 | } | |
84 | /**************************************************************************/ | |
85 | ||
86 | inline | |
87 | Int_t AliAODRun::GetNumberOfParticlesInEvent(Int_t event) const | |
88 | { | |
89 | //returns number of Particles in event | |
90 | AliAOD* e = GetEvent(event); | |
91 | return (e)?e->GetNumberOfParticles():0x0; | |
92 | } | |
93 | ||
94 | #endif |