fRunLoader (0),
fESDFile (0), fESDTree (0), fESD (0),
fESDfriend (0), fESDfriendExists(kFALSE),
- fRawReader (0)
+ fRawReader (0),
+ fAutoLoad(kFALSE),
+ fAutoLoadTime(5.),
+ fAutoLoadTimer(0),
+ fIsOnline(kFALSE)
{
// Default constructor.
}
fRunLoader (0),
fESDFile (0), fESDTree (0), fESD (0),
fESDfriend (0), fESDfriendExists(kFALSE),
- fRawReader (0)
+ fRawReader (0),
+ fAutoLoad(kFALSE),
+ fAutoLoadTime(5.),
+ fAutoLoadTimer(0),
+ fIsOnline(kFALSE)
{
// Constructor with event-directory URL and event-id.
{
// Destructor.
+ if (fAutoLoadTimer) delete fAutoLoadTimer;
// Somewhat unclear what to do here.
// In principle should close all data sources and deregister from
// TEveManager.
SetTitle(fPath);
}
+void AliEveEventManager::SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd)
+{
+ // Set an event from an external source
+ // The method is used in the online visualisation
+ fRunLoader = runLoader;
+ fRawReader = rawReader;
+ fESD = esd;
+ fIsOnline = kTRUE;
+ SetTitle("Online event in memory");
+ SetName("Online Event");
+
+ ElementChanged();
+ AfterNewEventLoaded();
+}
+
void AliEveEventManager::GotoEvent(Int_t event)
{
// Load data for specified event.
fEventId = event;
SetName(Form("Event %d", fEventId));
- UpdateItems();
+ ElementChanged();
AfterNewEventLoaded();
}
gGeoManager = AliGeomManager::GetGeometry();
return gGeoManager;
}
+
+void AliEveEventManager::SetAutoLoad(Bool_t autoLoad)
+{
+ // Set the automatic event loading mode
+ fAutoLoad = autoLoad;
+ StartStopAutoLoadTimer();
+}
+
+void AliEveEventManager::SetAutoLoadTime(Double_t time)
+{
+ // Set the auto-load time in seconds
+ fAutoLoadTime = time;
+ StartStopAutoLoadTimer();
+}
+
+void AliEveEventManager::StartStopAutoLoadTimer()
+{
+ // Create if needed and start
+ // the automatic event loading timer
+ if (fAutoLoad) {
+ if (!fAutoLoadTimer) {
+ fAutoLoadTimer = new TTimer;
+ fAutoLoadTimer->Connect("Timeout()","AliEveEventManager",this,"NextEvent()");
+ }
+ fAutoLoadTimer->Start((Long_t)fAutoLoadTime*1000,kTRUE);
+ }
+ else {
+ if (fAutoLoadTimer) fAutoLoadTimer->Stop();
+ }
+}
+
+void AliEveEventManager::PrevEvent()
+{
+ // Loads previous event
+ // only in case of manual mode
+ if (!fIsOnline) {
+ GotoEvent(fEventId - 1);
+ StartStopAutoLoadTimer();
+ }
+}
+
+void AliEveEventManager::NextEvent()
+{
+ // Loads next event
+ // either in automatic (online) or
+ // manual mode
+
+ if (fIsOnline) {
+ if (fAutoLoadTimer) fAutoLoadTimer->Stop();
+
+ DestroyElements();
+
+ gSystem->ExitLoop();
+ }
+ else {
+ GotoEvent(fEventId + 1);
+ StartStopAutoLoadTimer();
+ }
+}
+
+const char* AliEveEventManager::GetEventInfo() const
+{
+ // Dumps the event-header contents
+
+ static TString eventInfo;
+
+ if (!fRawReader) return "No event information is available";
+
+ const UInt_t* id = fRawReader->GetEventId();
+ const UInt_t* pattern = fRawReader->GetTriggerPattern();
+ const UInt_t* attr = fRawReader->GetAttributes();
+ eventInfo.Form("Run#: %d\nEvent type: %d\nPeriod: %x\nOrbit: %x\nBC: %x\nTrigger: %x-%x\nDetectors: %x\nAttributes:%x-%x-%x",
+ fRawReader->GetRunNumber(),fRawReader->GetType(),
+ (((id)[0]>>4)&0x0fffffff),((((id)[0]<<20)&0xf00000)|(((id)[1]>>12)&0xfffff)),((id)[1]&0x00000fff),
+ pattern[0],pattern[1],
+ *fRawReader->GetDetectorPattern(),
+ attr[0],attr[1],attr[2]);
+
+ return eventInfo.Data();
+}
+
virtual void Open();
+ void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd);
+
virtual void GotoEvent(Int_t event);
- virtual void NextEvent() { GotoEvent(fEventId + 1); }
- virtual void PrevEvent() { GotoEvent(fEventId - 1); }
+ virtual void NextEvent();
+ virtual void PrevEvent();
virtual void Close();
Int_t GetEventId() const { return fEventId; }
AliESDfriend* GetESDfriend() const { return fESDfriend; }
Bool_t GetESDfriendExists() const { return fESDfriendExists; }
virtual const Text_t* GetTitle() const { return fPath.Data(); }
+ const char* GetEventInfo() const;
static AliRunLoader* AssertRunLoader();
static AliESDEvent* AssertESD();
static TGeoManager* AssertGeometry();
+ Bool_t GetAutoLoad() const {return fAutoLoad;}
+ Double_t GetAutoLoadTime() const {return fAutoLoadTime;}
+ void SetAutoLoad(Bool_t autoLoad);
+ void SetAutoLoadTime(Double_t time);
+ Bool_t GetIsOnline() const {return fIsOnline;}
+
+ void StartStopAutoLoadTimer();
+
protected:
TString fPath; // URL to event-data.
Int_t fEventId; // Id of current event.
AliRawReader* fRawReader; // Raw-adata reader.
+ Bool_t fAutoLoad; // Automatic loading of events (online)
+ Double_t fAutoLoadTime; // Auto-load time in seconds
+ TTimer *fAutoLoadTimer; // Timer for automatic event loading
+ Bool_t fIsOnline; // Are we running online?
+
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.
#include "TVirtualPad.h"
#include "TColor.h"
-// Cleanup these includes:
-#include "TGLabel.h"
-#include "TGButton.h"
-#include "TGNumberEntry.h"
-#include "TGColorSelect.h"
-#include "TGDoubleSlider.h"
-
+#include <TEveGValuators.h>
+#include <TGButton.h>
+#include <TGTextView.h>
+#include <TGLabel.h>
//______________________________________________________________________________
// GUI editor for AliEveEventManager.
AliEveEventManagerEditor::AliEveEventManagerEditor(const TGWindow *p, Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
- fM(0)
- // Initialize widget pointers to 0
+ fM(0),
+ fAutoLoad(0),
+ fAutoLoadTime(0),
+ fNextEvent(0),
+ fPrevEvent(0),
+ fEventInfo(0)
{
// Constructor.
MakeTitle("AliEveEventManager");
// Create widgets
- // fXYZZ = new TGSomeWidget(this, ...);
- // AddFrame(fXYZZ, new TGLayoutHints(...));
- // fXYZZ->Connect("SignalName()", "Reve::AliEveEventManagerEditor", this, "DoXYZZ()");
+ {
+ fAutoLoadTime = new TEveGValuator(this, "Autoload time:", 110, 0);
+ fAutoLoadTime->SetShowSlider(kFALSE);
+ fAutoLoadTime->SetNELength(4);
+ fAutoLoadTime->Build();
+ fAutoLoadTime->SetLimits(0, 1000);
+ fAutoLoadTime->SetToolTip("Automatic event loading time in seconds");
+ fAutoLoadTime->Connect("ValueSet(Double_t)",
+ "AliEveEventManagerEditor", this, "DoSetAutoLoadTime()");
+
+ fAutoLoad = new TGCheckButton(fAutoLoadTime,"Autoload");
+ fAutoLoad->SetToolTipText("Automatic event loading (online)");
+ fAutoLoadTime->AddFrame(fAutoLoad, new TGLayoutHints(kLHintsLeft, 12, 0, 2, 0));
+ fAutoLoad->Connect("Toggled(Bool_t)",
+ "AliEveEventManagerEditor", this, "DoSetAutoLoad()");
+ AddFrame(fAutoLoadTime);
+ }
+ {
+ TGHorizontalFrame* f = new TGHorizontalFrame(this);
+ fPrevEvent = new TGTextButton(f, "Previous Event");
+ f->AddFrame(fPrevEvent, new TGLayoutHints(kLHintsExpandX, 0,4,0,0));
+ fPrevEvent->Connect("Clicked()",
+ "AliEveEventManagerEditor", this, "DoPrevEvent()");
+ fNextEvent = new TGTextButton(f, "Next Event");
+ f->AddFrame(fNextEvent, new TGLayoutHints(kLHintsExpandX, 4,0,0,0));
+ fNextEvent->Connect("Clicked()",
+ "AliEveEventManagerEditor", this, "DoNextEvent()");
+ AddFrame(f, new TGLayoutHints(kLHintsExpandX, 8,8,8,0));
+ }
+
+ {
+ TGVerticalFrame* f = new TGVerticalFrame(this);
+
+ TGLabel *eventInfoLabel = new TGLabel(f, "Event Information:");
+ f->AddFrame(eventInfoLabel, new TGLayoutHints(kLHintsNormal, 0,0,6,2));
+
+ fEventInfo = new TGTextView(f, 200, 200);
+ f->AddFrame(fEventInfo, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ AddFrame(f, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ }
+
}
/******************************************************************************/
fM = dynamic_cast<AliEveEventManager*>(obj);
// Set values of widgets
- // fXYZZ->SetValue(fM->GetXYZZ());
+ fAutoLoadTime->SetValue(fM->GetAutoLoadTime());
+ fAutoLoadTime->SetEnabled(fM->GetAutoLoad());
+ fAutoLoad->SetState(fM->GetAutoLoad() ? kButtonDown : kButtonUp);
+
+ fPrevEvent->SetEnabled(!fM->GetIsOnline());
+
+ fEventInfo->LoadBuffer(fM->GetEventInfo());
}
/******************************************************************************/
// Implements callback/slot methods
//______________________________________________________________________________
-// void AliEveEventManagerEditor::DoXYZZ()
-// {
-// // Slot for XYZZ.
-//
-// fM->SetXYZZ(fXYZZ->GetValue());
-// Update();
-// }
+void AliEveEventManagerEditor::DoSetAutoLoad()
+{
+ // Set the auto-load flag
+ //
+ fM->SetAutoLoad(fAutoLoad->IsOn());
+ Update();
+}
+
+//______________________________________________________________________________
+void AliEveEventManagerEditor::DoSetAutoLoadTime()
+{
+ // Set the auto-load time in seconds
+ //
+ fM->SetAutoLoadTime(fAutoLoadTime->GetValue());
+ fM->SetAutoLoad(fAutoLoad->IsOn());
+ Update();
+}
+
+//______________________________________________________________________________
+void AliEveEventManagerEditor::DoPrevEvent()
+{
+ // Load previous event
+ fM->PrevEvent();
+}
+
+//______________________________________________________________________________
+void AliEveEventManagerEditor::DoNextEvent()
+{
+ // Load next event
+ fM->NextEvent();
+}
#include "TGedFrame.h"
-class TGButton;
class TGCheckButton;
-class TGNumberEntry;
-class TGColorSelect;
+class TEveGValuator;
+class TGTextView;
class AliEveEventManager;
virtual void SetModel(TObject* obj);
// Declare callback/slot methods
- // void DoXYZZ();
+ void DoSetAutoLoad();
+ void DoSetAutoLoadTime();
+ void DoPrevEvent();
+ void DoNextEvent();
protected:
AliEveEventManager *fM; // Model object.
// Declare widgets
- // TGSomeWidget* fXYZZ;
+ TGCheckButton *fAutoLoad; // Check-box for automatic loading of events
+ TEveGValuator *fAutoLoadTime; // Time for automatic loading of events
+
+ TGTextButton *fNextEvent; // Load next event
+ TGTextButton *fPrevEvent; // Load previous event
+
+ TGTextView *fEventInfo; // Text box with event info
private:
AliEveEventManagerEditor(const AliEveEventManagerEditor&); // Not implemented
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+void alieve_online()
+{
+ // List of macros to be executed
+ gROOT->Macro("its_raw.C");
+ gROOT->Macro("its_clusters.C");
+}
AliCodeTimerAuto("");
if (!InitRun(input)) return kFALSE;
+
+ Bool_t runAliEVE = kFALSE;
+ if (strcmp(gProgName,"alieve") == 0) runAliEVE = kTRUE;
+
+ if (runAliEVE) {
+ TString macroStr;
+ macroStr.Form("%s/EVE/macros/alieve_online.C",gSystem->ExpandPathName("$ALICE_ROOT"));
+ AliInfo(Form("Loading AliEVE macro: %s",macroStr.Data()));
+ if (gROOT->LoadMacro(macroStr.Data()) != 0)
+ runAliEVE = kFALSE;
+ else
+ gROOT->ProcessLine("if (!gAliEveEvent) {gAliEveEvent = new AliEveEventManager();gAliEveEvent->SetAutoLoad(kTRUE);gAliEveEvent->AddNewEventCommand(\"alieve_online()\");gEve->AddEvent(gAliEveEvent);};");
+ }
//******* The loop over events
Int_t iEvent = 0;
(fRawReader && fRawReader->NextEvent())) {
if (!RunEvent(iEvent)) return kFALSE;
iEvent++;
+
+ if (runAliEVE) {
+ AliInfo("Running AliEVE...");
+ gROOT->ProcessLine(Form("gAliEveEvent->SetEvent((AliRunLoader*)%p,(AliRawReader*)%p,(AliESDEvent*)%p);",fRunLoader,fRawReader,fesd));
+ gROOT->ProcessLine("gAliEveEvent->StartStopAutoLoadTimer();");
+ gSystem->Run();
+ }
}
if (!FinishRun()) return kFALSE;