]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveHLT/AliEveHOMERManager.h
From Alexandru
[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 "AliEveHOMERSourceList.h"
31 #include "AliHLTHOMERSourceDesc.h"
32 #include "AliHLTHOMERBlockDesc.h"
33 #include "AliHLTHOMERReader.h"
34
35 #include "AliTPCPreprocessorOnline.h"
36
37
38 class AliHLTHOMERLibManager;
39
40 class AliEveHOMERManager : public TEveElementList
41 {
42 public:
43
44   /*
45    * ---------------------------------------------------------------------------------
46    *                            Constructor / Destructor
47    * ---------------------------------------------------------------------------------
48    */
49
50   /** constructor */
51   AliEveHOMERManager(TString xmlFile="" );
52
53   /** destructor */
54   virtual ~AliEveHOMERManager();
55
56   /*
57    * ---------------------------------------------------------------------------------
58    *                            Source Handling - public
59    * ---------------------------------------------------------------------------------
60    */
61
62   /** Create Sources List from HOMER-Proxy */
63   Int_t CreateHOMERSourcesList();
64
65   /** Set state of a source */
66   void SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
67
68   /** Get pointer to source List */
69   TList* GetSourceList() { return fSourceList; } // Get pointer to source List
70
71   /*
72    * ---------------------------------------------------------------------------------
73    *                            Connection Handling - public
74    * ---------------------------------------------------------------------------------
75    */
76
77   /** Connect to HOMER sources, out of Readout List, which gets created when state has changed */
78   Int_t ConnectHOMER();
79
80   /** Disconnect from HOMER sources */
81   void DisconnectHOMER();
82
83   /** Reconnect from HOMER sources */
84   Int_t ReconnectHOMER();
85
86   /*
87    * ---------------------------------------------------------------------------------
88    *                            Event Handling - public
89    * ---------------------------------------------------------------------------------
90    */
91
92   /** Loads the next Event, after being connected */
93   Int_t NextEvent();
94
95   /** Get event ID */
96   ULong_t GetEventID() { return fEventID; }    // Get event ID
97
98   /** Get pointer to block List */
99   TList* GetBlockList() { return fBlockList; } // Get pointer to block List
100   
101   /*
102    * ---------------------------------------------------------------------------------
103    *                            Test Realm ....
104    * ---------------------------------------------------------------------------------
105    */
106
107   /** Still under testing ... */
108   void DumpTPCCalib(TString objectName, Bool_t dumpToFile);
109
110   ///////////////////////////////////////////////////////////////////////////////////
111
112 protected:
113
114   AliHLTHOMERLibManager* fLibManager;             //! Dynamic loader manager for the HOMER library
115
116   ///////////////////////////////////////////////////////////////////////////////////
117
118 private:
119
120   AliEveHOMERManager(const AliEveHOMERManager&);            // Not implemented.
121   AliEveHOMERManager& operator=(const AliEveHOMERManager&); // Not implemented.
122
123   /*
124    * ---------------------------------------------------------------------------------
125    *                            Source Handling - private
126    * ---------------------------------------------------------------------------------
127    */
128
129   /** Get Information out of a TDS process in XML file */
130   Int_t GetTDSAttributes( TXMLNode * xmlNode );
131
132   /** Resolve Information of hostname and port for source which has to be used by HOMER */
133   Int_t ResolveHostPortInformation( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port );
134
135   /** Resolve information of source */
136   Int_t ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc * source );
137
138   /*
139    * ---------------------------------------------------------------------------------
140    *                            Connection Handling - private
141    * ---------------------------------------------------------------------------------
142    */
143
144   /** Create a readout list for Hostname and ports */
145   void CreateReadoutList( const char** socurceHostnames, UShort_t* sourcePorts, UInt_t &sourceCount);
146
147   /** Checks if already connected to HOMER sources */
148   Bool_t IsConnected() { return fConnected; }  // Checks if already connected to HOMER sources
149
150   /** Sets realm ( which can be ACR, GPN, HLT ) */ 
151   void SetRealm( TString s ) { fRealm = s; }   // Sets realm ( which can be ACR, GPN, HLT
152
153   /* ---------------------------------------------------------------------------------
154    *                            Event Handling - private
155    * ---------------------------------------------------------------------------------
156    */
157
158   /** Create a TList of blocks, which have been readout */
159   Int_t CreateBlockList();
160
161   /*
162    * ---------------------------------------------------------------------------------
163    *                            Block Handling - private
164    * ---------------------------------------------------------------------------------
165    */
166
167   /** Get Number of blocks in current event */
168   ULong_t GetNBlks() { return fNBlks; }                                        // Get Number of blocks in current event
169
170   /** Get pointer to block ndx in current event */
171   void* GetBlk( Int_t ndx );
172
173   /** Get pointer to current block in current event */
174   void* GetBlk() { return GetBlk( fCurrentBlk ); }                             // Get pointer to current block in current event
175
176   /** Get first block in current event */
177   void* GetFirstBlk() { return GetBlk( 0 ); }                                  // Get first block in current event
178
179   /** Get next block in current event */
180   void* GetNextBlk() { return GetBlk( ++fCurrentBlk ); }                       // Get next block in current event
181
182   /** Get size of block ndx */
183   ULong_t GetBlkSize( Int_t ndx );
184
185   /** Get size of current block */ 
186   ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }                   // Get size of current block 
187  
188   /** Get origin of block ndx */
189   TString GetBlkOrigin( Int_t ndx );
190
191   /** Get origin of current block */
192   TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }                // Get origin of current block
193
194   /** Get type of block ndx */
195   TString GetBlkType( Int_t ndx ); 
196
197   /** Get type of current block */
198   TString GetBlkType() { return GetBlkType( fCurrentBlk ); }                   // Get type of current block
199
200   /** Get specification of block ndx */
201   ULong_t GetBlkSpecification( Int_t ndx );
202
203   /** Get specification of current block */
204   ULong_t GetBlkSpecification() { return GetBlkSpecification( fCurrentBlk ); } // Get specification of current block
205
206   /** Checks if current Block should was requested */
207   Bool_t CheckIfRequested( AliHLTHOMERBlockDesc* block );
208
209   /*
210    * ---------------------------------------------------------------------------------
211    *                            Members - private
212    * ---------------------------------------------------------------------------------
213    */
214
215   // == XML parser ==
216   TString     fXMLFile;                           // XML input file
217   TDOMParser* fXMLParser;                         //! XML parser into DOM model
218   TXMLNode *  fRootNode;                          //! Root node of parsed config file
219
220   // == sources ==
221   TList * fSourceList;                            //! List to HOMER sources
222
223   // == connection ==
224   AliHLTHOMERReader* fReader;                     //! Pointer to HOMER reader
225   TString            fRealm;                      // Indicates the realm where AliEve can connect to ( HLT, GPN, ACR );
226
227   // == blocks ==
228   TList * fBlockList;                             //! List to HOMER blocks
229
230   // == events ==
231   ULong_t   fNBlks;                               // Number of blockes in current event
232   ULong64_t fEventID;                             // EventID of current event
233   ULong_t   fCurrentBlk;                          // Current block in current event
234
235   // == states ==
236   Bool_t fConnected;                              // Shows connection status
237   Bool_t fStateHasChanged;                        // Indicates, if a sources have changes, so that one has to reconnect.
238
239   // == sources ==
240   AliEveHOMERSourceList* fSrcList;                // List of HOMER Sources
241
242   //-----------------------------------------------------------------------------------------
243   AliTPCPreprocessorOnline* fTPCPre;              // Preprocessor for TPC calibration.
244
245   ClassDef(AliEveHOMERManager, 0); // Manage connections to HLT data-sources.
246 };
247
248 #endif