2 #ifndef ALIEVEHOMERMANGER_H
3 #define ALIEVEHOMERMANGER_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * See cxx source for full Copyright notice */
8 /** @file AliEVEHOMERManager.h
11 @brief Manager for HOMER in offline
14 #include <Reve/RenderElement.h>
17 #include "TDOMParser.h"
21 #include "AliHLTHOMERSourceDesc.h"
22 #include "AliHLTHOMERBlockDesc.h"
23 #include "AliHLTHOMERReader.h"
24 class AliHLTHOMERLibManager;
27 * @class AliEVEHOMERManager
29 * This class is the main class of the AliEVEHOMERManager
32 * @ingroup alihlt_homer
35 class AliEVEHOMERManager : public Reve::RenderElementList
40 * ---------------------------------------------------------------------------------
41 * Constructor / Destructor
42 * ---------------------------------------------------------------------------------
46 * @param argc Number of command line arguments.
47 * @param argv Array of command line arguments.
49 AliEVEHOMERManager(TString xmlFile="" );
50 /** not a valid copy constructor, defined according to effective C++ style */
51 AliEVEHOMERManager( const AliEVEHOMERManager& );
52 /** not a valid assignment op, but defined according to effective C++ style */
53 AliEVEHOMERManager& operator=( const AliEVEHOMERManager& );
55 virtual ~AliEVEHOMERManager();
58 * ---------------------------------------------------------------------------------
59 * Source Handling - public
60 * ---------------------------------------------------------------------------------
63 /** Create Sources List from HOMER-Proxy */
64 Int_t CreateHOMERSourcesList();
66 /** Set state of a source
67 * @param source Pointer to AliHLTHOMERSourceDesc object.
68 * @param state New (selected/not selected) state.
70 void SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
72 /** Get pointer to source List
73 * @return returns pointer to TList of sources
75 TList* GetSourceList() { return fSourceList; }
78 * ---------------------------------------------------------------------------------
79 * Connection Handling - public
80 * ---------------------------------------------------------------------------------
83 /** Connect to HOMER sources, out of Readout List, which gets created when state has changed
84 * @return 0 on sucess, "HOMER" errors on error
88 /** Disconnect from HOMER sources */
89 void DisconnectHOMER();
91 /** Reconnect from HOMER sources
92 * @return 0 on sucess, "ConnectHOMER()" errors on error
94 Int_t ReconnectHOMER();
97 * ---------------------------------------------------------------------------------
98 * Event Handling - public
99 * ---------------------------------------------------------------------------------
102 /** Loads the next Event, after being connected
103 * @return 0 on sucess, "HOMER" errors on error
108 * @return Returns eventID
110 ULong_t GetEventID() { return fEventID; }
112 /** Get pointer to block List
113 * @return returns pointer to TList of blocks
115 TList* GetBlockList() { return fBlockList; }
118 ///////////////////////////////////////////////////////////////////////////////////
122 ///////////////////////////////////////////////////////////////////////////////////
126 /** Dynamic loader manager for the HOMER library */
127 AliHLTHOMERLibManager* fLibManager; //! transient
133 * ---------------------------------------------------------------------------------
134 * Source Handling - private
135 * ---------------------------------------------------------------------------------
138 /** Get Information out of a TDS process in XML file
139 * @param xmlNode Pointer to childs of TDS node
140 * @return 0 on sucess, > 0 on error
142 Int_t GetTDSAttributes( TXMLNode * xmlNode );
144 /** Resolve Information of hostname and port for source which has to be used by HOMER
145 * ( due to port mapping inside the HLT )
146 * @param xmlHostname Hostname out of the XML
147 * @param xmlPort Port out of the XML
148 * @param hostname Return of the hostname
149 * @param port Return of the port
150 * @return 0 on sucess, 1 if hostname couldn't be resolved, 2 if port couldn't be resolved,
152 Int_t ResolveHostPortInformation( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port );
154 /** Resolve information of source
155 * @param xmlParent ParentString out of the XML
156 * @param source Return the filled AliHLTHOMERSourceDesc object
157 * @return 0 on sucess, 1 on error
159 Int_t ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc * source );
162 * ---------------------------------------------------------------------------------
163 * Connection Handling - private
164 * ---------------------------------------------------------------------------------
167 /** Create a readout list for Hostname and ports
168 * @param socurceHostnames Array of selected hostnames
169 * @param socurcePorts Array of selected ports
170 * @param socurceCount Number of selected hostname:port
172 void CreateReadoutList( const char** socurceHostnames, UShort_t* sourcePorts, UInt_t &sourceCount);
174 /** Checks if already connected to HOMER sources
175 * @return kTRUE or kFALSE, depending on connection state
177 Bool_t IsConnected() { return fConnected; }
179 /* ---------------------------------------------------------------------------------
180 * Event Handling - private
181 * ---------------------------------------------------------------------------------
184 /** Create a TList of blocks, which have been readout */
185 Int_t CreateBlockList();
188 * ---------------------------------------------------------------------------------
189 * Block Handling - private
190 * ---------------------------------------------------------------------------------
193 /** Get Number of blocks in current event
194 * @return returns number of blocks in current event
196 ULong_t GetNBlks() { return fNBlks; }
198 /** Get pointer to block ndx in current event
199 * @param ndx Block index
200 * @return returns pointer to blk, NULL if no block present
202 void* GetBlk( Int_t ndx );
204 /** Get pointer to current block in current event
205 * @param ndx Block index
206 * @return returns pointer to blk, NULL if no block present
208 void* GetBlk() { return GetBlk( fCurrentBlk ); }
210 /** Get first block in current event
211 * @return returns pointer to blk, NULL if no block present
213 void* GetFirstBlk() { return GetBlk( 0 ); }
215 /** Get next block in current event
216 * @return returns pointer to blk, NULL if no block present
218 void* GetNextBlk() { return GetBlk( ++fCurrentBlk ); }
220 /** Get size of block ndx
221 * @param ndx Block index
222 * @return returns pointer to blk, 0 if no block present
224 ULong_t GetBlkSize( Int_t ndx );
226 /** Get size of current block
227 * @param ndx Block index
228 * @return returns pointer to blk, 0 if no block present
230 ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }
232 /** Get origin of block ndx
233 * @param ndx Block index
234 * @return origin of block
236 TString GetBlkOrigin( Int_t ndx );
238 /** Get origin of current block
239 * @param ndx Block index
240 * @return origin of block
242 TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }
244 /** Get type of block ndx
245 * @param ndx Block index
246 * @return type of block
248 TString GetBlkType( Int_t ndx );
250 /** Get type of current block
251 * @param ndx Block index
252 * @return type of block
254 TString GetBlkType() { return GetBlkType( fCurrentBlk ); }
256 /** Get specification of block ndx
257 * @param ndx Block index
258 * @return specification of block
260 ULong_t GetBlkSpecification( Int_t ndx );
262 /** Get specification of current block
263 * @param ndx Block index
264 * @return specification of block
266 ULong_t GetBlkSpecification(){ return GetBlkSpecification( fCurrentBlk ); }
268 /** Checks if current Block should was requested
269 * @return returns kTRUE, if block should was requested
271 Bool_t CheckIfRequested( AliHLTHOMERBlockDesc* block );
274 * ---------------------------------------------------------------------------------
276 * ---------------------------------------------------------------------------------
281 /** XML input file */
282 TString fXMLFile; // see above
284 /** XML parser into DOM model */
285 TDOMParser* fXMLParser; //! transient
287 /** Root node of parsed config file */
288 TXMLNode * fRootNode; //! transient
292 /** List to HOMER sources */
293 TList * fSourceList; //! transient
298 /** Pointer to HOMER reader */
299 AliHLTHOMERReader* fReader; //! transient
303 /** List to HOMER blocks */
304 TList * fBlockList; //! transient
308 /** Number of blockes in current event */
309 ULong_t fNBlks; // see above
311 /** EventID of current event */
312 ULong64_t fEventID; // see above
314 /** Current block in current event */
315 ULong_t fCurrentBlk; // see above
319 /** Shows connection status */
320 Bool_t fConnected; // see above
322 /** Indicates, if a sources have changes,
323 * so that one has to reconnect .
325 Bool_t fStateHasChanged; // see above
327 ClassDef( AliEVEHOMERManager, 0 )