]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveBase/AliEveEventManager.h
Removing a circular dependence.
[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
f6afd0e1 17class AliEveMacroExecutor;
18
5a5a1232 19class AliRunLoader;
af885e0f 20class AliESDEvent;
3aecaefc 21class AliESDfriend;
b3b7b8d3 22class AliAODEvent;
c2c4b7a2 23class AliRawReader;
5a5a1232 24
8661a211 25class AliGRPObject;
93845f6c 26class AliMagF;
27
5a5a1232 28class TFile;
29class TTree;
632d2b03 30class TGeoManager;
5a5a1232 31
a15e6d7d 32//==============================================================================
33//
34// AliEveEventManager
35//
36// Interface to ALICE event-data (RunLoader, ESD), magnetic field and
37// geometry.
38//
39
5a5a1232 40
f76c9e9b 41class AliEveEventManager : public TEveEventManager,
42 public TQObject
5a5a1232 43{
5a5a1232 44public:
4d62585e 45 static void SetESDFileName(const TString& esd);
b3b7b8d3 46 static void SetAODFileName(const TString& aod);
47 static void AddAODfriend (const TString& friendFileName);
4d62585e 48 static void SetRawFileName(const TString& raw);
49 static void SetCdbUri (const TString& cdb);
b3b7b8d3 50 static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd,
51 Bool_t assertAod, Bool_t assertRaw);
632d2b03 52
08b0f222 53
ba5d58f2 54 AliEveEventManager(const TString& name="Event");
55 AliEveEventManager(const TString& name, const TString& path, Int_t ev=0);
a15e6d7d 56 virtual ~AliEveEventManager();
57
516389a2 58 virtual void Open();
482d0751 59 void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd, AliESDfriend *esdf);
f76c9e9b 60 virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const;
516389a2 61 virtual void GotoEvent(Int_t event);
62 virtual void NextEvent();
63 virtual void PrevEvent();
64 virtual void Close();
ecb84424 65 Bool_t FindNextByTrigger(Int_t& i);
66 Bool_t FindPrevByTrigger(Int_t& i);
516389a2 67
90fa773e 68
b3b7b8d3 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; }
2cea771a 74 AliESDfriend* GetESDfriend() const { return fESDfriend; }
75 Bool_t GetESDfriendExists() const { return fESDfriendExists; }
b3b7b8d3 76 TFile* GetAODFile() const { return fAODFile; }
77 TTree* GetAODTree() const { return fAODTree; }
78 AliAODEvent* GetAOD() const { return fAOD; }
2cea771a 79 virtual const Text_t* GetTitle() const { return fPath.Data(); }
12365217 80 TString GetEventInfoHorizontal() const;
81 TString GetEventInfoVertical() const;
5a5a1232 82
f6afd0e1 83 static Bool_t HasRunLoader();
84 static Bool_t HasESD();
85 static Bool_t HasESDfriend();
b3b7b8d3 86 static Bool_t HasAOD();
f6afd0e1 87 static Bool_t HasRawReader();
88
5a5a1232 89 static AliRunLoader* AssertRunLoader();
32e219c2 90 static AliESDEvent* AssertESD();
3aecaefc 91 static AliESDfriend* AssertESDfriend();
b3b7b8d3 92 static AliAODEvent* AssertAOD();
c2c4b7a2 93 static AliRawReader* AssertRawReader();
5a5a1232 94
8661a211 95 static AliMagF* AssertMagField();
632d2b03 96 static TGeoManager* AssertGeometry();
97
ba5d58f2 98 static AliEveEventManager* AddDependentManager(const TString& name, const TString& path);
99 static AliEveEventManager* GetDependentManager(const TString& name);
4d62585e 100
101 static AliEveEventManager* GetMaster();
102 static AliEveEventManager* GetCurrent();
103
8661a211 104 static void RegisterTransient (TEveElement* element);
105 static void RegisterTransientList(TEveElement* element);
08b0f222 106
107
488869c1 108 Double_t GetAutoLoadTime() const { return fAutoLoadTime; }
109 Bool_t GetAutoLoad() const { return fAutoLoad; }
110 void SetAutoLoadTime(Float_t time);
319f3084 111 void SetAutoLoad(Bool_t autoLoad);
488869c1 112 void AutoLoadNextEvent();
80547f2d 113
ecb84424 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; }
118
488869c1 119 Bool_t AreEventFilesOpened() const { return fIsOpen; }
120 Bool_t IsEventAvailable() const { return fHasEvent; }
121 Bool_t IsUnderExternalControl() const { return fExternalCtrl; }
319f3084 122
f6afd0e1 123 virtual void AfterNewEventLoaded();
124 void NewEventLoaded(); // *SIGNAL*
125
126 AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
f76c9e9b 127
4b456ebb 128protected:
129 TString fPath; // URL to event-data.
130 Int_t fEventId; // Id of current event.
131
132 AliRunLoader* fRunLoader; // Run loader.
133
4d62585e 134 TFile *fESDFile; // ESD file.
135 TTree *fESDTree; // ESD tree.
136 AliESDEvent *fESD; // ESDEvent object.
137 AliESDfriend *fESDfriend; // ESDfriend object.
4b456ebb 138 Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data.
b3b7b8d3 139 TFile *fAODFile; // AOD file.
140 TTree *fAODTree; // AOD tree.
141 AliAODEvent *fAOD; // AODEvent object.
4b456ebb 142
4d62585e 143 AliRawReader *fRawReader; // Raw-data reader.
c2c4b7a2 144
319f3084 145 Bool_t fAutoLoad; // Automatic loading of events (online)
488869c1 146 Float_t fAutoLoadTime; // Auto-load time in seconds
319f3084 147 TTimer *fAutoLoadTimer; // Timer for automatic event loading
80547f2d 148
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.
152
4d62585e 153 Bool_t fSelectOnTriggerType; // Whether to select on trigger-type.
154 TString fTriggerType; // Trigger-type to select on.
319f3084 155
f6afd0e1 156 AliEveMacroExecutor *fExecutor; // Executor for std macros
157
08b0f222 158 TEveElementList *fTransients; // Container for additional transient (per event) elements.
8661a211 159 TEveElementList *fTransientLists; // Container for lists of transient (per event) elements.
08b0f222 160
4d62585e 161 TList *fSubManagers; // Dependent event-managers, used for event embedding.
162
c2c4b7a2 163 static TString fgESDFileName; // Name by which to open ESD.
b3b7b8d3 164 static TString fgAODFileName; // Name by which to open AOD.
c2c4b7a2 165 static TString fgRawFileName; // Name by which to open raw-data file.
4b456ebb 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.
b3b7b8d3 169 static Bool_t fgAssertAOD; // Global flag specifying if AODEvent must be asserted during opening of the event-data.
c2c4b7a2 170 static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data.
4b456ebb 171
b3b7b8d3 172 static TList *fgAODfriends; // Global list of AOD friend names to be attached during opening of the event-data (empty by default).
4b456ebb 173
8661a211 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.
177
4b456ebb 178private:
179 AliEveEventManager(const AliEveEventManager&); // Not implemented
180 AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
181
488869c1 182 void InitInternals();
183 void StartAutoLoadTimer();
184 void StopAutoLoadTimer();
185
8661a211 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");
192
488869c1 193 Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
194
4d62585e 195 static AliEveEventManager* fgMaster;
196 static AliEveEventManager* fgCurrent;
197
4b456ebb 198 ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way.
199};
5a5a1232 200
5a5a1232 201#endif