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