2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
11 #ifndef ALIEVEHOMERMANGER_H
12 #define ALIEVEHOMERMANGER_H
14 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
15 * See cxx source for full Copyright notice */
17 /** @file AliEveHOMERManager.h
18 @author Jochen Thaeder
20 @brief Manager for HOMER in offline
23 #include <TEveElement.h>
26 #include "TDOMParser.h"
30 #include "AliHLTHOMERSourceDesc.h"
31 #include "AliHLTHOMERBlockDesc.h"
32 #include "AliHLTHOMERReader.h"
34 #include "AliTPCPreprocessorOnline.h"
37 class AliHLTHOMERLibManager;
40 * @class AliEveHOMERManager
42 * This class is the main class of the AliEveHOMERManager
45 * @ingroup alihlt_homer
48 class AliEveHOMERManager : public TEveElementList
51 AliEveHOMERManager(const AliEveHOMERManager&); // Not implemented.
52 AliEveHOMERManager& operator=(const AliEveHOMERManager&); // Not implemented.
57 * ---------------------------------------------------------------------------------
58 * Constructor / Destructor
59 * ---------------------------------------------------------------------------------
63 * @param argc Number of command line arguments.
64 * @param argv Array of command line arguments.
66 AliEveHOMERManager(TString xmlFile="" );
68 virtual ~AliEveHOMERManager();
71 * ---------------------------------------------------------------------------------
72 * Source Handling - public
73 * ---------------------------------------------------------------------------------
76 /** Create Sources List from HOMER-Proxy */
77 Int_t CreateHOMERSourcesList();
79 /** Set state of a source
80 * @param source Pointer to AliHLTHOMERSourceDesc object.
81 * @param state New (selected/not selected) state.
83 void SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
85 /** Get pointer to source List
86 * @return returns pointer to TList of sources
88 TList* GetSourceList() { return fSourceList; }
91 * ---------------------------------------------------------------------------------
92 * Connection Handling - public
93 * ---------------------------------------------------------------------------------
96 /** Connect to HOMER sources, out of Readout List, which gets created when state has changed
97 * @return 0 on sucess, "HOMER" errors on error
101 /** Disconnect from HOMER sources */
102 void DisconnectHOMER();
104 /** Reconnect from HOMER sources
105 * @return 0 on sucess, "ConnectHOMER()" errors on error
107 Int_t ReconnectHOMER();
110 * ---------------------------------------------------------------------------------
111 * Event Handling - public
112 * ---------------------------------------------------------------------------------
115 /** Loads the next Event, after being connected
116 * @return 0 on sucess, "HOMER" errors on error
121 * @return Returns eventID
123 ULong_t GetEventID() { return fEventID; }
125 /** Get pointer to block List
126 * @return returns pointer to TList of blocks
128 TList* GetBlockList() { return fBlockList; }
131 ///////////////////////////////////////////////////////////////////////////////////
134 void SelectClusterTPC();
138 void TestSelectClass( TString objectName );
140 void DumpTPCCalib(TString objectName, Bool_t dumpToFile);
142 ///////////////////////////////////////////////////////////////////////////////////
146 /** Dynamic loader manager for the HOMER library */
147 AliHLTHOMERLibManager* fLibManager; //! transient
153 * ---------------------------------------------------------------------------------
154 * Source Handling - private
155 * ---------------------------------------------------------------------------------
158 /** Get Information out of a TDS process in XML file
159 * @param xmlNode Pointer to childs of TDS node
160 * @return 0 on sucess, > 0 on error
162 Int_t GetTDSAttributes( TXMLNode * xmlNode );
164 /** Resolve Information of hostname and port for source which has to be used by HOMER
165 * ( due to port mapping inside the HLT )
166 * @param xmlHostname Hostname out of the XML
167 * @param xmlPort Port out of the XML
168 * @param hostname Return of the hostname
169 * @param port Return of the port
170 * @return 0 on sucess, 1 if hostname couldn't be resolved, 2 if port couldn't be resolved,
172 Int_t ResolveHostPortInformation( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port );
174 /** Resolve information of source
175 * @param xmlParent ParentString out of the XML
176 * @param source Return the filled AliHLTHOMERSourceDesc object
177 * @return 0 on sucess, 1 on error
179 Int_t ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc * source );
182 * ---------------------------------------------------------------------------------
183 * Connection Handling - private
184 * ---------------------------------------------------------------------------------
187 /** Create a readout list for Hostname and ports
188 * @param socurceHostnames Array of selected hostnames
189 * @param socurcePorts Array of selected ports
190 * @param socurceCount Number of selected hostname:port
192 void CreateReadoutList( const char** socurceHostnames, UShort_t* sourcePorts, UInt_t &sourceCount);
194 /** Checks if already connected to HOMER sources
195 * @return kTRUE or kFALSE, depending on connection state
197 Bool_t IsConnected() { return fConnected; }
199 /* ---------------------------------------------------------------------------------
200 * Eve AliEveHOMERManager::foo(nt Handling - private
201 * ---------------------------------------------------------------------------------
204 /** Create a TList of blocks, which have been readout */
205 Int_t CreateBlockList();
208 * ---------------------------------------------------------------------------------
209 * Block Handling - private
210 * ---------------------------------------------------------------------------------
213 /** Get Number of blocks in current event
214 * @return returns number of blocks in current event
216 ULong_t GetNBlks() { return fNBlks; }
218 /** Get pointer to block ndx in current event
219 * @param ndx Block index
220 * @return returns pointer to blk, NULL if no block present
222 void* GetBlk( Int_t ndx );
224 /** Get pointer to current block in current event
225 * @param ndx Block index
226 * @return returns pointer to blk, NULL if no block present
228 void* GetBlk() { return GetBlk( fCurrentBlk ); }
230 /** Get first block in current event
231 * @return returns pointer to blk, NULL if no block present
233 void* GetFirstBlk() { return GetBlk( 0 ); }
235 /** Get next block in current event
236 * @return returns pointer to blk, NULL if no block present
238 void* GetNextBlk() { return GetBlk( ++fCurrentBlk ); }
240 /** Get size of block ndx
241 * @param ndx Block index
242 * @return returns pointer to blk, 0 if no block present
244 ULong_t GetBlkSize( Int_t ndx );
246 /** Get size of current block
247 * @param ndx Block index
248 * @return returns pointer to blk, 0 if no block present
250 ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }
252 /** Get origin of block ndx
253 * @param ndx Block index
254 * @return origin of block
256 TString GetBlkOrigin( Int_t ndx );
258 /** Get origin of current block
259 * @param ndx Block index
260 * @return origin of block
262 TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }
264 /** Get type of block ndx
265 * @param ndx Block index
266 * @return type of block
268 TString GetBlkType( Int_t ndx );
270 /** Get type of current block
271 * @param ndx Block index
272 * @return type of block
274 TString GetBlkType() { return GetBlkType( fCurrentBlk ); }
276 /** Get specification of block ndx
277 * @param ndx Block index
278 * @return specification of block
280 ULong_t GetBlkSpecification( Int_t ndx );
282 /** Get specification of current block
283 * @param ndx Block index
284 * @return specification of block
286 ULong_t GetBlkSpecification(){ return GetBlkSpecification( fCurrentBlk ); }
288 /** Checks if current Block should was requested
289 * @return returns kTRUE, if block should was requested
291 Bool_t CheckIfRequested( AliHLTHOMERBlockDesc* block );
294 * ---------------------------------------------------------------------------------
296 * ---------------------------------------------------------------------------------
302 TString fXMLFile; // XML input file
305 TDOMParser* fXMLParser; //! XML parser into DOM model
308 TXMLNode * fRootNode; //! Root node of parsed config file
313 TList * fSourceList; //! List to HOMER sources
319 AliHLTHOMERReader* fReader; //! Pointer to HOMER reader
324 TList * fBlockList; //! List to HOMER blocks
329 ULong_t fNBlks; // Number of blockes in current event
332 ULong64_t fEventID; // EventID of current event
335 ULong_t fCurrentBlk; // Current block in current event
340 Bool_t fConnected; // Shows connection status
344 Bool_t fStateHasChanged; // Indicates, if a sources have changes, so that one has to reconnect.
349 AliTPCPreprocessorOnline* fTPCPre; // Preprocessor for TPC calibration.
351 ClassDef(AliEveHOMERManager, 0); // Manage connections to HLT data-sources.