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