Move MultiView.C into EveBase class AliEveMultiView.
[u/mrichter/AliRoot.git] / EVE / macros / alieve_online.C
CommitLineData
319f3084 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
2a6fc1f9 7class TEveProjectionManager;
8class TEveGeoShape;
9class TEveUtil;
10
2a6fc1f9 11Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
12
3545fba9 13
de33999e 14void alieve_online_init()
319f3084 15{
3e6470df 16 if (gROOT->LoadMacro("MultiView.C++") != 0)
3545fba9 17 {
18 gEnv->SetValue("Root.Stacktrace", "no");
19 Fatal("alieve_online.C", "Failed loading MultiView.C in compiled mode.");
20 }
de33999e 21
a9e18d1c 22 TEveUtil::AssertMacro("VizDB_scan.C");
23
06f4984c 24 TEveBrowser *browser = gEve->GetBrowser();
2a6fc1f9 25 browser->ShowCloseTab(kFALSE);
26
3545fba9 27 // Gentle-geom loading changes gGeoManager.
28 TEveGeoManagerHolder mgrRestore;
2a6fc1f9 29
1e9caa37 30 AliEveMultiView* mv = new AliEveMultiView;
31
32 mv->SetDepth(-10);
3545fba9 33
34 TEveUtil::LoadMacro("geom_gentle.C");
1e9caa37 35 mv->InitGeomGentle(geom_gentle(), geom_gentle_rphi(), geom_gentle_rhoz());
3545fba9 36
37 // See visscan_init.C for how to add TRD / MUON geometry.
2a6fc1f9 38
1e9caa37 39 mv->SetDepth(0);
40
c027b127 41 //============================================================================
42 // Standard macros to execute -- not all are enabled by default.
43 //============================================================================
44
45 AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor();
46
47 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE));
48 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE));
49 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE));
50 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE));
51 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE));
52 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE));
53 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE));
54 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE));
55 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE));
56
57 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C++", "its_clusters"));
58 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C++", "tpc_clusters"));
59 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C++", "tof_clusters"));
60 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus HMPID", "hmpid_clusters.C++", "hmpid_clusters"));
61
62 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "emcal_digits.C++", "emcal_digits"));
63
64 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS", "its_raw.C", "its_raw"));
65 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw"));
66 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TOF", "tof_raw.C", "tof_raw"));
67 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw"));
68 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw"));
69
70 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE));
71 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE));
72 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
73
74 // ???
75 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC TRD", "trd_detectors.C++", "trd_detectors", "", kFALSE));
76 // trd_tracks disabled due to memory leaks
77
78 //----------------------------------------------------------------------------
79
80 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
81 slot->StartEmbedding();
82 AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
83 slot->StopEmbedding("DataSelection");
84 exewin->PopulateMacros();
85
86 //============================================================================
87 // Final GUI setup
88 //============================================================================
89
14a4b686 90 browser->GetTabRight()->SetTab(1);
de33999e 91
47aab29b 92 browser->StartEmbedding(TRootBrowser::kBottom);
4d62585e 93 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
47aab29b 94 browser->StopEmbedding("EventCtrl");
95
06f4984c 96 browser->MoveResize(0, 0, gClient->GetDisplayWidth(),
97 gClient->GetDisplayHeight() - 32);
98
99 gEve->GetViewers()->SwitchColorSet();
100
101 TString autoRun(gSystem->Getenv("ONLINERECO_AUTORUN"));
102 if (autoRun == "1" || autoRun.CompareTo("true", TString::kIgnoreCase) == 0)
103 {
104 AliEveEventManager::GetMaster()->SetAutoLoad(kTRUE);
105 }
106
1110f3fe 107 {
108 TGTab *tab = gEve->GetBrowser()->GetTab(2);
109
110 TGHorizontalFrame *hf = (TGHorizontalFrame*) tab->GetParent();
111 TGVerticalFrame *vf = (TGVerticalFrame*) hf ->GetParent();
112
113 hf->Resize(hf->GetWidth(), hf->GetHeight() + 80);
114 vf->Layout();
115 }
116
3e6470df 117 gEve->FullRedraw3D(kTRUE);
118
1e9caa37 119 TGLViewer *glv = mv->Get3DView()->GetGLViewer();
3e6470df 120 glv->CurrentCamera().RotateRad(-0.4, 1);
121 glv->DoDraw();
de33999e 122}
123
124void alieve_online_on_new_event()
125{
de33999e 126 AliESDEvent* esd = AliEveEventManager::AssertESD();
127 Double_t x[3];
128 esd->GetPrimaryVertex()->GetXYZ(x);
129
130 TEveElement* top = gEve->GetCurrentEvent();
131
1e9caa37 132 AliEveMultiView* mv = AliEveMultiView::Instance();
133
134 mv->DestroyEventRPhi();
3545fba9 135 if (gCenterProjectionsAtPrimaryVertex)
1e9caa37 136 mv->SetCenterRPhi(x[0], x[1], x[2]);
137 mv->ImportEventRPhi(top);
3545fba9 138
1e9caa37 139 mv->DestroyEventRhoZ();
3545fba9 140 if (gCenterProjectionsAtPrimaryVertex)
1e9caa37 141 mv->SetCenterRhoZ(x[0], x[1], x[2]);
142 mv->ImportEventRhoZ(top);
319f3084 143}