]>
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 | ||
341ffc50 | 49 | //These macros crashes on mac os. To be checked. Problems on SLC as well. |
164d3d29 | 50 | |
341ffc50 | 51 | //TEveUtil::LoadMacro("geom_gentle_trd.C"); |
52 | //multiView->InitGeomGentleTrd(geom_gentle_trd()); | |
572d0620 | 53 | |
341ffc50 | 54 | //TEveUtil::LoadMacro("geom_gentle_muon.C"); |
55 | //multiView->InitGeomGentleMuon(geom_gentle_muon(), kFALSE, kFALSE, kTRUE); | |
572d0620 | 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 | ||
d2416c53 | 127 | // browser->MoveResize(0, 0, gClient->GetDisplayHeight()*1.6,gClient->GetDisplayHeight()-32); |
572d0620 | 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 | ||
f5e8dfd2 | 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 | ||
f5e8dfd2 | 198 | printf("Pre image dump: host='%s', delta=%f.\n",gSystem->HostName(), delta); |
572d0620 | 199 | |
200 | AliSysInfo::AddStamp("on_new_event_pic"); | |
f5e8dfd2 | 201 | // if (pichost == gSystem->HostName() && delta >= 30) |
572d0620 | 202 | { |
f5e8dfd2 | 203 | TString id; id.Form("online-viz-%03d", g_pic_id); |
204 | TString pic(id); pic += ".png"; | |
572d0620 | 205 | |
f5e8dfd2 | 206 | printf("In image dump: file='%s'.\n", pic.Data()); |
572d0620 | 207 | |
f5e8dfd2 | 208 | gEve->GetBrowser()->RaiseWindow(); |
209 | gEve->FullRedraw3D(); | |
210 | gSystem->ProcessEvents(); | |
572d0620 | 211 | |
f5e8dfd2 | 212 | Int_t status; |
572d0620 | 213 | |
f5e8dfd2 | 214 | // create screenshots from OpenGL views |
215 | TEveUtil::LoadMacro("saveViews.C"); | |
216 | saveViews(pic.Data()); | |
572d0620 | 217 | |
f5e8dfd2 | 218 | // send screenshot to AMORE |
219 | cout<<"Sending:"<<TString::Format("SendImageToAmore %s %s %d",id.Data(), pic.Data(),AliEveEventManager::AssertESD()->GetRunNumber())<<endl; | |
220 | ||
221 | status = gSystem->Exec(TString::Format("SendImageToAmore %s %s %d", | |
222 | id.Data(), pic.Data(), | |
223 | AliEveEventManager::AssertESD()->GetRunNumber())); | |
572d0620 | 224 | |
f5e8dfd2 | 225 | printf("Post AMORE reg -- status=%d, run=%d.\n", status, |
226 | AliEveEventManager::AssertESD()->GetRunNumber()); | |
572d0620 | 227 | |
f5e8dfd2 | 228 | if (++g_pic_id >= g_pic_max) |
229 | g_pic_id = 0; | |
230 | g_pic_prev.Set(); | |
231 | } | |
572d0620 | 232 | AliSysInfo::AddStamp("on_new_event_end"); |
cb175407 | 233 | } |
234 | ||
235 | void alieve_init_import_macros() | |
236 | { | |
572d0620 | 237 | // Put macros in the list of browsables, add a macro browser to |
238 | // top-level GUI. | |
239 | ||
240 | TString macdir("$(ALICE_ROOT)/EVE/alice-macros"); | |
241 | gSystem->ExpandPathName(macdir); | |
242 | ||
243 | TFolder* f = gEve->GetMacroFolder(); | |
244 | void* dirhandle = gSystem->OpenDirectory(macdir.Data()); | |
245 | if (dirhandle != 0) | |
cb175407 | 246 | { |
572d0620 | 247 | char* filename; |
248 | TPMERegexp re("\\.C$"); | |
249 | TObjArray names; | |
250 | while ((filename = gSystem->GetDirEntry(dirhandle)) != 0) | |
251 | { | |
252 | if (re.Match(filename)) | |
253 | names.AddLast(new TObjString(filename)); | |
254 | } | |
255 | names.Sort(); | |
256 | ||
257 | for (Int_t ii=0; ii<names.GetEntries(); ++ii) | |
258 | { | |
259 | TObjString * si = (TObjString*) names.At(ii); | |
260 | f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), (si->GetString()).Data()))); | |
261 | } | |
cb175407 | 262 | } |
572d0620 | 263 | gSystem->FreeDirectory(dirhandle); |
264 | ||
265 | gROOT->GetListOfBrowsables()->Add(new TSystemDirectory(macdir.Data(), macdir.Data())); | |
266 | ||
cb175407 | 267 | { |
572d0620 | 268 | TEveBrowser *br = gEve->GetBrowser(); |
269 | TGFileBrowser *fb = 0; | |
270 | fb = br->GetFileBrowser(); | |
271 | fb->GotoDir(macdir); | |
272 | { | |
273 | br->StartEmbedding(0); | |
274 | fb = br->MakeFileBrowser(); | |
275 | fb->BrowseObj(f); | |
276 | fb->Show(); | |
277 | br->StopEmbedding(); | |
278 | br->SetTabTitle("Macros", 0); | |
279 | br->SetTab(0, 0); | |
280 | } | |
cb175407 | 281 | } |
cb175407 | 282 | } |