Restore the changes from rev. 34587
[u/mrichter/AliRoot.git] / EVE / hlt-macros / onlineDisplay.C
CommitLineData
9e78371d 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
1d8ae8b6 11#if !defined(__CINT__) || defined(__MAKECINT__)
12
13//***************** ROOT ******************************************
14#include "TTimer.h"
15#include "TRandom.h"
16#include "TVirtualPad.h"
17#include "TGLViewer.h"
18#include "TThread.h"
19#include "TGFileBrowser.h"
20#include "TStyle.h"
21#include "TList.h"
22#include "TDirectory.h"
23#include "TFile.h"
24#include "TH2.h"
25#include "TCanvas.h"
26#include "TColor.h"
27
28//******************* ROOT/EVE ****************************************
29#include "TEveManager.h"
30#include "TEvePointSet.h"
31#include "TEveTrack.h"
32#include "TEveVSDStructs.h"
33#include "TEveTrackPropagator.h"
34#include "TEveScene.h"
35#include "TEveElement.h"
36#include "TEveUtil.h"
37#include "TEveEventManager.h"
38#include "TEveProjectionAxes.h"
39#include "TEveWindowManager.h"
40#include "TEveViewer.h"
41#include "TEveText.h"
42#include "TEveProjectionManager.h"
43#include "TEveGeoShape.h"
44
45//******************** AliRoot ***************************************
46#include "AliESDEvent.h"
47#include "AliCDBManager.h"
48#include "AliRawReaderMemory.h"
49#include "AliTPCRawStream.h"
50#include "AliGeomManager.h"
51//********************* AliRoot/EVE **************************************
52#include "AliHLTHOMERManager.h"
53#include "AliEveHOMERManager.h"
54#include "AliEveTPCLoader.h"
55#include "AliEveTPCData.h"
56#include "AliEveITSDigitsInfo.h"
57#include "AliEveITSModule.h"
58#include "AliEveMacroExecutor.h"
59#include "AliEveMacro.h"
60#include "AliEveTrack.h"
61//***********************AliRoot/HLT ************************************
62#include "AliHLTHOMERBlockDesc.h"
63#include "AliHLTHOMERReader.h"
64
65#include <AliHLTMUONUtils.h>
66#include "AliHLTMUONDataBlockReader.h"
67#include "AliHLTTriggerDecision.h"
68
69#include "AliHLTGlobalTriggerDecision.h"
70
71#include "tracking-ca/AliHLTTPCCATrackParam.h"
72
73//*********************AliRoot/MUON **************************************
74#include "AliMUONCalibrationData.h"
75#include "AliMUONVCalibParam.h"
76#include "AliMUONGeometryTransformer.h"
77#include "AliMUONGeometryDetElement.h"
78
79#include "AliMpCDB.h"
80#include "AliMpDDLStore.h"
81#include "AliMpDetElement.h"
82#include "AliMpDEIterator.h"
83#include "AliMpVSegmentation.h"
84#include "AliMpSegmentation.h"
85#include "AliMpTriggerCrate.h"
86#include "AliMpLocalBoard.h"
87//***********************************************************
88
89#include "hlt_structs.C"
90#include "hlt_alieve_init.C"
91#include "geom_gentle_hlt.C"
92#include "alice-macros/esd_tracks.C"
93
94//**************************AliRoot TRD *********************
95#include "AliHLTTRDCluster.h"
96#include "AliTRDcluster.h"
97
98
99
100//***********************************************************
f1fefc07 101#endif
9e78371d 102
f1fefc07 103class TEveTrackList;
9e78371d 104class TEveProjectionManager;
105class TEveGeoShape;
106class TEveUtil;
107class AliEveMacroExecutor;
108class TEveScene;
109class TEveElement;
110class TEveText;
111class AliHLTTriggerDecision;
112class TEvePointSet;
1d8ae8b6 113class TEvePointSetArray;
f1fefc07 114class AliHLTHOMERBlockDesc;
9e78371d 115
f1fefc07 116class TEveViewer;
9e78371d 117// -----------------------------------------------------------------
118// -- Geometry / Scenes --
119// -----------------------------------------------------------------
120
f1fefc07 121TEveGeoShape *gGeomGentle = 0;
122TEveGeoShape *gGeomGentleRPhi = 0;
123TEveGeoShape *gGeomGentleRhoZ = 0;
124TEveGeoShape *gGeomGentleTRD = 0;
125TEveGeoShape *gGeomGentleMUON = 0;
126
127TEveScene *gRPhiGeomScene = 0;
128TEveScene *gRhoZGeomScene = 0;
129TEveScene *gRPhiEventScene = 0;
130TEveScene *gRhoZEventScene = 0;
131
9e78371d 132TEveProjectionManager *gRPhiMgr = 0;
133TEveProjectionManager *gRhoZMgr = 0;
134
f1fefc07 135TEveViewer *g3DView = 0;
136TEveViewer *gRPhiView = 0;
137TEveViewer *gRhoZView = 0;
138
9e78371d 139// -----------------------------------------------------------------
140// -- Geometry / Scenes Parameters --
141// -----------------------------------------------------------------
142
143// -- Parameters to show different geometries
144Bool_t gShowMUON = kTRUE;
145Bool_t gShowMUONRPhi = kFALSE;
146Bool_t gShowMUONRhoZ = kTRUE;
f1fefc07 147Bool_t gShowTRD = kFALSE;
148
149Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
9e78371d 150
1d8ae8b6 151Int_t gHistoCount = 0;
152
9e78371d 153// -----------------------------------------------------------------
154// -- Members --
155// -----------------------------------------------------------------
156
157// -- Timer for automatic event loop
158TTimer eventTimer;
1d8ae8b6 159TTimer eventTimerFast;
9e78371d 160
161// -- HOMERManager
162AliEveHOMERManager* gHomerManager = 0;
163
164// -- Cluster members
165TEvePointSet* gPHOSClusters = 0;
166TEvePointSet* gTPCClusters = 0;
1d8ae8b6 167TEvePointSet* gTRDClusters = 0;
168TEvePointSetArray* gTRDColClusters = 0;
9e78371d 169TEvePointSet* gSPDClusters = 0;
1d8ae8b6 170TEvePointSet* gMUONClusters = 0;
9e78371d 171
f1fefc07 172// -- Text output members
173TEveText* gHLTText = 0;
174
9e78371d 175// -- Tracks members
176TEveTrackList* gTPCTrack = 0;
177
1d8ae8b6 178// -- Canvas for histograms
179TCanvas* gTRDCanvas = 0;
180TCanvas* gCanvas = 0;
181
182// -- TRD event counter
183Int_t gTRDEvents = 0;
184Int_t gTRDBins = 12;
185
186// --- Flag if eventloop is running
187Bool_t gEventLoopStarted = kFALSE;
f1fefc07 188
9e78371d 189// -----------------------------------------------------------------
190// -- Methods --
191// -----------------------------------------------------------------
192
1d8ae8b6 193Int_t initializeEveViewer( Bool_t TPCMode, Bool_t MUONMode, Bool_t TRDMode );
9e78371d 194
1d8ae8b6 195void nextEvent();
5de5a293 196
ea9a0e13 197Int_t processEvent();
9e78371d 198
f1fefc07 199//Int_t processPHOSClusters( AliHLTHOMERBlockDesc* block);
9e78371d 200
201Int_t processEsdTracks( AliHLTHOMERBlockDesc* block, TEveTrackList* cont );
202
203Int_t processHLTRDLST( AliHLTHOMERBlockDesc* block );
204
1d8ae8b6 205Int_t processROOTTOBJ( AliHLTHOMERBlockDesc* block, TEveText* text );
206
207Int_t processTPCClusters (AliHLTHOMERBlockDesc * block, TEvePointSet *cont );
208
209Int_t processTRDClusters (AliHLTHOMERBlockDesc * block, TEvePointSet * cont, TEvePointSetArray *contCol);
210
211Int_t processTRDHistograms (AliHLTHOMERBlockDesc * block, TCanvas * canvas );
212
213Int_t processMUONClusters( AliHLTHOMERBlockDesc* block);
9e78371d 214
9e78371d 215
216// #################################################################
217// #################################################################
218// #################################################################
219
220// -----------------------------------------------------------------
1d8ae8b6 221void onlineDisplay(Bool_t TPCMode = kTRUE, Bool_t MUONMode = kFALSE, Bool_t TRDMode = kFALSE) {
f1fefc07 222
9e78371d 223 // -- Loading Geometry
224 // ---------------------
225 Int_t run = 67179;
226 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
227 AliCDBManager::Instance()->SetRun(run);
228 AliGeomManager::LoadGeometry();
229
230 // -- Create new hM object
231 // -------------------------
232 gHomerManager = new AliEveHOMERManager();
233 gHomerManager->SetRetryCount(50,5);
234
235 Int_t iResult = gHomerManager->Initialize();
236 if (iResult) {
237 printf("Error Initializing AliHLTHOMERManager, quitting");
238 return;
239 }
240
241 // -- Add hM to EveTree
242 // ----------------------
243 gEve->AddToListTree(gHomerManager, kTRUE);
244
245 // -- Create SourceList
246 // ----------------------
247 iResult = gHomerManager->CreateEveSourcesListLoop();
248 if (iResult) {
249 printf ("Couldn't find active services. returning\n");
250 return;
251 }
252
253 // -- Initialize pointsets and add macros
254 // ----------------------------------------
1d8ae8b6 255 //TEveUtil::LoadMacro("hlt_alieve_init.C");
256 //hlt_alieve_init(".", -1);
9e78371d 257
258 // -- Initialize Eve
259 // -------------------
1d8ae8b6 260 initializeEveViewer( TPCMode, MUONMode, TRDMode);
9e78371d 261
262 // -- Finalize Eve
263 // -----------------
264 gSystem->ProcessEvents();
265 gEve->Redraw3D(kTRUE);
f1fefc07 266
1d8ae8b6 267 if ( TPCMode ) {
268 gHomerManager->ConnectEVEtoHOMER("TPC" );
269 } else if ( MUONMode ) {
270 gHomerManager->ConnectEVEtoHOMER("MUON");
271 } else if( TRDMode ) {
272 gHomerManager->ConnectEVEtoHOMER("TRD");
273 } else {
274 cout<<" No detectors selected, nothing will be displayed"<<endl;
275 }
9e78371d 276}
277
1d8ae8b6 278// -------------------------------------------------------------------------
279Int_t initializeEveViewer( Bool_t TPCMode, Bool_t MUONMode, Bool_t TRDMode) {
9e78371d 280
281 //==============================================================================
282 // Geometry, scenes, projections and viewers
283 //==============================================================================
284
f1fefc07 285 TEveBrowser *browser = gEve->GetBrowser();
286 browser->ShowCloseTab(kFALSE);
287
9e78371d 288 // -- Disable extra geometry
289 // ---------------------------
1d8ae8b6 290 if ( ! MUONMode ) {
9e78371d 291 gShowMUON = gShowMUONRPhi = gShowMUONRhoZ = kFALSE;
292 }
1d8ae8b6 293
294
9e78371d 295 // -- Load Geometry
296 // ------------------
297 TEveUtil::LoadMacro("geom_gentle_hlt.C");
f1fefc07 298 gGeomGentle = geom_gentle_hlt();
299 gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy();
300 gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy();
301 gGeomGentleTRD = geom_gentle_trd();
302
9e78371d 303 if (gShowMUON) {
f1fefc07 304 gGeomGentleMUON = geom_gentle_muon(kFALSE);
9e78371d 305 }
306
1d8ae8b6 307
308 // Scenes
f1fefc07 309
310 gRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry",
311 "Scene holding projected geometry for the RPhi view.");
312 gRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry",
313 "Scene holding projected geometry for the RhoZ view.");
314 gRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
315 "Scene holding projected geometry for the RPhi view.");
316 gRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
317 "Scene holding projected geometry for the RhoZ view.");
9e78371d 318
1d8ae8b6 319
320 // Projection managers
f1fefc07 321
9e78371d 322 gRPhiMgr = new TEveProjectionManager();
323 gRPhiMgr->SetProjection(TEveProjection::kPT_RPhi);
324 gEve->AddToListTree(gRPhiMgr, kFALSE);
325 {
326 TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
327 a->SetMainColor(kWhite);
328 a->SetTitle("R-Phi");
329 a->SetTitleSize(0.05);
330 a->SetTitleFont(102);
331 a->SetLabelSize(0.025);
332 a->SetLabelFont(102);
f1fefc07 333 gRPhiGeomScene->AddElement(a);
9e78371d 334 }
9e78371d 335 gRPhiMgr->SetCurrentDepth(-10);
f1fefc07 336 gRPhiMgr->ImportElements(gGeomGentleRPhi, gRPhiGeomScene);
9e78371d 337 gRPhiMgr->SetCurrentDepth(0);
1d8ae8b6 338 gRPhiMgr->ImportElements(gGeomGentleTRD, gRPhiGeomScene);
f1fefc07 339 if (gShowMUONRPhi) gRPhiMgr->ImportElements(gGeomGentleMUON, gRPhiGeomScene);
9e78371d 340
9e78371d 341 gRhoZMgr = new TEveProjectionManager();
342 gRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ);
343 gEve->AddToListTree(gRhoZMgr, kFALSE);
344 {
345 TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
346 a->SetMainColor(kWhite);
347 a->SetTitle("Rho-Z");
348 a->SetTitleSize(0.05);
349 a->SetTitleFont(102);
350 a->SetLabelSize(0.025);
351 a->SetLabelFont(102);
f1fefc07 352 gRhoZGeomScene->AddElement(a);
9e78371d 353 }
354 gRhoZMgr->SetCurrentDepth(-10);
f1fefc07 355 gRhoZMgr->ImportElements(gGeomGentleRhoZ, gRhoZGeomScene);
9e78371d 356 gRhoZMgr->SetCurrentDepth(0);
f1fefc07 357 if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD, gRhoZGeomScene);
358 if (gShowMUONRhoZ) gRhoZMgr->ImportElements(gGeomGentleMUON, gRhoZGeomScene);
9e78371d 359
1d8ae8b6 360 // Viewers
361
9e78371d 362
f1fefc07 363 TEveWindowSlot *slot = 0;
364 TEveWindowPack *pack = 0;
365
366 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
367 pack = slot->MakePack();
9e78371d 368 pack->SetElementName("Multi View");
369 pack->SetHorizontal();
370 pack->SetShowTitleBar(kFALSE);
371 pack->NewSlot()->MakeCurrent();
f1fefc07 372 g3DView = gEve->SpawnNewViewer("3D View", "");
373 g3DView->AddScene(gEve->GetGlobalScene());
374 g3DView->AddScene(gEve->GetEventScene());
375
9e78371d 376 pack = pack->NewSlot()->MakePack();
377 pack->SetShowTitleBar(kFALSE);
378 pack->NewSlot()->MakeCurrent();
f1fefc07 379 gRPhiView = gEve->SpawnNewViewer("RPhi View", "");
380 gRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
381 gRPhiView->AddScene(gRPhiGeomScene);
382 gRPhiView->AddScene(gRPhiEventScene);
9e78371d 383
384 pack->NewSlot()->MakeCurrent();
f1fefc07 385 gRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
386 gRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
387 gRhoZView->AddScene(gRhoZGeomScene);
388 gRhoZView->AddScene(gRhoZEventScene);
389
1d8ae8b6 390
391 // List of Viewers
9e78371d 392
393 TEveViewerList *viewerlist = new TEveViewerList();
394 viewerlist->AddElement(gEve->GetDefaultViewer());
395
f1fefc07 396 viewerlist->AddElement(g3DView);
397 viewerlist->AddElement(gRhoZView);
398 viewerlist->AddElement(gRPhiView);
9e78371d 399 viewerlist->SwitchColorSet();
400
401 //==============================================================================
402 // Macros / QA histograms
403 //==============================================================================
404
405 // -- Registration of per-event macros
406 // -------------------------------------
407
408 AliEveMacroExecutor *exec = new AliEveMacroExecutor();
409#if 0
410 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track", "kine_tracks.C", "kine_tracks", "", kFALSE));
411
412 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit ITS", "its_hits.C", "its_hits", "", kFALSE));
413 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit TPC", "tpc_hits.C", "tpc_hits", "", kFALSE));
414 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit T0", "t0_hits.C", "t0_hits", "", kFALSE));
415 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit FMD", "fmd_hits.C", "fmd_hits", "", kFALSE));
416
417 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD", "fmd_digits.C", "fmd_digits", "", kFALSE));
418
419 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw", "", kFALSE));
420 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0", "t0_raw.C", "t0_raw", "", kFALSE));
421 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw", "", kFALSE));
422 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE));
423 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE));
424
425 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE));
426 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE));
427 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE));
428 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE));
429 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE));
430 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE));
431 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE));
432 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE));
433 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE));
434#endif
435 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_onfly"));
436 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_offline"));
437 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0.C", "esd_V0"));
438 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C", "esd_cascade_points"));
439 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C", "esd_cascade"));
440 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink_points.C", "esd_kink_points"));
441 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink.C", "esd_kink"));
442
443 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE));
444 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE));
445 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
446
447 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE));
448
449 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC", "esd_zdc.C", "esd_zdc", "", kFALSE));
450#if 0
451 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus", "clusters.C+", "clusters", "", kFALSE));
452 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C+", "its_clusters"));
453 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C+", "tpc_clusters"));
454 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C+", "trd_clusters"));
455 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C+", "tof_clusters"));
456
457 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "vplot_tpc.C+", "vplot_tpc", "", kFALSE));
458
459 exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA HF", "aod_HF.C", "aod_HF", "", kFALSE));
460 exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA Jets", "jetplane.C", "jetplane", "", kFALSE));
461
462 // -- QA Viewer
463 // --------------
1d8ae8b6 464# endif
9e78371d 465
1d8ae8b6 466 // Histograms
467if(TRDMode){
9e78371d 468 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
469 slot->StartEmbedding();
f1fefc07 470
1d8ae8b6 471 gTRDCanvas = new TCanvas("c2","c2", 600, 400);
472 gTRDCanvas->Divide(3,2);
473 slot->StopEmbedding("TRD histograms");
474}
475 else if(TPCMode){
476 ;
477 }
f1fefc07 478
9e78371d 479 //==============================================================================
480 // Additional GUI components
481 //==============================================================================
482
483 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
5de5a293 484 TEveWindowTab *storeTab = slot->MakeTab();
1d8ae8b6 485 storeTab->SetElementNameTitle("WindowStore",
9e78371d 486 "Undocked windows whose previous container is not known\n"
487 "are placed here when the main-frame is closed.");
5de5a293 488 gEve->GetWindowManager()->SetDefaultContainer(storeTab);
9e78371d 489
490 return 0;
491}
492
5de5a293 493// -----------------------------------------------------------------
494void nextEvent() {
495
496 if ( gHomerManager->NextEvent() )
497 return;
498
499 processEvent();
500}
501
9e78371d 502// -----------------------------------------------------------------
ea9a0e13 503Int_t processEvent() {
9e78371d 504
505 Int_t iResult = 0;
506
507 gStyle->SetPalette(1, 0);
508 gEve->DisableRedraw();
509
9e78371d 510 // -- Reset
511 // ----------
512 if ( gTPCClusters ) gTPCClusters->Reset();
1d8ae8b6 513 if ( gMUONClusters ) gMUONClusters->Reset();
514 if ( gTRDClusters ) gTRDClusters->Reset();
515
516 if ( gTRDColClusters ) {
517 for (Int_t ii = 1; ii <= gTRDBins; ++ii)
518 gTRDColClusters->GetBin(ii)->Reset();
519 }
520
521
522 if ( gTRDCanvas ) gTRDCanvas->Clear();
9e78371d 523 if ( gPHOSClusters ) gPHOSClusters->Reset();
524 if ( gTPCTrack ) gTPCTrack->DestroyElements();
525
1d8ae8b6 526 if ( gTRDCanvas ) {
527 gTRDCanvas->Clear();
528 gTRDCanvas->Divide(3,2);
529 }
530 gHistoCount = 0;
531
532 if ( gHomerManager->GetBlockList() == NULL) {
ea9a0e13 533 printf ("No BlockList ... ");
534 return -1;
535 }
9e78371d 536 if (gHomerManager->GetBlockList()->IsEmpty() ) {
537 printf ("No Blocks in list ... ");
ea9a0e13 538 return -2;
9e78371d 539 }
540
541 TIter next(gHomerManager->GetBlockList());
542 AliHLTHOMERBlockDesc* block = 0;
543
544 // -- Iterate over blocks in the block list
545 // ------------------------------------------
546 while ((block = (AliHLTHOMERBlockDesc*)next())) {
ea9a0e13 547
548#if 0
549 printf( "------------------- xxxxxxxxxxxxxxx ----------------------\n");
550 printf( "Detector : %s\n", block->GetDetector().Data() );
551 printf( "Datatype : %s\n", block->GetDataType().Data() );
552 if (block->IsTObject() )
553 printf( "Is TObject of class: %s\n", block->GetClassName().Data() );
554 printf( "------------------- xxxxxxxxxxxxxxx ----------------------\n");
555#endif
9e78371d 556
557 // -- CHECK SOURCE
558 // -----------------------------------------------------
559
560 // ++ HLT BLOCK
561 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
562 if ( ! block->GetDetector().CompareTo("HLT") ) {
563
564 // -- ESDTREE
565 if ( ! block->GetDataType().CompareTo("ALIESDV0") ) {
9e78371d 566 if(!gTPCTrack){
567 gTPCTrack = new TEveTrackList("ESD Tracks");
568 gTPCTrack->SetMainColor(6);
569 gEve->AddElement(gTPCTrack);
570 }
9e78371d 571 iResult = processEsdTracks(block, gTPCTrack);
572 }
f1fefc07 573
9e78371d 574 // -- Process ROOTObj
575 else if ( ! block->GetDataType().CompareTo("ROOTTOBJ") ) {
f1fefc07 576 if(!gHLTText){
577 gHLTText = new TEveText();
578 //gHLTText->BBoxZero(5, -5, -5, 0);
579 //gHLTText->SetExtrude(25);
580 //gHLTText->AssertBBoxExtents(25,25,25);
581 gEve->AddElement(gHLTText);
582 }
583 processROOTTOBJ( block, gHLTText );
9e78371d 584 }
585
586 // -- Process HLT RDLST
587 else if ( ! block->GetDataType().CompareTo("HLTRDLST") ) {
f1fefc07 588 ;
589 //cout<<"Readlist"<<endl;
590 //processHLTRDLST( block );
591 }
9e78371d 592 } // if ( ! block->GetDetector().CompareTo("HLT") ) {
593
594 // ++ TPC BLOCK
595 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
596 else if ( ! block->GetDetector().CompareTo("TPC") ) {
597
f1fefc07 598 // -- Process TPC Clusters
599 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
f1fefc07 600 if(!gTPCClusters){
601 gTPCClusters = new TEvePointSet("TPC Clusters");
602 gTPCClusters->SetMainColor(kRed);
603 gTPCClusters->SetMarkerStyle((Style_t)kFullDotSmall);
604 gEve->AddElement(gTPCClusters);
605 }
606 iResult = processTPCClusters( block , gTPCClusters);
9e78371d 607 }
f1fefc07 608 } // else if ( ! block->GetDetector().CompareTo("TPC") ) {
609
1d8ae8b6 610 // ++ TRD BLOCK
611 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
612 else if ( ! block->GetDetector().CompareTo("TRD") ) {
613
614 // -- Process TRD Clusters
615 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
616
617 if(!gTRDClusters){
618 gTRDClusters = new TEvePointSet("TRD Clusters");
619 gTRDClusters->SetMainColor(kBlue);
620 gTRDClusters->SetMarkerStyle((Style_t)kFullDotSmall);
621 // gEve->AddElement(gTRDClusters);
622 }
623 // gTRDClusters->ElementChanged();
624
625 if(!gTRDColClusters){
626
627 gTRDColClusters = new TEvePointSetArray("TRD Clusters Colorized");
628 gTRDColClusters->SetMainColor(kRed);
629 gTRDColClusters->SetMarkerStyle(4); // antialiased circle
630 // gTRDColClusters->SetMarkerStyle((Style_t)kFullDotSmall);
631 gTRDColClusters->SetMarkerSize(0.8);
632 gTRDColClusters->InitBins("Cluster Charge", gTRDBins, 0., gTRDBins*100.);
633
634 TColor::SetPalette(1, 0); // Spectrum palette
635 const Int_t nCol = TColor::GetNumberOfColors();
636 for (Int_t ii = 0; ii < gTRDBins+1; ++ii)
637 gTRDColClusters->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (gTRDBins+2)));
638
639 gEve->AddElement(gTRDColClusters);
640 }
641
642 iResult = processTRDClusters( block, gTRDClusters, gTRDColClusters );
643
644 // gTRDClusters->ElementChanged();
645 gTRDColClusters->ElementChanged();
646 }
647
648 // -- Process TRD Histograms
649 else if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
650 iResult = processTRDHistograms( block, gTRDCanvas );
651 }
652
653 } // else if ( ! block->GetDetector().CompareTo("TRD") ) {
654
655
656
657 // ++ MUON BLOCK
658 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
659
660 else if ( ! block->GetDetector().CompareTo("MUON") ) {
661 if (gShowMUON) {
662 // -- MUON
663 //-----------------------------------------------------
664 if ( (block->GetDataType().CompareTo("RECHITS") == 0) || (block->GetDataType().CompareTo("TRIGRECS") == 0) ) {
665
666 if ( !gMUONClusters ) {
667 gMUONClusters = new TEvePointSet("MUON RecHits");
668 gMUONClusters->SetMainColor(kBlue);
669 gMUONClusters->SetMarkerStyle(20);
670 gEve->AddElement(gMUONClusters);
671 }
672
673 // ** Process Clusters
674 processMUONClusters( block );
675
676 gMUONClusters->ElementChanged();
677
678 }//MUON Clusters
679 }
680 }
681
682
9e78371d 683
f1fefc07 684 // ++ SPD BLOCK
9e78371d 685 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
686 else if ( ! block->GetDetector().CompareTo("ISPD") ){
687 if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) {
688 //processISPDClusters( block );
689 }
690 } // else if ( ! block->GetDetector().CompareTo("ISPD") ){
691
f1fefc07 692
693 // -- ITS
694 else if ( ! block->GetDetector().CompareTo("ITS") ){
695 if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
696 iResult = 0;
697 //iResult = processITSHist( block );
698 }
699 } // else if ( ! block->GetDetector().CompareTo("ISPD") ){
700
701
702 // ---------------------------------------------------------
9e78371d 703 } // while ((block = (AliHLTHOMERBlockDesc*)next())) {
704
f1fefc07 705
9e78371d 706 if ( gTPCClusters ) gTPCClusters->ResetBBox();
1d8ae8b6 707 if ( gTRDClusters ) gTRDClusters->ResetBBox();
708 // if ( gTRDColClusters ) gTRDColClusters->ResetBBox();
9e78371d 709 if ( gPHOSClusters ) gPHOSClusters->ResetBBox();
1d8ae8b6 710 if ( gMUONClusters ) gMUONClusters->ResetBBox();
9e78371d 711 if ( gSPDClusters ) gSPDClusters->ResetBBox();
712 if ( gTPCTrack ) gTPCTrack->ElementChanged();
1d8ae8b6 713 if ( gTRDCanvas) gTRDCanvas->Update();
ea9a0e13 714
715 // -- Set EventID in Window Title
716 // --------------------------------------------
ea9a0e13 717 TString winTitle("Eve Main Window -- Event ID : ");
718 winTitle += Form("0x%016X ", gHomerManager->GetEventID() );
719 gEve->GetBrowser()->SetWindowName(winTitle);
9e78371d 720
721 // -- Set Projections
722 // --------------------------------------------
9e78371d 723
724 // XXX Primary vertex ... to be retrieved from the ESD
1d8ae8b6 725 Double_t x[3] = { 0, 0, 0 };
f1fefc07 726
f1fefc07 727 TEveElement* top = gEve->GetCurrentEvent();
728
ea9a0e13 729 if (gRPhiMgr && top) {
f1fefc07 730 gRPhiEventScene->DestroyElements();
731 if (gCenterProjectionsAtPrimaryVertex)
732 gRPhiMgr->SetCenter(x[0], x[1], x[2]);
733 gRPhiMgr->ImportElements(top, gRPhiEventScene);
9e78371d 734 }
ea9a0e13 735
736 if (gRhoZMgr && top) {
f1fefc07 737 gRhoZEventScene->DestroyElements();
738 if (gCenterProjectionsAtPrimaryVertex)
739 gRhoZMgr->SetCenter(x[0], x[1], x[2]);
740 gRhoZMgr->ImportElements(top, gRhoZEventScene);
9e78371d 741 }
9e78371d 742
f1fefc07 743 // --------------------------------------------
ea9a0e13 744
745 gEve->Redraw3D(0,1); // (0, 1)
9e78371d 746 gEve->EnableRedraw();
f1fefc07 747
9e78371d 748 return iResult;
749}
750
5de5a293 751
9e78371d 752// -----------------------------------------------------------------
753void loopEvent() {
5de5a293 754
755 eventTimer.SetCommand("nextEvent()");
9e78371d 756 eventTimer.Start(6000);
757}
758
759// -----------------------------------------------------------------
760void stopLoopEvent() {
761 eventTimer.Stop();
762}
763
1d8ae8b6 764// -----------------------------------------------------------------
765void loopEventFast() {
766 eventTimerFast.SetCommand("nextEvent()");
767 eventTimerFast.Start(500);
768}
769
770// -----------------------------------------------------------------
771void stopLoopEventFast() {
772 eventTimerFast.Stop();
773}
774
775
f1fefc07 776// -----------------------------------------------------------------
777Int_t processITSHist(AliHLTHOMERBlockDesc* block) {
1d8ae8b6 778 TH2F* hist = dynamic_cast<TH2F*> (block->GetTObject());
f1fefc07 779
780 gCanvas->cd();
781 hist->Draw();
782 return 0;
783}
1d8ae8b6 784
9e78371d 785// -----------------------------------------------------------------
1d8ae8b6 786Int_t processHLTRDLST(AliHLTHOMERBlockDesc* /*block*/) {
9e78371d 787
788 return 0;
789}
790
791// -----------------------------------------------------------------
792Int_t processISPDClusters(AliHLTHOMERBlockDesc* block) {
793 cout<<"ISPD dump:"<<endl;
1d8ae8b6 794 TObject *ob = block->GetTObject();
795 ob->Dump();
f1fefc07 796
9e78371d 797 return 0;
798}
799
800// -----------------------------------------------------------------
1d8ae8b6 801Int_t processROOTTOBJ(AliHLTHOMERBlockDesc* block, TEveText* /*et*/) {
9e78371d 802
803 // -- AliHLTGlobalTriggerDecision
804 if ( ! block->GetClassName().CompareTo("AliHLTGlobalTriggerDecision") ) {
805
1d8ae8b6 806 AliHLTGlobalTriggerDecision *trig = dynamic_cast<AliHLTGlobalTriggerDecision*>( block->GetTObject());
5de5a293 807 trig->Print();
f1fefc07 808
ea9a0e13 809 // et->SetText("balle");;
9e78371d 810
ea9a0e13 811 // TEveText* tt = new TEveText("Trigger: Class is known ;-) ");
812 // gEve->AddElement(tt);
9e78371d 813
814 }
815 else {
816 printf(" Unknown root object %s",block->GetClassName().Data() );
817 }
818
819 return 0;
820}
821
822// -----------------------------------------------------------------
823Int_t processEsdTracks( AliHLTHOMERBlockDesc* block, TEveTrackList* cont ) {
824
825 AliESDEvent* esd = (AliESDEvent *) (block->GetTObject());
826 esd->GetStdContent();
827
828 esd_track_propagator_setup(cont->GetPropagator(),0.1*esd->GetMagneticField(), 520);
829
830 printf( "Number of ESD Tracks : %d \n", esd->GetNumberOfTracks());
831
832 for (Int_t iter = 0; iter < esd->GetNumberOfTracks(); ++iter) {
1d8ae8b6 833 AliEveTrack* track = dynamic_cast<AliEveTrack*>(esd_make_track(esd->GetTrack(iter), cont));
9e78371d 834 cont->AddElement(track);
835 }
836
837 cont->SetTitle(Form("N=%d", esd->GetNumberOfTracks()) );
838 cont->MakeTracks();
839
840 return 0;
841}
842
ea9a0e13 843// -----------------------------------------------------------------
844Int_t processTPCClusters(AliHLTHOMERBlockDesc* block, TEvePointSet* cont) {
f1fefc07 845
846 Int_t slice = block->GetSubDetector();
1d8ae8b6 847 //Int_t patch = block->GetSubSubDetector();
9e78371d 848 Float_t phi = ( slice + 0.5 ) * TMath::Pi() / 9.0;
849 Float_t cos = TMath::Cos( phi );
850 Float_t sin = TMath::Sin( phi );
ea9a0e13 851
852 AliHLTTPCClusterData *cd = reinterpret_cast<AliHLTTPCClusterData*> (block->GetData());
853 UChar_t *data = reinterpret_cast<UChar_t*> (cd->fSpacePoints);
9e78371d 854
ea9a0e13 855 if ( cd->fSpacePointCnt != 0 ) {
856 for (Int_t iter = 0; iter < cd->fSpacePointCnt; ++iter, data += sizeof(AliHLTTPCSpacePointData)) {
857 AliHLTTPCSpacePointData *sp = reinterpret_cast<AliHLTTPCSpacePointData*> (data);
9e78371d 858 cont->SetNextPoint(cos*sp->fX - sin*sp->fY, sin*sp->fX + cos*sp->fY, sp->fZ);
859 }
860 }
861
ea9a0e13 862 return 0;
9e78371d 863}
1d8ae8b6 864
865
866//****************************************************************************
867
868Int_t processMUONClusters(AliHLTHOMERBlockDesc* block) {
869
870 Int_t iResult = 0;
871
872 unsigned long size = block->GetSize();
873 int * buffer ;
874
875 buffer = (int *)block->GetData();
876// cout<<"block size : "<<size<<", buffer : "<<buffer<<", DataType : "<<block->GetDataType()<<endl;
877
878// // for(int idata=0;idata<int(size);idata++)
879// // printf("\tbuffer[%d] : %d\n",idata,buffer[idata]);
880
881
882
883 if(block->GetDataType().CompareTo("RECHITS") == 0){
884
885 AliHLTMUONRecHitsBlockReader trackblock((char*)buffer, size);
886 const AliHLTMUONRecHitStruct* hit = trackblock.GetArray();
887
888 for(AliHLTUInt32_t ientry = 0; ientry < trackblock.Nentries(); ientry++){
889// cout << setw(13) << left << hit->fX << setw(0);
890// cout << setw(13) << left << hit->fY << setw(0);
891// cout << hit->fZ << setw(0) << endl;
892 if(hit->fX!=0.0 && hit->fY!=0.0 && hit->fZ!=0.0)
893 gMUONClusters->SetNextPoint(hit->fX,hit->fY,hit->fZ);
894 hit++;
895
896 }// track hit loop
897 }
898
899 else{// if rechits
900 // if(!strcmp((BlockType(ULong64_t(reader->GetBlockDataType(i)))).Data(),"TRIGRECS")){
901
902 AliHLTMUONTriggerRecordsBlockReader trigblock(buffer, size);
903 const AliHLTMUONTriggerRecordStruct* trigrec = trigblock.GetArray();
904 for(AliHLTUInt32_t ientry = 0; ientry < trigblock.Nentries(); ientry++){
905
906 const AliHLTMUONRecHitStruct* hit = &trigrec->fHit[0];
907 for(AliHLTUInt32_t ch = 0; ch < 4; ch++)
908 {
909 cout << setw(10) << left << ch + 11 << setw(0);
910 cout << setw(13) << left << hit->fX << setw(0);
911 cout << setw(13) << left << hit->fY << setw(0);
912 cout << hit->fZ << setw(0) << endl;
913 if(hit->fX!=0.0 && hit->fY!=0.0 && hit->fZ!=0.0)
914 gMUONClusters->SetNextPoint(hit->fX,hit->fY,hit->fZ);
915 hit++;
916 }// trig chamber loop
917 trigrec++;
918 }//trig hit loop
919 }//else trigger
920
921 return iResult;
922}
923
9e78371d 924
1d8ae8b6 925// -----------------------------------------------------------------
926Int_t processTRDClusters(AliHLTHOMERBlockDesc* block, TEvePointSet *cont, TEvePointSetArray *contCol) {
927
928 Int_t iResult = 0;
929
930 Int_t sm = block->GetSubDetector();
931 if ( sm == 6 ) sm = 7;
932
933 Float_t phi = ( sm + 0.5 ) * TMath::Pi() / 9.0;
934 Float_t cos = TMath::Cos( phi );
935 Float_t sin = TMath::Sin( phi );
936
937 AliHLTTRDCluster* ptrData = reinterpret_cast<AliHLTTRDCluster*> (block->GetData());
938 UInt_t ptrSize = block->GetSize();
939
940 for (UInt_t size = 0; size+sizeof(AliHLTTRDCluster) <= ptrSize; size+=sizeof(AliHLTTRDCluster) ) {
941 AliHLTTRDCluster *cluster = reinterpret_cast<AliHLTTRDCluster*>(&(ptrData[size]));
942
943 AliTRDcluster *trdCluster = new AliTRDcluster;
944 cluster->ExportTRDCluster( trdCluster );
945
946 contCol->Fill(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
947 sin*trdCluster->GetX() + cos*trdCluster->GetY(),
948 trdCluster->GetZ(),
949 trdCluster->GetQ() );
950
951 cont->SetNextPoint(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
952 sin*trdCluster->GetX() + cos*trdCluster->GetY(), trdCluster->GetZ());
953
954 }
955
956 return iResult;
957}
958
959// -----------------------------------------------------------------
960Int_t processTRDHistograms(AliHLTHOMERBlockDesc* block, TCanvas * canvas) {
961
962 Int_t iResult = 0;
963
964 if ( ! block->GetClassName().CompareTo("TH1D")) {
965 TH1D* histo = reinterpret_cast<TH1D*>(block->GetTObject());
966 // list->Add(hist->Clone());
967
968 ++gHistoCount;
969
970 TVirtualPad* pad = canvas->cd(gHistoCount);
971 histo->Draw();
972 pad->SetGridy();
973 pad->SetGridx();
974
975 if ( ! strcmp(histo->GetName(), "nscls") ) {
976 gTRDEvents = static_cast<Int_t>(histo->GetEntries());
977 histo->GetXaxis()->SetRangeUser(0.,15.);
978 }
979
980 if ( ! strcmp(histo->GetName(),"sclsdist") ||
981 ! strcmp(histo->GetName(),"qClsCand") )
982 pad->SetLogy();
983 }
984 else if ( ! block->GetClassName().CompareTo("TH2F")) {
985 TH2F *hista = reinterpret_cast<TH2F*>(block->GetTObject());
986 // list->Add(hist->Clone());
987
988 ++gHistoCount;
989
990 TVirtualPad* pad = canvas->cd(gHistoCount);
991
992 if (gTRDEvents > 0)
993 hista->Scale(1./gTRDEvents);
994
995 hista->Draw("COLZ");
996 pad->SetLogz();
997 pad->SetGridy();
998 pad->SetGridx();
999 }
1000
1001 return iResult;
1002}
1003
1004// -----------------------------------------------------------------
1005void EventLoopFast() {
1006
1007 // Start/stop event loop
1008 if ( gEventLoopStarted ) {
1009 loopEventFast();
1010 gEventLoopStarted = kTRUE;
1011 }
1012 else {
1013 stopLoopEventFast();
1014 gEventLoopStarted = kFALSE;
1015 }
1016}
1017
1018
1019//****************************************************************************