]>
Commit | Line | Data |
---|---|---|
cb175407 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
3 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
4 | * full copyright notice. * | |
5 | **************************************************************************/ | |
6 | ||
cb175407 | 7 | class TEveProjectionManager; |
8 | class TEveGeoShape; | |
9 | class TEveUtil; | |
10 | class AliTriggerAnalysis; | |
11 | class AliSysInfo; | |
12 | ||
13 | TH2D* V0StateHistogram; | |
14 | ||
15 | Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE; | |
16 | ||
17 | void alieve_online_new() | |
18 | { | |
572d0620 | 19 | if (gSystem->Getenv("ALICE_ROOT") != 0) |
20 | { | |
21 | gInterpreter->AddIncludePath(Form("%s/MUON", gSystem->Getenv("ALICE_ROOT"))); | |
22 | gInterpreter->AddIncludePath(Form("%s/MUON/mapping", gSystem->Getenv("ALICE_ROOT"))); | |
23 | } | |
24 | ||
25 | AliEveEventManager::SetCdbUri("local://$ALICE_ROOT/OCDB"); | |
26 | ||
27 | Info("alieve_init", "Adding standard macros."); | |
28 | TString hack = gSystem->pwd(); // Problem with TGFileBrowser cding | |
29 | alieve_init_import_macros(); | |
30 | gSystem->cd(hack); | |
31 | ||
32 | new AliEveEventManager("online", -1); | |
33 | gEve->AddEvent(AliEveEventManager::GetMaster()); | |
34 | ||
35 | TEveUtil::AssertMacro("VizDB_scan.C"); | |
36 | gSystem->ProcessEvents(); | |
37 | ||
38 | AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor(); | |
39 | TEveBrowser *browser = gEve->GetBrowser(); | |
40 | browser->ShowCloseTab(kFALSE); | |
41 | ||
42 | AliEveMultiView *multiView = new AliEveMultiView(kTRUE); | |
43 | TEveUtil::LoadMacro("geom_gentle.C"); | |
44 | multiView->InitGeomGentle(geom_gentle(), | |
45 | geom_gentle_rphi(), | |
46 | geom_gentle_rhoz(), | |
47 | geom_gentle_rhoz()); | |
48 | ||
164d3d29 | 49 | //These macros crashes on mac os. To be checked |
50 | ||
572d0620 | 51 | //TEveUtil::LoadMacro("geom_gentle_trd.C"); |
52 | //multiView->InitGeomGentleTrd(geom_gentle_trd()); | |
53 | ||
54 | //TEveUtil::LoadMacro("geom_gentle_muon.C"); | |
55 | //multiView->InitGeomGentleMuon(geom_gentle_muon(), kFALSE, kFALSE, kTRUE); | |
56 | ||
57 | //============================================================================ | |
58 | // Standard macros to execute -- not all are enabled by default. | |
59 | //============================================================================ | |
60 | ||
61 | printf("============ Setting macro executor\n"); | |
62 | ||
63 | AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor(); | |
64 | ||
65 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE)); | |
66 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE)); | |
67 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE)); | |
68 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE)); | |
69 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE)); | |
70 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE)); | |
71 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE)); | |
72 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE)); | |
73 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE)); | |
74 | ||
75 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C", "its_clusters")); | |
76 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C", "tpc_clusters")); | |
77 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C", "trd_clusters")); | |
78 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C", "tof_clusters")); | |
79 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus HMPID", "hmpid_clusters.C", "hmpid_clusters")); | |
80 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus MUON", "muon_clusters.C", "muon_clusters")); | |
81 | ||
82 | ||
83 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG EMCAL", "emcal_digits.C", "emcal_digits")); | |
84 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS", "its_raw.C", "its_raw")); | |
85 | // exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw")); | |
86 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TOF", "tof_raw.C", "tof_raw")); | |
87 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE)); | |
88 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE)); | |
89 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW MUON", "muon_raw.C", "muon_raw")); | |
90 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw")); | |
91 | ||
92 | ||
93 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE)); | |
94 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE)); | |
95 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track MUON", "esd_muon_tracks.C", "esd_muon_tracks", "kTRUE,kFALSE", kTRUE)); | |
96 | ||
e339938c | 97 | |
98 | // these macros were leaking: | |
572d0620 | 99 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));// just a little |
100 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC FMD", "fmd_esd.C", "fmd_esd", "", kTRUE));//huge leak | |
e339938c | 101 | // |
102 | ||
572d0620 | 103 | // ??? |
104 | // exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC TRD", "trd_detectors.C", "trd_detectors", "", kFALSE)); | |
105 | // trd_tracks disabled due to memory leaks | |
e339938c | 106 | |
572d0620 | 107 | //---------------------------------------------------------------------------- |
108 | ||
109 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); | |
110 | slot->StartEmbedding(); | |
111 | AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec); | |
112 | slot->StopEmbedding("DataSelection"); | |
113 | exewin->PopulateMacros(); | |
114 | ||
115 | //============================================================================ | |
116 | // Final GUI setup | |
117 | //============================================================================ | |
118 | ||
119 | // | |
120 | browser->GetTabRight()->SetTab(1); | |
121 | browser->StartEmbedding(TRootBrowser::kBottom); | |
122 | new AliEveEventManagerWindow(AliEveEventManager::GetMaster()); | |
123 | browser->StopEmbedding("EventCtrl"); | |
124 | ||
125 | // browser->MoveResize(0, 0, gClient->GetDisplayWidth(),gClient->GetDisplayHeight() - 32); | |
126 | ||
127 | browser->MoveResize(0, 0, gClient->GetDisplayHeight()*1.6,gClient->GetDisplayHeight()-32); | |
128 | ||
129 | gEve->FullRedraw3D(kTRUE); | |
130 | gSystem->ProcessEvents(); | |
131 | ||
132 | TGLViewer *glv1 = multiView->Get3DView()->GetGLViewer(); | |
133 | TGLViewer *glv2 = multiView->GetRPhiView()->GetGLViewer(); | |
134 | TGLViewer *glv3 = multiView->GetRhoZView()->GetGLViewer(); | |
135 | ||
136 | glv1->CurrentCamera().RotateRad(-0.4, -1.8); | |
137 | glv2->CurrentCamera().Dolly(450, kFALSE, kFALSE); | |
138 | glv3->CurrentCamera().Dolly(1500, kFALSE, kFALSE); | |
139 | ||
140 | AliEveEventManager::GetMaster()->AddNewEventCommand("alieve_online_on_new_event();"); | |
141 | gEve->FullRedraw3D(); | |
142 | gSystem->ProcessEvents(); | |
143 | gEve->Redraw3D(kTRUE); | |
144 | ||
145 | AliEveEventManager::GetMaster()->SetAutoLoad(true); | |
e339938c | 146 | |
cb175407 | 147 | } |
148 | ||
149 | ||
150 | Int_t g_pic_id = 0; | |
151 | Int_t g_pic_max = 100; | |
152 | TTimeStamp g_pic_prev(0, 0); | |
153 | ||
154 | void alieve_online_on_new_event() | |
155 | { | |
572d0620 | 156 | AliSysInfo::AddStamp("on_new_event_start"); |
157 | ||
158 | Double_t x[3] = { 0, 0, 0 }; | |
159 | ||
160 | if (AliEveEventManager::HasESD()) | |
161 | { | |
162 | AliESDEvent* esd = AliEveEventManager::AssertESD(); | |
163 | esd->GetPrimaryVertex()->GetXYZ(x); | |
164 | ||
165 | TTimeStamp ts(esd->GetTimeStamp()); | |
166 | TString win_title("Eve Main Window -- Timestamp: "); | |
167 | win_title += ts.AsString("s"); | |
168 | win_title += "; Event # in ESD file: "; | |
169 | win_title += esd->GetEventNumberInFile(); | |
170 | gEve->GetBrowser()->SetWindowName(win_title); | |
171 | } | |
172 | ||
173 | TEveElement* top = gEve->GetCurrentEvent(); | |
174 | ||
175 | AliEveMultiView *mv = AliEveMultiView::Instance(); | |
176 | ||
177 | //mv->DestroyEventRPhi(); | |
178 | if (gCenterProjectionsAtPrimaryVertex) | |
179 | mv->SetCenterRPhi(x[0], x[1], x[2]); | |
180 | mv->ImportEventRPhi(top); | |
181 | ||
182 | //mv->DestroyEventRhoZ(); | |
183 | if (gCenterProjectionsAtPrimaryVertex) | |
184 | mv->SetCenterRhoZ(x[0], x[1], x[2]); | |
185 | mv->ImportEventRhoZ(top); | |
186 | ||
187 | if (gCenterProjectionsAtPrimaryVertex) | |
188 | mv->SetCenterMuon(x[0], x[1], x[2]); | |
189 | mv->ImportEventMuon(top); | |
190 | ||
7f97b015 | 191 | /* |
572d0620 | 192 | // Register image to amore. |
193 | // const TString pichost("aldaqacrs3"); | |
194 | const TString pichost(gEnv->GetValue("AliEve.imageDumpHost", "localhost")); | |
195 | TTimeStamp now; | |
196 | Double_t delta = now.AsDouble() - g_pic_prev.AsDouble(); | |
197 | ||
198 | printf("Pre image dump: host='%s', delta=%f.\n", | |
199 | gSystem->HostName(), delta); | |
200 | ||
201 | AliSysInfo::AddStamp("on_new_event_pic"); | |
202 | if (pichost == gSystem->HostName() && delta >= 30) | |
203 | { | |
204 | TString id; id.Form("online-viz-%03d", g_pic_id); | |
205 | TString pic(id); pic += ".png"; | |
206 | ||
207 | printf("In image dump: file='%s'.\n", pic.Data()); | |
208 | ||
209 | gEve->GetBrowser()->RaiseWindow(); | |
210 | gEve->FullRedraw3D(); | |
211 | gSystem->ProcessEvents(); | |
212 | ||
213 | Int_t status; | |
214 | ||
215 | // create screenshots from OpenGL views | |
216 | TEveUtil::LoadMacro("saveViews.C"); | |
217 | saveViews(pic.Data()); | |
218 | ||
219 | // send screenshot to AMORE | |
220 | status = gSystem->Exec(TString::Format("SendImageToAmore %s %s %d", | |
221 | id.Data(), pic.Data(), | |
222 | AliEveEventManager::AssertESD()->GetRunNumber())); | |
223 | ||
224 | printf("Post AMORE reg -- status=%d, run=%d.\n", status, | |
225 | AliEveEventManager::AssertESD()->GetRunNumber()); | |
226 | ||
227 | if (++g_pic_id >= g_pic_max) | |
228 | g_pic_id = 0; | |
229 | g_pic_prev.Set(); | |
230 | }*/ | |
231 | AliSysInfo::AddStamp("on_new_event_end"); | |
cb175407 | 232 | } |
233 | ||
234 | void alieve_init_import_macros() | |
235 | { | |
572d0620 | 236 | // Put macros in the list of browsables, add a macro browser to |
237 | // top-level GUI. | |
238 | ||
239 | TString macdir("$(ALICE_ROOT)/EVE/alice-macros"); | |
240 | gSystem->ExpandPathName(macdir); | |
241 | ||
242 | TFolder* f = gEve->GetMacroFolder(); | |
243 | void* dirhandle = gSystem->OpenDirectory(macdir.Data()); | |
244 | if (dirhandle != 0) | |
cb175407 | 245 | { |
572d0620 | 246 | char* filename; |
247 | TPMERegexp re("\\.C$"); | |
248 | TObjArray names; | |
249 | while ((filename = gSystem->GetDirEntry(dirhandle)) != 0) | |
250 | { | |
251 | if (re.Match(filename)) | |
252 | names.AddLast(new TObjString(filename)); | |
253 | } | |
254 | names.Sort(); | |
255 | ||
256 | for (Int_t ii=0; ii<names.GetEntries(); ++ii) | |
257 | { | |
258 | TObjString * si = (TObjString*) names.At(ii); | |
259 | f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), (si->GetString()).Data()))); | |
260 | } | |
cb175407 | 261 | } |
572d0620 | 262 | gSystem->FreeDirectory(dirhandle); |
263 | ||
264 | gROOT->GetListOfBrowsables()->Add(new TSystemDirectory(macdir.Data(), macdir.Data())); | |
265 | ||
cb175407 | 266 | { |
572d0620 | 267 | TEveBrowser *br = gEve->GetBrowser(); |
268 | TGFileBrowser *fb = 0; | |
269 | fb = br->GetFileBrowser(); | |
270 | fb->GotoDir(macdir); | |
271 | { | |
272 | br->StartEmbedding(0); | |
273 | fb = br->MakeFileBrowser(); | |
274 | fb->BrowseObj(f); | |
275 | fb->Show(); | |
276 | br->StopEmbedding(); | |
277 | br->SetTabTitle("Macros", 0); | |
278 | br->SetTab(0, 0); | |
279 | } | |
cb175407 | 280 | } |
cb175407 | 281 | } |