]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnEventBuffer.h
7d5463942993c473623c6f793e2b682264539336
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnEventBuffer.h
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * See cxx source for full Copyright notice                               *
4  **************************************************************************/
5  
6 //
7 // Class AliRsnEventBuffer
8 //
9 // Implements a temporary buffer of many AliRsnEvent objects
10 // which is useful for event mixing.
11 //
12 // author: Martin Vala (Martin.Vala@cern.ch)
13 // revised by: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
14 //
15
16 #ifndef AliRsnEventBuffer_h
17 #define AliRsnEventBuffer_h
18
19 #include "AliRsnEvent.h"
20
21 class AliRsnEventBuffer : public TObject
22 {
23 public:
24
25     AliRsnEventBuffer (Int_t buffsize = 1000, Bool_t deleteBufferWhenReset=kTRUE);
26     ~AliRsnEventBuffer();
27
28     void ClearBuffer();
29     void ResetIndex();
30
31     void AddEvent (AliRsnEvent *event);
32     AliRsnEvent *GetEvent (Int_t index) ;
33     AliRsnEvent *GetCurrentEvent ();
34     AliRsnEvent *GetNextEvent ();
35
36     void SetEventsBufferSize (const Int_t& theValue) { fEventsBufferSize = theValue; }
37     Int_t GetEventsBufferSize() const { return fEventsBufferSize; }
38     Int_t GetEventsBufferIndex() const { return fEventsBufferIndex; }
39
40     void SetDeleteBufferWhenReset (const Bool_t& theValue = kTRUE) { fDeleteBufferWhenReset = theValue; }
41     Bool_t GetDeleteBufferWhenReset() const { return fDeleteBufferWhenReset; }
42     
43     Int_t NEmptySlots();
44
45   private:
46   
47     AliRsnEventBuffer (const AliRsnEventBuffer& /*buf*/) :
48       fDeleteBufferWhenReset(0),fEventsBufferSize(0),fEventsBufferIndex(0) {}
49     const AliRsnEventBuffer& operator=(const AliRsnEventBuffer& /*buf*/) {return (*this);}
50
51     Bool_t       fDeleteBufferWhenReset;  // flag if buffer should be deleted when reset is done
52     Int_t        fEventsBufferSize;       // buffer size
53     Int_t        fEventsBufferIndex;      // current buffer index
54     AliRsnEvent *fEventsBuffer[10000];    // array of events
55
56     ClassDef (AliRsnEventBuffer, 1)
57 };
58
59 #endif