]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliEventBuffer.cxx
Splitted calibration object -> PARAMETERS FOR CENTRALITY RECONSTRUCTION
[u/mrichter/AliRoot.git] / ANALYSIS / AliEventBuffer.cxx
CommitLineData
78d7c6d3 1#include "AliEventBuffer.h"
2
3ClassImp(AliEventBuffer)
4
5//______________________________________________________
6////////////////////////////////////////////////////////
7//
8// class AliEventBuffer
9//
10// FIFO type event buffer
11//
12// Piotr.Skowronski@cern.ch
13//
14////////////////////////////////////////////////////////
15
16AliEventBuffer::AliEventBuffer():
17 fSize(-1),fEvents(),fIter(&fEvents)
18{
19 //ctor
20}
21/***********************************************************/
22
23AliEventBuffer::AliEventBuffer(Int_t size):
24 fSize(size),fEvents(),fIter(&fEvents)
25{
26 //ctor
27}
28/***********************************************************/
29
30AliEventBuffer::~AliEventBuffer()
31{
32 //dtor -- TList::IsOwner(1) does not work - Valgrind says that there is mem leak
33 //take care owerseves
34 if (fEvents.IsOwner())
35 {
36 AliAOD* e=0x0;
37 while (( e=RemoveLast() )) delete e;
38 }
39}
40/***********************************************************/
41
b684bec0 42void AliEventBuffer::Reset()
43{
44 //Resets the queue
45 if (fEvents.IsOwner())
46 {
47 AliAOD* e=0x0;
48 while (( e=RemoveLast() )) delete e;
49 }
50 else
51 {
52 fEvents.RemoveAll();
53 }
54}
55/***********************************************************/
56
78d7c6d3 57AliAOD* AliEventBuffer::Push(AliAOD* event)
58{
59 //adds a new event, and returns old of do not fit in size
60 if (fSize == 0) return event;
61
62 AliAOD* ret = 0x0;
63
64 if (fSize == fEvents.GetSize())
65 ret = dynamic_cast<AliAOD*>(fEvents.Remove(fEvents.Last()));
66 if (event) fEvents.AddFirst(event);
67 return ret;
68}
69