See new macro anyscan_init.C.
Fix some cluster macros to use VizDB.
**************************************************************************/
#include "AliEveEventManager.h"
+#include "AliEveMacroExecutor.h"
#include <TEveManager.h>
#include <AliRunLoader.h>
fAutoLoad(kFALSE),
fAutoLoadTime(5.),
fAutoLoadTimer(0),
- fIsOnline(kFALSE)
+ fIsOnline(kFALSE),
+ fExecutor(new AliEveMacroExecutor)
{
// Default constructor.
}
fAutoLoad(kFALSE),
fAutoLoadTime(5.),
fAutoLoadTimer(0),
- fIsOnline(kFALSE)
+ fIsOnline(kFALSE),
+ fExecutor(new AliEveMacroExecutor)
{
// Constructor with event-directory URL and event-id.
ElementChanged();
AfterNewEventLoaded();
- NewEventLoaded();
}
void AliEveEventManager::NextEvent()
// Static convenience functions, mainly used from macros.
/******************************************************************************/
+Bool_t AliEveEventManager::HasRunLoader()
+{
+ // Check if AliRunLoader is initialized.
+
+ return gAliEveEvent && gAliEveEvent->fRunLoader;
+}
+
+Bool_t AliEveEventManager::HasESD()
+{
+ // Check if AliESDEvent is initialized.
+
+ return gAliEveEvent && gAliEveEvent->fESD;
+}
+
+Bool_t AliEveEventManager::HasESDfriend()
+{
+ // Check if AliESDfriend is initialized.
+
+ return gAliEveEvent && gAliEveEvent->fESDfriend;
+}
+
+Bool_t AliEveEventManager::HasRawReader()
+{
+ // Check if raw-reader is initialized.
+
+ return gAliEveEvent && gAliEveEvent->fRawReader;
+}
+
AliRunLoader* AliEveEventManager::AssertRunLoader()
{
// Make sure AliRunLoader is initialized and return it.
}
}
+void AliEveEventManager::AfterNewEventLoaded()
+{
+ // Execute registered macros and commands.
+ // At the end emit NewEventLoaded signal.
+ //
+ // Virtual from TEveEventManager.
+
+ if (fExecutor)
+ fExecutor->ExecMacros();
+
+ TEveEventManager::AfterNewEventLoaded();
+
+ NewEventLoaded();
+}
+
void AliEveEventManager::NewEventLoaded()
{
// Emit NewEventLoaded signal.
#include <TEveEventManager.h>
#include <TQObject.h>
+class AliEveMacroExecutor;
+
class AliRunLoader;
class AliESDEvent;
class AliESDfriend;
virtual const Text_t* GetTitle() const { return fPath.Data(); }
const char* GetEventInfo() const;
+ static Bool_t HasRunLoader();
+ static Bool_t HasESD();
+ static Bool_t HasESDfriend();
+ static Bool_t HasRawReader();
+
static AliRunLoader* AssertRunLoader();
static AliESDEvent* AssertESD();
static AliESDfriend* AssertESDfriend();
void StartStopAutoLoadTimer();
- void NewEventLoaded(); // *SIGNAL*
+ virtual void AfterNewEventLoaded();
+ void NewEventLoaded(); // *SIGNAL*
+
+ AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
protected:
TString fPath; // URL to event-data.
TTimer *fAutoLoadTimer; // Timer for automatic event loading
Bool_t fIsOnline; // Are we running online?
+ AliEveMacroExecutor *fExecutor; // Executor for std macros
+
static TString fgESDFileName; // Name by which to open ESD.
static TString fgRawFileName; // Name by which to open raw-data file.
static TString fgCdbUri; // Global URI to CDB.
--- /dev/null
+// @(#)root/eve:$Id$
+// Author: Matevz Tadel 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#include "AliEveMacro.h"
+
+//______________________________________________________________________________
+// Full description of AliEveMacro
+//
+// !!! Eventually, fSources should be a bitfield, but we need a widget
+// that can show/edit this. Like combo-box with a check-box for each
+// entry.
+
+ClassImp(AliEveMacro)
+
+//______________________________________________________________________________
+AliEveMacro::AliEveMacro(Int_t src, const TString& mac, const TString& foo,
+ const TString& args, Bool_t act) :
+ TObject(),
+ fSources(src), fMacro(mac), fFunc(foo), fArgs(args), fActive(act)
+{
+ // Constructor.
+}
+
+/******************************************************************************/
+
+TString AliEveMacro::FormForExec() const
+{
+ // Return string suitable for execution.
+
+ return fFunc + "(" + fArgs + ");";
+}
+
+TString AliEveMacro::FormForDisplay() const
+{
+ // Return string suitable for display.
+
+ TString act(fActive ? " x " : " ");
+ return act + fMacro + " :: " + fFunc + " (" + fArgs + ")";
+}
--- /dev/null
+// @(#)root/eve:$Id$
+// Author: Matevz Tadel 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#ifndef AliEveMacro_H
+#define AliEveMacro_H
+
+#include <TObject.h>
+#include <TString.h>
+
+//______________________________________________________________________________
+// Short description of AliEveMacro
+//
+
+class AliEveMacro : public TObject
+{
+ friend class AliEveMacroEditor;
+
+public:
+ enum DataSource_e { kNone = 0, kRunLoader, kESD, kESDfriend, kRawReader };
+
+ AliEveMacro(Int_t src, const TString& mac, const TString& foo,
+ const TString& args="", Bool_t act=kTRUE);
+ virtual ~AliEveMacro() {}
+
+ Int_t GetSources() const { return fSources; }
+ void SetSources(Int_t x) { fSources = x; }
+ const TString& GetMacro() const { return fMacro; }
+ void SetMacro(const TString& x) { fMacro = x; }
+ const TString& GetFunc() const { return fFunc; }
+ void SetFunc(const TString& x) { fFunc = x; }
+ const TString& GetArgs() const { return fArgs; }
+ void SetArgs(const TString& x) { fArgs = x; }
+ Bool_t GetActive() const { return fActive; }
+ void SetActive(Bool_t x) { fActive = x; }
+
+ TString FormForExec() const;
+ TString FormForDisplay() const;
+
+protected:
+ Int_t fSources;
+ TString fMacro;
+ TString fFunc;
+ TString fArgs;
+ Bool_t fActive;
+
+private:
+
+ ClassDef(AliEveMacro, 0); // Short description.
+};
+
+#endif
--- /dev/null
+// @(#)root/eve:$Id$
+// Author: Matevz Tadel 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#include "AliEveMacroEditor.h"
+#include "AliEveMacro.h"
+
+#include "TVirtualPad.h"
+
+// Cleanup these includes:
+#include "TGLabel.h"
+#include "TGNumberEntry.h"
+#include "TGColorSelect.h"
+#include "TGTextEntry.h"
+
+#include "TGComboBox.h"
+
+//______________________________________________________________________________
+// GUI editor for AliEveMacro.
+//
+
+ClassImp(AliEveMacroEditor)
+
+//______________________________________________________________________________
+AliEveMacroEditor::AliEveMacroEditor(const TGWindow *p, Int_t width, Int_t height,
+ UInt_t options, Pixel_t back) :
+ TGedFrame(p, width, height, options | kVerticalFrame, back),
+ fM(0),
+ fSources(0),
+ fMacro(0),
+ fFunc(0),
+ fArgs(0),
+ fActive(0)
+{
+ // Constructor.
+
+ MakeTitle("AliEveMacro");
+
+ TGHorizontalFrame *f = 0;
+ //TGLabel *l = 0;
+ Int_t labelW = 48;
+ {
+ f = MkHFrame();
+ MkLabel(f, "Active: ", labelW);
+
+ fActive = new TGCheckButton(f);
+ f->AddFrame(fActive); // new TGLayoutHints());
+ fActive->Connect("Clicked()", "AliEveMacroEditor", this,
+ "DoActive()");
+
+ MkLabel(f, "Source: ", labelW, 32);
+ fSources = new TGComboBox(f);
+ f->AddFrame(fSources); // new TGLayoutHints());
+ fSources->AddEntry("None", AliEveMacro::kNone);
+ fSources->AddEntry("RunLoader", AliEveMacro::kRunLoader);
+ fSources->AddEntry("ESD", AliEveMacro::kESD);
+ fSources->AddEntry("ESDfriend", AliEveMacro::kESDfriend);
+ fSources->AddEntry("RawReafer", AliEveMacro::kRawReader);
+ {
+ TGListBox* lb = fSources->GetListBox();
+ lb->Resize(lb->GetWidth(), 5*16);
+ }
+ fSources->Resize(100, 20);
+ fSources->Connect("Selected(Int_t)", "AliEveMacroEditor", this,
+ "DoSources(Int_t)");
+ }
+ {
+ f = MkHFrame();
+ MkLabel(f, "Macro: ", labelW);
+ fMacro = new TGTextEntry(f);
+ f->AddFrame(fMacro, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
+ fMacro->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
+ "DoMacro()");
+
+ MkLabel(f, "Func: ", labelW);
+ fFunc = new TGTextEntry(f);
+ f->AddFrame(fFunc, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
+ fFunc->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
+ "DoFunc()");
+ }
+ {
+ f = MkHFrame();
+ MkLabel(f, "Args: ", labelW);
+ fArgs = new TGTextEntry(f);
+ f->AddFrame(fArgs, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
+ fArgs->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
+ "DoArgs()");
+ }
+}
+
+/******************************************************************************/
+
+//______________________________________________________________________________
+void AliEveMacroEditor::SetModel(TObject* obj)
+{
+ // Set model object.
+
+ fM = dynamic_cast<AliEveMacro*>(obj);
+
+ fSources->Select (fM->GetSources(), kFALSE);
+ // TGTextEntry emits a signal no matter what ...
+ TQObject::BlockAllSignals(kTRUE);
+ fMacro ->SetText (fM->GetMacro());
+ fFunc ->SetText (fM->GetFunc());
+ fArgs ->SetText (fM->GetArgs());
+ TQObject::BlockAllSignals(kFALSE);
+ fActive ->SetState(fM->fActive ? kButtonDown : kButtonUp);
+}
+
+//______________________________________________________________________________
+void AliEveMacroEditor::DoSources(Int_t v)
+{
+ // Slot for Sources.
+
+ fM->SetSources(v);
+ Update();
+}
+
+//______________________________________________________________________________
+void AliEveMacroEditor::DoMacro()
+{
+ // Slot for Macro.
+
+ fM->SetMacro(fMacro->GetText());
+ Update();
+}
+
+//______________________________________________________________________________
+void AliEveMacroEditor::DoFunc()
+{
+ // Slot for Func.
+
+ fM->SetFunc(fFunc->GetText());
+ Update();
+}
+//______________________________________________________________________________
+void AliEveMacroEditor::DoArgs()
+{
+ // Slot for Args.
+
+ fM->SetArgs(fArgs->GetText());
+ Update();
+}
+
+//______________________________________________________________________________
+void AliEveMacroEditor::DoActive()
+{
+ // Slot for Active.
+
+ fM->SetActive(fActive->IsOn());
+ Update();
+}
+
+/******************************************************************************/
+
+TGHorizontalFrame* AliEveMacroEditor::MkHFrame(TGCompositeFrame* p)
+{
+ // Make standard horizontal frame.
+
+ if (p == 0)
+ p = this;
+ TGHorizontalFrame* f = new TGHorizontalFrame(p);
+ p->AddFrame(f, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
+ return f;
+}
+
+TGLabel* AliEveMacroEditor::MkLabel(TGCompositeFrame* p, const char* txt, Int_t width,
+ Int_t lo, Int_t ro, Int_t to, Int_t bo)
+{
+ // Make standard label.
+
+ TGLabel *l = new TGLabel(p, txt);
+ p->AddFrame(l, new TGLayoutHints(kLHintsNormal, lo,ro,to,bo));
+ l->SetTextJustify(kTextRight);
+ l->SetWidth(width);
+ l->ChangeOptions(l->GetOptions() | kFixedWidth);
+ return l;
+}
+
--- /dev/null
+// @(#)root/eve:$Id$
+// Author: Matevz Tadel 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#ifndef AliEveMacroEditor_H
+#define AliEveMacroEditor_H
+
+#include "TGedFrame.h"
+
+class AliEveMacro;
+
+class TGCheckButton;
+class TGTextEntry;
+class TGComboBox;
+
+//______________________________________________________________________________
+// Short description of AliEveMacroEditor
+//
+
+class AliEveMacroEditor : public TGedFrame
+{
+public:
+ AliEveMacroEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
+ UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
+ virtual ~AliEveMacroEditor() {}
+
+ virtual void SetModel(TObject* obj);
+
+ void DoSources(Int_t v);
+ void DoMacro();
+ void DoFunc();
+ void DoArgs();
+ void DoActive();
+
+protected:
+ AliEveMacro *fM; // Model object.
+
+ TGComboBox *fSources;
+ TGTextEntry *fMacro;
+ TGTextEntry *fFunc;
+ TGTextEntry *fArgs;
+ TGCheckButton *fActive;
+
+ TGHorizontalFrame* MkHFrame(TGCompositeFrame* p=0);
+ TGLabel* MkLabel (TGCompositeFrame* p, const char* txt, Int_t width,
+ Int_t lo=0, Int_t ro=0, Int_t to=2, Int_t bo=0);
+
+private:
+ AliEveMacroEditor(const AliEveMacroEditor&); // Not implemented
+ AliEveMacroEditor& operator=(const AliEveMacroEditor&); // Not implemented
+
+ ClassDef(AliEveMacroEditor, 0); // GUI editor for AliEveMacro.
+};
+
+#endif
--- /dev/null
+// @(#)root/eve:$Id$
+// Author: Matevz Tadel 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#include "AliEveMacroExecutor.h"
+#include "AliEveMacro.h"
+#include "AliEveEventManager.h"
+
+#include <TEveUtil.h>
+#include <TList.h>
+#include <TROOT.h>
+
+//______________________________________________________________________________
+// Full description of AliEveMacroExecutor
+//
+
+ClassImp(AliEveMacroExecutor)
+
+//______________________________________________________________________________
+AliEveMacroExecutor::AliEveMacroExecutor() :
+ TObject(),
+ fMacros(new TList)
+{
+ // Constructor.
+
+ fMacros->SetOwner(kTRUE);
+}
+
+//______________________________________________________________________________
+AliEveMacroExecutor::~AliEveMacroExecutor()
+{
+ // Destructor.
+
+ delete fMacros;
+}
+
+/******************************************************************************/
+
+void AliEveMacroExecutor::AddMacro(AliEveMacro* mac)
+{
+ // Add a new macro. Ownership transfered to the executor.
+
+ static const TEveException kEH("AliEveMacroExecutor::AddMacro ");
+
+ const TString mname = mac->GetMacro();
+ if ( ! mname.IsNull() && TEveUtil::CheckMacro(mname) == kFALSE)
+ {
+ TEveUtil::LoadMacro(mname);
+ }
+ fMacros->Add(mac);
+}
+
+/******************************************************************************/
+
+#include "Api.h"
+#include "TInterpreter.h"
+
+void AliEveMacroExecutor::ExecMacros()
+{
+ // Execute registered macros.
+
+ TIter next(fMacros);
+ AliEveMacro* mac;
+ while ((mac = (AliEveMacro*) next()))
+ {
+ // printf ("macro '%s'; func '%s'; args '%s'\n", mac->GetMacro().Data(), mac->GetFunc().Data(), mac->GetArgs().Data());
+
+ if (mac->GetActive() == kFALSE || mac->GetFunc().IsNull())
+ {
+ continue;
+ }
+
+ switch (mac->GetSources())
+ {
+ case AliEveMacro::kRunLoader:
+ if ( ! AliEveEventManager::HasRunLoader())
+ continue;
+ break;
+ case AliEveMacro::kESD:
+ if ( ! AliEveEventManager::HasESD())
+ continue;
+ break;
+ case AliEveMacro::kESDfriend:
+ if ( ! AliEveEventManager::HasESDfriend())
+ continue;
+ break;
+ case AliEveMacro::kRawReader:
+ if ( ! AliEveEventManager::HasRawReader())
+ continue;
+ break;
+ default:
+ break;
+ }
+
+ TString cmd(mac->FormForExec());
+ try
+ {
+ gInterpreter->ProcessLine(cmd);
+ // Try to fix broken cint state? Code taken form pyroot.
+ if ( G__get_return( 0 ) > G__RETURN_NORMAL )
+ {
+ printf ("***INFIXING***\n");
+ G__security_recover( 0 ); // 0 ensures silence
+ }
+ }
+ catch(TEveException& exc)
+ {
+ Error("ExecMacros", "Executing %s::%s, caught exception: '%s'.",
+ mac->GetMacro().Data(), cmd.Data(), exc.Data());
+ }
+
+ // Try to fix broken cint state? Code taken form pyroot.
+ if ( G__get_return( 0 ) > G__RETURN_NORMAL )
+ {
+ printf ("***POSTFIXING****\n");
+ G__security_recover( 0 ); // 0 ensures silence
+ }
+ }
+}
--- /dev/null
+// @(#)root/eve:$Id$
+// Author: Matevz Tadel 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#ifndef AliEveMacroExecutor_H
+#define AliEveMacroExecutor_H
+
+#include "TObject.h"
+
+class AliEveMacro;
+
+//______________________________________________________________________________
+// Short description of AliEveMacroExecutor
+//
+
+class AliEveMacroExecutor : public TObject
+{
+ friend class AliEveMacroExecutorWindow;
+
+public:
+ AliEveMacroExecutor();
+ virtual ~AliEveMacroExecutor();
+
+ void AddMacro(AliEveMacro* mac);
+
+ void ExecMacros();
+
+protected:
+ TList* fMacros;
+
+private:
+ AliEveMacroExecutor(const AliEveMacroExecutor&); // Not implemented
+ AliEveMacroExecutor& operator=(const AliEveMacroExecutor&); // Not implemented
+
+ ClassDef(AliEveMacroExecutor, 0); // Short description.
+};
+
+#endif
--- /dev/null
+// @(#)root/eve:$Id$
+// Author: Matevz Tadel 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#include "AliEveMacroExecutorWindow.h"
+#include "AliEveMacroExecutor.h"
+#include "AliEveMacro.h"
+#include "AliEveEventManager.h"
+
+#include <TGedEditor.h>
+#include <TGListBox.h>
+#include <Buttons.h>
+
+namespace
+{
+class FooEntry : public TGTextLBEntry
+{
+public:
+ static void SetFont() { fgDefaultFont = gClient->GetFontPool()->GetFont("-*-lucidatypewriter-*-*-*-*-12-*-*-*-*-*-iso8859-1"); }
+};
+
+class FooEditor : public TGedEditor
+{
+protected:
+ AliEveMacroExecutorWindow* fMEW;
+
+public:
+ FooEditor(AliEveMacroExecutorWindow* w) : TGedEditor(0), fMEW(w) {}
+ virtual ~FooEditor() {}
+ virtual void Update(TGedFrame* gframe=0)
+ {
+ TGedEditor::Update(gframe);
+ fMEW->PopulateMacros();
+ }
+};
+}
+
+//______________________________________________________________________________
+// Full description of AliEveMacroExecutorWindow
+//
+
+ClassImp(AliEveMacroExecutorWindow)
+
+//______________________________________________________________________________
+AliEveMacroExecutorWindow::AliEveMacroExecutorWindow(AliEveMacroExecutor* master) :
+ TGMainFrame(gClient->GetRoot()), fM(master),
+ fMainFrame(0), fCtrlFrame(0), fListBox(0), fEditor(0)
+{
+ // Constructor.
+
+ fMainFrame = new TGVerticalFrame(this);
+ AddFrame(fMainFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
+
+ {
+ fCtrlFrame = new TGHorizontalFrame(fMainFrame);
+ fMainFrame->AddFrame(fCtrlFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
+ fCtrlFrame->Resize(400, 120);
+
+ TGButton* b = new TGTextButton(fCtrlFrame, "Reload event");
+ fCtrlFrame->AddFrame(b);
+ b->Connect("Clicked()", "AliEveMacroExecutorWindow", this,
+ "DoReloadEvent()");
+ }
+
+ fListBox = new TGListBox(fMainFrame);
+ fMainFrame->AddFrame(fListBox, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
+ fListBox->Resize(400, 400);
+ fListBox->Connect("Selected(Int_t)", "AliEveMacroExecutorWindow", this,
+ "DoMacroSelected(Int_t)");
+
+ fMainFrame->SetEditDisabled(kEditEnable);
+ fMainFrame->SetEditable();
+ fEditor = new FooEditor(this);
+ fEditor->SetGlobal(kFALSE);
+ fMainFrame->SetEditable(kEditDisable);
+ fMainFrame->SetEditable(kFALSE);
+ {
+ TGFrameElement *el = 0;
+ TIter next(fMainFrame->GetList());
+ while ((el = (TGFrameElement *) next())) {
+ if (el->fFrame == fEditor)
+ if (el->fLayout) {
+ el->fLayout->SetLayoutHints(kLHintsExpandX);
+ el->fLayout->SetPadLeft(1); el->fLayout->SetPadRight(1);
+ el->fLayout->SetPadTop(2); el->fLayout->SetPadBottom(2);
+ break;
+ }
+ }
+ }
+ fEditor->Resize(400, 160);
+ fEditor->ChangeOptions(fEditor->GetOptions() | kFixedHeight);
+
+ Resize(400, 700);
+
+ SetCleanup(kDeepCleanup);
+ Layout();
+ MapSubwindows();
+ MapWindow();
+
+ gAliEveEvent->Connect("NewEventLoaded()", "AliEveMacroExecutorWindow", this,
+ "NewEventLoaded()");
+}
+
+AliEveMacroExecutorWindow::~AliEveMacroExecutorWindow()
+{
+ // Destructor.
+
+ gAliEveEvent->Disconnect("NewEventLoaded()", this);
+}
+
+/******************************************************************************/
+
+void AliEveMacroExecutorWindow::PopulateMacros(Bool_t keep_selected)
+{
+ // Populate list-box (or whatever will replace it) with all macros.
+ // prototype: no selection, sorting
+
+ // printf("AliEveMacroExecutorWindow::PopulateMacros()\n");
+
+ AliEveMacro* ex_sel = 0;
+ if (keep_selected && fListBox->GetSelected() != -1)
+ ex_sel = fBoxContents[fListBox->GetSelected()];
+
+ fListBox->RemoveAll();
+ fBoxContents.clear();
+
+ FooEntry::SetFont();
+
+ TIter next(fM->fMacros);
+ AliEveMacro *mac;
+ Int_t id = 0;
+ Int_t sel_id = -1;
+ while ((mac = (AliEveMacro*) next()))
+ {
+ if (mac == ex_sel)
+ sel_id = id;
+ fListBox->AddEntry(mac->FormForDisplay(), id++);
+ fBoxContents.push_back(mac);
+ }
+
+ if (sel_id != -1)
+ fListBox->Select(sel_id);
+
+ fListBox->MapSubwindows();
+ fListBox->Layout();
+}
+
+/******************************************************************************/
+
+void AliEveMacroExecutorWindow::NewEventLoaded()
+{
+ // Slot called after a new event has been loaded
+
+ // !!! Once we have exit status from the macro, can update GUI showing this.
+}
+
+void AliEveMacroExecutorWindow::DoReloadEvent()
+{
+ // Slot for reload-event.
+
+ gAliEveEvent->GotoEvent(gAliEveEvent->GetEventId());
+}
+
+void AliEveMacroExecutorWindow::DoMacroSelected(Int_t mid)
+{
+ // Slot for macro-selected.
+
+ fEditor->SetModel(0, fBoxContents[mid], kButton1Down);
+}
--- /dev/null
+// @(#)root/eve:$Id$
+// Author: Matevz Tadel 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#ifndef AliEveMacroExecutorWindow_H
+#define AliEveMacroExecutorWindow_H
+
+#include "TGFrame.h"
+
+#include <vector>
+
+class AliEveMacroExecutor;
+class AliEveMacro;
+class TGListBox;
+class TGedEditor;
+
+//______________________________________________________________________________
+// Short description of AliEveMacroExecutorWindow
+//
+
+class AliEveMacroExecutorWindow : public TGMainFrame
+{
+public:
+ AliEveMacroExecutorWindow(AliEveMacroExecutor* master);
+ virtual ~AliEveMacroExecutorWindow();
+
+ void PopulateMacros(Bool_t keep_selected=kTRUE);
+
+ void NewEventLoaded();
+
+ void DoReloadEvent();
+ void DoMacroSelected(Int_t mid);
+
+protected:
+ AliEveMacroExecutor *fM;
+
+ TGCompositeFrame *fMainFrame;
+ TGCompositeFrame *fCtrlFrame;
+ TGListBox *fListBox;
+ TGedEditor *fEditor;
+
+ std::vector<AliEveMacro*> fBoxContents;
+
+private:
+ AliEveMacroExecutorWindow(const AliEveMacroExecutorWindow&); // Not implemented
+ AliEveMacroExecutorWindow& operator=(const AliEveMacroExecutorWindow&); // Not implemented
+
+ ClassDef(AliEveMacroExecutorWindow, 0); // Short description.
+};
+
+#endif
#pragma link C++ global gAliEveEvent;
+// AliEveMacro and AliEveMacroExecutor
+#pragma link C++ class AliEveMacro+;
+#pragma link C++ class AliEveMacroEditor+;
+#pragma link C++ class AliEveMacroExecutor+;
+#pragma link C++ class AliEveMacroExecutorWindow+;
+
#pragma link C++ class AliEveKineTools+;
#pragma link C++ class AliEveVSDCreator+;
return 0;
}
- clusters->SetMarkerStyle(2);
- clusters->SetMarkerSize(0.2);
- clusters->SetMarkerColor(4);
-
char form[1000];
sprintf(form,"ITS Clusters");
clusters->SetName(form);
char tip[1000];
sprintf(tip,"N=%d", clusters->Size());
clusters->SetTitle(tip);
+
+ const TString viz_tag("ITS Clusters");
+ if (gEve->FindVizDBEntry(viz_tag) == 0)
+ {
+ TEvePointSet* m = new TEvePointSet();
+ m->SetMarkerColor(4);
+ m->SetMarkerSize(0.2);
+ m->SetMarkerStyle(2);
+ gEve->InsertVizDBEntry(viz_tag, m);
+ }
+ // The above can be removed when going to new root - then call:
+ // clusters->ApplyVizTag(viz_tag, "Clusters");
+ clusters->ApplyVizTag(viz_tag);
+
gEve->AddElement(clusters, cont);
+
gEve->Redraw3D();
return clusters;
return 0;
}
- clusters->SetMarkerStyle(2);
- clusters->SetMarkerSize(0.2);
- clusters->SetMarkerColor(4);
-
char form[1000];
sprintf(form,"TOF Clusters");
clusters->SetName(form);
char tip[1000];
sprintf(tip,"N=%d", clusters->Size());
clusters->SetTitle(tip);
+
+ const TString viz_tag("TOF Clusters");
+ if (gEve->FindVizDBEntry(viz_tag) == 0)
+ {
+ TEvePointSet* m = new TEvePointSet();
+ m->SetMarkerColor(4);
+ m->SetMarkerSize(0.2);
+ m->SetMarkerStyle(2);
+ gEve->InsertVizDBEntry(viz_tag, m);
+ }
+ clusters->ApplyVizTag(viz_tag);
+
gEve->AddElement(clusters, cont);
+
gEve->Redraw3D();
return clusters;
return 0;
}
- clusters->SetMarkerStyle(2);
- clusters->SetMarkerSize(0.2);
- clusters->SetMarkerColor(4);
-
char form[1000];
sprintf(form,"TOF Clusters");
clusters->SetName(form);
char tip[1000];
sprintf(tip,"N=%d", clusters->Size());
clusters->SetTitle(tip);
+
+ const TString viz_tag("TOF Clusters");
+ if (gEve->FindVizDBEntry(viz_tag) == 0)
+ {
+ TEvePointSet* m = new TEvePointSet();
+ m->SetMarkerColor(4);
+ m->SetMarkerSize(0.2);
+ m->SetMarkerStyle(2);
+ gEve->InsertVizDBEntry(viz_tag, m);
+ }
+ // The above can be removed when going to new root - then call:
+ // clusters->ApplyVizTag(viz_tag, "Clusters");
+ clusters->ApplyVizTag(viz_tag);
+
gEve->AddElement(clusters, cont);
+
gEve->Redraw3D();
return clusters;
return 0;
}
- clusters->SetMarkerStyle(2);
- clusters->SetMarkerSize(0.2);
- clusters->SetMarkerColor(4);
-
char form[1000];
sprintf(form,"TPC Clusters");
clusters->SetName(form);
char tip[1000];
sprintf(tip,"N=%d", clusters->Size());
clusters->SetTitle(tip);
+
+ const TString viz_tag("TPC Clusters");
+ if (gEve->FindVizDBEntry(viz_tag) == 0)
+ {
+ TEvePointSet* m = new TEvePointSet();
+ m->SetMarkerColor(4);
+ m->SetMarkerSize(0.2);
+ m->SetMarkerStyle(2);
+ gEve->InsertVizDBEntry(viz_tag, m);
+ }
+ // The above can be removed when going to new root - then call:
+ // clusters->ApplyVizTag(viz_tag, "Clusters");
+ clusters->ApplyVizTag(viz_tag);
+
gEve->AddElement(clusters, cont);
+
gEve->Redraw3D();
return clusters;
return 0;
}
- clusters->SetMarkerStyle(2);
- clusters->SetMarkerSize(0.2);
- clusters->SetMarkerColor(4);
-
char form[1000];
sprintf(form,"TRD Clusters");
clusters->SetName(form);
char tip[1000];
sprintf(tip,"N=%d", clusters->Size());
clusters->SetTitle(tip);
+
+ const TString viz_tag("TRD Clusters");
+ if (gEve->FindVizDBEntry(viz_tag) == 0)
+ {
+ TEvePointSet* m = new TEvePointSet();
+ m->SetMarkerColor(4);
+ m->SetMarkerSize(0.2);
+ m->SetMarkerStyle(2);
+ gEve->InsertVizDBEntry(viz_tag, m);
+ }
+ // The above can be removed when going to new root - then call:
+ // clusters->ApplyVizTag(viz_tag, "Clusters");
+ clusters->ApplyVizTag(viz_tag);
+
gEve->AddElement(clusters, cont);
+
gEve->Redraw3D();
return clusters;
--- /dev/null
+void VizDB_scan()
+{
+ TEvePointSet* ps;
+
+ // Clusters
+
+ ps = new TEvePointSet();
+ ps->SetMarkerColor(5);
+ ps->SetMarkerSize(0.2);
+ ps->SetMarkerStyle(2);
+ gEve->InsertVizDBEntry("ITS Clusters", ps);
+
+ ps = new TEvePointSet();
+ ps->SetMarkerColor(4);
+ ps->SetMarkerSize(0.2);
+ ps->SetMarkerStyle(2);
+ gEve->InsertVizDBEntry("TPC Clusters", ps);
+
+ ps = new TEvePointSet();
+ ps->SetMarkerColor(7);
+ ps->SetMarkerSize(0.5);
+ ps->SetMarkerStyle(4);
+ gEve->InsertVizDBEntry("TRD Clusters", ps);
+
+ ps = new TEvePointSet();
+ ps->SetMarkerColor(kOrange);
+ ps->SetMarkerSize(0.5);
+ ps->SetMarkerStyle(4);
+ gEve->InsertVizDBEntry("TOF Clusters", ps);
+}
--- /dev/null
+// $Id: NLT_trackcount_init.C 24927 2008-04-04 13:46:04Z mtadel $
+// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+class AliEveMacroExecutor;
+
+class TEveProjectionManager;
+class TEveGeoShape;
+class TEveUtil;
+
+R__EXTERN TEveProjectionManager *gRPhiMgr;
+R__EXTERN TEveProjectionManager *gRhoZMgr;
+
+TEveGeoShape *gGeomGentle = 0;
+TEveGeoShape *gGeomGentleTRD = 0;
+
+Bool_t gShowTRD = kFALSE;
+
+void anyscan_init()
+{
+ TEveUtil::LoadMacro("alieve_init.C");
+ alieve_init(".", -1);
+
+ TEveLine::SetDefaultSmooth(1);
+
+ TEveUtil::AssertMacro("VizDB_scan.C");
+
+
+ AliEveTrackFitter* fitter = new AliEveTrackFitter();
+ gEve->AddToListTree(fitter, 1);
+ gEve->AddElement(fitter, gEve->GetEventScene());
+
+ AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
+ gEve->AddToListTree(g_trkcnt, kFALSE);
+
+
+ gROOT->ProcessLine(".L SplitGLView.C+");
+ TEveBrowser* browser = gEve->GetBrowser();
+ browser->ExecPlugin("SplitGLView", 0, "new SplitGLView(gClient->GetRoot(), 600, 450, kTRUE)");
+
+ if (gRPhiMgr) {
+ TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
+ a->SetNumTickMarks(3);
+ a->SetText("R-Phi");
+ a->SetFontFile("comicbd");
+ a->SetFontSize(10);
+ gEve->GetScenes()->FindChild("R-Phi Projection")->AddElement(a);
+ }
+ if (gRhoZMgr) {
+ TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
+ a->SetNumTickMarks(3);
+ a->SetText("Rho-Z");
+ a->SetFontFile("comicbd");
+ a->SetFontSize(10);
+ gEve->GetScenes()->FindChild("Rho-Z Projection")->AddElement(a);
+ }
+
+ // geometry
+ TEveUtil::LoadMacro("geom_gentle.C");
+ gGeomGentle = geom_gentle();
+ if (gShowTRD) {
+ TEveUtil::LoadMacro("geom_gentle_trd.C");
+ gGeomGentleTRD = geom_gentle_trd();
+ }
+
+
+ AliEveMacroExecutor *exec = gAliEveEvent->GetExecutor();
+
+ exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "primary_vertex.C", "primary_vertex"));
+ exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "esd_V0_points.C", "esd_V0_points"));
+ exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "esd_V0.C", "esd_V0"));
+ // exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "esd_tracks.C", ""));
+ TEveUtil::LoadMacro("esd_tracks.C");
+
+ exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "its_clusters.C+", "its_clusters"));
+ exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "tpc_clusters.C+", "tpc_clusters"));
+ exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "trd_clusters.C+", "trd_clusters"));
+ exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "tof_clusters.C+", "tof_clusters"));
+
+ TEveBrowser* browser = gEve->GetBrowser();
+
+ browser->StartEmbedding(TRootBrowser::kRight);
+ AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
+ browser->StopEmbedding("DataSelection");
+ exewin->PopulateMacros();
+
+ browser->GetTabRight()->SetTab(1);
+
+ browser->StartEmbedding(TRootBrowser::kBottom);
+ new AliEveEventManagerWindow;
+ browser->StopEmbedding("EventCtrl");
+
+ // event
+ gAliEveEvent->AddNewEventCommand("on_new_event();");
+ gAliEveEvent->GotoEvent(0);
+
+ gEve->EditElement(g_trkcnt);
+
+ gEve->Redraw3D(kTRUE);
+}
+
+/******************************************************************************/
+
+void on_new_event()
+{
+ printf("on_new_event() entered ...\n");
+
+ TEveElementList* cont = esd_tracks_vertex_cut();
+
+ // Here we expect five TEveTrackList containers.
+ // First two have reasonable primaries (sigma-to-prim-vertex < 5).
+ // Other three are almost certainly secondaries.
+ Int_t count = 1;
+ AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance;
+ g_trkcnt->Reset();
+ g_trkcnt->SetEventId(gAliEveEvent->GetEventId());
+ TEveElement::List_i i = cont->BeginChildren();
+ while (i != cont->EndChildren()) {
+ TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i);
+ if (l != 0) {
+ // l->SetLineWidth(2);
+ g_trkcnt->RegisterTracks(l, (count <= 2));
+ ++count;
+ }
+ ++i;
+ }
+
+ AliESDEvent* esd = AliEveEventManager::AssertESD();
+ {
+ TTimeStamp ts(esd->GetTimeStamp());
+ TString win_title("Eve Main Window -- Timestamp: ");
+ win_title += ts.AsString("s");
+ win_title += "; Event # in ESD file: ";
+ win_title += esd->GetEventNumberInFile();
+ gEve->GetBrowser()->SetWindowName(win_title);
+ }
+ Double_t x[3];
+ esd->GetPrimaryVertex()->GetXYZ(x);
+
+ TEveElement* top = gEve->GetCurrentEvent();
+
+ if (gRPhiMgr && top) {
+ gRPhiMgr->DestroyElements();
+ gRPhiMgr->SetCenter(x[0], x[1], x[2]);
+ gRPhiMgr->ImportElements(gGeomGentle);
+ if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD);
+ gRPhiMgr->ImportElements(top);
+ }
+ if (gRhoZMgr && top) {
+ gRhoZMgr->DestroyElements();
+ gRhoZMgr->SetCenter(x[0], x[1], x[2]);
+ gRhoZMgr->ImportElements(gGeomGentle);
+ if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD);
+ gRhoZMgr->ImportElements(top);
+ }
+
+ gROOT->ProcessLine("SplitGLView::UpdateSummary()");
+}
+
+/******************************************************************************/
+
+TParticle* id(Int_t label=0, Bool_t showParents=kTRUE)
+{
+ AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
+ rl->LoadKinematics();
+ AliStack* stack = rl->Stack();
+
+ printf("Number primaries %d, all particles %d, label %d\n",
+ stack->GetNprimary(), stack->GetNtrack(), label);
+ if (label < 0 || label >= stack->GetNtrack()) {
+ printf(" Label exceeds available range.\n");
+ return 0;
+ }
+
+ TParticle* part = stack->Particle(label);
+ if (part != 0) {
+ part->Print();
+ if (showParents) {
+ while (part->GetMother(0) >= 0) {
+ part = stack->Particle(part->GetMother(0));
+ part->Print();
+ }
+ }
+ }
+ return stack->Particle(label);
+}
TEveUtil::LoadMacro("alieve_init.C");
alieve_init(".", -1);
- TEveBrowser* b = gEve->GetBrowser();
- b->StartEmbedding(TRootBrowser::kBottom);
- new AliEveEventManagerWindow;
- b->StopEmbedding("EventCtrl");
-
-
- TEveUtil::LoadMacro("geom_gentle.C");
- if (gShowTRD) TEveUtil::LoadMacro("geom_gentle_trd.C");
-
- TEveUtil::LoadMacro("primary_vertex.C");
- TEveUtil::LoadMacro("esd_V0_points.C");
- TEveUtil::LoadMacro("esd_V0.C");
- TEveUtil::LoadMacro("esd_tracks.C");
- TEveUtil::LoadMacro("its_clusters.C+");
- TEveUtil::LoadMacro("tpc_clusters.C+");
- TEveUtil::LoadMacro("trd_clusters.C+");
- TEveUtil::LoadMacro("tof_clusters.C+");
-
- TEveLine::SetDefaultSmooth(1);
-
- /*
- TEveViewer* nv = gEve->SpawnNewViewer("NLT Projected");
- TEveScene* ns = gEve->SpawnNewScene("NLT");
- nv->AddScene(ns);
- TGLViewer* v = nv->GetGLViewer();
- v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
- TGLCameraMarkupStyle* mup = v->GetCameraMarkup();
- if(mup) mup->SetShow(kFALSE);
- */
-
AliEveTrackFitter* fitter = new AliEveTrackFitter();
gEve->AddToListTree(fitter, 1);
gEve->AddElement(fitter, gEve->GetEventScene());
gEve->AddToListTree(g_trkcnt, kFALSE);
- // geometry
- gGeomGentle = geom_gentle();
- if (gShowTRD) gGeomGentleTRD = geom_gentle_trd();
-
-
gROOT->ProcessLine(".L SplitGLView.C+");
TEveBrowser* browser = gEve->GetBrowser();
browser->ExecPlugin("SplitGLView", 0, "new SplitGLView(gClient->GetRoot(), 600, 450, kTRUE)");
gEve->GetScenes()->FindChild("Rho-Z Projection")->AddElement(a);
}
+ // geometry
+ TEveUtil::LoadMacro("geom_gentle.C");
+ gGeomGentle = geom_gentle();
+ if (gShowTRD) {
+ TEveUtil::LoadMacro("geom_gentle_trd.C");
+ gGeomGentleTRD = geom_gentle_trd();
+ }
+
+ // event data
+ TEveUtil::LoadMacro("primary_vertex.C");
+ TEveUtil::LoadMacro("esd_V0_points.C");
+ TEveUtil::LoadMacro("esd_V0.C");
+ TEveUtil::LoadMacro("esd_tracks.C");
+ TEveUtil::LoadMacro("its_clusters.C+");
+ TEveUtil::LoadMacro("tpc_clusters.C+");
+ TEveUtil::LoadMacro("trd_clusters.C+");
+ TEveUtil::LoadMacro("tof_clusters.C+");
+
+ TEveLine::SetDefaultSmooth(1);
+
+ TEveBrowser* browser = gEve->GetBrowser();
+
+ browser->StartEmbedding(TRootBrowser::kBottom);
+ new AliEveEventManagerWindow;
+ browser->StopEmbedding("EventCtrl");
+
// event
gAliEveEvent->AddNewEventCommand("on_new_event();");
gAliEveEvent->GotoEvent(0);