Fix in order to eliminate SSD overlaps (E. Cattaruzza)
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHOMERManager.h
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
a15e6d7d 9
059c30e4 10//-*- Mode: C++ -*-
11#ifndef ALIEVEHOMERMANGER_H
12#define ALIEVEHOMERMANGER_H
13
14/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
15 * See cxx source for full Copyright notice */
16
d810d0de 17/** @file AliEveHOMERManager.h
059c30e4 18 @author Jochen Thaeder
51346b82 19 @date
059c30e4 20 @brief Manager for HOMER in offline
21*/
22
84aff7a4 23#include <TEveElement.h>
059c30e4 24
25#include "TString.h"
26#include "TDOMParser.h"
27#include "TXMLNode.h"
28#include "TList.h"
29
30#include "AliHLTHOMERSourceDesc.h"
31#include "AliHLTHOMERBlockDesc.h"
32#include "AliHLTHOMERReader.h"
6612c5b3 33
34#include "AliTPCPreprocessorOnline.h"
35
36
059c30e4 37class AliHLTHOMERLibManager;
38
39/**
d810d0de 40 * @class AliEveHOMERManager
51346b82 41 *
d810d0de 42 * This class is the main class of the AliEveHOMERManager
059c30e4 43 * ... more to come
44 *
45 * @ingroup alihlt_homer
46 */
47
d810d0de 48class AliEveHOMERManager : public TEveElementList
059c30e4 49{
fd31e9de 50private:
51 AliEveHOMERManager(const AliEveHOMERManager&); // Not implemented.
52 AliEveHOMERManager& operator=(const AliEveHOMERManager&); // Not implemented.
53
059c30e4 54public:
55
56 /*
57 * ---------------------------------------------------------------------------------
51346b82 58 * Constructor / Destructor
59 * ---------------------------------------------------------------------------------
059c30e4 60 */
61
51346b82 62 /** constructor
059c30e4 63 * @param argc Number of command line arguments.
64 * @param argv Array of command line arguments.
65 */
51346b82 66 AliEveHOMERManager(TString xmlFile="" );
059c30e4 67 /** destructor */
d810d0de 68 virtual ~AliEveHOMERManager();
059c30e4 69
70 /*
71 * ---------------------------------------------------------------------------------
72 * Source Handling - public
51346b82 73 * ---------------------------------------------------------------------------------
059c30e4 74 */
51346b82 75
059c30e4 76 /** Create Sources List from HOMER-Proxy */
77 Int_t CreateHOMERSourcesList();
78
79 /** Set state of a source
80 * @param source Pointer to AliHLTHOMERSourceDesc object.
81 * @param state New (selected/not selected) state.
82 */
51346b82 83 void SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
059c30e4 84
85 /** Get pointer to source List
86 * @return returns pointer to TList of sources
87 */
88 TList* GetSourceList() { return fSourceList; }
89
90 /*
91 * ---------------------------------------------------------------------------------
92 * Connection Handling - public
51346b82 93 * ---------------------------------------------------------------------------------
059c30e4 94 */
51346b82 95
059c30e4 96 /** Connect to HOMER sources, out of Readout List, which gets created when state has changed
51346b82 97 * @return 0 on sucess, "HOMER" errors on error
059c30e4 98 */
99 Int_t ConnectHOMER();
100
101 /** Disconnect from HOMER sources */
102 void DisconnectHOMER();
103
104 /** Reconnect from HOMER sources
105 * @return 0 on sucess, "ConnectHOMER()" errors on error
106 */
107 Int_t ReconnectHOMER();
108
109 /*
110 * ---------------------------------------------------------------------------------
16718cdc 111 * Event Handling - public
51346b82 112 * ---------------------------------------------------------------------------------
059c30e4 113 */
114
16718cdc 115 /** Loads the next Event, after being connected
51346b82 116 * @return 0 on sucess, "HOMER" errors on error
059c30e4 117 */
118 Int_t NextEvent();
51346b82 119
059c30e4 120 /** Get event ID
121 * @return Returns eventID
122 */
123 ULong_t GetEventID() { return fEventID; }
124
125 /** Get pointer to block List
126 * @return returns pointer to TList of blocks
127 */
128 TList* GetBlockList() { return fBlockList; }
129
130
131 ///////////////////////////////////////////////////////////////////////////////////
132
6612c5b3 133 void SelectRawTPC();
134 void SelectClusterTPC();
135 void SelectESDTPC();
136
059c30e4 137 void TestSelect();
6612c5b3 138 void TestSelectClass( TString objectName );
139
140 void DumpTPCCalib(TString objectName, Bool_t dumpToFile);
059c30e4 141
142 ///////////////////////////////////////////////////////////////////////////////////
143
144protected:
145
146 /** Dynamic loader manager for the HOMER library */
147 AliHLTHOMERLibManager* fLibManager; //! transient
51346b82 148
059c30e4 149
150private:
151
152 /*
153 * ---------------------------------------------------------------------------------
154 * Source Handling - private
51346b82 155 * ---------------------------------------------------------------------------------
059c30e4 156 */
51346b82 157
059c30e4 158 /** Get Information out of a TDS process in XML file
159 * @param xmlNode Pointer to childs of TDS node
51346b82 160 * @return 0 on sucess, > 0 on error
059c30e4 161 */
162 Int_t GetTDSAttributes( TXMLNode * xmlNode );
163
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
51346b82 170 * @return 0 on sucess, 1 if hostname couldn't be resolved, 2 if port couldn't be resolved,
059c30e4 171 */
172 Int_t ResolveHostPortInformation( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port );
173
51346b82 174 /** Resolve information of source
059c30e4 175 * @param xmlParent ParentString out of the XML
176 * @param source Return the filled AliHLTHOMERSourceDesc object
177 * @return 0 on sucess, 1 on error
178 */
179 Int_t ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc * source );
180
181 /*
182 * ---------------------------------------------------------------------------------
183 * Connection Handling - private
51346b82 184 * ---------------------------------------------------------------------------------
059c30e4 185 */
51346b82 186
187 /** Create a readout list for Hostname and ports
059c30e4 188 * @param socurceHostnames Array of selected hostnames
189 * @param socurcePorts Array of selected ports
190 * @param socurceCount Number of selected hostname:port
191 */
192 void CreateReadoutList( const char** socurceHostnames, UShort_t* sourcePorts, UInt_t &sourceCount);
193
194 /** Checks if already connected to HOMER sources
195 * @return kTRUE or kFALSE, depending on connection state
196 */
197 Bool_t IsConnected() { return fConnected; }
198
199 /* ---------------------------------------------------------------------------------
d810d0de 200 * Eve AliEveHOMERManager::foo(nt Handling - private
51346b82 201 * ---------------------------------------------------------------------------------
059c30e4 202 */
51346b82 203
059c30e4 204 /** Create a TList of blocks, which have been readout */
205 Int_t CreateBlockList();
206
207 /*
208 * ---------------------------------------------------------------------------------
209 * Block Handling - private
51346b82 210 * ---------------------------------------------------------------------------------
059c30e4 211 */
212
213 /** Get Number of blocks in current event
214 * @return returns number of blocks in current event
215 */
216 ULong_t GetNBlks() { return fNBlks; }
217
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
221 */
222 void* GetBlk( Int_t ndx );
223
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
227 */
228 void* GetBlk() { return GetBlk( fCurrentBlk ); }
229
230 /** Get first block in current event
231 * @return returns pointer to blk, NULL if no block present
232 */
233 void* GetFirstBlk() { return GetBlk( 0 ); }
234
235 /** Get next block in current event
236 * @return returns pointer to blk, NULL if no block present
237 */
238 void* GetNextBlk() { return GetBlk( ++fCurrentBlk ); }
239
240 /** Get size of block ndx
241 * @param ndx Block index
242 * @return returns pointer to blk, 0 if no block present
243 */
244 ULong_t GetBlkSize( Int_t ndx );
245
246 /** Get size of current block
247 * @param ndx Block index
248 * @return returns pointer to blk, 0 if no block present
249 */
250 ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }
51346b82 251
059c30e4 252 /** Get origin of block ndx
253 * @param ndx Block index
254 * @return origin of block
255 */
51346b82 256 TString GetBlkOrigin( Int_t ndx );
257
059c30e4 258 /** Get origin of current block
259 * @param ndx Block index
260 * @return origin of block
261 */
262 TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }
263
264 /** Get type of block ndx
265 * @param ndx Block index
266 * @return type of block
267 */
268 TString GetBlkType( Int_t ndx );
269
270 /** Get type of current block
271 * @param ndx Block index
272 * @return type of block
273 */
274 TString GetBlkType() { return GetBlkType( fCurrentBlk ); }
275
276 /** Get specification of block ndx
277 * @param ndx Block index
278 * @return specification of block
279 */
280 ULong_t GetBlkSpecification( Int_t ndx );
281
282 /** Get specification of current block
283 * @param ndx Block index
284 * @return specification of block
51346b82 285 */
059c30e4 286 ULong_t GetBlkSpecification(){ return GetBlkSpecification( fCurrentBlk ); }
287
288 /** Checks if current Block should was requested
289 * @return returns kTRUE, if block should was requested
290 */
291 Bool_t CheckIfRequested( AliHLTHOMERBlockDesc* block );
292
293 /*
294 * ---------------------------------------------------------------------------------
295 * Members - private
51346b82 296 * ---------------------------------------------------------------------------------
059c30e4 297 */
298
299 // == XML parser ==
300
a15e6d7d 301 /** */
302 TString fXMLFile; // XML input file
059c30e4 303
a15e6d7d 304 /** */
305 TDOMParser* fXMLParser; //! XML parser into DOM model
51346b82 306
a15e6d7d 307 /** */
308 TXMLNode * fRootNode; //! Root node of parsed config file
059c30e4 309
310 // == sources ==
311
a15e6d7d 312 /** */
313 TList * fSourceList; //! List to HOMER sources
059c30e4 314
315 // == connection ==
51346b82 316
059c30e4 317
a15e6d7d 318 /** */
319 AliHLTHOMERReader* fReader; //! Pointer to HOMER reader
059c30e4 320
321 // == blocks ==
322
a15e6d7d 323 /** */
324 TList * fBlockList; //! List to HOMER blocks
059c30e4 325
326 // == events ==
51346b82 327
a15e6d7d 328 /** */
329 ULong_t fNBlks; // Number of blockes in current event
059c30e4 330
a15e6d7d 331 /** */
332 ULong64_t fEventID; // EventID of current event
059c30e4 333
a15e6d7d 334 /** */
335 ULong_t fCurrentBlk; // Current block in current event
51346b82 336
059c30e4 337 // == states ==
338
a15e6d7d 339 /** */
340 Bool_t fConnected; // Shows connection status
059c30e4 341
a15e6d7d 342 /** .
059c30e4 343 */
a15e6d7d 344 Bool_t fStateHasChanged; // Indicates, if a sources have changes, so that one has to reconnect.
059c30e4 345
6612c5b3 346
347 //----
348
a15e6d7d 349 AliTPCPreprocessorOnline* fTPCPre; // Preprocessor for TPC calibration.
6612c5b3 350
a15e6d7d 351 ClassDef(AliEveHOMERManager, 0); // Manage connections to HLT data-sources.
059c30e4 352};
353
354#endif