Adding ALICE specific implementations of Eve
authorquark <quark@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Jun 2012 13:05:50 +0000 (13:05 +0000)
committerquark <quark@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Jun 2012 13:05:50 +0000 (13:05 +0000)
EVE/EveBase/AliEveApplication.cxx [new file with mode: 0644]
EVE/EveBase/AliEveApplication.h [new file with mode: 0644]
EVE/EveBase/AliEveManager.cxx [new file with mode: 0644]
EVE/EveBase/AliEveManager.h [new file with mode: 0644]

diff --git a/EVE/EveBase/AliEveApplication.cxx b/EVE/EveBase/AliEveApplication.cxx
new file mode 100644 (file)
index 0000000..9cce3e8
--- /dev/null
@@ -0,0 +1,54 @@
+// Author: Mihai Niculescu 2012
+
+/**************************************************************************
+ * Copyright(c) 1998-2012, ALICE Experiment at CERN, all rights reserved.                                       *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for                                                                                        *
+ * full copyright notice.                                                                                                                                                                                                                               *
+ **************************************************************************/
+
+#include <TInterpreter.h>
+#include <TSystem.h>
+#include <TString.h>
+#include <TROOT.h>
+
+#include <AliLog.h>
+
+#include <AliEveApplication.h>
+#include <AliEveManager.h>
+
+
+ClassImp(AliEveApplication)
+
+AliEveApplication::AliEveApplication(const char* appClassName, int* argc, char** argv, void* options, int numOptions, Bool_t noLogo)
+       : TRint(appClassName, argc, argv, options, numOptions, noLogo)
+{
+  Init();
+}
+
+AliEveApplication::~AliEveApplication()
+{}
+
+void  AliEveApplication::Init()
+{
+
+       static const TEveException kEH("alieve::main");
+
+  TString evedir(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
+
+  TString macPath(gROOT->GetMacroPath());
+  macPath += Form(":%s/macros", evedir.Data());
+  gInterpreter->AddIncludePath(evedir);
+
+  macPath += Form(":%s/alice-macros", evedir.Data());
+  gInterpreter->AddIncludePath(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
+  gInterpreter->AddIncludePath(Form("%s/PWG0", gSystem->Getenv("ALICE_ROOT")));
+  gInterpreter->AddIncludePath(Form("%s/include", gSystem->Getenv("ALICE_ROOT")));
+  gInterpreter->AddIncludePath(gSystem->Getenv("ALICE_ROOT"));
+  gROOT->SetMacroPath(macPath);
+
+  // make sure logger is instantiated
+  AliLog::GetRootLogger();
+
+
+}
diff --git a/EVE/EveBase/AliEveApplication.h b/EVE/EveBase/AliEveApplication.h
new file mode 100644 (file)
index 0000000..db1b5f8
--- /dev/null
@@ -0,0 +1,30 @@
+// Author: Mihai Niculescu 2012
+
+/**************************************************************************
+ * Copyright(c) 1998-2012, ALICE Experiment at CERN, all rights reserved.                                       *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for                                                                                        *
+ * full copyright notice.                                                                                                                                                                                                                               *
+ **************************************************************************/
+#ifndef AliEveApplication_H
+#define AliEveApplication_H
+
+#include <TRint.h>
+
+class AliEveApplication : public TRint
+{
+public:
+       AliEveApplication(const char* appClassName, Int_t* argc, char** argv, void* options = 0, Int_t numOptions = 0, Bool_t noLogo = kFALSE);
+       virtual ~AliEveApplication();
+       
+       void Init(); // Initialize AliEve & Rint Environment
+       
+private:
+       AliEveApplication(const AliEveApplication&);               // not implemented
+       AliEveApplication& operator=(const AliEveApplication&);    // not implemented
+       
+public:
+
+       ClassDef(AliEveApplication, 0); // AliEve application
+};
+#endif
diff --git a/EVE/EveBase/AliEveManager.cxx b/EVE/EveBase/AliEveManager.cxx
new file mode 100644 (file)
index 0000000..d92918a
--- /dev/null
@@ -0,0 +1,81 @@
+#include <TInterpreter.h>
+#include <TGeoManager.h>
+#include <TEveBrowser.h>
+#include <TEveGedEditor.h>
+#include <TEveManager.h>
+#include <TEveViewer.h>
+#include <TEveSelection.h>
+#include <TSystem.h>
+#include <TString.h>
+#include <TROOT.h>
+
+#include <AliLog.h>
+#include <AliEveConfigManager.h>
+#include <AliEveMultiView.h>
+
+#include "AliEveManager.h"
+
+//______________________________________________________________________________
+// AliEveManager
+//
+// Central aplication manager for AliEve.
+// Manages environment, gEve, elements, GUI, GL scenes and GL viewers.
+//
+// ALICE_ROOT must be defined prior creating this object
+ClassImp(AliEveManager);
+
+AliEveManager::AliEveManager(UInt_t w, UInt_t h, Bool_t map_window, Option_t* opt)
+       : TEveManager(w, h, map_window, opt)
+{
+
+       Init();
+       
+}
+
+AliEveManager* AliEveManager::Create(Bool_t map_window, Option_t* opt)
+{
+       Int_t w = 1024;
+       Int_t h =  768;
+  
+  if(gEve == 0){
+      gEve = new AliEveManager(w, h, map_window, opt);
+  }
+       
+       return (AliEveManager*)gEve;
+}
+
+AliEveManager::~AliEveManager()
+{ 
+      AliEveMultiView* mv = AliEveMultiView::Instance();
+      
+      delete mv;
+      mv = 0;
+}
+
+void AliEveManager::Init()
+{
+       GetDefaultViewer()->SetElementName("3D View");
+  GetSelection()->SetPickToSelect(TEveSelection::kPS_PableCompound);
+  GetHighlight()->SetPickToSelect(TEveSelection::kPS_PableCompound);
+
+       RegisterGeometryAlias("Default", Form("%s/EVE/alice-data/default_geo.root",  gSystem->Getenv("ALICE_ROOT")) );
+
+       AliEveConfigManager::InitializeMaster(); // initializes menus
+}
+
+void AliEveManager::CloseEveWindow()
+{
+               // Close button haas been clicked on EVE main window (browser).
+   // Cleanup and terminate application.
+
+   TEveBrowser *eb = dynamic_cast<TEveBrowser*>( GetMainWindow() );
+        eb->DontCallClose();
+               
+       TEveGedEditor::DestroyEditors();
+
+}
+
+void AliEveManager::Terminate()
+{
+
+}
diff --git a/EVE/EveBase/AliEveManager.h b/EVE/EveBase/AliEveManager.h
new file mode 100644 (file)
index 0000000..5e4b310
--- /dev/null
@@ -0,0 +1,31 @@
+// Author: Mihai Niculescu 2012
+
+/**************************************************************************
+ * Copyright(c) 1998-2012, ALICE Experiment at CERN, all rights reserved.                                       *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for                                                                                        *
+ * full copyright notice.                                                                                                                                                                                                                               *
+ **************************************************************************/
+#ifndef AliEveManager_H
+#define AliEveManager_H
+
+#include <TEveManager.h>
+
+class AliEveManager : public TEveManager
+{
+public:
+       AliEveManager(UInt_t w, UInt_t h, Bool_t map_window=kTRUE, Option_t* opt="FI");
+       ~AliEveManager();
+
+       static AliEveManager* Create(Bool_t map_window=kTRUE, Option_t* opt="FIV");
+       
+       void CloseEveWindow();
+       void Terminate();
+protected:
+       void Init();
+
+public:
+
+       ClassDef(AliEveManager, 0); // Eve application manager
+};
+#endif