]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HBTAN/AliHBTRun.h
Bug correction
[u/mrichter/AliRoot.git] / HBTAN / AliHBTRun.h
CommitLineData
1b446896 1#ifndef ALIHBTRUN_H
2#define ALIHBTRUN_H
e1c43ab8 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
1b446896 16
17#include "AliHBTEvent.h"
18#include <TObjArray.h>
19
1b446896 20class AliHBTParticle;
21
22class AliHBTEvent;
23
24class 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*)
8089a083 31 void AddParticle(Int_t event, TParticle* part, Int_t idx);//inerface to AliHBTEvent::AddParticle(TParticle*)
1b446896 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)
8089a083 34 void AddParticle(Int_t event, Int_t pdg, Int_t idx,
1b446896 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
bed069a4 38 void SetEvent(Int_t number, AliHBTEvent* event);
1b446896 39 AliHBTParticle* GetParticle(Int_t event, Int_t n); //returns nth particle from event
40 AliHBTEvent* GetEvent(Int_t event) const; //returns AliHBTEvent number "event"
41
42 Int_t GetNumberOfEvents() const; //returns number of events
43 Int_t GetNumberOfParticlesInEvent(Int_t event) const; //returns number of particles in event number "event"
44 void Reset();//clears all events in the array (deletes)
45 protected:
46 TObjArray* fEvents;//!Array containig AliHBTEvents
47 private:
48
49 public:
50 ClassDef(AliHBTRun,1)
51 };
52
53
54/**************************************************************************/
55
56inline
57AliHBTEvent* AliHBTRun::GetEvent(Int_t event) const
58{
59//returns pointer to AliHBTEvent number "event"
e1c43ab8 60 //check if array is enough big - protect from error massage from array "Out Of Bounds"
61 if (event>=fEvents->GetSize()) return 0x0;//WARNING, that line relies
62 //on index of first object in TObjArray is 0
63 //== LowerBound = 0
1b446896 64 return (AliHBTEvent*)fEvents->At(event);
65}
66/**************************************************************************/
67inline
68AliHBTParticle* AliHBTRun::GetParticle(Int_t event, Int_t n)
69{
70 //returns nth particle from event number event
e1c43ab8 71 AliHBTEvent* e = GetEvent(event);
72 return (e)?e->GetParticle(n):0x0;
1b446896 73}
74
75/**************************************************************************/
76
77inline
78Int_t AliHBTRun::GetNumberOfEvents() const
79 {
80//returns number of events in collection
81
82 return fEvents->GetEntriesFast(); //there may be empty slots but we do not care
83 //Analysis checks it if return is not NULL
84 }
85/**************************************************************************/
86
87inline
88Int_t AliHBTRun::GetNumberOfParticlesInEvent(Int_t event) const
89{
90//returns number of Particles in event
e1c43ab8 91 AliHBTEvent* e = GetEvent(event);
92 return (e)?e->GetNumberOfParticles():0x0;
1b446896 93}
94
95#endif