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