AliEveConfigManager
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 20 Nov 2009 15:46:35 +0000 (15:46 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 20 Nov 2009 15:46:35 +0000 (15:46 +0000)
- New class to handle management of AliEve configuration.

alieve_main
- Instantiate AliEveConfigManager.

its_hits.C
- Only use VizDB.

EVE/EveBase/AliEveConfigManager.cxx [new file with mode: 0644]
EVE/EveBase/AliEveConfigManager.h [new file with mode: 0644]
EVE/EveBase/EveBaseLinkDef.h
EVE/alice-macros/its_hits.C
EVE/alieve_main/alieve_main.cxx

diff --git a/EVE/EveBase/AliEveConfigManager.cxx b/EVE/EveBase/AliEveConfigManager.cxx
new file mode 100644 (file)
index 0000000..a3696c8
--- /dev/null
@@ -0,0 +1,117 @@
+// $Id$
+// Author: Matevz Tadel 2009
+
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+#include "AliEveConfigManager.h"
+
+#include <TEveManager.h>
+#include <TEveBrowser.h>
+#include <TGMenu.h>
+
+#include <RVersion.h>
+
+//______________________________________________________________________________
+// Full description of AliEveConfigManager
+//
+
+ClassImp(AliEveConfigManager)
+
+AliEveConfigManager* AliEveConfigManager::fgMaster = 0;
+
+namespace
+{
+ enum EAliEveMenu_e
+ {
+   kAEMTest
+ };
+}
+//______________________________________________________________________________
+AliEveConfigManager* AliEveConfigManager::InitializeMaster()
+{
+  // Get main instance.
+
+  static const TEveException kEH("AliEveConfigManager::InitializeMaster ");
+
+  if (fgMaster)
+    throw kEH + "Master already initialized.";
+
+  fgMaster = new AliEveConfigManager;
+  return fgMaster;
+}
+
+//______________________________________________________________________________
+AliEveConfigManager* AliEveConfigManager::GetMaster()
+{
+  // Get main instance.
+
+  static const TEveException kEH("AliEveConfigManager::GetMaster ");
+
+  if (!fgMaster)
+    throw kEH + "Master not initialized.";
+
+  return fgMaster;
+}
+
+//______________________________________________________________________________
+AliEveConfigManager::AliEveConfigManager() :
+  TObject(),
+  fAliEvePopup(0)
+{
+  // Constructor.
+  // Expected TEveManager is already initialized.
+
+  fAliEvePopup = new TGPopupMenu(gClient->GetRoot());
+  fAliEvePopup->AddEntry("&Test", kAEMTest);
+
+  fAliEvePopup->AddSeparator();
+
+  fAliEvePopup->Connect("Activated(Int_t)", "AliEveConfigManager",
+                        this, "AliEvePopupHandler(Int_t)");
+
+  TGMenuBar *mBar = 0;
+#if ROOT_VERSION_CODE >= ROOT_VERSION(5,25,4) || defined XXX_LATEST_ROOT
+  mBar = gEve->GetBrowser()->GetMenuBar();
+#else
+  // Uber hack as TRootBrowser does not provede manu-bar getter.
+  TGFrameElement   *xxFE = (TGFrameElement*)   gEve->GetBrowser()->GetList()->First();
+  TGCompositeFrame *xxCF = (TGCompositeFrame*) xxFE->fFrame;
+  xxFE = (TGFrameElement*)   xxCF->GetList()->First();
+  xxCF = (TGCompositeFrame*) xxFE->fFrame;
+  xxFE = (TGFrameElement*)   xxCF->GetList()->First();
+  xxCF = (TGCompositeFrame*) xxFE->fFrame;
+  xxFE = (TGFrameElement*)   xxCF->GetList()->First();
+  mBar = (TGMenuBar*) xxFE->fFrame;
+#endif
+  mBar->AddPopup("&AliEve", fAliEvePopup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
+  ((TGCompositeFrame*)mBar->GetParent()->GetParent())->Layout();
+}
+
+//==============================================================================
+
+void AliEveConfigManager::AliEvePopupHandler(Int_t id)
+{
+  // Handle user selections from AliEve popup.
+
+  static const TEveException kEH("AliEveConfigManager::AliEvePopupHandler ");
+
+  switch (id)
+  {
+    case kAEMTest:
+    {
+      printf("Test!\n");
+      break;
+    }
+
+    default:
+    {
+      Warning(kEH, "Unknown menu entry.");
+      break;
+    }
+  }
+}
diff --git a/EVE/EveBase/AliEveConfigManager.h b/EVE/EveBase/AliEveConfigManager.h
new file mode 100644 (file)
index 0000000..12dea41
--- /dev/null
@@ -0,0 +1,45 @@
+// $Id$
+// Author: Matevz Tadel 2009
+
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+#ifndef AliEveConfigManager_H
+#define AliEveConfigManager_H
+
+#include "TObject.h"
+
+class TGPopupMenu;
+
+//______________________________________________________________________________
+// Short description of AliEveConfigManager
+//
+
+class AliEveConfigManager : public TObject
+{
+public:
+  static AliEveConfigManager* InitializeMaster();
+  static AliEveConfigManager* GetMaster();
+
+  virtual ~AliEveConfigManager() {}
+
+  void AliEvePopupHandler(Int_t id);
+
+protected:
+  static AliEveConfigManager* fgMaster;  // Main instance.
+
+  TGPopupMenu      *fAliEvePopup; // AliEve menu.
+
+private:
+  AliEveConfigManager();
+
+  AliEveConfigManager(const AliEveConfigManager&);            // Not implemented
+  AliEveConfigManager& operator=(const AliEveConfigManager&); // Not implemented
+
+  ClassDef(AliEveConfigManager, 0); // Short description.
+};
+
+#endif
index 5e9c136..daab3a7 100644 (file)
@@ -11,6 +11,9 @@
 #pragma link off all globals;
 #pragma link off all classes;
 
+// AliEveConfigManager
+#pragma link C++ class AliEveConfigManager+;
+
 // AliEveEventManager
 #pragma link C++ class AliEveEventManager+;
 #pragma link C++ class AliEveEventManagerEditor+;
index 906b9d9..fc41f73 100644 (file)
@@ -30,12 +30,9 @@ its_hits(const char *varexp    = "fX:fY:fZ",
   }
 
   points->SetName(Form("ITS Hits"));
-  const TString viz_tag("SIM Hits ITS");
-  points->ApplyVizTag(viz_tag, "Hits");
-
   points->SetTitle(Form("N=%d", points->Size()));
-  points->SetMarkerSize(.5);
-  points->SetMarkerColor(2);
+
+  points->ApplyVizTag("SIM Hits ITS", "Hits");
 
   gEve->AddElement(points, cont);
   gEve->Redraw3D();
index db2d634..91824f6 100644 (file)
@@ -7,6 +7,8 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
+#include <EveBase/AliEveConfigManager.h>
+
 #include <TInterpreter.h>
 #include <TRint.h>
 #include <TROOT.h>
@@ -66,7 +68,9 @@ int main(int argc, char **argv)
   TRint  *app = new TRint("App", &argc, argv);
 
 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,25,4) || defined XXX_LATEST_ROOT
-  TEveGListTreeEditorFrame::SetEditorClass("AliEveGedEditor");
+  // Waiting for update by Pawel. Now GED in ROOT is better again :)
+  // Uncomment when fixed in AliEveGedXXX.
+  // TEveGListTreeEditorFrame::SetEditorClass("AliEveGedEditor");
 #endif
 
   TEveManager::Create();
@@ -75,6 +79,8 @@ int main(int argc, char **argv)
 
   gEve->RegisterGeometryAlias("Default", Form("%s/alice-data/default_geo.root", evedir.Data()));
 
+  AliEveConfigManager::InitializeMaster();
+
   app->Run(kTRUE);
 
   gEve->GetBrowser()->UnmapWindow();