]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveHLT/AliEveHOMERManager.h
d078ded9c3b461a612b4704e4ef95a166bdd028e
[u/mrichter/AliRoot.git] / EVE / EveHLT / 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
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
17 /** @file   AliEveHOMERManager.h
18     @author Jochen Thaeder
19     @date
20     @brief  Manager for HOMER in offline
21 */
22
23 #include <TEveElement.h>
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"
33
34 #include "AliTPCPreprocessorOnline.h"
35
36
37 class AliHLTHOMERLibManager;
38
39 /**
40  * @class AliEveHOMERManager
41  *
42  * This class is the main class of the AliEveHOMERManager
43  * ... more to come
44  *
45  * @ingroup alihlt_homer
46  */
47
48 class AliEveHOMERManager : public TEveElementList
49 {
50 private:
51   AliEveHOMERManager(const AliEveHOMERManager&);            // Not implemented.
52   AliEveHOMERManager& operator=(const AliEveHOMERManager&); // Not implemented.
53
54 public:
55
56   /*
57    * ---------------------------------------------------------------------------------
58    *                            Constructor / Destructor
59    * ---------------------------------------------------------------------------------
60    */
61
62   /** constructor
63    * @param argc    Number of command line arguments.
64    * @param argv    Array of command line arguments.
65    */
66   AliEveHOMERManager(TString xmlFile="" );
67   /** destructor */
68   virtual ~AliEveHOMERManager();
69
70   /*
71    * ---------------------------------------------------------------------------------
72    *                            Source Handling - public
73    * ---------------------------------------------------------------------------------
74    */
75
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    */
83   void SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
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
93    * ---------------------------------------------------------------------------------
94    */
95
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
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    * ---------------------------------------------------------------------------------
111    *                            Event Handling - public
112    * ---------------------------------------------------------------------------------
113    */
114
115   /** Loads the next Event, after being connected
116    * @return            0 on sucess, "HOMER" errors on error
117    */
118   Int_t NextEvent();
119
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
133   void SelectRawTPC();
134   void SelectClusterTPC();
135   void SelectESDTPC();
136
137   void TestSelect();
138   void TestSelectClass( TString objectName );
139
140   void DumpTPCCalib(TString objectName, Bool_t dumpToFile);
141
142   ///////////////////////////////////////////////////////////////////////////////////
143
144 protected:
145
146   /** Dynamic loader manager for the HOMER library */
147   AliHLTHOMERLibManager* fLibManager;             //! transient
148
149
150 private:
151
152   /*
153    * ---------------------------------------------------------------------------------
154    *                            Source Handling - private
155    * ---------------------------------------------------------------------------------
156    */
157
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
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
170    * @return             0 on sucess, 1 if hostname couldn't be resolved, 2 if port couldn't be resolved,
171    */
172   Int_t ResolveHostPortInformation( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port );
173
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
178    */
179   Int_t ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc * source );
180
181   /*
182    * ---------------------------------------------------------------------------------
183    *                            Connection Handling - private
184    * ---------------------------------------------------------------------------------
185    */
186
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
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   /* ---------------------------------------------------------------------------------
200    *                            Eve AliEveHOMERManager::foo(nt Handling - private
201    * ---------------------------------------------------------------------------------
202    */
203
204   /** Create a TList of blocks, which have been readout */
205   Int_t CreateBlockList();
206
207   /*
208    * ---------------------------------------------------------------------------------
209    *                            Block Handling - private
210    * ---------------------------------------------------------------------------------
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 ); }
251
252   /** Get origin of block ndx
253    * @param ndx        Block index
254    * @return           origin of block
255    */
256   TString GetBlkOrigin( Int_t ndx );
257
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
285    */
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
296    * ---------------------------------------------------------------------------------
297    */
298
299   // == XML parser ==
300
301   /**    */
302   TString fXMLFile;                               // XML input file
303
304   /**  */
305   TDOMParser* fXMLParser;                         //! XML parser into DOM model
306
307   /**  */
308   TXMLNode * fRootNode;                           //! Root node of parsed config file
309
310   // == sources ==
311
312   /**  */
313   TList * fSourceList;                            //! List to HOMER sources
314
315   // == connection ==
316
317
318   /**  */
319   AliHLTHOMERReader* fReader;                     //! Pointer to HOMER reader
320
321   // == blocks ==
322
323   /**  */
324   TList * fBlockList;                             //! List to HOMER blocks
325
326   // == events ==
327
328   /**  */
329   ULong_t fNBlks;                                 // Number of blockes in current event
330
331   /**  */
332   ULong64_t fEventID;                             // EventID of current event
333
334   /**  */
335   ULong_t fCurrentBlk;                            // Current block in current event
336
337   // == states ==
338
339   /**  */
340   Bool_t fConnected;                              // Shows connection status
341
342   /**  .
343    */
344   Bool_t fStateHasChanged;                        // Indicates, if a sources have changes, so that one has to reconnect.
345
346
347   //----
348
349   AliTPCPreprocessorOnline* fTPCPre;              // Preprocessor for TPC calibration.
350
351   ClassDef(AliEveHOMERManager, 0); // Manage connections to HLT data-sources.
352 };
353
354 #endif