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;
36 //==============================================================================
40 // Interface to ALICE event-data (RunLoader, ESD), magnetic field and
45 class AliEveEventManager : public TEveEventManager,
49 static void SetESDFileName(const TString& esd);
50 static void SetAODFileName(const TString& aod);
51 static void AddAODfriend (const TString& friendFileName);
52 static void SetRawFileName(const TString& raw);
53 static void SetCdbUri (const TString& cdb);
54 static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd,
55 Bool_t assertAod, Bool_t assertRaw);
56 static void SearchRawForCentralReconstruction();
58 AliEveEventManager(const TString& name="Event");
59 AliEveEventManager(const TString& name, const TString& path, Int_t ev=0);
60 virtual ~AliEveEventManager();
63 void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd, AliESDfriend *esdf);
64 virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const;
65 virtual void GotoEvent(Int_t event);
66 virtual void NextEvent();
67 virtual void PrevEvent();
70 Int_t GetEventId() const { return fEventId; }
71 AliRunLoader* GetRunLoader() const { return fRunLoader; }
72 TFile* GetESDFile() const { return fESDFile; }
73 TTree* GetESDTree() const { return fESDTree; }
74 AliESDEvent* GetESD() const { return fESD; }
75 AliESDfriend* GetESDfriend() const { return fESDfriend; }
76 Bool_t GetESDfriendExists() const { return fESDfriendExists; }
77 TFile* GetAODFile() const { return fAODFile; }
78 TTree* GetAODTree() const { return fAODTree; }
79 AliAODEvent* GetAOD() const { return fAOD; }
80 virtual const Text_t* GetTitle() const { return fPath.Data(); }
81 AliEveEventSelector* GetEventSelector() const { return fPEventSelector; }
82 TString GetEventInfoHorizontal() const;
83 TString GetEventInfoVertical() const;
85 static Int_t CurrentEventId();
87 static Bool_t HasRunLoader();
88 static Bool_t HasESD();
89 static Bool_t HasESDfriend();
90 static Bool_t HasAOD();
91 static Bool_t HasRawReader();
93 static AliRunLoader* AssertRunLoader();
94 static AliESDEvent* AssertESD();
95 static AliESDfriend* AssertESDfriend();
96 static AliAODEvent* AssertAOD();
97 static AliRawReader* AssertRawReader();
99 static AliMagF* AssertMagField();
100 static TGeoManager* AssertGeometry();
102 static AliEveEventManager* AddDependentManager(const TString& name, const TString& path);
103 static AliEveEventManager* GetDependentManager(const TString& name);
105 static AliEveEventManager* GetMaster();
106 static AliEveEventManager* GetCurrent();
108 static void RegisterTransient (TEveElement* element);
109 static void RegisterTransientList(TEveElement* element);
112 Double_t GetAutoLoadTime() const { return fAutoLoadTime; }
113 Bool_t GetAutoLoad() const { return fAutoLoad; }
114 void SetAutoLoadTime(Float_t time);
115 void SetAutoLoad(Bool_t autoLoad);
116 void SetTrigSel(Int_t trig);
117 void AutoLoadNextEvent();
119 Bool_t AreEventFilesOpened() const { return fIsOpen; }
120 Bool_t IsEventAvailable() const { return fHasEvent; }
121 Bool_t IsUnderExternalControl() const { return fExternalCtrl; }
123 Bool_t InsertGlobal(const TString& tag, TEveElement* model);
124 Bool_t InsertGlobal(const TString& tag, TEveElement* model,
125 Bool_t replace, Bool_t update);
126 TEveElement* FindGlobal(const TString& tag);
128 virtual void AfterNewEventLoaded();
129 void NewEventDataLoaded(); // *SIGNAL*
130 void NewEventLoaded(); // *SIGNAL*
132 AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
135 TString fPath; // URL to event-data.
136 Int_t fEventId; // Id of current event.
138 AliRunLoader* fRunLoader; // Run loader.
140 TFile *fESDFile; // ESD file.
141 TTree *fESDTree; // ESD tree.
142 AliESDEvent *fESD; // ESDEvent object.
143 AliESDfriend *fESDfriend; // ESDfriend object.
144 Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data.
145 TFile *fAODFile; // AOD file.
146 TTree *fAODTree; // AOD tree.
147 AliAODEvent *fAOD; // AODEvent object.
149 AliRawReader *fRawReader; // Raw-data reader.
151 Bool_t fAutoLoad; // Automatic loading of events (online)
152 Float_t fAutoLoadTime; // Auto-load time in seconds
153 TTimer *fAutoLoadTimer; // Timer for automatic event loading
155 Bool_t fIsOpen; // Are event-files opened.
156 Bool_t fHasEvent; // Is an event available.
157 Bool_t fExternalCtrl; // Are we under external event-loop.
160 Bool_t fGlobalReplace; // Are global replace
161 Bool_t fGlobalUpdate; // Are global updates
163 AliEveMacroExecutor *fExecutor; // Executor for std macros
165 TEveElementList *fTransients; // Container for additional transient (per event) elements.
166 TEveElementList *fTransientLists; // Container for lists of transient (per event) elements.
168 AliEveEventSelector* fPEventSelector; // Event filter
170 TList *fSubManagers; // Dependent event-managers, used for event embedding.
172 static TString fgESDFileName; // Name by which to open ESD.
173 static TString fgAODFileName; // Name by which to open AOD.
174 static TString fgRawFileName; // Name by which to open raw-data file.
175 static TString fgCdbUri; // Global URI to CDB.
176 static Bool_t fgAssertRunLoader; // Global flag specifying if AliRunLoader must be asserted during opening of the event-data.
177 static Bool_t fgAssertESD; // Global flag specifying if ESDEvent must be asserted during opening of the event-data.
178 static Bool_t fgAssertAOD; // Global flag specifying if AODEvent must be asserted during opening of the event-data.
179 static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data.
181 static TList *fgAODfriends; // Global list of AOD friend names to be attached during opening of the event-data (empty by default).
183 static Bool_t fgRawFromStandardLoc; // Global flag to enable looking for raw data in ../../../raw/, as it is stored for central reco.
185 static Bool_t fgGRPLoaded; // Global run parameters loaded?
186 static AliMagF *fgMagField; // Global pointer to magnetic field.
187 static Bool_t fgUniformField; // Track with uniform field.
190 AliEveEventManager(const AliEveEventManager&); // Not implemented
191 AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
193 void InitInternals();
194 void StartAutoLoadTimer();
195 void StopAutoLoadTimer();
197 static Bool_t InitGRP();
199 Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
201 static AliEveEventManager* fgMaster;
202 static AliEveEventManager* fgCurrent;
204 ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way.