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 **************************************************************************/
7 class TEveProjectionManager;
10 class AliTriggerAnalysis;
13 TH2D* V0StateHistogram;
15 Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
17 void alieve_online_init()
20 if (gSystem->Getenv("ALICE_ROOT") != 0)
22 gInterpreter->AddIncludePath(Form("%s/MUON", gSystem->Getenv("ALICE_ROOT")));
23 gInterpreter->AddIncludePath(Form("%s/MUON/mapping", gSystem->Getenv("ALICE_ROOT")));
26 TEveUtil::AssertMacro("VizDB_scan.C");
28 TEveBrowser *browser = gEve->GetBrowser();
29 browser->ShowCloseTab(kFALSE);
31 // Gentle-geom loading changes gGeoManager.
32 TEveGeoManagerHolder mgrRestore;
34 AliEveMultiView *multiView = new AliEveMultiView(kTRUE);
36 TEveUtil::LoadMacro("geom_gentle.C");
37 multiView->InitGeomGentle(geom_gentle(),
42 TEveUtil::LoadMacro("geom_gentle_trd.C");
43 multiView->InitGeomGentleTrd(geom_gentle_trd());
45 TEveUtil::LoadMacro("geom_gentle_muon.C");
46 multiView->InitGeomGentleMuon(geom_gentle_muon(), kFALSE, kFALSE, kTRUE);
48 //============================================================================
49 // Standard macros to execute -- not all are enabled by default.
50 //============================================================================
52 AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor();
54 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE));
55 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE));
56 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE));
57 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE));
58 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE));
59 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE));
60 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE));
61 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE));
62 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE));
64 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C++", "its_clusters"));
65 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C++", "tpc_clusters"));
66 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C++", "trd_clusters"));
67 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C++", "tof_clusters"));
68 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus HMPID", "hmpid_clusters.C++", "hmpid_clusters"));
69 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus MUON", "muon_clusters.C++", "muon_clusters"));
71 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG EMCAL", "emcal_digits.C++", "emcal_digits"));
73 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS", "its_raw.C", "its_raw"));
74 // exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw"));
75 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TOF", "tof_raw.C", "tof_raw"));
76 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE));
77 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE));
78 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW MUON", "muon_raw.C++", "muon_raw"));
79 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw"));
81 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C++", "esd_tracks", "", kFALSE));
82 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C++", "esd_tracks_MI", "", kFALSE));
83 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C++", "esd_tracks_by_category", "", kTRUE));
84 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track MUON", "esd_muon_tracks.C++", "esd_muon_tracks", "kTRUE,kFALSE", kTRUE));
85 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC FMD", "fmd_esd.C", "fmd_esd", "", kTRUE));
88 // exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC TRD", "trd_detectors.C++", "trd_detectors", "", kFALSE));
89 // trd_tracks disabled due to memory leaks
91 //----------------------------------------------------------------------------
93 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
94 slot->StartEmbedding();
95 AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
96 slot->StopEmbedding("DataSelection");
97 exewin->PopulateMacros();
99 //============================================================================
100 // VZERO state histogram
101 //============================================================================
103 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
104 slot->StartEmbedding();
105 TCanvas* pad = new TCanvas();
107 gStyle->SetCanvasColor(0);
109 V0StateHistogram = new TH2D("V0 Histogram","V0 Trigger State", 4, 0, 4, 4, 0, 4);
110 V0StateHistogram->Draw("colz");
112 V0StateHistogram->GetXaxis()->SetBinLabel(1,"V0A Invalid");
113 V0StateHistogram->GetXaxis()->SetBinLabel(2,"V0A Empty");
114 V0StateHistogram->GetXaxis()->SetBinLabel(3,"V0A BB");
115 V0StateHistogram->GetXaxis()->SetBinLabel(4,"V0A BG");
117 V0StateHistogram->GetYaxis()->SetBinLabel(1,"V0C Invalid");
118 V0StateHistogram->GetYaxis()->SetBinLabel(2,"V0C Empty");
119 V0StateHistogram->GetYaxis()->SetBinLabel(3,"V0C BB");
120 V0StateHistogram->GetYaxis()->SetBinLabel(4,"V0C BG");
122 slot->StopEmbedding("V0 Trigger State");
124 //============================================================================
126 //============================================================================
128 browser->GetTabRight()->SetTab(1);
130 browser->StartEmbedding(TRootBrowser::kBottom);
131 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
132 browser->StopEmbedding("EventCtrl");
134 browser->MoveResize(0, 0, gClient->GetDisplayWidth(),
135 gClient->GetDisplayHeight() - 32);
137 gEve->GetViewers()->SwitchColorSet();
139 TString autoRun(gSystem->Getenv("ONLINERECO_AUTORUN"));
140 if (autoRun == "1" || autoRun.CompareTo("true", TString::kIgnoreCase) == 0)
142 AliEveEventManager::GetMaster()->SetAutoLoad(kTRUE);
146 TGTab *tab = gEve->GetBrowser()->GetTab(2);
148 TGHorizontalFrame *hf = (TGHorizontalFrame*) tab->GetParent();
149 TGVerticalFrame *vf = (TGVerticalFrame*) hf ->GetParent();
151 hf->Resize(hf->GetWidth(), hf->GetHeight() + 80);
155 gEve->GetWindowManager()->HideAllEveDecorations();
157 if(gEve->GetScenes()->FindChild("Geometry scene")->FindChild("Gentle MUON"))
159 gEve->GetScenes()->FindChild("Geometry scene")->FindChild("Gentle MUON")->SetRnrSelf(kFALSE);
160 gEve->GetScenes()->FindChild("Geometry scene")->FindChild("Gentle MUON")->SetRnrChildren(kFALSE);
163 if(gEve->GetScenes()->FindChild("Muon Geometry")->FindChild("Gentle MUON [P]"))
165 gEve->GetScenes()->FindChild("Muon Geometry")->FindChild("Gentle MUON [P]")->SetRnrSelf(kTRUE);
166 gEve->GetScenes()->FindChild("Muon Geometry")->FindChild("Gentle MUON [P]")->SetRnrChildren(kTRUE);
169 gEve->FullRedraw3D(kTRUE);
171 TGLViewer *glv1 = multiView->Get3DView()->GetGLViewer();
172 TGLViewer *glv2 = multiView->GetRPhiView()->GetGLViewer();
173 TGLViewer *glv3 = multiView->GetRhoZView()->GetGLViewer();
175 glv1->CurrentCamera().RotateRad(-0.4, -1.8);
176 glv2->CurrentCamera().Dolly(450, kFALSE, kFALSE);
177 glv3->CurrentCamera().Dolly(1500, kFALSE, kFALSE);
179 gEve->FullRedraw3D();
184 Int_t g_pic_max = 100;
185 TTimeStamp g_pic_prev(0, 0);
187 void alieve_online_on_new_event()
189 AliSysInfo::AddStamp("on_new_event_start");
191 AliTriggerAnalysis atr;
193 AliESDEvent* esd = AliEveEventManager::AssertESD();
194 Double_t x[3] = { 0, 0, 0 };
195 esd->GetPrimaryVertex()->GetXYZ(x);
197 TEveElement* top = gEve->GetCurrentEvent();
199 AliEveMultiView *multiView = AliEveMultiView::Instance();
202 TGLViewer *glv = (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("3D View")))->GetGLViewer();
204 if(gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON"))
206 if (esd->GetNumberOfMuonTracks() == 0 && !gEve->GetKeepEmptyCont())
208 gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON")->SetRnrChildren(kFALSE);
210 if(gEve->GetEventScene()->FirstChild()->FindChild("MUON Clusters"))
211 gEve->GetEventScene()->FirstChild()->FindChild("MUON Clusters")->SetRnrSelf(kFALSE);
212 if(gEve->GetEventScene()->FirstChild()->FindChild("MUON Raw digits"))
213 gEve->GetEventScene()->FirstChild()->FindChild("MUON Raw digits")->SetRnrChildren(kFALSE);
215 gEve->FullRedraw3D(kTRUE);
216 glv->CurrentCamera().RotateRad(-0.4, -1.8);
220 gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON")->SetRnrChildren(kTRUE);
222 if(gEve->GetEventScene()->FirstChild()->FindChild("MUON Clusters"))
223 gEve->GetEventScene()->FirstChild()->FindChild("MUON Clusters")->SetRnrSelf(kTRUE);
224 if(gEve->GetEventScene()->FirstChild()->FindChild("MUON Raw digits"))
225 gEve->GetEventScene()->FirstChild()->FindChild("MUON Raw digits")->SetRnrChildren(kTRUE);
227 gEve->FullRedraw3D(kTRUE);
228 glv->CurrentCamera().RotateRad(-0.4, 1);
235 AliTriggerAnalysis::V0Decision decisionV0a =
236 atr.V0Trigger(esd, AliTriggerAnalysis::kASide, kFALSE);
237 AliTriggerAnalysis::V0Decision decisionV0c =
238 atr.V0Trigger(esd, AliTriggerAnalysis::kCSide, kFALSE);
243 if( decisionV0a == AliTriggerAnalysis::kV0Invalid ) a = 0.5;
244 if( decisionV0a == AliTriggerAnalysis::kV0Empty ) a = 1.5;
245 if( decisionV0a == AliTriggerAnalysis::kV0BB ) a = 2.5;
246 if( decisionV0a == AliTriggerAnalysis::kV0BG ) a = 3.5;
248 if( decisionV0c == AliTriggerAnalysis::kV0Invalid ) c = 0.5;
249 if( decisionV0c == AliTriggerAnalysis::kV0Empty ) c = 1.5;
250 if( decisionV0c == AliTriggerAnalysis::kV0BB ) c = 2.5;
251 if( decisionV0c == AliTriggerAnalysis::kV0BG ) c = 3.5;
253 V0StateHistogram->Fill(a,c);
254 AliSysInfo::AddStamp("on_new_event_after_trig");
256 TGLViewer *glv = multiView->Get3DView()->GetGLViewer();
257 TGLViewer *glv1 = multiView->GetRPhiView()->GetGLViewer();
258 TGLViewer *glv2 = multiView->GetRhoZView()->GetGLViewer();
260 Double_t RPhiCameraFrustrumCenter = TMath::Sqrt(glv1->CurrentCamera().FrustumCenter().X()*glv1->CurrentCamera().FrustumCenter().X() + glv1->CurrentCamera().FrustumCenter().Y()*glv1->CurrentCamera().FrustumCenter().Y());
262 Double_t RhoZCameraFrustrumCenter = TMath::Sqrt(glv2->CurrentCamera().FrustumCenter().X()*glv2->CurrentCamera().FrustumCenter().X() + glv2->CurrentCamera().FrustumCenter().Y()*glv2->CurrentCamera().FrustumCenter().Y());
264 if(RPhiCameraFrustrumCenter > 500 || RhoZCameraFrustrumCenter > 500)
267 glv->ResetCurrentCamera();
268 glv1->ResetCurrentCamera();
269 glv2->ResetCurrentCamera();
271 glv->CurrentCamera().RotateRad(-0.4, -1.8);
272 glv1->CurrentCamera().Dolly(450, kFALSE, kFALSE);
273 glv2->CurrentCamera().Dolly(1500, kFALSE, kFALSE);
275 gEve->FullRedraw3D();
279 multiView->DestroyEventRPhi();
280 if (gCenterProjectionsAtPrimaryVertex)
281 multiView->SetCenterRPhi(x[0], x[1], x[2]);
282 multiView->ImportEventRPhi(top);
284 multiView->DestroyEventRhoZ();
285 if (gCenterProjectionsAtPrimaryVertex)
286 multiView->SetCenterRhoZ(x[0], x[1], x[2]);
287 multiView->ImportEventRhoZ(top);
289 AliSysInfo::AddStamp("on_new_event_after_rozphi");
291 if(multiView->IsMuonView()) { multiView->DestroyEventMuon(); multiView->ImportEventMuon(top); }
293 if(gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("MUON Clusters"))
295 gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("MUON Clusters")->SetRnrSelf(kFALSE);
296 gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("MUON Clusters")->SetRnrChildren(kFALSE);
299 if(gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("ESD MUON Clusters"))
301 gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("ESD MUON Clusters")->SetRnrSelf(kFALSE);
302 gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("ESD MUON Clusters")->SetRnrChildren(kFALSE);
305 if(gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("ESD MUON Tracks"))
307 gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("ESD MUON Tracks")->SetRnrSelf(kFALSE);
308 gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("ESD MUON Tracks")->SetRnrChildren(kFALSE);
311 if(gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("MUON Raw digits"))
313 gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("MUON Raw digits")->SetRnrSelf(kFALSE);
314 gEve->GetScenes()->FindChild("Event scene")->FindChild("Online Event")->FindChild("MUON Raw digits")->SetRnrChildren(kFALSE);
317 if(gEve->GetScenes()->FindChild("Muon Event Data"))
319 if(gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]"))
321 if(gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]")->FindChild("MUON Clusters [P]"))
323 gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]")->FindChild("MUON Clusters [P]")->SetRnrSelf(kTRUE);
324 gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]")->FindChild("MUON Clusters [P]")->SetRnrChildren(kTRUE);
327 if(gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]")->FindChild("ESD MUON Clusters [P]"))
329 gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]")->FindChild("ESD MUON Clusters [P]")->SetRnrSelf(kTRUE);
330 gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]")->FindChild("ESD MUON Clusters [P]")->SetRnrChildren(kTRUE);
333 if(gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]")->FindChild("ESD MUON Tracks [P]"))
335 gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]")->FindChild("ESD MUON Tracks [P]")->SetRnrSelf(kTRUE);
336 gEve->GetScenes()->FindChild("Muon Event Data")->FindChild("Online Event [P]")->FindChild("ESD MUON Tracks [P]")->SetRnrChildren(kTRUE);
341 if(gEve->GetScenes()->FindChild("RhoZ Event Data"))
343 if(gEve->GetScenes()->FindChild("RhoZ Event Data")->FindChild("Online Event [P]"))
345 if(gEve->GetScenes()->FindChild("RhoZ Event Data")->FindChild("Online Event [P]")->FindChild("FMD [P]"))
347 gEve->GetScenes()->FindChild("RhoZ Event Data")->FindChild("Online Event [P]")->FindChild("FMD [P]")->SetRnrSelf(kFALSE);
348 gEve->GetScenes()->FindChild("RhoZ Event Data")->FindChild("Online Event [P]")->FindChild("FMD [P]")->SetRnrChildren(kFALSE);
353 if(gEve->GetScenes()->FindChild("RPhi Event Data"))
355 if(gEve->GetScenes()->FindChild("RPhi Event Data")->FindChild("Online Event [P]"))
357 if(gEve->GetScenes()->FindChild("RPhi Event Data")->FindChild("Online Event [P]")->FindChild("FMD [P]"))
359 gEve->GetScenes()->FindChild("RPhi Event Data")->FindChild("Online Event [P]")->FindChild("FMD [P]")->SetRnrSelf(kFALSE);
360 gEve->GetScenes()->FindChild("RPhi Event Data")->FindChild("Online Event [P]")->FindChild("FMD [P]")->SetRnrChildren(kFALSE);
364 AliSysInfo::AddStamp("on_new_event_after_muon");
366 gEve->FullRedraw3D();
368 // Register image to amore.
369 // const TString pichost("aldaqacrs3");
370 const TString pichost(gEnv->GetValue("AliEve.imageDumpHost", "aldaqacrs3"));
372 Double_t delta = now.AsDouble() - g_pic_prev.AsDouble();
374 printf("Pre image dump: host='%s', delta=%f.\n",
375 gSystem->HostName(), delta);
377 AliSysInfo::AddStamp("on_new_event_pic");
378 if (pichost == gSystem->HostName() && delta >= 30)
380 TString id; id.Form("online-viz-%03d", g_pic_id);
381 TString pic(id); pic += ".png";
383 printf("In image dump: file='%s'.\n", pic.Data());
385 gEve->GetBrowser()->RaiseWindow();
386 gEve->FullRedraw3D();
387 gSystem->ProcessEvents();
391 status = gSystem->Exec(TString::Format("xwd -id %u | convert - %s",
392 gEve->GetBrowser()->GetId(), pic.Data()));
394 printf("Post capture -- status=%d.\n", status);
396 status = gSystem->Exec(TString::Format("SendImageToAmore %s %s %d",
397 id.Data(), pic.Data(),
398 AliEveEventManager::AssertRawReader()->GetRunNumber()));
400 printf("Post AMORE reg -- status=%d, run=%d.\n", status,
401 AliEveEventManager::AssertRawReader()->GetRunNumber());
403 if (++g_pic_id >= g_pic_max)
407 AliSysInfo::AddStamp("on_new_event_end");