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;
32 //==============================================================================
36 // Interface to ALICE event-data (RunLoader, ESD), magnetic field and
41 class AliEveEventManager : public TEveEventManager,
45 static void SetESDFileName(const TString& esd);
46 static void SetAODFileName(const TString& aod);
47 static void AddAODfriend (const TString& friendFileName);
48 static void SetRawFileName(const TString& raw);
49 static void SetCdbUri (const TString& cdb);
50 static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd,
51 Bool_t assertAod, Bool_t assertRaw);
54 AliEveEventManager(const TString& name="Event");
55 AliEveEventManager(const TString& name, const TString& path, Int_t ev=0);
56 virtual ~AliEveEventManager();
59 void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd, AliESDfriend *esdf);
60 virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const;
61 virtual void GotoEvent(Int_t event);
62 virtual void NextEvent();
63 virtual void PrevEvent();
65 Bool_t FindNextByTrigger(Int_t& i);
66 Bool_t FindPrevByTrigger(Int_t& i);
69 Int_t GetEventId() const { return fEventId; }
70 AliRunLoader* GetRunLoader() const { return fRunLoader; }
71 TFile* GetESDFile() const { return fESDFile; }
72 TTree* GetESDTree() const { return fESDTree; }
73 AliESDEvent* GetESD() const { return fESD; }
74 AliESDfriend* GetESDfriend() const { return fESDfriend; }
75 Bool_t GetESDfriendExists() const { return fESDfriendExists; }
76 TFile* GetAODFile() const { return fAODFile; }
77 TTree* GetAODTree() const { return fAODTree; }
78 AliAODEvent* GetAOD() const { return fAOD; }
79 virtual const Text_t* GetTitle() const { return fPath.Data(); }
80 TString GetEventInfoHorizontal() const;
81 TString GetEventInfoVertical() const;
83 static Bool_t HasRunLoader();
84 static Bool_t HasESD();
85 static Bool_t HasESDfriend();
86 static Bool_t HasAOD();
87 static Bool_t HasRawReader();
89 static AliRunLoader* AssertRunLoader();
90 static AliESDEvent* AssertESD();
91 static AliESDfriend* AssertESDfriend();
92 static AliAODEvent* AssertAOD();
93 static AliRawReader* AssertRawReader();
95 static AliMagF* AssertMagField();
96 static TGeoManager* AssertGeometry();
98 static AliEveEventManager* AddDependentManager(const TString& name, const TString& path);
99 static AliEveEventManager* GetDependentManager(const TString& name);
101 static AliEveEventManager* GetMaster();
102 static AliEveEventManager* GetCurrent();
104 static void RegisterTransient (TEveElement* element);
105 static void RegisterTransientList(TEveElement* element);
108 Double_t GetAutoLoadTime() const { return fAutoLoadTime; }
109 Bool_t GetAutoLoad() const { return fAutoLoad; }
110 void SetAutoLoadTime(Float_t time);
111 void SetAutoLoad(Bool_t autoLoad);
112 void AutoLoadNextEvent();
114 Bool_t GetSelectOnTriggerType() const { return fSelectOnTriggerType; }
115 TString GetTriggerType() const { return fTriggerType; }
116 void SetTriggerType(const TString& triggertype) { fTriggerType = triggertype; }
117 void SetSelectOnTriggerType(Bool_t sel) { fSelectOnTriggerType = sel; }
119 Bool_t AreEventFilesOpened() const { return fIsOpen; }
120 Bool_t IsEventAvailable() const { return fHasEvent; }
121 Bool_t IsUnderExternalControl() const { return fExternalCtrl; }
123 virtual void AfterNewEventLoaded();
124 void NewEventLoaded(); // *SIGNAL*
126 AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
129 TString fPath; // URL to event-data.
130 Int_t fEventId; // Id of current event.
132 AliRunLoader* fRunLoader; // Run loader.
134 TFile *fESDFile; // ESD file.
135 TTree *fESDTree; // ESD tree.
136 AliESDEvent *fESD; // ESDEvent object.
137 AliESDfriend *fESDfriend; // ESDfriend object.
138 Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data.
139 TFile *fAODFile; // AOD file.
140 TTree *fAODTree; // AOD tree.
141 AliAODEvent *fAOD; // AODEvent object.
143 AliRawReader *fRawReader; // Raw-data reader.
145 Bool_t fAutoLoad; // Automatic loading of events (online)
146 Float_t fAutoLoadTime; // Auto-load time in seconds
147 TTimer *fAutoLoadTimer; // Timer for automatic event loading
149 Bool_t fIsOpen; // Are event-files opened.
150 Bool_t fHasEvent; // Is an event available.
151 Bool_t fExternalCtrl; // Are we under external event-loop.
153 Bool_t fSelectOnTriggerType; // Whether to select on trigger-type.
154 TString fTriggerType; // Trigger-type to select on.
156 AliEveMacroExecutor *fExecutor; // Executor for std macros
158 TEveElementList *fTransients; // Container for additional transient (per event) elements.
159 TEveElementList *fTransientLists; // Container for lists of transient (per event) elements.
161 TList *fSubManagers; // Dependent event-managers, used for event embedding.
163 static TString fgESDFileName; // Name by which to open ESD.
164 static TString fgAODFileName; // Name by which to open AOD.
165 static TString fgRawFileName; // Name by which to open raw-data file.
166 static TString fgCdbUri; // Global URI to CDB.
167 static Bool_t fgAssertRunLoader; // Global flag specifying if AliRunLoader must be asserted during opening of the event-data.
168 static Bool_t fgAssertESD; // Global flag specifying if ESDEvent must be asserted during opening of the event-data.
169 static Bool_t fgAssertAOD; // Global flag specifying if AODEvent must be asserted during opening of the event-data.
170 static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data.
172 static TList *fgAODfriends; // Global list of AOD friend names to be attached during opening of the event-data (empty by default).
174 static AliGRPObject *fgGRPData; // Global run parameters.
175 static AliMagF *fgMagField; // Global pointer to magnetic field.
176 static Bool_t fgUniformField; // Track with uniform field.
179 AliEveEventManager(const AliEveEventManager&); // Not implemented
180 AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
182 void InitInternals();
183 void StartAutoLoadTimer();
184 void StopAutoLoadTimer();
186 static Bool_t InitGRP();
187 static Bool_t SetFieldMap(Float_t l3Cur, Float_t diCur,
188 Float_t l3Pol, Float_t diPol,
189 Float_t beamenergy = 7000,
190 const Char_t *beamtype = "pp",
191 const Char_t *path = "$(ALICE_ROOT)/data/maps/mfchebKGI_sym.root");
193 Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
195 static AliEveEventManager* fgMaster;
196 static AliEveEventManager* fgCurrent;
198 ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way.