aad97381370f227b40142a6b68578308b2434e98
[u/mrichter/AliRoot.git] / EVE / hlt-macros / onlineDisplay.C
1 //-*- Mode: C++ -*-
2
3 // ** USED macros :
4 // ***************************************************
5 // - hlt_alieve_init.C
6 // - VizDB_scan.C
7 // - geom_gentle_hlt.C
8 // - geom_gentle_muon.C
9 // ***************************************************
10
11
12 #ifndef __CINT__
13 #include "unistd.h"
14 #include <TEvePointSet.h>
15 #include "EveBase/AliEveEventManager.h"
16 #include <AliCluster.h>
17 #include <TPC/AliTPCClustersRow.h>
18 #include <EveHLT/AliEveHOMERManager.h>
19 #include <TTimer.h>
20 #endif
21
22 class TEveTrackList;
23 class TEveProjectionManager;
24 class TEveGeoShape;
25 class TEveUtil;
26 class AliEveMacroExecutor;
27 class TEveScene;
28 class TEveElement;
29 class TEveText;
30 class AliHLTTriggerDecision;
31 class TEvePointSet;
32 class AliHLTHOMERBlockDesc;
33
34 class TEveViewer;
35 // -----------------------------------------------------------------
36 // --                       Geometry / Scenes                     --
37 // -----------------------------------------------------------------
38
39 TEveGeoShape *gGeomGentle     = 0;
40 TEveGeoShape *gGeomGentleRPhi = 0;
41 TEveGeoShape *gGeomGentleRhoZ = 0;
42 TEveGeoShape *gGeomGentleTRD  = 0;
43 TEveGeoShape *gGeomGentleMUON = 0;
44
45 TEveScene *gRPhiGeomScene  = 0;
46 TEveScene *gRhoZGeomScene  = 0;
47 TEveScene *gRPhiEventScene = 0;
48 TEveScene *gRhoZEventScene = 0;
49
50 TEveProjectionManager *gRPhiMgr = 0;
51 TEveProjectionManager *gRhoZMgr = 0;
52
53 TEveViewer *g3DView   = 0;
54 TEveViewer *gRPhiView = 0;
55 TEveViewer *gRhoZView = 0;
56
57 // -----------------------------------------------------------------
58 // --                Geometry / Scenes Parameters                 --
59 // -----------------------------------------------------------------
60
61 // -- Parameters to show different geometries
62 Bool_t gShowMUON     = kTRUE;
63 Bool_t gShowMUONRPhi = kFALSE;
64 Bool_t gShowMUONRhoZ = kTRUE;
65 Bool_t gShowTRD      = kFALSE;
66
67 Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
68
69 // -----------------------------------------------------------------
70 // --                         Members                            --
71 // -----------------------------------------------------------------
72
73 // -- Timer for automatic event loop
74 TTimer                                    eventTimer;
75
76 // -- HOMERManager
77 AliEveHOMERManager*                       gHomerManager    = 0;
78
79 // -- Cluster members
80 TEvePointSet*                             gPHOSClusters    = 0;
81 TEvePointSet*                             gTPCClusters     = 0;
82 TEvePointSet*                             gSPDClusters     = 0;
83
84 // -- Text output members
85 TEveText*                                 gHLTText         = 0;
86
87 // -- Tracks members
88 TEveTrackList*                            gTPCTrack        = 0;
89
90
91 // -- Canvas for histos
92 TCanvas*                                  gCanvas          = 0;
93
94 // -----------------------------------------------------------------
95 // --                          Methods                            --
96 // -----------------------------------------------------------------
97
98 Int_t initializeEveViewer( Bool_t showExtraGeo );
99
100 Int_t nextEvent();
101
102 //Int_t processPHOSClusters( AliHLTHOMERBlockDesc* block);
103
104 Int_t processEsdTracks( AliHLTHOMERBlockDesc* block, TEveTrackList* cont );
105
106 Int_t processHLTRDLST( AliHLTHOMERBlockDesc* block );
107
108 Int_t processROOTTOBJ( AliHLTHOMERBlockDesc* block );
109
110 Int_t processTPCClusters (AliHLTHOMERBlockDesc * block, TEvePointSet cont );
111
112 // #################################################################
113 // #################################################################
114 // #################################################################
115
116 // -----------------------------------------------------------------
117 void onlineDisplay(Bool_t showMuonGeo=kFALSE) {
118
119
120   // -- Loading Geometry
121   // ---------------------
122   Int_t run = 67179;
123   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
124   AliCDBManager::Instance()->SetRun(run);
125   AliGeomManager::LoadGeometry();
126
127   // -- Create new hM object
128   // -------------------------
129   gHomerManager = new AliEveHOMERManager();
130   gHomerManager->SetRetryCount(50,5);
131
132   Int_t iResult = gHomerManager->Initialize();
133   if (iResult) { 
134     printf("Error Initializing AliHLTHOMERManager, quitting");
135     return; 
136   }
137
138   // -- Add hM to EveTree
139   // ----------------------
140   gEve->AddToListTree(gHomerManager, kTRUE);
141
142   // -- Create SourceList
143   // ----------------------
144   iResult = gHomerManager->CreateEveSourcesListLoop();
145   if (iResult) {
146     printf ("Couldn't find active services. returning\n");
147     return;
148   } 
149
150   // -- Initialize pointsets and add macros
151   // ----------------------------------------
152   TEveUtil::LoadMacro("hlt_alieve_init.C");
153   hlt_alieve_init(".", -1);
154
155   // -- Initialize Eve
156   // -------------------
157   initializeEveViewer( showMuonGeo );
158
159   // -- Finalize Eve
160   // -----------------
161   gSystem->ProcessEvents();
162   gEve->Redraw3D(kTRUE);
163
164   gHomerManager->ConnectEVEtoHOMER("TPC" );
165
166 }
167
168 // -----------------------------------------------------------------
169 Int_t initializeEveViewer( Bool_t showMuonGeo ) {
170   
171   //==============================================================================
172   // Geometry, scenes, projections and viewers
173   //==============================================================================
174
175
176   TEveBrowser         *browser = gEve->GetBrowser();
177   browser->ShowCloseTab(kFALSE);
178   
179
180   // -- Disable extra geometry
181   // ---------------------------
182   if ( ! showMuonGeo ) {
183     gShowMUON = gShowMUONRPhi = gShowMUONRhoZ = kFALSE;
184   }
185   
186   // -- Load Geometry
187   // ------------------
188   TEveUtil::LoadMacro("geom_gentle_hlt.C");
189   gGeomGentle = geom_gentle_hlt();
190   gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy();
191   gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy();
192   gGeomGentleTRD  = geom_gentle_trd();
193
194   if (gShowMUON) {
195     TEveUtil::LoadMacro("geom_gentle_muon.C");
196     gGeomGentleMUON = geom_gentle_muon(kFALSE);
197   }
198
199
200   // Scenes
201
202   gRPhiGeomScene  = gEve->SpawnNewScene("RPhi Geometry",
203                     "Scene holding projected geometry for the RPhi view.");
204   gRhoZGeomScene  = gEve->SpawnNewScene("RhoZ Geometry",
205                     "Scene holding projected geometry for the RhoZ view.");
206   gRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
207                     "Scene holding projected geometry for the RPhi view.");
208   gRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
209                     "Scene holding projected geometry for the RhoZ view.");
210
211
212   // Projection managers
213
214   gRPhiMgr = new TEveProjectionManager();
215   gRPhiMgr->SetProjection(TEveProjection::kPT_RPhi);
216   gEve->AddToListTree(gRPhiMgr, kFALSE);
217   {
218     TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
219     a->SetMainColor(kWhite);
220     a->SetTitle("R-Phi");
221     a->SetTitleSize(0.05);
222     a->SetTitleFont(102);
223     a->SetLabelSize(0.025);
224     a->SetLabelFont(102);
225     gRPhiGeomScene->AddElement(a);
226   }
227   gRPhiMgr->SetCurrentDepth(-10);
228   gRPhiMgr->ImportElements(gGeomGentleRPhi, gRPhiGeomScene);
229   gRPhiMgr->SetCurrentDepth(0);
230   if (gShowTRD)      gRPhiMgr->ImportElements(gGeomGentleTRD, gRPhiGeomScene);
231   if (gShowMUONRPhi) gRPhiMgr->ImportElements(gGeomGentleMUON, gRPhiGeomScene);
232
233   gRhoZMgr = new TEveProjectionManager();
234   gRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ);
235   gEve->AddToListTree(gRhoZMgr, kFALSE);
236   {
237     TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
238     a->SetMainColor(kWhite);
239     a->SetTitle("Rho-Z");
240     a->SetTitleSize(0.05);
241     a->SetTitleFont(102);
242     a->SetLabelSize(0.025);
243     a->SetLabelFont(102);
244     gRhoZGeomScene->AddElement(a);
245   }
246   gRhoZMgr->SetCurrentDepth(-10);
247   gRhoZMgr->ImportElements(gGeomGentleRhoZ, gRhoZGeomScene);
248   gRhoZMgr->SetCurrentDepth(0);
249   if (gShowTRD)      gRhoZMgr->ImportElements(gGeomGentleTRD, gRhoZGeomScene);
250   if (gShowMUONRhoZ) gRhoZMgr->ImportElements(gGeomGentleMUON, gRhoZGeomScene);
251
252   // Viewers
253
254   TEveWindowSlot *slot = 0;
255   TEveWindowPack *pack = 0;
256
257   slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
258   pack = slot->MakePack();
259   pack->SetElementName("Multi View");
260   pack->SetHorizontal();
261   pack->SetShowTitleBar(kFALSE);
262   pack->NewSlot()->MakeCurrent();
263   g3DView = gEve->SpawnNewViewer("3D View", "");
264   g3DView->AddScene(gEve->GetGlobalScene());
265   g3DView->AddScene(gEve->GetEventScene());
266
267   pack = pack->NewSlot()->MakePack();
268   pack->SetShowTitleBar(kFALSE);
269   pack->NewSlot()->MakeCurrent();
270   gRPhiView = gEve->SpawnNewViewer("RPhi View", "");
271   gRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
272   gRPhiView->AddScene(gRPhiGeomScene);
273   gRPhiView->AddScene(gRPhiEventScene);
274
275   pack->NewSlot()->MakeCurrent();
276   gRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
277   gRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
278   gRhoZView->AddScene(gRhoZGeomScene);
279   gRhoZView->AddScene(gRhoZEventScene);
280
281
282   // List of Viewers
283
284   TEveViewerList *viewerlist = new TEveViewerList();
285   viewerlist->AddElement(gEve->GetDefaultViewer());
286
287   viewerlist->AddElement(g3DView);
288   viewerlist->AddElement(gRhoZView);
289   viewerlist->AddElement(gRPhiView);
290   viewerlist->SwitchColorSet();
291
292   //==============================================================================
293   // Macros / QA histograms
294   //==============================================================================
295
296   // -- Registration of per-event macros
297   // -------------------------------------
298
299   AliEveMacroExecutor *exec    = new AliEveMacroExecutor();
300 #if 0
301   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track",   "kine_tracks.C", "kine_tracks", "", kFALSE));
302
303   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit ITS", "its_hits.C",    "its_hits",    "", kFALSE));
304   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit TPC", "tpc_hits.C",    "tpc_hits",    "", kFALSE));
305   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit T0",  "t0_hits.C",     "t0_hits",     "", kFALSE));
306   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit FMD", "fmd_hits.C",    "fmd_hits",    "", kFALSE));
307
308   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD",     "fmd_digits.C",  "fmd_digits",  "", kFALSE));
309
310   exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC",     "tpc_raw.C",     "tpc_raw",     "", kFALSE));
311   exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0",      "t0_raw.C",      "t0_raw",      "", kFALSE));
312   exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD",     "fmd_raw.C",     "fmd_raw",     "", kFALSE));
313   exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO",   "vzero_raw.C",   "vzero_raw",   "", kFALSE));
314   exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE",  "acorde_raw.C",  "acorde_raw",  "", kFALSE));
315
316   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX",         "primary_vertex.C", "primary_vertex",             "",                kTRUE));
317   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse",     "",                kTRUE));
318   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box",     "primary_vertex.C", "primary_vertex_box",         "kFALSE, 3, 3, 3", kFALSE));
319   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX",         "primary_vertex.C", "primary_vertex_spd",         "",                kTRUE));
320   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "",                kTRUE));
321   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box",     "primary_vertex.C", "primary_vertex_box_spd",     "kFALSE, 3, 3, 3", kFALSE));
322   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX",         "primary_vertex.C", "primary_vertex_tpc",         "",                kFALSE));
323   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "",                kFALSE));
324   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box",     "primary_vertex.C", "primary_vertex_box_tpc",     "kFALSE, 3, 3, 3", kFALSE));
325 #endif
326   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0",   "esd_V0_points.C",       "esd_V0_points_onfly"));
327   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0",   "esd_V0_points.C",       "esd_V0_points_offline"));
328   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0",   "esd_V0.C",              "esd_V0"));
329   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C",  "esd_cascade_points"));
330   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C",         "esd_cascade"));
331   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink_points.C",     "esd_kink_points"));
332   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink.C",            "esd_kink"));
333
334   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks",             "", kFALSE));
335   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI",          "", kFALSE));
336   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
337
338   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE));
339
340   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC",      "esd_zdc.C", "esd_zdc", "", kFALSE));
341 #if 0
342   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus",     "clusters.C+",     "clusters", "", kFALSE));
343   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C+", "its_clusters"));
344   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C+", "tpc_clusters"));
345   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C+", "trd_clusters"));
346   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C+", "tof_clusters"));
347
348   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "vplot_tpc.C+",    "vplot_tpc", "", kFALSE));
349
350   exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA HF",   "aod_HF.C",   "aod_HF",   "", kFALSE));
351   exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA Jets", "jetplane.C", "jetplane", "", kFALSE));
352
353   // -- QA Viewer
354   // --------------
355
356
357   slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
358   slot->StartEmbedding();
359   
360 //  gCanvas = new TCanvas("c1","c1", 600, 400);
361   slot->StopEmbedding("QA histograms");
362 #endif
363
364
365   //==============================================================================
366   // Additional GUI components
367   //==============================================================================
368   
369   slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
370   TEveWindowTab *store_tab = slot->MakeTab();
371   store_tab->SetElementNameTitle("WindowStore",
372                                  "Undocked windows whose previous container is not known\n"
373                                  "are placed here when the main-frame is closed.");
374   gEve->GetWindowManager()->SetDefaultContainer(store_tab);
375   
376   return 0;
377 }
378
379 // -----------------------------------------------------------------
380 Int_t nextEvent() {
381
382   Int_t iResult = 0;
383
384   gStyle->SetPalette(1, 0);
385   gEve->DisableRedraw();
386
387   Bool_t enableReDraw = kFALSE;
388
389   // -- Get Next Event from HOMER
390   // ------------------------------
391   if ( ( iResult = gHomerManager->NextEvent()) ){
392     return iResult;
393   }
394
395   // -- Reset
396   // ----------
397   if ( gTPCClusters ) gTPCClusters->Reset();
398   if ( gPHOSClusters ) gPHOSClusters->Reset();
399   if ( gTPCTrack )    gTPCTrack->DestroyElements();
400
401   if (gHomerManager->GetBlockList()->IsEmpty() ) {
402     printf ("No Blocks in list ... ");
403     return;
404   }
405
406   TIter next(gHomerManager->GetBlockList());
407   AliHLTHOMERBlockDesc* block = 0;
408
409   // -- Iterate over blocks in the block list
410   // ------------------------------------------
411   while ((block = (AliHLTHOMERBlockDesc*)next())) {
412     
413     //    printf( "------------------- xxxxxxxxxxxxxxx ----------------------\n");
414     //  printf( "Detector           : %s\n", block->GetDetector().Data() );
415     //  printf( "Datatype           : %s\n", block->GetDataType().Data() );
416     // if (block->IsTObject() )
417     //  printf( "Is TObject of class: %s\n", block->GetClassName().Data() );
418     //    printf( "------------------- xxxxxxxxxxxxxxx ----------------------\n");
419
420     // -- CHECK SOURCE
421     // -----------------------------------------------------
422     
423     // ++ HLT BLOCK
424     // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
425     if ( ! block->GetDetector().CompareTo("HLT") ) {
426
427       // -- ESDTREE
428       if ( ! block->GetDataType().CompareTo("ALIESDV0") ) {
429         cout << "ALIESDV0 ------- ALIESDV0 ------ ALIESDV0" << endl;
430
431         if(!gTPCTrack){
432           gTPCTrack = new TEveTrackList("ESD Tracks");
433           gTPCTrack->SetMainColor(6);
434           gEve->AddElement(gTPCTrack);
435         }
436         iResult = processEsdTracks(block, gTPCTrack);
437         enableReDraw = kTRUE;
438       }
439       
440       // -- Process ROOTObj
441       else if ( ! block->GetDataType().CompareTo("ROOTTOBJ") ) {
442         if(!gHLTText){
443           gHLTText = new TEveText();
444           //gHLTText->BBoxZero(5, -5, -5, 0);
445           //gHLTText->SetExtrude(25);
446           //gHLTText->AssertBBoxExtents(25,25,25);
447           gEve->AddElement(gHLTText);
448         } 
449         processROOTTOBJ( block, gHLTText );
450       } 
451
452       // -- Process HLT RDLST
453       else if ( ! block->GetDataType().CompareTo("HLTRDLST") ) {
454         ;
455         //cout<<"Readlist"<<endl;
456         //processHLTRDLST( block );
457       }
458
459     
460       
461     } // if ( ! block->GetDetector().CompareTo("HLT") ) {
462
463     // ++ TPC BLOCK
464     // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
465     else if ( ! block->GetDetector().CompareTo("TPC") ) {
466       
467       // -- Process TPC Clusters
468       if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
469         cout <<"Processing clusters"<<endl;
470         if(!gTPCClusters){
471           gTPCClusters = new TEvePointSet("TPC Clusters");
472           gTPCClusters->SetMainColor(kRed);
473           gTPCClusters->SetMarkerStyle((Style_t)kFullDotSmall);
474           gEve->AddElement(gTPCClusters);
475         } 
476         iResult = processTPCClusters( block , gTPCClusters);
477       }
478     } // else if ( ! block->GetDetector().CompareTo("TPC") ) {
479
480
481     // ++ SPD  BLOCK
482     // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
483     else if ( ! block->GetDetector().CompareTo("ISPD") ){
484       if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) {
485         //processISPDClusters( block );
486       } 
487     } // else if ( ! block->GetDetector().CompareTo("ISPD") ){
488
489
490     // -- ITS
491    else if ( ! block->GetDetector().CompareTo("ITS") ){
492       if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
493         iResult = 0;
494         //iResult = processITSHist( block );
495       } 
496     } // else if ( ! block->GetDetector().CompareTo("ISPD") ){
497
498
499     // ---------------------------------------------------------
500   } // while ((block = (AliHLTHOMERBlockDesc*)next())) {
501
502
503   if ( gTPCClusters ) gTPCClusters->ResetBBox();
504   if ( gPHOSClusters ) gPHOSClusters->ResetBBox();
505   if ( gSPDClusters ) gSPDClusters->ResetBBox();
506   if ( gTPCTrack ) gTPCTrack->ElementChanged();
507
508   
509 #if 0
510   TTimeStamp ts(esd->GetTimeStamp());
511   TString win_title("Eve Main Window -- Timestamp: ");
512   win_title += ts.AsString("s");
513   win_title += "; Event # in ESD file: ";
514   win_title += esd->GetEventNumberInFile();
515   gEve->GetBrowser()->SetWindowName(win_title);
516 #endif
517
518   // -- Set Projections
519   // --------------------------------------------
520   TEveElement* top = gEve->GetCurrentEvent();
521
522   // XXX Primary vertex ... to be retrieved from the ESD
523   // Double_t x[3] = { 0, 0, 0 };
524
525
526
527   TEveElement* top = gEve->GetCurrentEvent();
528
529   if (gRPhiMgr && top)
530   {
531     gRPhiEventScene->DestroyElements();
532     if (gCenterProjectionsAtPrimaryVertex)
533       gRPhiMgr->SetCenter(x[0], x[1], x[2]);
534     gRPhiMgr->ImportElements(top, gRPhiEventScene);
535   }
536   if (gRhoZMgr && top)
537   {
538     gRhoZEventScene->DestroyElements();
539     if (gCenterProjectionsAtPrimaryVertex)
540       gRhoZMgr->SetCenter(x[0], x[1], x[2]);
541     gRhoZMgr->ImportElements(top, gRhoZEventScene);
542   }
543
544
545   // --------------------------------------------
546   //  if (enableReDraw) {
547     gEve->Redraw3D(0,1); // (0, 1)
548     //gEve->DoRedraw3D(); // (0, 1)
549     //}
550   gEve->EnableRedraw(); 
551
552   return iResult;
553 }
554
555 // -----------------------------------------------------------------
556 void loopEvent() {
557   eventTimer.SetCommand("nextEvent()");
558   eventTimer.Start(6000);
559 }
560
561 // -----------------------------------------------------------------
562 void stopLoopEvent() {
563   eventTimer.Stop();
564 }
565
566 // -----------------------------------------------------------------
567 Int_t processITSHist(AliHLTHOMERBlockDesc* block) {
568   TH2F* hist = block->GetTObject();
569   
570   gCanvas->cd();
571   hist->Draw();
572   return 0;
573 }
574 // -----------------------------------------------------------------
575 Int_t processHLTRDLST(AliHLTHOMERBlockDesc* block) {
576
577   return 0;
578 }
579
580 // -----------------------------------------------------------------
581 Int_t processISPDClusters(AliHLTHOMERBlockDesc* block) {
582   cout<<"ISPD dump:"<<endl;
583   TObject ob = block->GetTObject();
584   ob.Dump();
585   
586   return 0;
587 }
588
589 // -----------------------------------------------------------------
590 Int_t processROOTTOBJ(AliHLTHOMERBlockDesc* block, TEveText* et) {
591   
592   // -- AliHLTGlobalTriggerDecision
593   if ( ! block->GetClassName().CompareTo("AliHLTGlobalTriggerDecision") ) {
594
595     AliHLTGlobalTriggerDecision *trig = dynamic_cast<AliHLTGlobalTriggerDecision*> block->GetTObject();
596     trig->Print(); 
597     
598     et->SetText("balle");;
599
600    //    TEveText* tt = new TEveText("Trigger: Class is known ;-) ");
601     //gEve->AddElement(tt);
602
603   }
604   else {
605     printf(" Unknown root object %s",block->GetClassName().Data() );
606   }
607
608   return 0;
609 }
610
611 // -----------------------------------------------------------------
612 Int_t processEsdTracks( AliHLTHOMERBlockDesc* block, TEveTrackList* cont ) {
613
614   AliESDEvent* esd = (AliESDEvent *) (block->GetTObject());
615   esd->GetStdContent();
616
617   esd_track_propagator_setup(cont->GetPropagator(),0.1*esd->GetMagneticField(), 520);
618
619   printf( "Number of ESD Tracks : %d \n", esd->GetNumberOfTracks());
620
621   for (Int_t iter = 0; iter < esd->GetNumberOfTracks(); ++iter) {
622     AliEveTrack* track = esd_make_track(esd->GetTrack(iter), cont);
623     cont->AddElement(track);
624   }
625   
626   cont->SetTitle(Form("N=%d", esd->GetNumberOfTracks()) );
627   cont->MakeTracks();
628
629   return 0;
630 }
631
632
633
634  Int_t processTPCClusters(AliHLTHOMERBlockDesc* block, TEvePointSet *  cont) {
635   
636    Int_t iResult = 0;
637   
638   Int_t   slice = block->GetSubDetector();
639   Int_t   patch = block->GetSubSubDetector();
640   Float_t phi   = ( slice + 0.5 ) * TMath::Pi() / 9.0;  
641   Float_t cos   = TMath::Cos( phi );
642   Float_t sin   = TMath::Sin( phi );
643     
644   AliHLTTPCClusterData *cd = (AliHLTTPCClusterData*) block->GetData();
645   UChar_t *data            = (UChar_t*) cd->fSpacePoints;
646
647   if ( cd->fSpacePointCnt == 0 ) {
648     printf ("No Clusters found in sector %d patch %d.\n", slice, patch );
649     iResult = -1;
650   } 
651   else {
652     
653     for (Int_t ii = 0; ii < cd->fSpacePointCnt; ++ii, data += sizeof(AliHLTTPCSpacePointData)) {
654       AliHLTTPCSpacePointData *sp = (AliHLTTPCSpacePointData *) data;
655       
656       cont->SetNextPoint(cos*sp->fX - sin*sp->fY, sin*sp->fX + cos*sp->fY, sp->fZ);
657     }
658   }
659   
660   return iResult;
661 }
662