]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTRun.h
Cleanup of STEER coding conventions
[u/mrichter/AliRoot.git] / HBTAN / AliHBTRun.h
1 #ifndef ALIHBTRUN_H
2 #define ALIHBTRUN_H
3 //____________________
4 ///////////////////////////////////////////////////////
5 //                                                   //
6 // AliHBTRun                                         //
7 //                                                   //
8 // Class storing and managing set events             //
9 // designed for fast acces                           //
10 //                                                   //
11 // Piotr.Skowronski@cern.ch                          //
12 // http://alisoft.cern.ch/people/skowron/analyzer    //
13 //                                                   //
14 ///////////////////////////////////////////////////////
15
16
17 #include "AliHBTEvent.h"
18 #include <TObjArray.h>
19
20 class AliHBTParticle;
21
22 class AliHBTEvent;
23
24 class AliHBTRun: public TObject
25  {
26   public:
27     AliHBTRun();
28     virtual ~AliHBTRun();
29
30     void            AddParticle(Int_t event, AliHBTParticle* part); //inerface to AliHBTEvent::AddParticle(AliHBTParticle*) 
31     void            AddParticle(Int_t event, TParticle* part);//inerface to AliHBTEvent::AddParticle(TParticle*) 
32     
33     //inerface to AliHBTEvent::AddParticle(Int_t.Double_t,Double_t,Double_t,Double_t,Double_t,Double_t,Double_t,Double_t,Double_t)
34     void            AddParticle(Int_t event, Int_t pdg, 
35                                 Double_t px, Double_t py, Double_t pz, Double_t etot,
36                                 Double_t vx, Double_t vy, Double_t vz, Double_t time); 
37     
38     AliHBTParticle* GetParticle(Int_t event, Int_t n); //returns nth particle from event
39     AliHBTEvent*    GetEvent(Int_t event) const; //returns AliHBTEvent 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 AliHBTEvents
46   private:
47     
48   public:
49     ClassDef(AliHBTRun,1)
50  };
51  
52  
53 /**************************************************************************/
54
55 inline
56 AliHBTEvent* AliHBTRun::GetEvent(Int_t event) const
57 {
58 //returns pointer to AliHBTEvent 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 (AliHBTEvent*)fEvents->At(event);
64 }
65 /**************************************************************************/
66 inline
67 AliHBTParticle* AliHBTRun::GetParticle(Int_t event, Int_t n) 
68 {
69  //returns nth particle from event number event
70   AliHBTEvent* e = GetEvent(event);
71   return (e)?e->GetParticle(n):0x0;
72 }
73
74 /**************************************************************************/
75
76 inline
77 Int_t AliHBTRun::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 AliHBTRun::GetNumberOfParticlesInEvent(Int_t event) const
88 {
89 //returns number of Particles in event 
90   AliHBTEvent* e = GetEvent(event);
91   return (e)?e->GetNumberOfParticles():0x0;
92 }
93  
94 #endif