3 // $Id: AliHLTHOMERManager.h $
5 #ifndef ALIEVEHOMERMANGER_H
6 #define ALIEVEHOMERMANGER_H
8 /* This file is property of and copyright by the ALICE HLT Project *
9 * ALICE Experiment at CERN, All rights reserved. *
10 * See cxx source for full Copyright notice
13 /** @file AliHLTHOMERManager.h
14 @author Jochen Thaeder
16 @brief Manager for HOMER in aliroot
23 #include "AliHLTHOMERSourceDesc.h"
24 #include "AliHLTHOMERBlockDesc.h"
25 #include "AliHLTHOMERReader.h"
26 #include "AliHLTHOMERProxyHandler.h"
28 #include "AliHLTLogging.h"
30 class AliHLTHOMERLibManager;
33 * @class AliHLTHOMERManager
34 * This Class should handle the communication
35 * from the HLT to aliroot. The HLT sends data via
36 * the HOMER interface on several TCP ports of nodes
37 * in the CERN GPN and DCS network.
38 * All this communication is hidden from the user.
40 * Right now, a xml file ( SCC1 ) is used to get the
41 * configuration, this will/ has to change to a proxy
42 * running on dedicated nodes.
44 * @ingroup alihlt_homer
47 class AliHLTHOMERManager : public TObject, public AliHLTLogging {
51 * ---------------------------------------------------------------------------------
52 * Constructor / Destructor
53 * ---------------------------------------------------------------------------------
56 /** default constructor */
60 virtual ~AliHLTHOMERManager();
63 * @return 0 on success, <0 for failure
68 * ---------------------------------------------------------------------------------
69 * Source Handling - public
70 * ---------------------------------------------------------------------------------
73 /** Create Sources List from HOMER-Proxy
74 * @return 0 on success, <0 for failure
76 virtual Int_t CreateSourcesList();
78 /** Set state of a source
79 * @param source Pointer to AliHLTHOMERSourceDesc object.
80 * @param state New (selected/not selected) state.
82 void SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
84 /** Get pointer to source List */
85 TList* GetSourceList() { return fSourceList; }
88 * ---------------------------------------------------------------------------------
89 * Connection Handling - public
90 * ---------------------------------------------------------------------------------
93 /** Connect to HOMER sources, of a certain detector.
94 * which gets created when state has changed
95 * @param detector Detector to be connected to
96 * @return 0 on success, <0 for failure
98 Int_t ConnectHOMER( TString detector );
100 /** Disconnect from HOMER sources */
101 void DisconnectHOMER();
103 /** Reconnect from HOMER sources
104 * @param detector Detector to be connected to
105 * @return 0 on success, <0 for failure
107 Int_t ReconnectHOMER( TString detector);
110 * ---------------------------------------------------------------------------------
111 * Event Handling - public
112 * ---------------------------------------------------------------------------------
115 /** Loads the next Event, after being connected
116 * @return 0 on success, <0 for failure
118 virtual Int_t NextEvent();
120 /** Loads the next Cycle, after being connected
121 * @return 0 on success, <0 for failure
123 virtual Int_t NextCycle() { return NextEvent(); }
126 ULong_t GetEventID() { return fEventID; } // Get event ID
128 /** Get pointer to block List */
129 TList* GetBlockList() { return fBlockList; } // Get pointer to block List
131 ///////////////////////////////////////////////////////////////////////////////////
135 /** Dynamic loader manager for the HOMER library */
136 AliHLTHOMERLibManager* fLibManager; //! transient
138 ///////////////////////////////////////////////////////////////////////////////////
142 /** copy constructor prohibited */
143 AliHLTHOMERManager(const AliHLTHOMERManager&);
145 /** assignment operator prohibited */
146 AliHLTHOMERManager& operator=(const AliHLTHOMERManager&);
149 * ---------------------------------------------------------------------------------
150 * Connection Handling - private
151 * ---------------------------------------------------------------------------------
154 /** Create a readout list for Hostname and ports
155 * @param socurceHostnames Array of selected hostnames
156 * @param socurcePorts Array of selected ports
157 * @param socurceCount Number of selected hostname:port
158 * @param detector detector to be selected
160 void CreateReadoutList( const char** sourceHostnames, UShort_t* sourcePorts,
161 UInt_t &sourceCount, TString detector );
163 /** Checks if already connected to HOMER sources */
164 Bool_t IsConnected() { return fConnected; }
166 /* ---------------------------------------------------------------------------------
167 * Event Handling - private
168 * ---------------------------------------------------------------------------------
171 /** Create a TList of blocks, which have been readout */
172 void CreateBlockList();
175 * ---------------------------------------------------------------------------------
176 * Block Handling - private
177 * ---------------------------------------------------------------------------------
180 /** Get Number of blocks in current event */
181 ULong_t GetNBlks() { return fNBlks; }
183 // ----------------------------------------------------
185 /** Get pointer to block ndx in current event
186 * @param ndx Block index
187 * @return returns pointer to blk, NULL if no block present
189 void* GetBlk( Int_t ndx );
191 /** Get pointer to current block in current event */
192 void* GetBlk() { return GetBlk(fCurrentBlk); }
194 /** Get first block in current event */
195 void* GetFirstBlk() { fCurrentBlk=0; return GetBlk(0); }
197 /** Get next block in current event */
198 void* GetNextBlk() { return GetBlk(++fCurrentBlk); }
200 // ----------------------------------------------------
202 /** Get size of block ndx
203 * @param ndx Block index
204 * @return returns size blk, 0 otherwise
206 ULong_t GetBlkSize( Int_t ndx );
208 /** Get size of current block */
209 ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }
211 // ----------------------------------------------------
213 /** Get origin of block ndx
214 * @param ndx Block index
215 * @return origin of block
217 TString GetBlkOrigin( Int_t ndx );
219 /** Get origin of current block */
220 TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }
222 // ----------------------------------------------------
224 /** Get type of block ndx
225 * @param ndx Block index
226 * @return type of block
228 TString GetBlkType( Int_t ndx );
230 /** Get type of current block */
231 TString GetBlkType() { return GetBlkType( fCurrentBlk ); }
233 // ----------------------------------------------------
235 /** Get specification of block ndx
236 * @param ndx Block index
237 * @return specification of block
239 ULong_t GetBlkSpecification( Int_t ndx );
241 /** Get specification of current block */
242 ULong_t GetBlkSpecification() { return GetBlkSpecification( fCurrentBlk ); }
244 // ----------------------------------------------------
246 /** Checks if current Block should was requested
247 * @return returns kTRUE, if block should was requested
249 Bool_t CheckIfRequested( AliHLTHOMERBlockDesc* block );
252 * ---------------------------------------------------------------------------------
254 * ---------------------------------------------------------------------------------
257 /** Proxy Handler to get the list of sources */
258 AliHLTHOMERProxyHandler *fProxyHandler; //! transient
262 /** Pointer to HOMER reader */
263 AliHLTHOMERReader* fReader; //! transient
267 /** List to HOMER sources */
268 TList *fSourceList; //! transient
272 /** List to HOMER blocks */
273 TList *fBlockList; //! transient
277 /** Number of blockes in current event */
278 ULong_t fNBlks; // see above
280 /** EventID of current event */
281 ULong64_t fEventID; // see above
283 /** Current block in current event */
284 ULong_t fCurrentBlk; // see above
288 /** Shows connection status */
289 Bool_t fConnected; // see above
291 /** Indicates, if a sources have changes,
292 * so that one has to reconnect. */
293 Bool_t fStateHasChanged; // see above
295 ClassDef(AliHLTHOMERManager, 0); // Manage connections to HLT data-sources.