Cluster Map moved to ANALYSIS
[u/mrichter/AliRoot.git] / HBTAN / AliHBTEventBuffer.cxx
CommitLineData
bed069a4 1#include "AliHBTEventBuffer.h"
2
3ClassImp(AliHBTEventBuffer)
4
5//______________________________________________________
6////////////////////////////////////////////////////////
7//
8// class AliHBTEventBuffer
9//
10// FIFO type event buffer
0a97a08e 11//
12// Piotr.Skowronski@cern.ch
13//
14////////////////////////////////////////////////////////
bed069a4 15
16AliHBTEventBuffer::AliHBTEventBuffer():
17 fSize(-1),fEvents(),fIter(&fEvents)
18{
19 //ctor
20}
21/***********************************************************/
0a97a08e 22
bed069a4 23AliHBTEventBuffer::AliHBTEventBuffer(Int_t size):
24 fSize(size),fEvents(),fIter(&fEvents)
25{
26 //ctor
27}
0a97a08e 28/***********************************************************/
29
30AliHBTEventBuffer::~AliHBTEventBuffer()
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 AliHBTEvent* e=0x0;
37 while (( e=RemoveLast() )) delete e;
38 }
39}
40/***********************************************************/
bed069a4 41
42AliHBTEvent* AliHBTEventBuffer::Push(AliHBTEvent* event)
43{
44 //adds a new event, and returns old of do not fit in size
45 if (fSize == 0) return event;
46
47 AliHBTEvent* ret = 0x0;
48
49 if (fSize == fEvents.GetSize())
50 ret = dynamic_cast<AliHBTEvent*>(fEvents.Remove(fEvents.Last()));
51 if (event) fEvents.AddFirst(event);
52 return ret;
53}
54