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