AliEveEventManager
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveEventManager.h
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
5a5a1232 3
d810d0de 4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
9
ecb84424 10#ifndef AliEveEventManager_H
a15e6d7d 11#define AliEveEventManager_H
5a5a1232 12
84aff7a4 13#include <TEveEventManager.h>
f76c9e9b 14#include <TQObject.h>
ecb84424 15#include <TObjArray.h>
16#include <AliESDEvent.h>
5a5a1232 17
f6afd0e1 18class AliEveMacroExecutor;
19
5a5a1232 20class AliRunLoader;
af885e0f 21class AliESDEvent;
3aecaefc 22class AliESDfriend;
c2c4b7a2 23class AliRawReader;
5a5a1232 24
93845f6c 25class AliMagF;
26
5a5a1232 27class TFile;
28class TTree;
632d2b03 29class TGeoManager;
5a5a1232 30
a15e6d7d 31//==============================================================================
32//
33// AliEveEventManager
34//
35// Interface to ALICE event-data (RunLoader, ESD), magnetic field and
36// geometry.
37//
38
5a5a1232 39
f76c9e9b 40class AliEveEventManager : public TEveEventManager,
41 public TQObject
5a5a1232 42{
5a5a1232 43public:
4d62585e 44 static void SetESDFileName(const TString& esd);
45 static void SetRawFileName(const TString& raw);
46 static void SetCdbUri (const TString& cdb);
c2c4b7a2 47 static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd, Bool_t assertRaw);
632d2b03 48
ba5d58f2 49 AliEveEventManager(const TString& name="Event");
50 AliEveEventManager(const TString& name, const TString& path, Int_t ev=0);
a15e6d7d 51 virtual ~AliEveEventManager();
52
516389a2 53 virtual void Open();
54 void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd);
f76c9e9b 55 virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const;
516389a2 56 virtual void GotoEvent(Int_t event);
57 virtual void NextEvent();
58 virtual void PrevEvent();
59 virtual void Close();
ecb84424 60 Bool_t FindNextByTrigger(Int_t& i);
61 Bool_t FindPrevByTrigger(Int_t& i);
516389a2 62
90fa773e 63
5a5a1232 64 Int_t GetEventId() const { return fEventId; }
65 AliRunLoader* GetRunLoader() const { return fRunLoader; }
77e5986c 66 TFile* GetESDFile() const { return fESDFile; }
5a5a1232 67 TTree* GetESDTree() const { return fESDTree; }
32e219c2 68 AliESDEvent* GetESD() const { return fESD; }
2cea771a 69 AliESDfriend* GetESDfriend() const { return fESDfriend; }
70 Bool_t GetESDfriendExists() const { return fESDfriendExists; }
71 virtual const Text_t* GetTitle() const { return fPath.Data(); }
12365217 72 TString GetEventInfoHorizontal() const;
73 TString GetEventInfoVertical() const;
5a5a1232 74
f6afd0e1 75 static Bool_t HasRunLoader();
76 static Bool_t HasESD();
77 static Bool_t HasESDfriend();
78 static Bool_t HasRawReader();
79
5a5a1232 80 static AliRunLoader* AssertRunLoader();
32e219c2 81 static AliESDEvent* AssertESD();
3aecaefc 82 static AliESDfriend* AssertESDfriend();
c2c4b7a2 83 static AliRawReader* AssertRawReader();
5a5a1232 84
93845f6c 85 static AliMagF* AssertMagField();
86
632d2b03 87 static TGeoManager* AssertGeometry();
88
ba5d58f2 89 static AliEveEventManager* AddDependentManager(const TString& name, const TString& path);
90 static AliEveEventManager* GetDependentManager(const TString& name);
4d62585e 91
92 static AliEveEventManager* GetMaster();
93 static AliEveEventManager* GetCurrent();
94
488869c1 95 Double_t GetAutoLoadTime() const { return fAutoLoadTime; }
96 Bool_t GetAutoLoad() const { return fAutoLoad; }
97 void SetAutoLoadTime(Float_t time);
319f3084 98 void SetAutoLoad(Bool_t autoLoad);
488869c1 99 void AutoLoadNextEvent();
80547f2d 100
ecb84424 101 Bool_t GetSelectOnTriggerType() const { return fSelectOnTriggerType; }
102 TString GetTriggerType() const { return fTriggerType; }
103 void SetTriggerType(const TString& triggertype) { fTriggerType = triggertype; }
104 void SetSelectOnTriggerType(Bool_t sel) { fSelectOnTriggerType = sel; }
105
488869c1 106 Bool_t AreEventFilesOpened() const { return fIsOpen; }
107 Bool_t IsEventAvailable() const { return fHasEvent; }
108 Bool_t IsUnderExternalControl() const { return fExternalCtrl; }
319f3084 109
f6afd0e1 110 virtual void AfterNewEventLoaded();
111 void NewEventLoaded(); // *SIGNAL*
112
113 AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
f76c9e9b 114
4b456ebb 115protected:
116 TString fPath; // URL to event-data.
117 Int_t fEventId; // Id of current event.
118
119 AliRunLoader* fRunLoader; // Run loader.
120
4d62585e 121 TFile *fESDFile; // ESD file.
122 TTree *fESDTree; // ESD tree.
123 AliESDEvent *fESD; // ESDEvent object.
124 AliESDfriend *fESDfriend; // ESDfriend object.
4b456ebb 125 Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data.
126
4d62585e 127 AliRawReader *fRawReader; // Raw-data reader.
c2c4b7a2 128
319f3084 129 Bool_t fAutoLoad; // Automatic loading of events (online)
488869c1 130 Float_t fAutoLoadTime; // Auto-load time in seconds
319f3084 131 TTimer *fAutoLoadTimer; // Timer for automatic event loading
80547f2d 132
133 Bool_t fIsOpen; // Are event-files opened.
134 Bool_t fHasEvent; // Is an event available.
135 Bool_t fExternalCtrl; // Are we under external event-loop.
136
4d62585e 137 Bool_t fSelectOnTriggerType; // Whether to select on trigger-type.
138 TString fTriggerType; // Trigger-type to select on.
319f3084 139
f6afd0e1 140 AliEveMacroExecutor *fExecutor; // Executor for std macros
141
4d62585e 142 TList *fSubManagers; // Dependent event-managers, used for event embedding.
143
c2c4b7a2 144 static TString fgESDFileName; // Name by which to open ESD.
145 static TString fgRawFileName; // Name by which to open raw-data file.
4b456ebb 146 static TString fgCdbUri; // Global URI to CDB.
147 static Bool_t fgAssertRunLoader; // Global flag specifying if AliRunLoader must be asserted during opening of the event-data.
148 static Bool_t fgAssertESD; // Global flag specifying if ESDEvent must be asserted during opening of the event-data.
c2c4b7a2 149 static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data.
4b456ebb 150
4d62585e 151 static AliMagF* fgMagField; // Global pointer to magnetic field.
4b456ebb 152
153private:
154 AliEveEventManager(const AliEveEventManager&); // Not implemented
155 AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
156
488869c1 157 void InitInternals();
158 void StartAutoLoadTimer();
159 void StopAutoLoadTimer();
160
161 Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
162
4d62585e 163 static AliEveEventManager* fgMaster;
164 static AliEveEventManager* fgCurrent;
165
4b456ebb 166 ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way.
167};
5a5a1232 168
5a5a1232 169#endif