Coding rules
[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
4d62585e 11TEveGeoShape *gGeomGentle = 0;
de33999e 12
2a6fc1f9 13TEveScene *gRPhiGeomScene = 0;
14TEveScene *gRhoZGeomScene = 0;
15TEveScene *gRPhiEventScene = 0;
16TEveScene *gRhoZEventScene = 0;
17
18TEveProjectionManager *gRPhiMgr = 0;
19TEveProjectionManager *gRhoZMgr = 0;
20
21TEveViewer *g3DView = 0;
22TEveViewer *gRPhiView = 0;
23TEveViewer *gRhoZView = 0;
24
25Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
26
de33999e 27void alieve_online_init()
319f3084 28{
de33999e 29 gROOT->LoadMacro("geom_gentle.C");
30
31 gROOT->LoadMacro("primary_vertex.C");
32 gROOT->LoadMacro("esd_tracks.C");
9fb2a3ed 33 gROOT->LoadMacro("trd_tracks.C++");
34 gROOT->LoadMacro("trd_detectors.C++");
de33999e 35
dc9dec4d 36 gROOT->LoadMacro("its_clusters.C++");
37 gROOT->LoadMacro("tpc_clusters.C++");
95a0b764 38 gROOT->LoadMacro("tof_clusters.C++");
f1fa3b4b 39 gROOT->LoadMacro("hmpid_clusters.C++");
de33999e 40
41 gROOT->LoadMacro("acorde_raw.C");
42 gROOT->LoadMacro("its_raw.C");
43 gROOT->LoadMacro("tpc_raw.C");
95a0b764 44 gROOT->LoadMacro("tof_raw.C");
de33999e 45
a9e18d1c 46 TEveUtil::AssertMacro("VizDB_scan.C");
47
2a6fc1f9 48 TEveBrowser *browser = gEve->GetBrowser();
49 browser->ShowCloseTab(kFALSE);
50
2a8440b7 51 // Temp fix !!!
52 TGeoManager *man = gGeoManager;
de33999e 53 gGeomGentle = geom_gentle();
2a6fc1f9 54 gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy();
55 gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy();
2a8440b7 56 // Temp fix !!!
57 gGeoManager = man;
de33999e 58
2a6fc1f9 59 // Scenes
60 gRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry",
61 "Scene holding projected geometry for the RPhi view.");
62 gRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry",
63 "Scene holding projected geometry for the RhoZ view.");
64 gRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
65 "Scene holding projected geometry for the RPhi view.");
66 gRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
67 "Scene holding projected geometry for the RhoZ view.");
68
69 gRPhiMgr = new TEveProjectionManager();
70 gRPhiMgr->SetProjection(TEveProjection::kPT_RPhi);
71 gEve->AddToListTree(gRPhiMgr, kFALSE);
72 {
de33999e 73 TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
b631c5f2 74 a->SetMainColor(kWhite);
68ca2fe7 75 a->SetTitle("R-Phi");
b631c5f2 76 a->SetTitleSize(0.05);
2a6fc1f9 77 a->SetTitleFont(102);
b631c5f2 78 a->SetLabelSize(0.025);
2a6fc1f9 79 a->SetLabelFont(102);
80 gRPhiGeomScene->AddElement(a);
de33999e 81 }
2a6fc1f9 82 gRPhiMgr->SetCurrentDepth(-10);
83 gRPhiMgr->ImportElements(gGeomGentleRPhi, gRPhiGeomScene);
84 gRPhiMgr->SetCurrentDepth(0);
85
86 gRhoZMgr = new TEveProjectionManager();
87 gRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ);
88 gEve->AddToListTree(gRhoZMgr, kFALSE);
89 {
de33999e 90 TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
b631c5f2 91 a->SetMainColor(kWhite);
2a6fc1f9 92 a->SetTitle("Rho-Z");
b631c5f2 93 a->SetTitleSize(0.05);
2a6fc1f9 94 a->SetTitleFont(102);
b631c5f2 95 a->SetLabelSize(0.025);
2a6fc1f9 96 a->SetLabelFont(102);
97 gRhoZGeomScene->AddElement(a);
de33999e 98 }
2a6fc1f9 99 gRhoZMgr->SetCurrentDepth(-10);
100 gRhoZMgr->ImportElements(gGeomGentleRhoZ, gRhoZGeomScene);
101 gRhoZMgr->SetCurrentDepth(0);
102
103 // Viewers
104 TEveWindowSlot *slot = 0;
105 TEveWindowPack *pack = 0;
106
107 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
108 pack = slot->MakePack();
109 pack->SetElementName("Multi View");
110 pack->SetHorizontal();
111 pack->SetShowTitleBar(kFALSE);
112 pack->NewSlot()->MakeCurrent();
113 g3DView = gEve->SpawnNewViewer("3D View", "");
114 g3DView->AddScene(gEve->GetGlobalScene());
115 g3DView->AddScene(gEve->GetEventScene());
116
117 pack = pack->NewSlot()->MakePack();
118 pack->SetShowTitleBar(kFALSE);
119 pack->NewSlot()->MakeCurrent();
120 gRPhiView = gEve->SpawnNewViewer("RPhi View", "");
121 gRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
122 gRPhiView->AddScene(gRPhiGeomScene);
123 gRPhiView->AddScene(gRPhiEventScene);
124
125 pack->NewSlot()->MakeCurrent();
126 gRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
127 gRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
128 gRhoZView->AddScene(gRhoZGeomScene);
129 gRhoZView->AddScene(gRhoZEventScene);
130
de33999e 131
47aab29b 132 browser->StartEmbedding(TRootBrowser::kBottom);
4d62585e 133 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
47aab29b 134 browser->StopEmbedding("EventCtrl");
135
de33999e 136 gEve->Redraw3D(kTRUE);
137}
138
139void alieve_online_on_new_event()
140{
effa8d5d 141 if (AliEveEventManager::HasRawReader())
142 its_raw();
de33999e 143 its_clusters();
144
effa8d5d 145 if (AliEveEventManager::HasRawReader())
146 tpc_raw();
de33999e 147 tpc_clusters();
148
95a0b764 149 if (AliEveEventManager::HasRawReader())
150 tof_raw();
151 tof_clusters();
152
f1fa3b4b 153 hmpid_clusters();
154
effa8d5d 155 if (AliEveEventManager::HasRawReader())
156 acorde_raw();
de33999e 157
158 primary_vertex();
159 esd_tracks();
160
9fb2a3ed 161 if (AliEveEventManager::HasESDfriend()) trd_tracks();
162 trd_detectors();
163
de33999e 164 AliESDEvent* esd = AliEveEventManager::AssertESD();
165 Double_t x[3];
166 esd->GetPrimaryVertex()->GetXYZ(x);
167
168 TEveElement* top = gEve->GetCurrentEvent();
169
2a6fc1f9 170 if (gRPhiMgr && top)
171 {
172 gRPhiEventScene->DestroyElements();
173 if (gCenterProjectionsAtPrimaryVertex)
174 gRPhiMgr->SetCenter(x[0], x[1], x[2]);
175 gRPhiMgr->ImportElements(top, gRPhiEventScene);
de33999e 176 }
2a6fc1f9 177 if (gRhoZMgr && top)
178 {
179 gRhoZEventScene->DestroyElements();
180 if (gCenterProjectionsAtPrimaryVertex)
181 gRhoZMgr->SetCenter(x[0], x[1], x[2]);
182 gRhoZMgr->ImportElements(top, gRhoZEventScene);
de33999e 183 }
319f3084 184}