]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/EveHLT/AliEveHOMERManager.h
Added "Save Viewers" button and functionality to alihlteve
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHOMERManager.h
index d078ded9c3b461a612b4704e4ef95a166bdd028e..71b29d0ba286441144e7e17855b9f0903bdf8bf6 100644 (file)
@@ -1,3 +1,5 @@
+//-*- Mode: C++ -*-
+
 // $Id$
 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
 
@@ -7,49 +9,43 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
-//-*- Mode: C++ -*-
-#ifndef ALIEVEHOMERMANGER_H
-#define ALIEVEHOMERMANGER_H
+#ifndef ALIEVEHOMERMANAGER_H
+#define ALIEVEHOMERMANAGER_H
 
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
 /** @file   AliEveHOMERManager.h
-    @author Jochen Thaeder
+    @author Jochen Thaeder, Svein Lindal
     @date
-    @brief  Manager for HOMER in offline
+    @brief  Manager for HOMER in HLT . Inherits some functionalitye
+    from AliHLTHOMERManager, mainly from TEveEventManager
 */
-
-#include <TEveElement.h>
-
-#include "TString.h"
-#include "TDOMParser.h"
-#include "TXMLNode.h"
-#include "TList.h"
-
-#include "AliHLTHOMERSourceDesc.h"
-#include "AliHLTHOMERBlockDesc.h"
-#include "AliHLTHOMERReader.h"
-
-#include "AliTPCPreprocessorOnline.h"
-
-
-class AliHLTHOMERLibManager;
-
-/**
- * @class AliEveHOMERManager
- *
- * This class is the main class of the AliEveHOMERManager
- * ... more to come
- *
- * @ingroup alihlt_homer
- */
-
-class AliEveHOMERManager : public TEveElementList
-{
-private:
-  AliEveHOMERManager(const AliEveHOMERManager&);            // Not implemented.
-  AliEveHOMERManager& operator=(const AliEveHOMERManager&); // Not implemented.
+#include "AliHLTHOMERManager.h"
+#include <TEveEventManager.h>
+#include <TGeoManager.h>
+
+class AliEveHOMERSourceList;
+class TString;
+class TEveManager;
+class TEveScene;
+class TEveProjectionManager;
+class TTimer;
+class TEveViewer;
+
+class AliHLTEvePhos;
+class AliHLTEveEmcal;
+class AliHLTEveTPC;
+class AliHLTEveHLT;
+class AliHLTEveITS;
+class AliHLTEveISSD;
+class AliHLTEveISDD;
+class AliHLTEveISPD;
+class AliHLTEveTRD;
+class AliHLTEveAny;
+class AliHLTEveMuon;
+
+class AliEveHOMERManager : public TEveElementList, public AliHLTHOMERManager {
 
 public:
 
@@ -59,296 +55,120 @@ public:
    * ---------------------------------------------------------------------------------
    */
 
-  /** constructor
-   * @param argc    Number of command line arguments.
-   * @param argv    Array of command line arguments.
-   */
-  AliEveHOMERManager(TString xmlFile="" );
+  /** constructor */
+  AliEveHOMERManager();
+
   /** destructor */
   virtual ~AliEveHOMERManager();
 
-  /*
-   * ---------------------------------------------------------------------------------
-   *                            Source Handling - public
-   * ---------------------------------------------------------------------------------
-   */
-
-  /** Create Sources List from HOMER-Proxy */
-  Int_t CreateHOMERSourcesList();
-
-  /** Set state of a source
-   * @param source      Pointer to AliHLTHOMERSourceDesc object.
-   * @param state       New (selected/not selected) state.
-   */
-  void SetSourceState( AliHLTHOMERSourceDesc* source, Bool_t state);
-
-  /** Get pointer to source List
-   * @return            returns pointer to TList of sources
-   */
-  TList* GetSourceList() { return fSourceList; }
-
-  /*
-   * ---------------------------------------------------------------------------------
-   *                            Connection Handling - public
-   * ---------------------------------------------------------------------------------
-   */
-
-  /** Connect to HOMER sources, out of Readout List, which gets created when state has changed
-   * @return            0 on sucess, "HOMER" errors on error
-   */
-  Int_t ConnectHOMER();
-
-  /** Disconnect from HOMER sources */
-  void DisconnectHOMER();
+  /** Connect to avahi and get the list for sources */
+  Int_t CreateEveSourcesList();
 
-  /** Reconnect from HOMER sources
-   * @return            0 on sucess, "ConnectHOMER()" errors on error
-   */
-  Int_t ReconnectHOMER();
-
-  /*
-   * ---------------------------------------------------------------------------------
-   *                            Event Handling - public
-   * ---------------------------------------------------------------------------------
-   */
-
-  /** Loads the next Event, after being connected
-   * @return            0 on sucess, "HOMER" errors on error
-   */
-  Int_t NextEvent();
+  /** Keep on looking for sources until some are found */
+  Int_t CreateEveSourcesListLoop();
+  
+  /** Connect to the sources found */
+  Int_t ConnectEVEtoHOMER(TString detector="ALL");
 
-  /** Get event ID
-   * @return            Returns eventID
-   */
-  ULong_t GetEventID() { return fEventID; }
-
-  /** Get pointer to block List
-   * @return            returns pointer to TList of blocks
-   */
-  TList* GetBlockList() { return fBlockList; }
+  /** Delete current connections to sources and reconnect */
+  Int_t ReConnectHOMER( TString detector="" );
 
+  /** Set the retry count for source list loop */
+  void SetRetryCount(Int_t count, Int_t sleeptime) { fRetryCount = count; fRetrySleeptime = sleeptime; }
+  
+  /** Get next event from the readers */
+  Int_t NextHOMEREvent();
 
-  ///////////////////////////////////////////////////////////////////////////////////
+  /** Process the event data */
+  Int_t ProcessEvent();
 
-  void SelectRawTPC();
-  void SelectClusterTPC();
-  void SelectESDTPC();
+  /** Set flag for event loop */
+  void SetEventLoopStarted (Bool_t started) {fEventLoopStarted = started;}
 
-  void TestSelect();
-  void TestSelectClass( TString objectName );
+  /** Set flag for showing barrel */
+  void SetBarrelFlag(Bool_t flag) { fShowBarrel = flag;}
+  /** Set flag for showing muon arm */
+  void SetMuonFlag(Bool_t flag) { fShowMuon = flag;}
 
-  void DumpTPCCalib(TString objectName, Bool_t dumpToFile);
+  /**Set and get the global instance of the Eve manager */
+  void SetEveManager(TEveManager * manager) {fEveManager = manager;}
+  TEveManager * GetEveManager() const {return fEveManager;}
 
-  ///////////////////////////////////////////////////////////////////////////////////
+  /**Set and get the global instance of TGeoManager */
+  void SetGeoManager(TGeoManager * manager) {fGeoManager = manager;}
+  TGeoManager * GetGeoManager() const {return fGeoManager;}
 
-protected:
+  /** Set the projection scenes and their managers */
+  void SetRPhiManager (TEveProjectionManager * mgr) {fRPhiManager = mgr;}
+  void SetRPhiEventScene (TEveScene * scene ) {fRPhiEventScene = scene;}
+  void SetRPhiViewer(TEveViewer * viewer ) {fRPhiViewer = viewer;}
+  void SetRhoZManager(TEveProjectionManager * mgr) {fRhoZManager = mgr;}
+  void SetRhoZEventScene(TEveScene * scene ) {fRhoZEventScene = scene;}
+  void SetRhoZViewer(TEveViewer * viewer ) {fRhoZViewer = viewer;}
 
-  /** Dynamic loader manager for the HOMER library */
-  AliHLTHOMERLibManager* fLibManager;             //! transient
+  /** Start and stop the automatic event loop */
+  void StartLoop();
+  void StopLoop();
 
+  /** Print the screens to a file **/
+  void PrintScreens();
 
 private:
 
-  /*
-   * ---------------------------------------------------------------------------------
-   *                            Source Handling - private
-   * ---------------------------------------------------------------------------------
-   */
-
-  /** Get Information out of a TDS process in XML file
-   * @param xmlNode   Pointer to childs of TDS node
-   * @return          0 on sucess, > 0 on error
-   */
-  Int_t GetTDSAttributes( TXMLNode * xmlNode );
-
-  /** Resolve Information of hostname and port for source which has to be used by HOMER
-   * ( due to port mapping inside the HLT )
-   * @param xmlHostname  Hostname out of the XML
-   * @param xmlPort      Port out of the XML
-   * @param hostname     Return of the hostname
-   * @param port         Return of the port
-   * @return             0 on sucess, 1 if hostname couldn't be resolved, 2 if port couldn't be resolved,
-   */
-  Int_t ResolveHostPortInformation( TString xmlHostname, TString xmlPort, TString &hostname, Int_t &port );
-
-  /** Resolve information of source
-   * @param xmlParent   ParentString out of the XML
-   * @param source      Return the filled AliHLTHOMERSourceDesc object
-   * @return            0 on sucess, 1 on error
-   */
-  Int_t ResolveSourceInformation( TString xmlParent, AliHLTHOMERSourceDesc * source );
-
-  /*
-   * ---------------------------------------------------------------------------------
-   *                            Connection Handling - private
-   * ---------------------------------------------------------------------------------
-   */
-
-  /** Create a readout list for Hostname and ports
-   * @param socurceHostnames   Array of selected hostnames
-   * @param socurcePorts       Array of selected ports
-   * @param socurceCount       Number of selected hostname:port
-   */
-  void CreateReadoutList( const char** socurceHostnames, UShort_t* sourcePorts, UInt_t &sourceCount);
-
-  /** Checks if already connected to HOMER sources
-   * @return             kTRUE or kFALSE, depending on connection state
-   */
-  Bool_t IsConnected() { return fConnected; }
-
-  /* ---------------------------------------------------------------------------------
-   *                            Eve AliEveHOMERManager::foo(nt Handling - private
-   * ---------------------------------------------------------------------------------
-   */
-
-  /** Create a TList of blocks, which have been readout */
-  Int_t CreateBlockList();
-
-  /*
-   * ---------------------------------------------------------------------------------
-   *                            Block Handling - private
-   * ---------------------------------------------------------------------------------
-   */
-
-  /** Get Number of blocks in current event
-   * @return           returns number of blocks in current event
-   */
-  ULong_t GetNBlks() { return fNBlks; }
-
-  /** Get pointer to block ndx in current event
-   * @param ndx        Block index
-   * @return           returns pointer to blk, NULL if no block present
-   */
-  void* GetBlk( Int_t ndx );
-
-  /** Get pointer to current block in current event
-   * @param ndx        Block index
-   * @return           returns pointer to blk, NULL if no block present
-   */
-  void* GetBlk() { return GetBlk( fCurrentBlk ); }
-
-  /** Get first block in current event
-   * @return           returns pointer to blk, NULL if no block present
-   */
-  void* GetFirstBlk() { return GetBlk( 0 ); }
-
-  /** Get next block in current event
-   * @return           returns pointer to blk, NULL if no block present
-   */
-  void* GetNextBlk() { return GetBlk( ++fCurrentBlk ); }
-
-  /** Get size of block ndx
-   * @param ndx        Block index
-   * @return           returns pointer to blk, 0 if no block present
-   */
-  ULong_t GetBlkSize( Int_t ndx );
-
-  /** Get size of current block
-   * @param ndx        Block index
-   * @return           returns pointer to blk, 0 if no block present
-   */
-  ULong_t GetBlkSize() { return GetBlkSize( fCurrentBlk ); }
-
-  /** Get origin of block ndx
-   * @param ndx        Block index
-   * @return           origin of block
-   */
-  TString GetBlkOrigin( Int_t ndx );
-
-  /** Get origin of current block
-   * @param ndx        Block index
-   * @return           origin of block
-   */
-  TString GetBlkOrigin(){ return GetBlkOrigin( fCurrentBlk ); }
-
-  /** Get type of block ndx
-   * @param ndx        Block index
-   * @return           type of block
-   */
-  TString GetBlkType( Int_t ndx );
-
-  /** Get type of current block
-   * @param ndx        Block index
-   * @return           type of block
-   */
-  TString GetBlkType() { return GetBlkType( fCurrentBlk ); }
-
-  /** Get specification of block ndx
-   * @param ndx        Block index
-   * @return           specification of block
-   */
-  ULong_t GetBlkSpecification( Int_t ndx );
-
-  /** Get specification of current block
-   * @param ndx        Block index
-   * @return           specification of block
-   */
-  ULong_t GetBlkSpecification(){ return GetBlkSpecification( fCurrentBlk ); }
-
-  /** Checks if current Block should was requested
-   * @return           returns kTRUE, if block should was requested
-   */
-  Bool_t CheckIfRequested( AliHLTHOMERBlockDesc* block );
-
-  /*
-   * ---------------------------------------------------------------------------------
-   *                            Members - private
-   * ---------------------------------------------------------------------------------
-   */
-
-  // == XML parser ==
+  /** copy constructor prohibited */
+  AliEveHOMERManager(const AliEveHOMERManager&);
 
-  /**   */
-  TString fXMLFile;                               // XML input file
+  /** assignment operator prohibited */
+  AliEveHOMERManager& operator=(const AliEveHOMERManager&);
 
-  /**  */
-  TDOMParser* fXMLParser;                         //! XML parser into DOM model
-
-  /**  */
-  TXMLNode * fRootNode;                           //! Root node of parsed config file
+  void DestroyDetectorElements();
+  
+  /** Process block */
+  void ProcessBlock(AliHLTHOMERBlockDesc * block);  //Process block
+  /** Reset the elements in the display */
+  void ResetDisplay();  
+  /** Update the display  */
+  void UpdateDisplay(); 
 
   // == sources ==
-
-  /**  */
-  TList * fSourceList;                            //! List to HOMER sources
-
-  // == connection ==
-
-
-  /**  */
-  AliHLTHOMERReader* fReader;                     //! Pointer to HOMER reader
-
-  // == blocks ==
-
-  /**  */
-  TList * fBlockList;                             //! List to HOMER blocks
-
-  // == events ==
-
-  /**  */
-  ULong_t fNBlks;                                 // Number of blockes in current event
-
-  /**  */
-  ULong64_t fEventID;                             // EventID of current event
-
-  /**  */
-  ULong_t fCurrentBlk;                            // Current block in current event
-
-  // == states ==
-
-  /**  */
-  Bool_t fConnected;                              // Shows connection status
-
-  /**  .
-   */
-  Bool_t fStateHasChanged;                        // Indicates, if a sources have changes, so that one has to reconnect.
-
-
-  //----
-
-  AliTPCPreprocessorOnline* fTPCPre;              // Preprocessor for TPC calibration.
-
+  AliEveHOMERSourceList* fSrcList;        // List of Connected HOMER Sources
+
+  Int_t fRetryCount;                     //How many times to retry creating source list before giving up
+  Int_t fRetrySleeptime;                 //Sleep time between attempt at craeting source list
+
+  TGeoManager * fGeoManager;              //The global TGeoManager instance
+  TEveManager * fEveManager;              //The global TEveManager instance
+  TEveProjectionManager * fRPhiManager;   //The R - Phi projection scene manager
+  TEveProjectionManager * fRhoZManager;   //The Rho- Z projection sene manager
+  TEveScene * fRPhiEventScene;            //The R - Phi projection scene
+  TEveScene * fRhoZEventScene;            //The Rho - Z projection sene
+  TEveViewer * fRPhiViewer;
+  TEveViewer * fRhoZViewer;
+  
+
+
+  TTimer * fTimer;                   //Timer for event loop
+  //TTimer * fSourceListTimer;       //Timer for source list loop
+  AliHLTEvePhos  * fPhosElement;     //Phos eve processor
+  AliHLTEveEmcal * fEmcalElement;    //Emcal eve processor
+  AliHLTEveTPC   * fTPCElement;      //TPC eve processor
+  AliHLTEveHLT   * fHLTElement;      //HLT
+  AliHLTEveITS   * fITSElement;      //ITS
+  AliHLTEveISPD  * fISPDElement;     //ISPD
+  AliHLTEveISSD  * fISSDElement;     //ISSD
+  AliHLTEveISDD  * fISDDElement;     //ISDD
+  AliHLTEveTRD   * fTRDElement;      //TRD
+  AliHLTEveMuon  * fMuonElement;     //MUON
+  AliHLTEveAny   * fAnyElement;      //Catch all
+
+  Bool_t fEventLoopStarted;                    // Flag indicating whether the loop is running
+  Bool_t fCenterProjectionsAtPrimaryVertex;    // Flag indicating whether to center the projection scenes at primary vertex (as opposed to 0, 0, 0)
+  Bool_t fShowBarrel;                               // Display barrel detectors ?
+  Bool_t fShowMuon;                                 // Display Muon arm ?
+   
   ClassDef(AliEveHOMERManager, 0); // Manage connections to HLT data-sources.
-};
 
+};
 #endif