2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
10 #ifndef AliEveEventManager_H
11 #define AliEveEventManager_H
13 #include <TEveEventManager.h>
15 #include <TObjArray.h>
17 class AliEveMacroExecutor;
18 class AliEveEventSelector;
33 //==============================================================================
37 // Interface to ALICE event-data (RunLoader, ESD), magnetic field and
42 class AliEveEventManager : public TEveEventManager,
46 static void SetESDFileName(const TString& esd);
47 static void SetAODFileName(const TString& aod);
48 static void AddAODfriend (const TString& friendFileName);
49 static void SetRawFileName(const TString& raw);
50 static void SetCdbUri (const TString& cdb);
51 static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd,
52 Bool_t assertAod, Bool_t assertRaw);
55 AliEveEventManager(const TString& name="Event");
56 AliEveEventManager(const TString& name, const TString& path, Int_t ev=0);
57 virtual ~AliEveEventManager();
60 void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd, AliESDfriend *esdf);
61 virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const;
62 virtual void GotoEvent(Int_t event);
63 virtual void NextEvent();
64 virtual void PrevEvent();
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; }
72 AliESDfriend* GetESDfriend() const { return fESDfriend; }
73 Bool_t GetESDfriendExists() const { return fESDfriendExists; }
74 TFile* GetAODFile() const { return fAODFile; }
75 TTree* GetAODTree() const { return fAODTree; }
76 AliAODEvent* GetAOD() const { return fAOD; }
77 virtual const Text_t* GetTitle() const { return fPath.Data(); }
78 AliEveEventSelector* GetEventSelector() const { return fPEventSelector; }
79 TString GetEventInfoHorizontal() const;
80 TString GetEventInfoVertical() const;
82 static Bool_t HasRunLoader();
83 static Bool_t HasESD();
84 static Bool_t HasESDfriend();
85 static Bool_t HasAOD();
86 static Bool_t HasRawReader();
88 static AliRunLoader* AssertRunLoader();
89 static AliESDEvent* AssertESD();
90 static AliESDfriend* AssertESDfriend();
91 static AliAODEvent* AssertAOD();
92 static AliRawReader* AssertRawReader();
94 static AliMagF* AssertMagField();
95 static TGeoManager* AssertGeometry();
97 static AliEveEventManager* AddDependentManager(const TString& name, const TString& path);
98 static AliEveEventManager* GetDependentManager(const TString& name);
100 static AliEveEventManager* GetMaster();
101 static AliEveEventManager* GetCurrent();
103 static void RegisterTransient (TEveElement* element);
104 static void RegisterTransientList(TEveElement* element);
107 Double_t GetAutoLoadTime() const { return fAutoLoadTime; }
108 Bool_t GetAutoLoad() const { return fAutoLoad; }
109 void SetAutoLoadTime(Float_t time);
110 void SetAutoLoad(Bool_t autoLoad);
111 void SetTrigSel(Int_t trig);
112 void AutoLoadNextEvent();
114 Bool_t AreEventFilesOpened() const { return fIsOpen; }
115 Bool_t IsEventAvailable() const { return fHasEvent; }
116 Bool_t IsUnderExternalControl() const { return fExternalCtrl; }
118 virtual void AfterNewEventLoaded();
119 void NewEventLoaded(); // *SIGNAL*
121 AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
124 TString fPath; // URL to event-data.
125 Int_t fEventId; // Id of current event.
127 AliRunLoader* fRunLoader; // Run loader.
129 TFile *fESDFile; // ESD file.
130 TTree *fESDTree; // ESD tree.
131 AliESDEvent *fESD; // ESDEvent object.
132 AliESDfriend *fESDfriend; // ESDfriend object.
133 Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data.
134 TFile *fAODFile; // AOD file.
135 TTree *fAODTree; // AOD tree.
136 AliAODEvent *fAOD; // AODEvent object.
138 AliRawReader *fRawReader; // Raw-data reader.
140 Bool_t fAutoLoad; // Automatic loading of events (online)
141 Float_t fAutoLoadTime; // Auto-load time in seconds
142 TTimer *fAutoLoadTimer; // Timer for automatic event loading
144 Bool_t fIsOpen; // Are event-files opened.
145 Bool_t fHasEvent; // Is an event available.
146 Bool_t fExternalCtrl; // Are we under external event-loop.
148 AliEveMacroExecutor *fExecutor; // Executor for std macros
150 TEveElementList *fTransients; // Container for additional transient (per event) elements.
151 TEveElementList *fTransientLists; // Container for lists of transient (per event) elements.
153 AliEveEventSelector* fPEventSelector; // Event filter
155 TList *fSubManagers; // Dependent event-managers, used for event embedding.
157 static TString fgESDFileName; // Name by which to open ESD.
158 static TString fgAODFileName; // Name by which to open AOD.
159 static TString fgRawFileName; // Name by which to open raw-data file.
160 static TString fgCdbUri; // Global URI to CDB.
161 static Bool_t fgAssertRunLoader; // Global flag specifying if AliRunLoader must be asserted during opening of the event-data.
162 static Bool_t fgAssertESD; // Global flag specifying if ESDEvent must be asserted during opening of the event-data.
163 static Bool_t fgAssertAOD; // Global flag specifying if AODEvent must be asserted during opening of the event-data.
164 static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data.
166 static TList *fgAODfriends; // Global list of AOD friend names to be attached during opening of the event-data (empty by default).
168 static Bool_t fgGRPLoaded; // Global run parameters loaded?
169 static AliMagF *fgMagField; // Global pointer to magnetic field.
170 static Bool_t fgUniformField; // Track with uniform field.
173 AliEveEventManager(const AliEveEventManager&); // Not implemented
174 AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
176 void InitInternals();
177 void StartAutoLoadTimer();
178 void StopAutoLoadTimer();
180 static Bool_t InitGRP();
182 Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
184 static AliEveEventManager* fgMaster;
185 static AliEveEventManager* fgCurrent;
187 ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way.