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