AliEveMacro
[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>
5a5a1232 16
f6afd0e1 17class AliEveMacroExecutor;
18
5a5a1232 19class AliRunLoader;
af885e0f 20class AliESDEvent;
3aecaefc 21class AliESDfriend;
b3b7b8d3 22class AliAODEvent;
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);
b3b7b8d3 45 static void SetAODFileName(const TString& aod);
46 static void AddAODfriend (const TString& friendFileName);
4d62585e 47 static void SetRawFileName(const TString& raw);
48 static void SetCdbUri (const TString& cdb);
b3b7b8d3 49 static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd,
50 Bool_t assertAod, Bool_t assertRaw);
632d2b03 51
08b0f222 52
ba5d58f2 53 AliEveEventManager(const TString& name="Event");
54 AliEveEventManager(const TString& name, const TString& path, Int_t ev=0);
a15e6d7d 55 virtual ~AliEveEventManager();
56
516389a2 57 virtual void Open();
482d0751 58 void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd, AliESDfriend *esdf);
f76c9e9b 59 virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const;
516389a2 60 virtual void GotoEvent(Int_t event);
61 virtual void NextEvent();
62 virtual void PrevEvent();
63 virtual void Close();
ecb84424 64 Bool_t FindNextByTrigger(Int_t& i);
65 Bool_t FindPrevByTrigger(Int_t& i);
516389a2 66
90fa773e 67
b3b7b8d3 68 Int_t GetEventId() const { return fEventId; }
69 AliRunLoader* GetRunLoader() const { return fRunLoader; }
70 TFile* GetESDFile() const { return fESDFile; }
71 TTree* GetESDTree() const { return fESDTree; }
72 AliESDEvent* GetESD() const { return fESD; }
2cea771a 73 AliESDfriend* GetESDfriend() const { return fESDfriend; }
74 Bool_t GetESDfriendExists() const { return fESDfriendExists; }
b3b7b8d3 75 TFile* GetAODFile() const { return fAODFile; }
76 TTree* GetAODTree() const { return fAODTree; }
77 AliAODEvent* GetAOD() const { return fAOD; }
2cea771a 78 virtual const Text_t* GetTitle() const { return fPath.Data(); }
12365217 79 TString GetEventInfoHorizontal() const;
80 TString GetEventInfoVertical() const;
5a5a1232 81
f6afd0e1 82 static Bool_t HasRunLoader();
83 static Bool_t HasESD();
84 static Bool_t HasESDfriend();
b3b7b8d3 85 static Bool_t HasAOD();
f6afd0e1 86 static Bool_t HasRawReader();
87
5a5a1232 88 static AliRunLoader* AssertRunLoader();
32e219c2 89 static AliESDEvent* AssertESD();
3aecaefc 90 static AliESDfriend* AssertESDfriend();
b3b7b8d3 91 static AliAODEvent* AssertAOD();
c2c4b7a2 92 static AliRawReader* AssertRawReader();
5a5a1232 93
632d2b03 94 static TGeoManager* AssertGeometry();
95
ba5d58f2 96 static AliEveEventManager* AddDependentManager(const TString& name, const TString& path);
97 static AliEveEventManager* GetDependentManager(const TString& name);
4d62585e 98
99 static AliEveEventManager* GetMaster();
100 static AliEveEventManager* GetCurrent();
101
08b0f222 102 static void RegisterTransient(TEveElement* element);
103
104
488869c1 105 Double_t GetAutoLoadTime() const { return fAutoLoadTime; }
106 Bool_t GetAutoLoad() const { return fAutoLoad; }
107 void SetAutoLoadTime(Float_t time);
319f3084 108 void SetAutoLoad(Bool_t autoLoad);
488869c1 109 void AutoLoadNextEvent();
80547f2d 110
ecb84424 111 Bool_t GetSelectOnTriggerType() const { return fSelectOnTriggerType; }
112 TString GetTriggerType() const { return fTriggerType; }
113 void SetTriggerType(const TString& triggertype) { fTriggerType = triggertype; }
114 void SetSelectOnTriggerType(Bool_t sel) { fSelectOnTriggerType = sel; }
115
488869c1 116 Bool_t AreEventFilesOpened() const { return fIsOpen; }
117 Bool_t IsEventAvailable() const { return fHasEvent; }
118 Bool_t IsUnderExternalControl() const { return fExternalCtrl; }
319f3084 119
f6afd0e1 120 virtual void AfterNewEventLoaded();
121 void NewEventLoaded(); // *SIGNAL*
122
123 AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
f76c9e9b 124
4b456ebb 125protected:
126 TString fPath; // URL to event-data.
127 Int_t fEventId; // Id of current event.
128
129 AliRunLoader* fRunLoader; // Run loader.
130
4d62585e 131 TFile *fESDFile; // ESD file.
132 TTree *fESDTree; // ESD tree.
133 AliESDEvent *fESD; // ESDEvent object.
134 AliESDfriend *fESDfriend; // ESDfriend object.
4b456ebb 135 Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data.
b3b7b8d3 136 TFile *fAODFile; // AOD file.
137 TTree *fAODTree; // AOD tree.
138 AliAODEvent *fAOD; // AODEvent object.
4b456ebb 139
4d62585e 140 AliRawReader *fRawReader; // Raw-data reader.
c2c4b7a2 141
319f3084 142 Bool_t fAutoLoad; // Automatic loading of events (online)
488869c1 143 Float_t fAutoLoadTime; // Auto-load time in seconds
319f3084 144 TTimer *fAutoLoadTimer; // Timer for automatic event loading
80547f2d 145
146 Bool_t fIsOpen; // Are event-files opened.
147 Bool_t fHasEvent; // Is an event available.
148 Bool_t fExternalCtrl; // Are we under external event-loop.
149
4d62585e 150 Bool_t fSelectOnTriggerType; // Whether to select on trigger-type.
151 TString fTriggerType; // Trigger-type to select on.
319f3084 152
f6afd0e1 153 AliEveMacroExecutor *fExecutor; // Executor for std macros
154
08b0f222 155 TEveElementList *fTransients; // Container for additional transient (per event) elements.
156
4d62585e 157 TList *fSubManagers; // Dependent event-managers, used for event embedding.
158
c2c4b7a2 159 static TString fgESDFileName; // Name by which to open ESD.
b3b7b8d3 160 static TString fgAODFileName; // Name by which to open AOD.
c2c4b7a2 161 static TString fgRawFileName; // Name by which to open raw-data file.
4b456ebb 162 static TString fgCdbUri; // Global URI to CDB.
163 static Bool_t fgAssertRunLoader; // Global flag specifying if AliRunLoader must be asserted during opening of the event-data.
164 static Bool_t fgAssertESD; // Global flag specifying if ESDEvent must be asserted during opening of the event-data.
b3b7b8d3 165 static Bool_t fgAssertAOD; // Global flag specifying if AODEvent must be asserted during opening of the event-data.
c2c4b7a2 166 static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data.
4b456ebb 167
b3b7b8d3 168 static TList *fgAODfriends; // Global list of AOD friend names to be attached during opening of the event-data (empty by default).
4b456ebb 169
170private:
171 AliEveEventManager(const AliEveEventManager&); // Not implemented
172 AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
173
488869c1 174 void InitInternals();
175 void StartAutoLoadTimer();
176 void StopAutoLoadTimer();
177
178 Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
179
4d62585e 180 static AliEveEventManager* fgMaster;
181 static AliEveEventManager* fgCurrent;
182
4b456ebb 183 ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way.
184};
5a5a1232 185
5a5a1232 186#endif