]>
Commit | Line | Data |
---|---|---|
30e7579c | 1 | //-*- Mode: C++ -*- |
2 | ||
3 | // $Id$ | |
4 | ||
5 | #ifndef ALIEVEEVENTBUFFER_H | |
6 | #define ALIEVEEVENTBUFFER_H | |
7 | ||
8 | /* This file is property of and copyright by the ALICE HLT Project * | |
9 | * ALICE Experiment at CERN, All rights reserved. * | |
10 | * See cxx source for full Copyright notice | |
11 | */ | |
12 | ||
13 | /** @file AliEveEventBuffer.h | |
14 | @author Svein Lindal | |
15 | @date | |
16 | @brief Manager for HOMER in aliroot | |
17 | */ | |
18 | ||
19 | ||
20 | class TObjArray; | |
21 | class TObject; | |
22 | class TTimer; | |
23 | class TThread; | |
24 | ||
25 | #include "TTimer.h" | |
26 | ||
27 | class AliEveEventBuffer : public TObject{ | |
28 | ||
29 | public: | |
30 | ||
31 | /** default constructor */ | |
32 | AliEveEventBuffer(); | |
33 | ||
34 | /** destructor */ | |
35 | virtual ~AliEveEventBuffer(); | |
36 | ||
37 | void SetBufferSize(Int_t bs) { fBufferSize = bs;} | |
38 | void SetBusy(Bool_t busy) { fBusy = busy;} | |
239fdf4e | 39 | Bool_t GetBusy() { return fBusy;} |
40 | ||
30e7579c | 41 | //Navigate the event buffer |
42 | // TObject * NavigateFwd(); | |
43 | // TObject * NavigateBack(); | |
44 | TObject * NextEvent(); | |
45 | TObject * Back(); | |
46 | TObject * Fwd(); | |
47 | ||
48 | void StartBufferMonitor(); | |
49 | void StopBufferMonitor(); | |
50 | //Needed for Homer buffer | |
51 | virtual void ConnectToSource() = 0; | |
52 | //Check if more events are needed in buffer | |
53 | void MonitorBuffer(); | |
54 | ||
55 | static void * BufferThread(void * buffer); | |
56 | virtual void WriteToFile() {//Do nothing | |
57 | ; | |
58 | } | |
59 | ||
239fdf4e | 60 | void CreateBufferThread(); |
61 | ||
8676f4b1 | 62 | ULong64_t GetEventId() const { return fEventId[fBIndex[kCurrent]]; } |
239fdf4e | 63 | |
30e7579c | 64 | protected: |
65 | ||
66 | enum fBufferIndex { | |
67 | kCurrent, | |
68 | kLast, | |
69 | kTop, | |
70 | kSize | |
71 | }; | |
72 | ||
73 | ||
74 | Int_t fBufferSize; | |
75 | Int_t fPreBuffer; | |
76 | Bool_t fBusy; | |
77 | ||
78 | //TClonesArray containing the stored events | |
79 | TObjArray * fEventBuffer; | |
80 | ||
81 | //Pointer to current event | |
82 | TObject * fCurrentEvent; | |
83 | ||
84 | //Event buffer indexes | |
85 | Int_t fBIndex[kSize]; | |
86 | ||
87 | ||
88 | //Add event to buffer | |
89 | virtual void AddToBuffer(TObject * event); | |
8676f4b1 | 90 | // virtual void AddToBuffer(TObject * event, ULong64_t eventId); |
30e7579c | 91 | virtual TObject * GetEventFromSource() = 0; |
8676f4b1 | 92 | virtual ULong64_t GetEventIdFromSource() { return 0;} |
93 | ||
30e7579c | 94 | |
95 | void FetchEvent(); | |
96 | ||
97 | ||
98 | //Calculate buffer index stuff | |
99 | Int_t CalculateDifference(Int_t top, Int_t low); | |
100 | Int_t CalculatePrevious(Int_t current); | |
101 | Int_t CalculateNext(Int_t current); | |
102 | ||
8676f4b1 | 103 | void SetEventId(ULong64_t eventId) { fEventId[fBIndex[kCurrent]] = eventId;} |
30e7579c | 104 | |
b088c0a1 | 105 | void SetBufferMonStarted(Bool_t started) {fBufferMonStarted = started;} |
106 | Bool_t GetBufferMonStarted () const { return fBufferMonStarted;} | |
30e7579c | 107 | |
108 | private: | |
109 | ||
110 | /** copy constructor prohibited */ | |
111 | AliEveEventBuffer(const AliEveEventBuffer&); | |
112 | ||
113 | /** assignment operator prohibited */ | |
114 | AliEveEventBuffer& operator=(const AliEveEventBuffer&); | |
115 | ||
239fdf4e | 116 | |
30e7579c | 117 | |
118 | TObject * GetNextUnSeen(); | |
119 | ||
120 | void PrintIndeces(); | |
121 | void PrintBuffer(); | |
122 | ||
123 | TTimer * fTimer; | |
124 | ||
30e7579c | 125 | //Current event id |
8676f4b1 | 126 | ULong64_t * fEventId; |
30e7579c | 127 | |
b088c0a1 | 128 | Bool_t fBufferMonStarted; |
129 | ||
130 | ||
30e7579c | 131 | |
132 | ClassDef(AliEveEventBuffer, 0); // Manage connections to HLT data-sources. | |
133 | }; | |
134 | ||
135 | #endif |