]>
Commit | Line | Data |
---|---|---|
1b446896 | 1 | #include "AliHBTRun.h" |
2 | ||
3 | #include <TObjArray.h> | |
4 | ||
5 | ||
6 | ClassImp(AliHBTRun) | |
7 | /**************************************************************************/ | |
8 | ||
9 | AliHBTRun::AliHBTRun() | |
10 | { | |
11 | //contructor | |
12 | ||
13 | fEvents = new TObjArray();//create array for AliHBTEvents | |
14 | if(!fEvents) Fatal("AliHBTRun::AliHBTRun","Can not allocate memory"); | |
15 | fEvents->SetOwner(); //array is an owner: when is deleted or cleared it deletes objects that it contains | |
16 | } | |
17 | /**************************************************************************/ | |
18 | AliHBTRun::~AliHBTRun() | |
19 | { | |
20 | //destructor | |
21 | ||
22 | delete fEvents;//delete array with events | |
23 | } | |
24 | ||
25 | ||
26 | /**************************************************************************/ | |
27 | void AliHBTRun::Reset() | |
28 | { | |
29 | fEvents->Clear();//clear an array with events. | |
30 | //All events are deleted because array is an owner (set in constructor) | |
31 | } | |
32 | /**************************************************************************/ | |
33 | ||
34 | ||
35 | void AliHBTRun::AddParticle(Int_t event, AliHBTParticle* part) | |
36 | { | |
37 | //Adds particle to event | |
38 | ||
39 | //if there is no event of this number, crate it and add to the collection | |
40 | if(!GetEvent(event)) fEvents->AddAtAndExpand(new AliHBTEvent, event); | |
41 | ||
42 | GetEvent(event)->AddParticle(part); | |
43 | } | |
44 | /**************************************************************************/ | |
45 | ||
46 | ||
47 | void AliHBTRun::AddParticle(Int_t event, TParticle* part) | |
48 | { | |
49 | //if there is no event of this number, crate it and add to the collection | |
50 | if(!GetEvent(event)) fEvents->AddAtAndExpand(new AliHBTEvent, event); | |
51 | GetEvent(event)->AddParticle(part); | |
52 | } | |
53 | /**************************************************************************/ | |
54 | ||
55 | ||
56 | void AliHBTRun::AddParticle(Int_t event, Int_t pdg, | |
57 | Double_t px, Double_t py, Double_t pz, Double_t etot, | |
58 | Double_t vx, Double_t vy, Double_t vz, Double_t time) | |
59 | { | |
60 | //if there is no event of this number, crate it and add to the collection | |
61 | if(!GetEvent(event)) fEvents->AddAtAndExpand(new AliHBTEvent, event); | |
62 | GetEvent(event)->AddParticle(pdg,px,py,pz,etot,vx,vy,vz,time); | |
63 | } | |
64 | ||
65 | /**************************************************************************/ |