3 // $Id: AliHLTHOMERManager.h $
5 #ifndef ALIEVEHOMERMANGER_H
6 #define ALIEVEHOMERMANGER_H
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
13 /** @file AliHLTHOMERManager.h
14 @author Jochen Thaeder
16 @brief Manager for HOMER in aliroot
23 #include "AliHLTHOMERSourceDesc.h"
24 #include "AliHLTHOMERBlockDesc.h"
25 #include "AliHLTHOMERReader.h"
26 #include "AliHLTHOMERProxyHandler.h"
28 #include "AliHLTLogging.h"
30 class AliHLTHOMERLibManager;
33 * @class AliHLTHOMERManager
34 * This Class should handle the communication
35 * from the HLT to aliroot. The HLT sends data via
36 * the HOMER interface on several TCP ports of nodes
37 * in the CERN GPN and DCS network.
38 * All this communication is hidden from the user.
40 * Right now, a xml file ( SCC1 ) is used to get the
41 * configuration, this will/ has to change to a proxy
42 * running on dedicated nodes.
44 * @ingroup alihlt_homer
47 class AliHLTHOMERManager : public TObject, public AliHLTLogging {
51 * ---------------------------------------------------------------------------------
52 * Constructor / Destructor
53 * ---------------------------------------------------------------------------------
56 /** default constructor */
60 virtual ~AliHLTHOMERManager();
63 * @return 0 on success, <0 for failure
68 * ---------------------------------------------------------------------------------
69 * Source Handling - public
70 * ---------------------------------------------------------------------------------
73 /** Create Sources List from HOMER-Proxy
74 * @return 0 on success, <0 for failure
76 virtual Int_t CreateSourcesList();
78 /** Set state of a source
79 * @param source Pointer to AliHLTHOMERSourceDesc object.
80 * @param state New (selected/not selected) state.
82 void SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
84 /** Get pointer to source List */
85 TList* GetSourceList() { return fSourceList; }
88 * ---------------------------------------------------------------------------------
89 * Connection Handling - public
90 * ---------------------------------------------------------------------------------
93 /** Connect to HOMER sources, out of Readout List,
94 * which gets created when state has changed
95 * @return 0 on success, <0 for failure
99 /** Disconnect from HOMER sources */
100 void DisconnectHOMER();
102 /** Reconnect from HOMER sources
103 * @return 0 on success, <0 for failure
105 Int_t ReconnectHOMER();
108 * ---------------------------------------------------------------------------------
109 * Event Handling - public
110 * ---------------------------------------------------------------------------------
113 /** Loads the next Event, after being connected
114 * @return 0 on success, <0 for failure
116 virtual Int_t NextEvent();
119 ULong_t GetEventID() { return fEventID; } // Get event ID
121 /** Get pointer to block List */
122 TList* GetBlockList() { return fBlockList; } // Get pointer to block List
124 ///////////////////////////////////////////////////////////////////////////////////
128 /** Dynamic loader manager for the HOMER library */
129 AliHLTHOMERLibManager* fLibManager; //! transient
131 ///////////////////////////////////////////////////////////////////////////////////
135 /** copy constructor prohibited */
136 AliHLTHOMERManager(const AliHLTHOMERManager&);
138 /** assignment operator prohibited */
139 AliHLTHOMERManager& operator=(const AliHLTHOMERManager&);
142 * ---------------------------------------------------------------------------------
143 * Connection Handling - private
144 * ---------------------------------------------------------------------------------
147 /** Create a readout list for Hostname and ports
148 * @param socurceHostnames Array of selected hostnames
149 * @param socurcePorts Array of selected ports
150 * @param socurceCount Number of selected hostname:port
152 void CreateReadoutList( const char** sourceHostnames, UShort_t* sourcePorts,
153 UInt_t &sourceCount);
155 /** Checks if already connected to HOMER sources */
156 Bool_t IsConnected() { return fConnected; }
158 /* ---------------------------------------------------------------------------------
159 * Event Handling - private
160 * ---------------------------------------------------------------------------------
163 /** Create a TList of blocks, which have been readout */
164 void CreateBlockList();
167 * ---------------------------------------------------------------------------------
168 * Block Handling - private
169 * ---------------------------------------------------------------------------------
172 /** Get Number of blocks in current event */
173 ULong_t GetNBlks() { return fNBlks; }
175 // ----------------------------------------------------
177 /** Get pointer to block ndx in current event
178 * @param ndx Block index
179 * @return returns pointer to blk, NULL if no block present
181 void* GetBlk( Int_t ndx );
183 /** Get pointer to current block in current event */
184 void* GetBlk() { return GetBlk(fCurrentBlk); }
186 /** Get first block in current event */
187 void* GetFirstBlk() { fCurrentBlk=0; return GetBlk(0); }
189 /** Get next block in current event */
190 void* GetNextBlk() { return GetBlk(++fCurrentBlk); }
192 // ----------------------------------------------------
194 /** Get size of block ndx
195 * @param ndx Block index
196 * @return returns size blk, 0 otherwise
198 ULong_t GetBlkSize( Int_t ndx );
200 /** Get size of current block */
201 ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }
203 // ----------------------------------------------------
205 /** Get origin of block ndx
206 * @param ndx Block index
207 * @return origin of block
209 TString GetBlkOrigin( Int_t ndx );
211 /** Get origin of current block */
212 TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }
214 // ----------------------------------------------------
216 /** Get type of block ndx
217 * @param ndx Block index
218 * @return type of block
220 TString GetBlkType( Int_t ndx );
222 /** Get type of current block */
223 TString GetBlkType() { return GetBlkType( fCurrentBlk ); }
225 // ----------------------------------------------------
227 /** Get specification of block ndx
228 * @param ndx Block index
229 * @return specification of block
231 ULong_t GetBlkSpecification( Int_t ndx );
233 /** Get specification of current block */
234 ULong_t GetBlkSpecification() { return GetBlkSpecification( fCurrentBlk ); }
236 // ----------------------------------------------------
238 /** Checks if current Block should was requested
239 * @return returns kTRUE, if block should was requested
241 Bool_t CheckIfRequested( AliHLTHOMERBlockDesc* block );
244 * ---------------------------------------------------------------------------------
246 * ---------------------------------------------------------------------------------
249 /** Proxy Handler to get the list of sources */
250 AliHLTHOMERProxyHandler *fProxyHandler; //! transient
254 /** Pointer to HOMER reader */
255 AliHLTHOMERReader* fReader; //! transient
259 /** List to HOMER sources */
260 TList *fSourceList; //! transient
264 /** List to HOMER blocks */
265 TList *fBlockList; //! transient
269 /** Number of blockes in current event */
270 ULong_t fNBlks; // see above
272 /** EventID of current event */
273 ULong64_t fEventID; // see above
275 /** Current block in current event */
276 ULong_t fCurrentBlk; // see above
280 /** Shows connection status */
281 Bool_t fConnected; // see above
283 /** Indicates, if a sources have changes,
284 * so that one has to reconnect. */
285 Bool_t fStateHasChanged; // see above
287 ClassDef(AliHLTHOMERManager, 0); // Manage connections to HLT data-sources.