AliEveEventManager
[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>
16#include <AliESDEvent.h>
5a5a1232 17
f6afd0e1 18class AliEveMacroExecutor;
19
5a5a1232 20class AliRunLoader;
af885e0f 21class AliESDEvent;
3aecaefc 22class AliESDfriend;
c2c4b7a2 23class AliRawReader;
5a5a1232 24
93845f6c 25class AliMagF;
26
5a5a1232 27class TFile;
28class TTree;
632d2b03 29class TGeoManager;
5a5a1232 30
a15e6d7d 31//==============================================================================
32//
33// AliEveEventManager
34//
35// Interface to ALICE event-data (RunLoader, ESD), magnetic field and
36// geometry.
37//
38
5a5a1232 39
f76c9e9b 40class AliEveEventManager : public TEveEventManager,
41 public TQObject
5a5a1232 42{
5a5a1232 43public:
c2c4b7a2 44 static void SetESDFileName(const Text_t* esd);
45 static void SetRawFileName(const Text_t* raw);
46 static void SetCdbUri(const Text_t* cdb);
47 static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd, Bool_t assertRaw);
632d2b03 48
d810d0de 49 AliEveEventManager();
50 AliEveEventManager(TString path, Int_t ev=0);
a15e6d7d 51 virtual ~AliEveEventManager();
52
5a5a1232 53
516389a2 54 virtual void Open();
55 void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd);
f76c9e9b 56 virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const;
516389a2 57 virtual void GotoEvent(Int_t event);
58 virtual void NextEvent();
59 virtual void PrevEvent();
60 virtual void Close();
ecb84424 61 Bool_t FindNextByTrigger(Int_t& i);
62 Bool_t FindPrevByTrigger(Int_t& i);
516389a2 63
90fa773e 64
5a5a1232 65 Int_t GetEventId() const { return fEventId; }
66 AliRunLoader* GetRunLoader() const { return fRunLoader; }
77e5986c 67 TFile* GetESDFile() const { return fESDFile; }
5a5a1232 68 TTree* GetESDTree() const { return fESDTree; }
32e219c2 69 AliESDEvent* GetESD() const { return fESD; }
2cea771a 70 AliESDfriend* GetESDfriend() const { return fESDfriend; }
71 Bool_t GetESDfriendExists() const { return fESDfriendExists; }
72 virtual const Text_t* GetTitle() const { return fPath.Data(); }
12365217 73 TString GetEventInfoHorizontal() const;
74 TString GetEventInfoVertical() const;
5a5a1232 75
f6afd0e1 76 static Bool_t HasRunLoader();
77 static Bool_t HasESD();
78 static Bool_t HasESDfriend();
79 static Bool_t HasRawReader();
80
5a5a1232 81 static AliRunLoader* AssertRunLoader();
32e219c2 82 static AliESDEvent* AssertESD();
3aecaefc 83 static AliESDfriend* AssertESDfriend();
c2c4b7a2 84 static AliRawReader* AssertRawReader();
5a5a1232 85
93845f6c 86 static AliMagF* AssertMagField();
87
632d2b03 88 static TGeoManager* AssertGeometry();
89
488869c1 90 Double_t GetAutoLoadTime() const { return fAutoLoadTime; }
91 Bool_t GetAutoLoad() const { return fAutoLoad; }
92 void SetAutoLoadTime(Float_t time);
319f3084 93 void SetAutoLoad(Bool_t autoLoad);
488869c1 94 void AutoLoadNextEvent();
80547f2d 95
ecb84424 96 Bool_t GetSelectOnTriggerType() const { return fSelectOnTriggerType; }
97 TString GetTriggerType() const { return fTriggerType; }
98 void SetTriggerType(const TString& triggertype) { fTriggerType = triggertype; }
99 void SetSelectOnTriggerType(Bool_t sel) { fSelectOnTriggerType = sel; }
100
488869c1 101 Bool_t AreEventFilesOpened() const { return fIsOpen; }
102 Bool_t IsEventAvailable() const { return fHasEvent; }
103 Bool_t IsUnderExternalControl() const { return fExternalCtrl; }
319f3084 104
f6afd0e1 105 virtual void AfterNewEventLoaded();
106 void NewEventLoaded(); // *SIGNAL*
107
108 AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
f76c9e9b 109
4b456ebb 110protected:
111 TString fPath; // URL to event-data.
112 Int_t fEventId; // Id of current event.
113
114 AliRunLoader* fRunLoader; // Run loader.
115
116 TFile* fESDFile; // ESD file.
117 TTree* fESDTree; // ESD tree.
118 AliESDEvent* fESD; // ESDEvent object.
119 AliESDfriend* fESDfriend; // ESDfriend object.
120 Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data.
121
c2c4b7a2 122 AliRawReader* fRawReader; // Raw-adata reader.
123
319f3084 124 Bool_t fAutoLoad; // Automatic loading of events (online)
488869c1 125 Float_t fAutoLoadTime; // Auto-load time in seconds
319f3084 126 TTimer *fAutoLoadTimer; // Timer for automatic event loading
80547f2d 127
128 Bool_t fIsOpen; // Are event-files opened.
129 Bool_t fHasEvent; // Is an event available.
130 Bool_t fExternalCtrl; // Are we under external event-loop.
131
ecb84424 132 Bool_t fSelectOnTriggerType; //whether to select on triggertype
133 TString fTriggerType; //triggertype to select on
319f3084 134
f6afd0e1 135 AliEveMacroExecutor *fExecutor; // Executor for std macros
136
c2c4b7a2 137 static TString fgESDFileName; // Name by which to open ESD.
138 static TString fgRawFileName; // Name by which to open raw-data file.
4b456ebb 139 static TString fgCdbUri; // Global URI to CDB.
140 static Bool_t fgAssertRunLoader; // Global flag specifying if AliRunLoader must be asserted during opening of the event-data.
141 static Bool_t fgAssertESD; // Global flag specifying if ESDEvent must be asserted during opening of the event-data.
c2c4b7a2 142 static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data.
4b456ebb 143
144 static AliMagF* fgMagField; // Global pointer to magneti field.
145
146private:
147 AliEveEventManager(const AliEveEventManager&); // Not implemented
148 AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
149
488869c1 150 void InitInternals();
151 void StartAutoLoadTimer();
152 void StopAutoLoadTimer();
153
154 Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
155
4b456ebb 156 ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way.
157};
5a5a1232 158
a15e6d7d 159extern AliEveEventManager* gAliEveEvent;
5a5a1232 160
161#endif