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