]>
Commit | Line | Data |
---|---|---|
ef795f0b | 1 | // $Id: AliEveEventManager.h 64557 2013-10-16 20:03:08Z hristov $ |
d810d0de | 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> |
164d3d29 | 16 | #include <TThread.h> |
5a5a1232 | 17 | |
f944f125 | 18 | #include <AliEventInfo.h> |
7e0cf530 | 19 | #include <AliESDEvent.h> |
164d3d29 | 20 | #include "AliStorageTypes.h" |
7e0cf530 | 21 | |
f6afd0e1 | 22 | class AliEveMacroExecutor; |
3d94b490 | 23 | class AliEveEventSelector; |
f6afd0e1 | 24 | |
5a5a1232 | 25 | class AliRunLoader; |
af885e0f | 26 | class AliESDEvent; |
3aecaefc | 27 | class AliESDfriend; |
b3b7b8d3 | 28 | class AliAODEvent; |
c2c4b7a2 | 29 | class AliRawReader; |
5a5a1232 | 30 | |
8661a211 | 31 | class AliGRPObject; |
f944f125 | 32 | class AliRecoParam; |
93845f6c | 33 | class AliMagF; |
34 | ||
3d94b490 | 35 | class TEveElement; |
5a5a1232 | 36 | class TFile; |
37 | class TTree; | |
632d2b03 | 38 | class TGeoManager; |
3d94b490 | 39 | class TString; |
40 | class TMap; | |
5a5a1232 | 41 | |
a15e6d7d | 42 | //============================================================================== |
43 | // | |
44 | // AliEveEventManager | |
45 | // | |
46 | // Interface to ALICE event-data (RunLoader, ESD), magnetic field and | |
47 | // geometry. | |
48 | // | |
49 | ||
5a5a1232 | 50 | |
164d3d29 | 51 | class AliEveEventManager : public TEveEventManager, public TQObject |
5a5a1232 | 52 | { |
5a5a1232 | 53 | public: |
164d3d29 | 54 | AliEveEventManager(const TString& name="Event", Int_t ev=0); |
55 | virtual ~AliEveEventManager(); | |
56 | ||
51104899 | 57 | enum EVisibleESDTrees{ kOfflineTree, kHLTTree }; |
58 | ||
59 | static void SetESDFileName(const TString& esd, EVisibleESDTrees shown=kOfflineTree); | |
60 | static void SetESDfriendFileName(const TString& esdf); | |
61 | static void SetAODFileName(const TString& aod); | |
62 | static void AddAODfriend (const TString& friendFileName); | |
63 | static void SetRawFileName(const TString& raw); | |
64 | static void SetCdbUri (const TString& cdb); | |
566ba262 | 65 | static void SetSpecificCdbUri(const TString& path,const TString& value); |
51104899 | 66 | static void SetGAliceFileName(const TString& galice); |
67 | ||
68 | // set Local Directory or URL where the files are located | |
69 | // it can also be a path to root_archive.zip | |
70 | // assumes the filenames of ESD, AOD, etc are standard ALICE names | |
71 | // (AliESDs.root, AliESDfriends.root, AliAOD.root, AliAODfriend.root, galice.root,raw.root) | |
72 | static void SetFilesPath(const TString& path); | |
51104899 | 73 | static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd, |
74 | Bool_t assertAod, Bool_t assertRaw); | |
75 | static void SearchRawForCentralReconstruction(); | |
76 | ||
51104899 | 77 | virtual void Open(); |
51104899 | 78 | virtual Int_t GetMaxEventId(Bool_t refreshESD=kFALSE) const; |
79 | virtual void GotoEvent(Int_t event); | |
80 | virtual void NextEvent(); | |
81 | virtual void PrevEvent(); | |
164d3d29 | 82 | void MarkCurrentEvent(); |
51104899 | 83 | virtual void Close(); |
164d3d29 | 84 | |
85 | void SetEvent(AliRunLoader *runLoader, AliRawReader *rawReader, AliESDEvent *esd, AliESDfriend *esdf); | |
51104899 | 86 | void Timeout(); // * SIGNAL* |
87 | ||
88 | Int_t GetEventId() const { return fEventId; } | |
89 | AliRunLoader* GetRunLoader() const { return fRunLoader; } | |
90 | TFile* GetESDFile() const { return fESDFile; } | |
91 | TTree* GetESDTree() const { return fESDTree; } | |
92 | TTree* GetHLTESDTree() const { return fHLTESDTree; } | |
93 | AliESDEvent* GetESD() const { return fESD; } | |
94 | AliESDfriend* GetESDfriend() const { return fESDfriend; } | |
95 | Bool_t GetESDfriendExists() const { return fESDfriendExists; } | |
96 | TFile* GetAODFile() const { return fAODFile; } | |
97 | TTree* GetAODTree() const { return fAODTree; } | |
98 | AliAODEvent* GetAOD() const { return fAOD; } | |
99 | AliEveEventSelector* GetEventSelector() const { return fPEventSelector; } | |
100 | TString GetEventInfoHorizontal() const; | |
101 | TString GetEventInfoVertical() const; | |
102 | const AliEventInfo* GetEventInfo(); | |
103 | ||
104 | static Int_t CurrentEventId(); | |
51104899 | 105 | static Bool_t HasRunLoader(); |
106 | static Bool_t HasESD(); | |
107 | static Bool_t HasESDfriend(); | |
108 | static Bool_t HasAOD(); | |
109 | static Bool_t HasRawReader(); | |
110 | ||
111 | static AliRunLoader* AssertRunLoader(); | |
112 | static AliESDEvent* AssertESD(); | |
113 | static AliESDfriend* AssertESDfriend(); | |
114 | static AliAODEvent* AssertAOD(); | |
115 | static AliRawReader* AssertRawReader(); | |
51104899 | 116 | static AliMagF* AssertMagField(); |
117 | static TGeoManager* AssertGeometry(); | |
118 | static AliRecoParam* AssertRecoParams(); | |
119 | ||
120 | static AliEveEventManager* AddDependentManager(const TString& name, const TString& path); | |
121 | static AliEveEventManager* GetDependentManager(const TString& name); | |
51104899 | 122 | static AliEveEventManager* GetMaster(); |
123 | static AliEveEventManager* GetCurrent(); | |
51104899 | 124 | static void RegisterTransient (TEveElement* element); |
125 | static void RegisterTransientList(TEveElement* element); | |
126 | ||
51104899 | 127 | Double_t GetAutoLoadTime() const { return fAutoLoadTime; } |
128 | Bool_t GetAutoLoad() const { return fAutoLoad; } | |
626a3158 | 129 | Bool_t GetLoopMarked() const { return fLoopMarked; } |
51104899 | 130 | void SetAutoLoadTime(Float_t time); |
131 | void SetAutoLoad(Bool_t autoLoad); | |
626a3158 | 132 | void SetLoopMarked(Bool_t loopMarked); |
51104899 | 133 | void SetTrigSel(Int_t trig); |
134 | void AutoLoadNextEvent(); | |
135 | ||
136 | Bool_t AreEventFilesOpened() const { return fIsOpen; } | |
137 | Bool_t IsEventAvailable() const { return fHasEvent; } | |
138 | Bool_t IsUnderExternalControl() const { return fExternalCtrl; } | |
139 | ||
01ca7d6f | 140 | Bool_t IsOnlineMode() const { return fOnlineMode; } |
141 | ||
51104899 | 142 | Bool_t InsertGlobal(const TString& tag, TEveElement* model); |
143 | Bool_t InsertGlobal(const TString& tag, TEveElement* model, | |
144 | Bool_t replace, Bool_t update); | |
145 | TEveElement* FindGlobal(const TString& tag); | |
146 | ||
147 | virtual void AfterNewEventLoaded(); | |
148 | void NewEventDataLoaded(); // *SIGNAL* | |
149 | void NewEventLoaded(); // *SIGNAL* | |
01ca7d6f | 150 | void NoEventLoaded(); // *SIGNAL* |
0790c3e6 | 151 | void StorageManagerOk(); // *SIGNAL* |
152 | void StorageManagerDown(); // *SIGNAL* | |
51104899 | 153 | |
154 | AliEveMacroExecutor* GetExecutor() const { return fExecutor; } | |
164d3d29 | 155 | void InitOCDB(int runNo=-1); |
156 | ||
157 | void PrepareForNewEvent(AliESDEvent *event); | |
01ca7d6f | 158 | Int_t NewEventAvailable(); |
159 | ||
4b456ebb | 160 | protected: |
51104899 | 161 | Int_t fEventId; // Id of current event. |
4b456ebb | 162 | |
51104899 | 163 | AliRunLoader* fRunLoader; // Run loader. |
4b456ebb | 164 | |
51104899 | 165 | TFile *fESDFile; // ESD file. |
166 | TTree *fESDTree; // ESD tree. | |
167 | TTree *fHLTESDTree; // HLT ESD tree. | |
168 | AliESDEvent *fESD; // ESDEvent object. | |
169 | AliESDfriend *fESDfriend; // ESDfriend object. | |
170 | Bool_t fESDfriendExists; // Flag specifying if ESDfriend was found during opening of the event-data. | |
171 | TFile *fAODFile; // AOD file. | |
172 | TTree *fAODTree; // AOD tree. | |
173 | AliAODEvent *fAOD; // AODEvent object. | |
4b456ebb | 174 | |
51104899 | 175 | AliRawReader *fRawReader; // Raw-data reader. |
176 | AliEventInfo fEventInfo; // Current Event Info | |
80547f2d | 177 | |
51104899 | 178 | Bool_t fAutoLoad; // Automatic loading of events (online) |
626a3158 | 179 | Bool_t fLoopMarked; // Automatic loading of marked events |
51104899 | 180 | Float_t fAutoLoadTime; // Auto-load time in seconds |
181 | TTimer *fAutoLoadTimer; // Timer for automatic event loading | |
80547f2d | 182 | |
51104899 | 183 | Bool_t fIsOpen; // Are event-files opened. |
184 | Bool_t fHasEvent; // Is an event available. | |
185 | Bool_t fExternalCtrl; // Are we under external event-loop. | |
3d94b490 | 186 | |
51104899 | 187 | TMap* fGlobal; |
188 | Bool_t fGlobalReplace; // Are global replace | |
189 | Bool_t fGlobalUpdate; // Are global updates | |
f6afd0e1 | 190 | |
51104899 | 191 | AliEveMacroExecutor *fExecutor; // Executor for std macros |
08b0f222 | 192 | |
51104899 | 193 | TEveElementList *fTransients; // Container for additional transient (per event) elements. |
194 | TEveElementList *fTransientLists; // Container for lists of transient (per event) elements. | |
008ac94c | 195 | |
51104899 | 196 | AliEveEventSelector* fPEventSelector; // Event filter |
4d62585e | 197 | |
51104899 | 198 | TList *fSubManagers; // Dependent event-managers, used for event embedding. |
4b456ebb | 199 | |
51104899 | 200 | static TString fgGAliceFileName; // galice.root file |
201 | static TString fgESDFileName; // Name by which to open ESD. | |
202 | static EVisibleESDTrees fgESDvisibleTrees; // trees to open from ESD | |
203 | static TString fgESDfriendsFileName; | |
204 | static TString fgAODFileName; // Name by which to open AOD. | |
205 | static TString fgRawFileName; // Name by which to open raw-data file. | |
206 | static TString fgCdbUri; // Global URI to CDB. | |
566ba262 | 207 | static TString fgSpecificCdbUriValue; // Global URI to specific CDB object. |
208 | static TString fgSpecificCdbUriPath; // Global URI to specific CDB object. | |
51104899 | 209 | static Bool_t fgAssertRunLoader; // Global flag specifying if AliRunLoader must be asserted during opening of the event-data. |
210 | static Bool_t fgAssertESD; // Global flag specifying if ESDEvent must be asserted during opening of the event-data. | |
211 | static Bool_t fgAssertAOD; // Global flag specifying if AODEvent must be asserted during opening of the event-data. | |
212 | static Bool_t fgAssertRaw; // Global flag specifying if raw-data presence must be asserted during opening of the event-data. | |
4b456ebb | 213 | |
51104899 | 214 | static TList *fgAODfriends; // Global list of AOD friend names to be attached during opening of the event-data (empty by default). |
25dddcb1 | 215 | |
51104899 | 216 | static Bool_t fgRawFromStandardLoc; // Global flag to enable looking for raw data in ../../../raw/, as it is stored for central reco. |
217 | ||
218 | static Bool_t fgGRPLoaded; // Global run parameters loaded? | |
219 | static AliMagF *fgMagField; // Global pointer to magnetic field. | |
220 | static AliRecoParam* fgRecoParam; | |
221 | static Bool_t fgUniformField; // Track with uniform field. | |
8661a211 | 222 | |
51104899 | 223 | |
164d3d29 | 224 | private: |
51104899 | 225 | void InitInternals(); |
ef795f0b | 226 | |
51104899 | 227 | void StartAutoLoadTimer(); |
228 | void StopAutoLoadTimer(); | |
164d3d29 | 229 | Bool_t fAutoLoadTimerRunning; // State of auto-load timer. |
4b456ebb | 230 | |
51104899 | 231 | static Bool_t InitGRP(); |
232 | static Bool_t InitRecoParam(); | |
51104899 | 233 | TTree* readESDTree(const char* treeName, int &run); |
8661a211 | 234 | |
51104899 | 235 | static AliEveEventManager* fgMaster; |
236 | static AliEveEventManager* fgCurrent; | |
4d62585e | 237 | |
7f97b015 | 238 | static void* DispatchEventListener(void *arg){static_cast<AliEveEventManager*>(arg)->GetNextEvent();return nullptr;} |
239 | static void* DispatchStorageManagerWatcher(void *arg){static_cast<AliEveEventManager*>(arg)->CheckStorageStatus();return nullptr;} | |
164d3d29 | 240 | void GetNextEvent(); |
0790c3e6 | 241 | void CheckStorageStatus(); |
242 | TThread *fEventListenerThread; | |
243 | TThread *fStorageManagerWatcherThread; | |
7f97b015 | 244 | TMutex *fMutex; |
164d3d29 | 245 | AliESDEvent *fCurrentEvent[2]; |
246 | TTree *fCurrentTree[2]; | |
247 | int fEventInUse; | |
248 | int fWritingToEventIndex; | |
249 | bool fIsNewEventAvaliable; | |
250 | storageSockets fgSubSock; | |
7dcdaa40 | 251 | int fCurrentRun; |
01ca7d6f | 252 | |
253 | Bool_t fOnlineMode; | |
254 | Bool_t fStorageDown; | |
7f97b015 | 255 | Bool_t fFinished; |
01ca7d6f | 256 | |
164d3d29 | 257 | AliEveEventManager(const AliEveEventManager&); // Not implemented |
258 | AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented | |
259 | ||
51104899 | 260 | ClassDef(AliEveEventManager, 0); // Interface for getting all event components in a uniform way. |
4b456ebb | 261 | }; |
5a5a1232 | 262 | |
5a5a1232 | 263 | #endif |