]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveEventManager.h
* AliEveVSDCreator
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveEventManager.h
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
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  **************************************************************************/
9
10 #ifndef AliEveEventManager_H
11 #define AliEveEventManager_H
12
13 #include <TEveEventManager.h>
14 #include <TQObject.h>
15 #include <TObjArray.h>
16
17 class AliEveMacroExecutor;
18 class AliEveEventSelector;
19
20 class AliRunLoader;
21 class AliESDEvent;
22 class AliESDfriend;
23 class AliAODEvent;
24 class AliRawReader;
25
26 class AliGRPObject;
27 class AliMagF;
28
29 class TFile;
30 class TTree;
31 class TGeoManager;
32
33 //==============================================================================
34 //
35 // AliEveEventManager
36 //
37 // Interface to ALICE event-data (RunLoader, ESD), magnetic field and
38 // geometry.
39 //
40
41
42 class AliEveEventManager : public TEveEventManager,
43                            public TQObject
44 {
45 public:
46   static void SetESDFileName(const TString& esd);
47   static void SetAODFileName(const TString& aod);
48   static void AddAODfriend  (const TString& friendFileName);
49   static void SetRawFileName(const TString& raw);
50   static void SetCdbUri     (const TString& cdb);
51   static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd,
52                                 Bool_t assertAod, Bool_t assertRaw);
53
54
55   AliEveEventManager(const TString& name="Event");
56   AliEveEventManager(const TString& name, const TString& path, Int_t ev=0);
57   virtual ~AliEveEventManager();
58
59   virtual void  Open();
60   void          SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd, AliESDfriend *esdf);
61   virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const;
62   virtual void  GotoEvent(Int_t event);
63   virtual void  NextEvent();
64   virtual void  PrevEvent();
65   virtual void  Close();
66
67   Int_t         GetEventId()         const { return fEventId; }
68   AliRunLoader* GetRunLoader()       const { return fRunLoader; }
69   TFile*        GetESDFile()         const { return fESDFile; }
70   TTree*        GetESDTree()         const { return fESDTree; }
71   AliESDEvent*  GetESD()             const { return fESD;     }
72   AliESDfriend* GetESDfriend()       const { return fESDfriend; }
73   Bool_t        GetESDfriendExists() const { return fESDfriendExists; }
74   TFile*        GetAODFile()         const { return fAODFile; }
75   TTree*        GetAODTree()         const { return fAODTree; }
76   AliAODEvent*  GetAOD()             const { return fAOD;     }
77   virtual const Text_t* GetTitle()   const { return fPath.Data(); }
78   AliEveEventSelector* GetEventSelector() const { return fPEventSelector; }
79   TString       GetEventInfoHorizontal() const;
80   TString       GetEventInfoVertical()   const;
81
82   static Int_t  CurrentEventId();
83
84   static Bool_t HasRunLoader();
85   static Bool_t HasESD();
86   static Bool_t HasESDfriend();
87   static Bool_t HasAOD();
88   static Bool_t HasRawReader();
89
90   static AliRunLoader* AssertRunLoader();
91   static AliESDEvent*  AssertESD();
92   static AliESDfriend* AssertESDfriend();
93   static AliAODEvent*  AssertAOD();
94   static AliRawReader* AssertRawReader();
95
96   static AliMagF*      AssertMagField();
97   static TGeoManager*  AssertGeometry();
98
99   static AliEveEventManager* AddDependentManager(const TString& name, const TString& path);
100   static AliEveEventManager* GetDependentManager(const TString& name);
101
102   static AliEveEventManager* GetMaster();
103   static AliEveEventManager* GetCurrent();
104
105   static void                RegisterTransient    (TEveElement* element);
106   static void                RegisterTransientList(TEveElement* element);
107
108
109   Double_t      GetAutoLoadTime()        const { return fAutoLoadTime; }
110   Bool_t        GetAutoLoad()            const { return fAutoLoad;     }
111   void          SetAutoLoadTime(Float_t time);
112   void          SetAutoLoad(Bool_t autoLoad);
113   void          SetTrigSel(Int_t trig);
114   void          AutoLoadNextEvent();
115
116   Bool_t        AreEventFilesOpened()    const { return fIsOpen;       }
117   Bool_t        IsEventAvailable()       const { return fHasEvent;     }
118   Bool_t        IsUnderExternalControl() const { return fExternalCtrl; }
119
120   virtual void  AfterNewEventLoaded();
121   void          NewEventDataLoaded();  // *SIGNAL*
122   void          NewEventLoaded();      // *SIGNAL*
123
124   AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
125
126 protected:
127   TString       fPath;                  // URL to event-data.
128   Int_t         fEventId;               // Id of current event.
129
130   AliRunLoader* fRunLoader;             // Run loader.
131
132   TFile        *fESDFile;               // ESD file.
133   TTree        *fESDTree;               // ESD tree.
134   AliESDEvent  *fESD;                   // ESDEvent object.
135   AliESDfriend *fESDfriend;             // ESDfriend object.
136   Bool_t        fESDfriendExists;       // Flag specifying if ESDfriend was found during opening of the event-data.
137   TFile        *fAODFile;               // AOD file.
138   TTree        *fAODTree;               // AOD tree.
139   AliAODEvent  *fAOD;                   // AODEvent object.
140
141   AliRawReader *fRawReader;             // Raw-data reader.
142
143   Bool_t        fAutoLoad;              // Automatic loading of events (online)
144   Float_t       fAutoLoadTime;          // Auto-load time in seconds
145   TTimer       *fAutoLoadTimer;         // Timer for automatic event loading
146
147   Bool_t        fIsOpen;                // Are event-files opened.
148   Bool_t        fHasEvent;              // Is an event available.
149   Bool_t        fExternalCtrl;          // Are we under external event-loop.
150
151   AliEveMacroExecutor *fExecutor;       // Executor for std macros
152
153   TEveElementList     *fTransients;     // Container for additional transient (per event) elements.
154   TEveElementList     *fTransientLists; // Container for lists of transient (per event) elements.
155
156   AliEveEventSelector* fPEventSelector; // Event filter
157
158   TList        *fSubManagers;           // Dependent event-managers, used for event embedding.
159
160   static TString  fgESDFileName;        // Name by which to open ESD.
161   static TString  fgAODFileName;        // Name by which to open AOD.
162   static TString  fgRawFileName;        // Name by which to open raw-data file.
163   static TString  fgCdbUri;             // Global URI to CDB.
164   static Bool_t   fgAssertRunLoader;    // Global flag specifying if AliRunLoader must be asserted during opening of the event-data.
165   static Bool_t   fgAssertESD;          // Global flag specifying if ESDEvent must be asserted during opening of the event-data.
166   static Bool_t   fgAssertAOD;          // Global flag specifying if AODEvent must be asserted during opening of the event-data.
167   static Bool_t   fgAssertRaw;          // Global flag specifying if raw-data presence must be asserted during opening of the event-data.
168
169   static TList   *fgAODfriends;         // Global list of AOD friend names to be attached during opening of the event-data (empty by default).
170
171   static Bool_t        fgGRPLoaded;     // Global run parameters loaded?
172   static AliMagF      *fgMagField;      // Global pointer to magnetic field.
173   static Bool_t        fgUniformField;  // Track with uniform field.
174
175 private:
176   AliEveEventManager(const AliEveEventManager&);            // Not implemented
177   AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
178
179   void InitInternals();
180   void StartAutoLoadTimer();
181   void StopAutoLoadTimer();
182
183   static Bool_t InitGRP();
184
185   Bool_t fAutoLoadTimerRunning; // State of auto-load timer.
186
187   static AliEveEventManager* fgMaster;
188   static AliEveEventManager* fgCurrent;
189
190   ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way.
191 };
192
193 #endif