LCOV - code coverage report
Current view: top level - HLT/BASE - AliHLTHOMERManager.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 19 5.3 %
Date: 2016-06-14 17:26:59 Functions: 1 23 4.3 %

          Line data    Source code
       1             : //-*- Mode: C++ -*-
       2             : 
       3             : // $Id$
       4             : 
       5             : #ifndef ALIHLTHOMERMANAGER_H
       6             : #define ALIHLTHOMERMANAGER_H
       7             : 
       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     
      11             :  */
      12             : 
      13             : /** @file   AliHLTHOMERManager.h
      14             :     @author Jochen Thaeder
      15             :     @author Svein Lindal <slindal@fys.uio.no>
      16             :     @date   October 2010
      17             :     @brief  Manager for HOMER in aliroot
      18             : */
      19             : 
      20             : 
      21             : #include "TClonesArray.h"
      22             : #include "TString.h"
      23             : #include "TList.h"
      24             : 
      25             : #include "AliHLTHOMERSourceDesc.h"
      26             : #include "AliHLTHOMERBlockDesc.h"
      27             : #include "AliHLTHOMERReader.h"
      28             : #include "AliHLTHOMERProxyHandler.h"
      29             : 
      30             : #include "AliHLTLoggingVariadicFree.h"
      31             : 
      32             : #define BUFFERSIZE 15
      33             : 
      34             : class AliHLTHOMERLibManager;
      35             : 
      36             : /**
      37             :  * @class AliHLTHOMERManager
      38             :  * This Class should handle the communication
      39             :  * from the HLT to aliroot. The HLT sends data via 
      40             :  * the HOMER interface on several TCP ports of nodes 
      41             :  * in the CERN GPN and DCS network.
      42             :  * All this communication is hidden from the user.
      43             :  * 
      44             :  * Right now, a xml file ( SCC1 ) is used to get the
      45             :  * configuration, this will/ has to change to a proxy
      46             :  * running on dedicated nodes.
      47             :  *
      48             :  * @ingroup alihlt_homer
      49             :  */
      50             : 
      51             : class AliHLTHOMERManager : public AliHLTLogging 
      52             : {
      53             : public:
      54             :   
      55             :   /** default constructor */
      56             :   AliHLTHOMERManager();
      57             : 
      58             :   /** destructor */
      59             :   virtual ~AliHLTHOMERManager();
      60             : 
      61             :   /** Initialize */
      62             :   Int_t Initialize();
      63             : 
      64             :   /** Create Sources List from HOMER-Proxy */
      65             :   virtual Int_t CreateSourcesList();
      66             : 
      67             :   /** Set state of a source */
      68             :   void   SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
      69             : 
      70             :   /** Get pointer to source List */
      71           0 :   TList* GetSourceList() { return fSourceList; }
      72             : 
      73             :   /** Connect to HOMER sources, of a certain detector. */
      74             :   Int_t ConnectHOMER( TString detector="ALL" );
      75             : 
      76             :   /** Disconnect from HOMER sources */
      77             :   void  DisconnectHOMER();
      78             : 
      79             :   /** Reconnect from HOMER sources */
      80             :   Int_t ReconnectHOMER( TString detector);
      81             : 
      82             : 
      83             :   /** Loads the next Event, after being connected */
      84             :   virtual Int_t NextEvent();
      85             : 
      86             :   /** Loads the next Cycle, after being connected */
      87           0 :   virtual Int_t NextCycle() { return NextEvent(); }
      88             : 
      89             :   /** Get event ID */
      90           0 :   ULong_t GetEventID() { return fEventId; }
      91             : 
      92           0 :   Int_t GetNAvailableEvents() { return fNEventsAvailable;}
      93             :   
      94             :   /** Get pointer to last requested BlockList */
      95           0 :   TList* GetBlockList() { return fBlockList; }
      96           0 :   TList* GetAsyncBlockList() { return fAsyncBlockList; }
      97             : 
      98             :   /** Navigate backwards in event buffer */
      99             :   Int_t  NavigateEventBufferBack();
     100             : 
     101             :   /** Navigate forwards in event buffer */
     102             :   Int_t  NavigateEventBufferFwd();
     103             : 
     104             :   /** Set and get the string used to select triggers */
     105           0 :   void SetTriggerString ( TString triggerString ) { fTriggerString = triggerString; }
     106             : 
     107             :   /** Get TriggerString */
     108           0 :   TString GetTriggerString () { return fTriggerString; }
     109             : 
     110           0 :   void SetBlockOwner(Bool_t owner) { fBlockList->SetOwner(owner); }
     111           0 :   Bool_t GetBlockOwner() const { return fBlockList->IsOwner(); }
     112             : 
     113             : protected:
     114             : 
     115             :   /** Dynamic loader manager for the HOMER library */
     116             :   AliHLTHOMERLibManager* fLibManager;             //! transient
     117             : 
     118             :   /** Indicates, if a sources have changes,  so that one has to reconnect. */
     119             :   Bool_t    fStateHasChanged;                     //  see above
     120             : 
     121             :   Bool_t Connected() const { return fConnected; }
     122             : 
     123             : private:
     124             : 
     125             :   /** copy constructor prohibited */
     126             :   AliHLTHOMERManager(const AliHLTHOMERManager&);
     127             : 
     128             :   /** assignment operator prohibited */
     129             :   AliHLTHOMERManager& operator=(const AliHLTHOMERManager&);
     130             : 
     131             :   //==============Connection to homer ==========================
     132             : 
     133             :   /** Create a readout list for Hostname and ports */
     134             :   void CreateReadoutList( const char** sourceHostnames, UShort_t* sourcePorts, 
     135             :                           UInt_t &sourceCount, TString detector );
     136             : 
     137             :   /** Checks if already connected to HOMER sources */
     138           0 :   Bool_t IsConnected() { return fConnected; }  
     139             : 
     140             :   /** Create and add Block List to Buffer */
     141             :   void AddBlockListToBuffer();
     142             : 
     143             :   /** Add bocks to asynchronous BlockList */
     144             :   void AddToAsyncBlockList();
     145             :   void AddToBlockList();
     146             : 
     147             : 
     148             :   //============ Block Handling ====================
     149             : 
     150             :   /** Get pointer to block list in event buffer */
     151             :   TList* GetBlockListEventBuffer( );
     152             :     
     153             :   /** Get Number of blocks in current event */
     154             :   ULong_t GetNBlks() { return fNBlks; }
     155             : 
     156             :   /** Handle Blocks and fill them in event buffer or asyncronous BlockList */
     157             :   Int_t HandleBlocks();
     158             : 
     159             :   /** Check is block are from syncronous source */
     160             :   Bool_t IsSyncBlocks();
     161             : 
     162             :   /** Get pointer to block ndx in current event */
     163             :   void* GetBlk( Int_t ndx );
     164             : 
     165             :   /** Get pointer to current block in current event */
     166           0 :   void* GetBlk() { return GetBlk(fCurrentBlk); }
     167             : 
     168             :   /** Get first block in current event */
     169           0 :   void* GetFirstBlk() { fCurrentBlk=0; return GetBlk(0); }
     170             : 
     171             :   /** Get next block in current event */
     172           0 :   void* GetNextBlk() { return GetBlk(++fCurrentBlk); }
     173             : 
     174             :   /** Get size of block ndx */
     175             :   ULong_t GetBlkSize( Int_t ndx );
     176             : 
     177             :   /** Get size of current block */ 
     178           0 :   ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }
     179             : 
     180             :   /** Get origin of block ndx  */
     181             :   TString GetBlkOrigin( Int_t ndx );
     182             : 
     183             :   /** Get origin of current block */
     184           0 :   TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }
     185             : 
     186             :   /** Get type of block ndx */
     187             :   TString GetBlkType( Int_t ndx ); 
     188             : 
     189             :   /** Get type of current block */
     190           0 :   TString GetBlkType() { return GetBlkType( fCurrentBlk ); } 
     191             :   
     192             :   //Get specification of block at ndx in bufferindex
     193             :   ULong_t GetBlkSpecification( Int_t ndx );
     194             : 
     195             :   /** Get specification of current block */
     196           0 :   ULong_t GetBlkSpecification() { return GetBlkSpecification( fCurrentBlk ); } 
     197             : 
     198             :   //Check if requested in eve
     199             :   Bool_t CheckIfRequested( AliHLTHOMERBlockDesc* block );
     200             :     
     201             :   //Check trigger decision
     202             :   Bool_t CheckTriggerDecision();
     203             :   
     204             :   AliHLTHOMERProxyHandler * fProxyHandler;  /** Proxy Handler to get the list of sources */  //! transient 
     205             :   AliHLTHOMERReader* fCurrentReader;   /** Pointer to current HOMER reader */ //! transient 
     206             :   TList* fReaderList;                 /** List to pointer of HOMER readers */
     207             : 
     208             :   // == sources ==
     209             :   TList* fSourceList;                /** List to HOMER sources */
     210             :   ULong_t fNBlks;                    /** Number of blockes in current event */
     211             :   ULong64_t fEventID[BUFFERSIZE];    /** EventID of current event */
     212             :   ULong64_t fEventId;
     213             :   ULong_t fCurrentBlk;               /** Current block in current event */
     214             :   TList* fAsyncBlockList;            /** List containing asychronous blocks */
     215             :   TList* fBlockList;            /** List containing asychronous blocks */
     216             : 
     217             :   // == event buffer ==
     218             :   TClonesArray     * fEventBuffer;  /** Event Buffer */
     219             :   Int_t  fBufferTopIdx;             /** Buffer index to last received event */
     220             :   Int_t  fBufferLowIdx;             /** Buffer index to last received event */
     221             :   Int_t  fCurrentBufferIdx;         /** Buffer index to current event */
     222             :   Int_t  fNavigateBufferIdx;        //  Navigate index through event buffer */
     223             :   Int_t  fNEventsAvailable;         //Number of available events
     224             :   
     225             :   Bool_t fConnected;                /** Shows connection status */
     226             :   TString fTriggerString;           /** String indicating which trigger should be used to select events */
     227             :   Int_t  fNEventsNotTriggered;      /** Number Events not triggered, before next triggered event is found */
     228             :   
     229             :   Bool_t fRetryNextEvent;           /** Retry reading next event */
     230             : 
     231             :   Bool_t fIsBlockOwner;
     232             : 
     233         126 :   ClassDef(AliHLTHOMERManager, 1); // Manage connections to HLT data-sources.
     234             : };
     235             : 
     236             : #endif

Generated by: LCOV version 1.11