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 #include <AliEventInfo.h>
19 class AliEveMacroExecutor;
20 class AliEveEventSelector;
39 //==============================================================================
43 // Interface to ALICE event-data (RunLoader, ESD), magnetic field and
48 class AliEveEventManager : public TEveEventManager,
52 static void SetESDFileName(const TString& esd);
53 static void SetAODFileName(const TString& aod);
54 static void AddAODfriend (const TString& friendFileName);
55 static void SetRawFileName(const TString& raw);
56 static void SetCdbUri (const TString& cdb);
57 static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd,
58 Bool_t assertAod, Bool_t assertRaw);
59 static void SearchRawForCentralReconstruction();
61 AliEveEventManager(const TString& name="Event");
62 AliEveEventManager(const TString& name, const TString& path, Int_t ev=0);
63 virtual ~AliEveEventManager();
66 void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd, AliESDfriend *esdf);
67 virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const;
68 virtual void GotoEvent(Int_t event);
69 virtual void NextEvent();
70 virtual void PrevEvent();
72 void Timeout(); // * SIGNAL*
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; }
79 AliESDfriend* GetESDfriend() const { return fESDfriend; }
80 Bool_t GetESDfriendExists() const { return fESDfriendExists; }
81 TFile* GetAODFile() const { return fAODFile; }
82 TTree* GetAODTree() const { return fAODTree; }
83 AliAODEvent* GetAOD() const { return fAOD; }
84 virtual const Text_t* GetTitle() const { return fPath.Data(); }
85 AliEveEventSelector* GetEventSelector() const { return fPEventSelector; }
86 TString GetEventInfoHorizontal() const;
87 TString GetEventInfoVertical() const;
88 const AliEventInfo* GetEventInfo();
90 static Int_t CurrentEventId();
92 static Bool_t HasRunLoader();
93 static Bool_t HasESD();
94 static Bool_t HasESDfriend();
95 static Bool_t HasAOD();
96 static Bool_t HasRawReader();
98 static AliRunLoader* AssertRunLoader();
99 static AliESDEvent* AssertESD();
100 static AliESDfriend* AssertESDfriend();
101 static AliAODEvent* AssertAOD();
102 static AliRawReader* AssertRawReader();
104 static AliMagF* AssertMagField();
105 static TGeoManager* AssertGeometry();
106 static AliRecoParam* AssertRecoParams();
108 static AliEveEventManager* AddDependentManager(const TString& name, const TString& path);
109 static AliEveEventManager* GetDependentManager(const TString& name);
111 static AliEveEventManager* GetMaster();
112 static AliEveEventManager* GetCurrent();
114 static void RegisterTransient (TEveElement* element);
115 static void RegisterTransientList(TEveElement* element);
118 Double_t GetAutoLoadTime() const { return fAutoLoadTime; }
119 Bool_t GetAutoLoad() const { return fAutoLoad; }
120 void SetAutoLoadTime(Float_t time);
121 void SetAutoLoad(Bool_t autoLoad);
122 void SetTrigSel(Int_t trig);
123 void AutoLoadNextEvent();
125 Bool_t AreEventFilesOpened() const { return fIsOpen; }
126 Bool_t IsEventAvailable() const { return fHasEvent; }
127 Bool_t IsUnderExternalControl() const { return fExternalCtrl; }
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);
134 virtual void AfterNewEventLoaded();
135 void NewEventDataLoaded(); // *SIGNAL*
136 void NewEventLoaded(); // *SIGNAL*
138 AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
141 TString fPath; // URL to event-data.
142 Int_t fEventId; // Id of current event.
144 AliRunLoader* fRunLoader; // Run loader.
146 TFile *fESDFile; // ESD file.
147 TTree *fESDTree; // ESD tree.
148 AliESDEvent *fESD; // ESDEvent object.
149 AliESDfriend *fESDfriend; // ESDfriend object.
150 Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data.
151 TFile *fAODFile; // AOD file.
152 TTree *fAODTree; // AOD tree.
153 AliAODEvent *fAOD; // AODEvent object.
155 AliRawReader *fRawReader; // Raw-data reader.
156 AliEventInfo fEventInfo; // Current Event Info
158 Bool_t fAutoLoad; // Automatic loading of events (online)
159 Float_t fAutoLoadTime; // Auto-load time in seconds
160 TTimer *fAutoLoadTimer; // Timer for automatic event loading
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.
167 Bool_t fGlobalReplace; // Are global replace
168 Bool_t fGlobalUpdate; // Are global updates
170 AliEveMacroExecutor *fExecutor; // Executor for std macros
172 TEveElementList *fTransients; // Container for additional transient (per event) elements.
173 TEveElementList *fTransientLists; // Container for lists of transient (per event) elements.
175 AliEveEventSelector* fPEventSelector; // Event filter
177 TList *fSubManagers; // Dependent event-managers, used for event embedding.
179 static TString fgGAlice; // galice.root file
180 static TString fgESDFileName; // Name by which to open ESD.
181 static TString fgESDfriendsFileName;
182 static TString fgAODFileName; // Name by which to open AOD.
183 static TString fgRawFileName; // Name by which to open raw-data file.
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.
187 static Bool_t fgAssertAOD; // Global flag specifying if AODEvent must be asserted during opening of the event-data.
188 static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data.
190 static TList *fgAODfriends; // Global list of AOD friend names to be attached during opening of the event-data (empty by default).
192 static Bool_t fgRawFromStandardLoc; // Global flag to enable looking for raw data in ../../../raw/, as it is stored for central reco.
194 static Bool_t fgGRPLoaded; // Global run parameters loaded?
195 static AliMagF *fgMagField; // Global pointer to magnetic field.
196 static AliRecoParam* fgRecoParam;
197 static Bool_t fgUniformField; // Track with uniform field.
200 AliEveEventManager(const AliEveEventManager&); // Not implemented
201 AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
203 void InitInternals();
204 void StartAutoLoadTimer();
205 void StopAutoLoadTimer();
207 static Bool_t InitGRP();
208 static Bool_t InitRecoParam();
210 Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
212 static AliEveEventManager* fgMaster;
213 static AliEveEventManager* fgCurrent;
215 ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way.