6 ///////////////////////////////////////////////////////
10 // Class storing and managing events //
12 // Piotr.Skowronski@cern.ch //
13 // http://alisoft.cern.ch/people/skowron/analyzer //
15 ///////////////////////////////////////////////////////
18 /**************************************************************************/
20 AliHBTRun::AliHBTRun()
23 fEvents = new TObjArray();//create array for AliHBTEvents
24 if(!fEvents) Fatal("AliHBTRun::AliHBTRun","Can not allocate memory");
25 fEvents->SetOwner(); //array is an owner: when is deleted or cleared it deletes objects that it contains
27 /**************************************************************************/
29 AliHBTRun::~AliHBTRun()
32 delete fEvents;//delete array with events
34 /**************************************************************************/
36 void AliHBTRun::Reset()
38 fEvents->Clear();//clear an array with events.
39 //All events are deleted because array is an owner (set in constructor)
41 /**************************************************************************/
43 void AliHBTRun::AddParticle(Int_t event, AliHBTParticle* part)
45 //Adds particle to event
46 //if there is no event of this number, crate it and add to the collection
47 if(!GetEvent(event)) fEvents->AddAtAndExpand(new AliHBTEvent, event);
49 GetEvent(event)->AddParticle(part);
51 /**************************************************************************/
53 void AliHBTRun::AddParticle(Int_t event, TParticle* part, Int_t idx)
55 //if there is no event of this number, crate it and add to the collection
56 if(!GetEvent(event)) fEvents->AddAtAndExpand(new AliHBTEvent, event);
57 GetEvent(event)->AddParticle(part,idx);
59 /**************************************************************************/
61 void AliHBTRun::AddParticle(Int_t event, Int_t pdg, Int_t idx,
62 Double_t px, Double_t py, Double_t pz, Double_t etot,
63 Double_t vx, Double_t vy, Double_t vz, Double_t time)
65 //if there is no event of this number, crate it and add to the collection
66 if(!GetEvent(event)) fEvents->AddAtAndExpand(new AliHBTEvent, event);
67 GetEvent(event)->AddParticle(pdg,idx,px,py,pz,etot,vx,vy,vz,time);
69 /**************************************************************************/
71 void AliHBTRun::SetEvent(Int_t number, AliHBTEvent* event)
73 //adds an event to the run
74 // makes an own copy of the event!
77 delete fEvents->RemoveAt(number);
80 AliHBTEvent* ev = GetEvent(number);
82 else fEvents->AddAtAndExpand(new AliHBTEvent(*event), number);
84 /**************************************************************************/