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