Missing task added.
[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"
cfa641b1 48#include "TLine.h"
49#include "TEveStraightLineSet.h"
50#include "TGeoNode.h"
51#include "TGeoManager.h"
52#include "TGLOverlayButton.h"
ea48ba6e 53//****************** AliRoot ***************************************
1d8ae8b6 54#include "AliESDEvent.h"
55#include "AliCDBManager.h"
56#include "AliRawReaderMemory.h"
57#include "AliTPCRawStream.h"
58#include "AliGeomManager.h"
ea48ba6e 59
60//****************** AliRoot/EVE ***********************************
1d8ae8b6 61#include "AliHLTHOMERManager.h"
62#include "AliEveHOMERManager.h"
63#include "AliEveTPCLoader.h"
64#include "AliEveTPCData.h"
65#include "AliEveITSDigitsInfo.h"
66#include "AliEveITSModule.h"
67#include "AliEveMacroExecutor.h"
68#include "AliEveMacro.h"
69#include "AliEveTrack.h"
ea48ba6e 70
71//****************** AliRoot/HLT ***********************************
1d8ae8b6 72#include "AliHLTHOMERBlockDesc.h"
73#include "AliHLTHOMERReader.h"
c5e3aa8e 74#include "AliHLTMUONUtils.h"
1d8ae8b6 75#include "AliHLTMUONDataBlockReader.h"
76#include "AliHLTTriggerDecision.h"
1d8ae8b6 77#include "AliHLTGlobalTriggerDecision.h"
c5e3aa8e 78#include "AliHLTTPCCATrackParam.h"
cfa641b1 79
1d8ae8b6 80
ea48ba6e 81//****************** AliRoot/MUON **********************************
1d8ae8b6 82#include "AliMUONCalibrationData.h"
83#include "AliMUONVCalibParam.h"
84#include "AliMUONGeometryTransformer.h"
85#include "AliMUONGeometryDetElement.h"
cfa641b1 86#include "AliMUONConstants.h"
1d8ae8b6 87
88#include "AliMpCDB.h"
89#include "AliMpDDLStore.h"
90#include "AliMpDetElement.h"
91#include "AliMpDEIterator.h"
92#include "AliMpVSegmentation.h"
93#include "AliMpSegmentation.h"
94#include "AliMpTriggerCrate.h"
95#include "AliMpLocalBoard.h"
1d8ae8b6 96
c5e3aa8e 97// ***************** AliRoot/ITS **********************************
98#include "AliITSRecPoint.h"
99
ea48ba6e 100//****************** AliRoot/TRD ***********************************
101#include "AliHLTTRDCluster.h"
102#include "AliTRDcluster.h"
cfa641b1 103#include "AliTRDCalibraVdriftLinearFit.h"
ea48ba6e 104
c5e3aa8e 105
cfa641b1 106
107
108//#################### AliRoot EMCAL ###################################3
109#include "AliHLTCaloClusterDataStruct.h"
110#include "AliHLTCaloClusterReader.h"
111
112#include "HLT/CALO/AliHLTCaloChannelDataHeaderStruct.h"
113#include "HLT/CALO/AliHLTCaloChannelDataStruct.h"
114
115
116//#####################AliRoot PHOS ##################################
117#include "AliPHOSGeometry.h"
118#include "HLT/PHOS/AliHLTPHOSDigitDataStruct.h"
119#include "AliHLTPHOSChannelDataHeaderStruct.h"
120#include "AliHLTPHOSChannelDataStruct.h"
ea48ba6e 121//****************** Macros ****************************************
1d8ae8b6 122#include "hlt_structs.C"
123#include "hlt_alieve_init.C"
124#include "geom_gentle_hlt.C"
125#include "alice-macros/esd_tracks.C"
cfa641b1 126#include "hlt_esd_tracks.C"
127//#include "alieve_vizdb.C"
1d8ae8b6 128
f1fefc07 129#endif
9e78371d 130
f1fefc07 131class TEveTrackList;
9e78371d 132class TEveProjectionManager;
133class TEveGeoShape;
134class TEveUtil;
135class AliEveMacroExecutor;
136class TEveScene;
137class TEveElement;
138class TEveText;
139class AliHLTTriggerDecision;
140class TEvePointSet;
1d8ae8b6 141class TEvePointSetArray;
f1fefc07 142class AliHLTHOMERBlockDesc;
9e78371d 143
f1fefc07 144class TEveViewer;
ea48ba6e 145
cfa641b1 146//
147class caloCell : public TObject
148{
149
150public :
151
152 AliHLTPHOSChannelDataStruct phosStruct;
153
154private :
155 ClassDef(caloCell, 1);
156
157};
158
159
160
9e78371d 161// -----------------------------------------------------------------
162// -- Geometry / Scenes --
163// -----------------------------------------------------------------
164
f1fefc07 165TEveGeoShape *gGeomGentle = 0;
166TEveGeoShape *gGeomGentleRPhi = 0;
167TEveGeoShape *gGeomGentleRhoZ = 0;
168TEveGeoShape *gGeomGentleTRD = 0;
169TEveGeoShape *gGeomGentleMUON = 0;
170
171TEveScene *gRPhiGeomScene = 0;
172TEveScene *gRhoZGeomScene = 0;
173TEveScene *gRPhiEventScene = 0;
174TEveScene *gRhoZEventScene = 0;
175
9e78371d 176TEveProjectionManager *gRPhiMgr = 0;
177TEveProjectionManager *gRhoZMgr = 0;
178
f1fefc07 179TEveViewer *g3DView = 0;
180TEveViewer *gRPhiView = 0;
181TEveViewer *gRhoZView = 0;
182
9e78371d 183// -----------------------------------------------------------------
184// -- Geometry / Scenes Parameters --
185// -----------------------------------------------------------------
186
187// -- Parameters to show different geometries
188Bool_t gShowMUON = kTRUE;
189Bool_t gShowMUONRPhi = kFALSE;
190Bool_t gShowMUONRhoZ = kTRUE;
f1fefc07 191Bool_t gShowTRD = kFALSE;
192
193Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
9e78371d 194
195// -----------------------------------------------------------------
196// -- Members --
197// -----------------------------------------------------------------
198
199// -- Timer for automatic event loop
200TTimer eventTimer;
1d8ae8b6 201TTimer eventTimerFast;
9e78371d 202
203// -- HOMERManager
c5e3aa8e 204AliEveHOMERManager* gHomerManager = 0;
205
206// -- Geometry Manager
207TGeoManager* gGeoManager = 0;
208AliPHOSGeometry* gPHOSGeom = 0;
9e78371d 209
210// -- Cluster members
c5e3aa8e 211TEvePointSet* gSPDClusters = 0;
212TEvePointSet* gSSDClusters = 0;
213TEvePointSet* gSDDClusters = 0;
214TEvePointSet* gTRDClusters = 0;
215TEvePointSetArray* gTRDColClusters = 0;
216TEvePointSet* gTPCClusters = 0;
49993c6f 217TEvePointSet* gTPCTestClusters = 0;
c5e3aa8e 218TEvePointSetArray* gTPCColClusters = 0;
219TEveBoxSet* gPHOSBoxSet[5] = {0, 0, 0, 0, 0};
cfa641b1 220TEveBoxSet* gEMCALBoxSet[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
c5e3aa8e 221TEvePointSet* gMUONClusters = 0;
cfa641b1 222TEveStraightLineSet* gMUONTracks = 0;
9e78371d 223
f1fefc07 224// -- Text output members
c5e3aa8e 225TEveText* gHLTText = 0;
f1fefc07 226
9e78371d 227// -- Tracks members
c5e3aa8e 228TEveTrackList* gTPCTrack = 0;
9e78371d 229
1d8ae8b6 230// -- Canvas for histograms
c5e3aa8e 231TCanvas* gTRDCanvas = 0;
232TCanvas* gTPCCanvas = 0;
cfa641b1 233TCanvas* gTRDCalibCanvas=0;
234TCanvas * gTRDEORCanvas=0;
235TCanvas * gVertexCanvas = 0;
236
237// -- vertex ----
238Int_t gVertexHistoCount = 0;
1d8ae8b6 239
ea48ba6e 240// -- TRD --
c5e3aa8e 241Int_t gTRDHistoCount = 0;
242Int_t gTRDEvents = 0;
243Int_t gTRDBins = 12;
244
245// -- TPC --
246Int_t gTPCBins = 15;
247TH1F* gTPCCharge = 0;
248TH1F* gTPCQMax = 0;
249TH1F* gTPCQMaxOverCharge = 0;
ea48ba6e 250
c5e3aa8e 251// -- PHOS --
252TEveElementList* gPHOSElementList = 0;
1d8ae8b6 253
cfa641b1 254// -- EMCAL
255TEveElementList* gEMCALElementList = 0;
256TGeoNode *gEMCALNode = 0;
257
1d8ae8b6 258// --- Flag if eventloop is running
259Bool_t gEventLoopStarted = kFALSE;
f1fefc07 260
cfa641b1 261
262//Container for gGeoManager till it is broken
263TGeoManager *fGeoManager = 0;
9e78371d 264// -----------------------------------------------------------------
265// -- Methods --
266// -----------------------------------------------------------------
267
1d8ae8b6 268Int_t initializeEveViewer( Bool_t TPCMode, Bool_t MUONMode, Bool_t TRDMode );
9e78371d 269
1d8ae8b6 270void nextEvent();
5de5a293 271
ea9a0e13 272Int_t processEvent();
9e78371d 273
c5e3aa8e 274Int_t processPHOSClusters( AliHLTHOMERBlockDesc* block);
9e78371d 275
cfa641b1 276Int_t processEMCALClusters( AliHLTHOMERBlockDesc* block);
277
9e78371d 278Int_t processEsdTracks( AliHLTHOMERBlockDesc* block, TEveTrackList* cont );
279
280Int_t processHLTRDLST( AliHLTHOMERBlockDesc* block );
281
1d8ae8b6 282Int_t processROOTTOBJ( AliHLTHOMERBlockDesc* block, TEveText* text );
283
49993c6f 284Int_t processTPCClusters( AliHLTHOMERBlockDesc * block, TEvePointSet *cont, TEvePointSetArray *contCol = NULL );
1d8ae8b6 285
c5e3aa8e 286Int_t processTRDClusters( AliHLTHOMERBlockDesc * block, TEvePointSet *cont, TEvePointSetArray *contCol);
1d8ae8b6 287
288Int_t processTRDHistograms (AliHLTHOMERBlockDesc * block, TCanvas * canvas );
289
cfa641b1 290Int_t processVertexHistograms (AliHLTHOMERBlockDesc * block, TCanvas * canvas );
291
292Int_t processTRDCalibHistograms(AliHLTHOMERBlockDesc *block, TCanvas *canvas);
293
1d8ae8b6 294Int_t processMUONClusters( AliHLTHOMERBlockDesc* block);
9e78371d 295
cfa641b1 296Int_t processMUONTracks( AliHLTHOMERBlockDesc* block);
297
c5e3aa8e 298Int_t processITSClusters(AliHLTHOMERBlockDesc* block, TEvePointSet* cont);
299
300Int_t processITSHist(AliHLTHOMERBlockDesc* block);
9e78371d 301
cfa641b1 302void writeToFile();
303
304
9e78371d 305// #################################################################
306// #################################################################
307// #################################################################
308
309// -----------------------------------------------------------------
1d8ae8b6 310void onlineDisplay(Bool_t TPCMode = kTRUE, Bool_t MUONMode = kFALSE, Bool_t TRDMode = kFALSE) {
f1fefc07 311
9e78371d 312 // -- Loading Geometry
313 // ---------------------
314 Int_t run = 67179;
315 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
316 AliCDBManager::Instance()->SetRun(run);
317 AliGeomManager::LoadGeometry();
318
c5e3aa8e 319 // Get the pointer to gGeoManager before it's broken (bug in alieve)
cfa641b1 320 fGeoManager = gGeoManager;
c5e3aa8e 321
9e78371d 322 // -- Create new hM object
323 // -------------------------
324 gHomerManager = new AliEveHOMERManager();
cfa641b1 325 gHomerManager->SetRetryCount(1000,15);
9e78371d 326
327 Int_t iResult = gHomerManager->Initialize();
328 if (iResult) {
329 printf("Error Initializing AliHLTHOMERManager, quitting");
330 return;
331 }
332
333 // -- Add hM to EveTree
334 // ----------------------
335 gEve->AddToListTree(gHomerManager, kTRUE);
336
337 // -- Create SourceList
338 // ----------------------
339 iResult = gHomerManager->CreateEveSourcesListLoop();
340 if (iResult) {
341 printf ("Couldn't find active services. returning\n");
342 return;
343 }
344
345 // -- Initialize pointsets and add macros
346 // ----------------------------------------
1d8ae8b6 347 //TEveUtil::LoadMacro("hlt_alieve_init.C");
348 //hlt_alieve_init(".", -1);
9e78371d 349
350 // -- Initialize Eve
351 // -------------------
1d8ae8b6 352 initializeEveViewer( TPCMode, MUONMode, TRDMode);
9e78371d 353
c5e3aa8e 354 // -- Reset gGeoManager to the original pointer
355 // ----------------------------------------------
cfa641b1 356 gGeoManager = fGeoManager;
c5e3aa8e 357 gPHOSGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
358
9e78371d 359 // -- Finalize Eve
360 // -----------------
361 gSystem->ProcessEvents();
362 gEve->Redraw3D(kTRUE);
f1fefc07 363
1d8ae8b6 364 if ( TPCMode ) {
365 gHomerManager->ConnectEVEtoHOMER("TPC" );
366 } else if ( MUONMode ) {
367 gHomerManager->ConnectEVEtoHOMER("MUON");
368 } else if( TRDMode ) {
369 gHomerManager->ConnectEVEtoHOMER("TRD");
370 } else {
371 cout<<" No detectors selected, nothing will be displayed"<<endl;
372 }
c5e3aa8e 373
374 g_esd_tracks_true_field = kFALSE;
cfa641b1 375
9e78371d 376}
377
1d8ae8b6 378// -------------------------------------------------------------------------
379Int_t initializeEveViewer( Bool_t TPCMode, Bool_t MUONMode, Bool_t TRDMode) {
9e78371d 380
cfa641b1 381 //=============================================================================
382 // Visualization database
383 //============================================================================
384
385 TEveUtil::AssertMacro("VizDB_scan.C");
386
387 // alieve_vizdb();
388
389
390
9e78371d 391 //==============================================================================
ea48ba6e 392 // -- Geometry, scenes, projections and viewers
9e78371d 393 //==============================================================================
394
f1fefc07 395 TEveBrowser *browser = gEve->GetBrowser();
396 browser->ShowCloseTab(kFALSE);
397
9e78371d 398 // -- Disable extra geometry
399 // ---------------------------
ea48ba6e 400 if (!MUONMode)
9e78371d 401 gShowMUON = gShowMUONRPhi = gShowMUONRhoZ = kFALSE;
ea48ba6e 402
9e78371d 403 // -- Load Geometry
404 // ------------------
405 TEveUtil::LoadMacro("geom_gentle_hlt.C");
f1fefc07 406 gGeomGentle = geom_gentle_hlt();
407 gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy();
408 gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy();
409 gGeomGentleTRD = geom_gentle_trd();
410
cfa641b1 411 gGeoManager = fGeoManager;
412
413 gEMCALNode = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
414
415 TEveGeoTopNode* emcal_re = new TEveGeoTopNode(gGeoManager, gEMCALNode);
416 gEve->AddGlobalElement(emcal_re);
417 gEve->Redraw3D();
418
ea48ba6e 419 if (gShowMUON)
f1fefc07 420 gGeomGentleMUON = geom_gentle_muon(kFALSE);
ea48ba6e 421
422 // -- Scenes
423 // -----------
f1fefc07 424 gRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry",
425 "Scene holding projected geometry for the RPhi view.");
426 gRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry",
427 "Scene holding projected geometry for the RhoZ view.");
428 gRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
429 "Scene holding projected geometry for the RPhi view.");
430 gRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
431 "Scene holding projected geometry for the RhoZ view.");
9e78371d 432
ea48ba6e 433 // -- Projection managers
434 // ------------------------
f1fefc07 435
9e78371d 436 gRPhiMgr = new TEveProjectionManager();
437 gRPhiMgr->SetProjection(TEveProjection::kPT_RPhi);
438 gEve->AddToListTree(gRPhiMgr, kFALSE);
439 {
440 TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
441 a->SetMainColor(kWhite);
442 a->SetTitle("R-Phi");
443 a->SetTitleSize(0.05);
444 a->SetTitleFont(102);
445 a->SetLabelSize(0.025);
446 a->SetLabelFont(102);
f1fefc07 447 gRPhiGeomScene->AddElement(a);
9e78371d 448 }
9e78371d 449 gRPhiMgr->SetCurrentDepth(-10);
f1fefc07 450 gRPhiMgr->ImportElements(gGeomGentleRPhi, gRPhiGeomScene);
9e78371d 451 gRPhiMgr->SetCurrentDepth(0);
1d8ae8b6 452 gRPhiMgr->ImportElements(gGeomGentleTRD, gRPhiGeomScene);
f1fefc07 453 if (gShowMUONRPhi) gRPhiMgr->ImportElements(gGeomGentleMUON, gRPhiGeomScene);
9e78371d 454
9e78371d 455 gRhoZMgr = new TEveProjectionManager();
456 gRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ);
457 gEve->AddToListTree(gRhoZMgr, kFALSE);
458 {
459 TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
460 a->SetMainColor(kWhite);
461 a->SetTitle("Rho-Z");
462 a->SetTitleSize(0.05);
463 a->SetTitleFont(102);
464 a->SetLabelSize(0.025);
465 a->SetLabelFont(102);
f1fefc07 466 gRhoZGeomScene->AddElement(a);
9e78371d 467 }
468 gRhoZMgr->SetCurrentDepth(-10);
f1fefc07 469 gRhoZMgr->ImportElements(gGeomGentleRhoZ, gRhoZGeomScene);
9e78371d 470 gRhoZMgr->SetCurrentDepth(0);
f1fefc07 471 if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD, gRhoZGeomScene);
472 if (gShowMUONRhoZ) gRhoZMgr->ImportElements(gGeomGentleMUON, gRhoZGeomScene);
9e78371d 473
ea48ba6e 474 // -- Viewers
475 // ------------
9e78371d 476
ea48ba6e 477 TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
478 TEveWindowPack *pack = slot->MakePack();
9e78371d 479 pack->SetElementName("Multi View");
480 pack->SetHorizontal();
481 pack->SetShowTitleBar(kFALSE);
482 pack->NewSlot()->MakeCurrent();
f1fefc07 483 g3DView = gEve->SpawnNewViewer("3D View", "");
484 g3DView->AddScene(gEve->GetGlobalScene());
485 g3DView->AddScene(gEve->GetEventScene());
486
cfa641b1 487
488
489
9e78371d 490 pack = pack->NewSlot()->MakePack();
491 pack->SetShowTitleBar(kFALSE);
492 pack->NewSlot()->MakeCurrent();
f1fefc07 493 gRPhiView = gEve->SpawnNewViewer("RPhi View", "");
494 gRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
495 gRPhiView->AddScene(gRPhiGeomScene);
496 gRPhiView->AddScene(gRPhiEventScene);
9e78371d 497
498 pack->NewSlot()->MakeCurrent();
f1fefc07 499 gRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
500 gRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
501 gRhoZView->AddScene(gRhoZGeomScene);
502 gRhoZView->AddScene(gRhoZEventScene);
503
cfa641b1 504
505
506 //Add HLT Text to windows
507
508 TGLOverlayButton *ob1 = new TGLOverlayButton(g3DView->GetGLViewer(), "HLT", 0, 20, 110, 60);
509 ob1->SetAlphaValues(0.8, 0.8);
510 cout << "color" << ob1->GetBackColor() << endl;
511 //ob1->SetBackColor(8421631);
512 ob1->SetBackColor(10492431);
513 TGLOverlayButton *ob2 = new TGLOverlayButton(g3DView->GetGLViewer(), "ALICE", 0, 0, 110, 20);
514 ob2->SetAlphaValues(0.8, 0.8);
515 ob1->SetBackColor(0.2);
516 TGLOverlayButton *ob3 = new TGLOverlayButton(gEve->GetDefaultGLViewer(), "HLT", 0, 20, 110, 60);
517 ob3->SetAlphaValues(0.8, 0.8);
518 TGLOverlayButton *ob4 = new TGLOverlayButton(gEve->GetDefaultGLViewer(), "ALICE", 0, 0, 110, 20);
519 ob4->SetAlphaValues(0.8, 0.8);
520
521
ea48ba6e 522 // -- List of Viewers
523 // --------------------
9e78371d 524
525 TEveViewerList *viewerlist = new TEveViewerList();
526 viewerlist->AddElement(gEve->GetDefaultViewer());
527
f1fefc07 528 viewerlist->AddElement(g3DView);
529 viewerlist->AddElement(gRhoZView);
530 viewerlist->AddElement(gRPhiView);
9e78371d 531 viewerlist->SwitchColorSet();
532
533 //==============================================================================
ea48ba6e 534 // -- Macros / QA histograms
9e78371d 535 //==============================================================================
536
537 // -- Registration of per-event macros
538 // -------------------------------------
539
540 AliEveMacroExecutor *exec = new AliEveMacroExecutor();
541#if 0
542 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track", "kine_tracks.C", "kine_tracks", "", kFALSE));
543
544 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit ITS", "its_hits.C", "its_hits", "", kFALSE));
545 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit TPC", "tpc_hits.C", "tpc_hits", "", kFALSE));
546 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit T0", "t0_hits.C", "t0_hits", "", kFALSE));
547 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit FMD", "fmd_hits.C", "fmd_hits", "", kFALSE));
548
549 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD", "fmd_digits.C", "fmd_digits", "", kFALSE));
550
551 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw", "", kFALSE));
552 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0", "t0_raw.C", "t0_raw", "", kFALSE));
553 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw", "", kFALSE));
554 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE));
555 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE));
556
557 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE));
558 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE));
559 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE));
560 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE));
561 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE));
562 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE));
563 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE));
564 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE));
565 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE));
566#endif
567 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_onfly"));
568 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_offline"));
569 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0.C", "esd_V0"));
570 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C", "esd_cascade_points"));
571 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C", "esd_cascade"));
572 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink_points.C", "esd_kink_points"));
573 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink.C", "esd_kink"));
574
575 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE));
576 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE));
577 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
578
579 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE));
580
581 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC", "esd_zdc.C", "esd_zdc", "", kFALSE));
582#if 0
583 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus", "clusters.C+", "clusters", "", kFALSE));
584 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C+", "its_clusters"));
585 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C+", "tpc_clusters"));
586 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C+", "trd_clusters"));
587 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C+", "tof_clusters"));
588
589 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "vplot_tpc.C+", "vplot_tpc", "", kFALSE));
590
591 exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA HF", "aod_HF.C", "aod_HF", "", kFALSE));
592 exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA Jets", "jetplane.C", "jetplane", "", kFALSE));
593
594 // -- QA Viewer
595 // --------------
1d8ae8b6 596# endif
9e78371d 597
c5e3aa8e 598
599 //==============================================================================
600 // -- Histograms
601 //==============================================================================
602
603 if(TRDMode) {
ea48ba6e 604 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
605 slot->StartEmbedding();
606
607 gTRDCanvas = new TCanvas("canvasTRD","canvasTRD", 600, 400);
608 gTRDCanvas->Divide(3,2);
609 slot->StopEmbedding("TRD histograms");
cfa641b1 610
611 slot=TEveWindow::CreateWindowInTab(browser->GetTabRight());
612 slot->StartEmbedding();
613 gTRDCalibCanvas=new TCanvas("CalibCanvasTRD","CalibCanvasTRD",600,400);
614 gTRDCalibCanvas->Divide(2,2);
615 slot->StopEmbedding("TRD Calibration Histograms");
616
617 slot=TEveWindow::CreateWindowInTab(browser->GetTabRight());
618 slot->StartEmbedding();
619 gTRDEORCanvas=new TCanvas("CalibEORTRD","CalibCEORTRD",600,400);
620 gTRDEORCanvas->Divide(3,2);
621 slot->StopEmbedding("TRD EOR Histograms");
ea48ba6e 622 }
623 else if(TPCMode){
c5e3aa8e 624 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
625 slot->StartEmbedding();
626
627 gTPCCanvas = new TCanvas("canvasTPC","canvasTPC", 600, 400);
628 gTPCCharge = new TH1F("ClusterCharge","ClusterCharge",100,0,500);
629 gTPCQMax = new TH1F("QMax","QMax",50,0,250);
630 gTPCQMaxOverCharge = new TH1F("QMaxOverCharge","QMaxOverCharge",50,0,1);
631 slot->StopEmbedding("TPC histograms");
ea48ba6e 632 }
f1fefc07 633
cfa641b1 634
635 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
636 slot->StartEmbedding();
637
638 gVertexCanvas = new TCanvas("canvasVertex","canvasVertex", 600, 400);
639 slot->StopEmbedding("Vertex Histograms");
640
641
642
643
9e78371d 644 //==============================================================================
ea48ba6e 645 // -- Additional GUI components
9e78371d 646 //==============================================================================
647
648 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
5de5a293 649 TEveWindowTab *storeTab = slot->MakeTab();
1d8ae8b6 650 storeTab->SetElementNameTitle("WindowStore",
9e78371d 651 "Undocked windows whose previous container is not known\n"
652 "are placed here when the main-frame is closed.");
5de5a293 653 gEve->GetWindowManager()->SetDefaultContainer(storeTab);
9e78371d 654
cfa641b1 655
656
9e78371d 657 return 0;
658}
659
5de5a293 660// -----------------------------------------------------------------
661void nextEvent() {
662
cfa641b1 663 if ( gHomerManager->NextEvent() ) {
664 if (gEventLoopStarted) {
665 cout << "HomerManager failed getting next event, trying to reconnect" << endl;
666
667 gHomerManager->DisconnectHOMER();
668 gHomerManager->ConnectEVEtoHOMER();
669 nextEvent();
670
671 } else {
672 return;
673 }
674 }
675
5de5a293 676 processEvent();
677}
678
9e78371d 679// -----------------------------------------------------------------
ea9a0e13 680Int_t processEvent() {
9e78371d 681
682 Int_t iResult = 0;
683
684 gStyle->SetPalette(1, 0);
685 gEve->DisableRedraw();
686
ea48ba6e 687 //==============================================================================
9e78371d 688 // -- Reset
ea48ba6e 689 //==============================================================================
690
cfa641b1 691
692
693
ea48ba6e 694 if ( gTRDCanvas ) {
695 gTRDCanvas->Clear();
696 gTRDCanvas->Divide(3,2);
697 }
cfa641b1 698 if(gTRDCalibCanvas){
699 gTRDCalibCanvas->Clear();
700 gTRDCalibCanvas->Divide(2,2);
701 }
702 if(gTRDEORCanvas){
703 gTRDEORCanvas->Clear();
704 gTRDEORCanvas->Divide(3,2);
705 }
706
707 if(gVertexCanvas) {
708 gVertexCanvas->Clear();
709 gVertexCanvas->Divide(2,2);
710 }
ea48ba6e 711
712 if ( gTPCTrack ) gTPCTrack->DestroyElements();
713
c5e3aa8e 714 if ( gSPDClusters ) gSPDClusters->Reset();
715 if ( gSSDClusters ) gSSDClusters->Reset();
716 if ( gSDDClusters ) gSSDClusters->Reset();
ea48ba6e 717 if ( gTPCClusters ) gTPCClusters->Reset();
49993c6f 718 if ( gTPCTestClusters ) gTPCTestClusters->Reset();
ea48ba6e 719 if ( gTRDClusters ) gTRDClusters->Reset();
c5e3aa8e 720 if ( gMUONClusters ) gMUONClusters->Reset();
cfa641b1 721 if ( gMUONTracks ){
722 gMUONTracks->Destroy();
723 gMUONTracks = 0x0;
724 }
1d8ae8b6 725
c5e3aa8e 726 if ( gPHOSBoxSet[1] )
727 for(int im = 0; im < 5; im++)
728 gPHOSBoxSet[im]->Reset();
729
cfa641b1 730 if ( gEMCALElementList)
731 for(int i = 0; i < 12; i++) {
732 gEMCALBoxSet[i]->Reset();
733 }
734
735
c5e3aa8e 736 if ( gTPCColClusters )
737 for (Int_t ii = 0; ii <= gTPCBins+1; ++ii)
738 gTPCColClusters->GetBin(ii)->Reset();
739
740 if ( gTRDColClusters )
741 for (Int_t ii = 0; ii <= gTRDBins+1; ++ii)
1d8ae8b6 742 gTRDColClusters->GetBin(ii)->Reset();
1d8ae8b6 743
ea48ba6e 744 gTRDHistoCount = 0;
cfa641b1 745 gVertexHistoCount = 0;
746
1d8ae8b6 747
ea48ba6e 748 //==============================================================================
749 // -- Process Blocks
750 //==============================================================================
1d8ae8b6 751
752 if ( gHomerManager->GetBlockList() == NULL) {
cfa641b1 753 printf ("onlineDisplay: No BlockList ... ");
754 cout << endl;
ea9a0e13 755 return -1;
756 }
9e78371d 757 if (gHomerManager->GetBlockList()->IsEmpty() ) {
cfa641b1 758 printf ("onlineDisplay: No Blocks in list ... ");
759 cout<<endl;
ea9a0e13 760 return -2;
9e78371d 761 }
762
763 TIter next(gHomerManager->GetBlockList());
764 AliHLTHOMERBlockDesc* block = 0;
765
766 // -- Iterate over blocks in the block list
767 // ------------------------------------------
768 while ((block = (AliHLTHOMERBlockDesc*)next())) {
ea9a0e13 769
cfa641b1 770#if 1 //DEBUG
ea9a0e13 771 printf( "------------------- xxxxxxxxxxxxxxx ----------------------\n");
772 printf( "Detector : %s\n", block->GetDetector().Data() );
773 printf( "Datatype : %s\n", block->GetDataType().Data() );
774 if (block->IsTObject() )
775 printf( "Is TObject of class: %s\n", block->GetClassName().Data() );
776 printf( "------------------- xxxxxxxxxxxxxxx ----------------------\n");
777#endif
9e78371d 778
9e78371d 779 // ++ HLT BLOCK
780 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
781 if ( ! block->GetDetector().CompareTo("HLT") ) {
782
783 // -- ESDTREE
784 if ( ! block->GetDataType().CompareTo("ALIESDV0") ) {
9e78371d 785 if(!gTPCTrack){
786 gTPCTrack = new TEveTrackList("ESD Tracks");
787 gTPCTrack->SetMainColor(6);
788 gEve->AddElement(gTPCTrack);
789 }
9e78371d 790 iResult = processEsdTracks(block, gTPCTrack);
ea48ba6e 791 gTPCTrack->ElementChanged();
c5e3aa8e 792 } // if ( ! block->GetDataType().CompareTo("ALIESDV0") ) {
f1fefc07 793
9e78371d 794 // -- Process ROOTObj
795 else if ( ! block->GetDataType().CompareTo("ROOTTOBJ") ) {
f1fefc07 796 if(!gHLTText){
ea48ba6e 797 //gHLTText = new TEveText();
f1fefc07 798 //gHLTText->BBoxZero(5, -5, -5, 0);
799 //gHLTText->SetExtrude(25);
800 //gHLTText->AssertBBoxExtents(25,25,25);
ea48ba6e 801 //gEve->AddElement(gHLTText);
f1fefc07 802 }
803 processROOTTOBJ( block, gHLTText );
c5e3aa8e 804 } // else if ( ! block->GetDataType().CompareTo("ROOTTOBJ") ) {
9e78371d 805
806 // -- Process HLT RDLST
807 else if ( ! block->GetDataType().CompareTo("HLTRDLST") ) {
c5e3aa8e 808 processHLTRDLST( block );
809 } // else if ( ! block->GetDataType().CompareTo("HLTRDLST") ) {
810
9e78371d 811 } // if ( ! block->GetDetector().CompareTo("HLT") ) {
812
813 // ++ TPC BLOCK
814 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
815 else if ( ! block->GetDetector().CompareTo("TPC") ) {
816
f1fefc07 817 // -- Process TPC Clusters
818 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
cfa641b1 819 if(!gTPCClusters){
f1fefc07 820 gTPCClusters = new TEvePointSet("TPC Clusters");
cfa641b1 821 //gTPCClusters->ApplyVizTag("TPC Clusters");
f1fefc07 822 gTPCClusters->SetMainColor(kRed);
823 gTPCClusters->SetMarkerStyle((Style_t)kFullDotSmall);
824 gEve->AddElement(gTPCClusters);
825 }
c5e3aa8e 826
827 if(!gTPCColClusters){
828 gTPCColClusters = new TEvePointSetArray("TPC Clusters Colorized");
829 gTPCColClusters->SetMainColor(kRed);
830 gTPCColClusters->SetMarkerStyle(4); // antialiased circle
831 gTPCColClusters->SetMarkerSize(0.8);
832 gTPCColClusters->InitBins("Cluster Charge", gTPCBins, 0., gTPCBins*20.);
833
834 const Int_t nCol = TColor::GetNumberOfColors();
cfa641b1 835
c5e3aa8e 836 for (Int_t ii = 0; ii < gTPCBins+1; ++ii)
837 gTPCColClusters->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (gTPCBins+2)));
838
839 gEve->AddElement(gTPCColClusters);
840 }
841
842 iResult = processTPCClusters(block, gTPCClusters, gTPCColClusters);
ea48ba6e 843 gTPCClusters->ElementChanged();
c5e3aa8e 844 gTPCColClusters->ElementChanged();
9e78371d 845 }
ea48ba6e 846
f1fefc07 847 } // else if ( ! block->GetDetector().CompareTo("TPC") ) {
848
1d8ae8b6 849 // ++ TRD BLOCK
850 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
851 else if ( ! block->GetDetector().CompareTo("TRD") ) {
852
853 // -- Process TRD Clusters
854 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
855
856 if(!gTRDClusters){
857 gTRDClusters = new TEvePointSet("TRD Clusters");
858 gTRDClusters->SetMainColor(kBlue);
859 gTRDClusters->SetMarkerStyle((Style_t)kFullDotSmall);
ea48ba6e 860 gEve->AddElement(gTRDClusters);
1d8ae8b6 861 }
1d8ae8b6 862
863 if(!gTRDColClusters){
1d8ae8b6 864 gTRDColClusters = new TEvePointSetArray("TRD Clusters Colorized");
865 gTRDColClusters->SetMainColor(kRed);
866 gTRDColClusters->SetMarkerStyle(4); // antialiased circle
867 // gTRDColClusters->SetMarkerStyle((Style_t)kFullDotSmall);
868 gTRDColClusters->SetMarkerSize(0.8);
869 gTRDColClusters->InitBins("Cluster Charge", gTRDBins, 0., gTRDBins*100.);
870
ea48ba6e 871 //TColor::SetPalette(1, 0); // Spectrum palette
1d8ae8b6 872 const Int_t nCol = TColor::GetNumberOfColors();
873 for (Int_t ii = 0; ii < gTRDBins+1; ++ii)
874 gTRDColClusters->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (gTRDBins+2)));
ea48ba6e 875
1d8ae8b6 876 gEve->AddElement(gTRDColClusters);
877 }
878
879 iResult = processTRDClusters( block, gTRDClusters, gTRDColClusters );
ea48ba6e 880 gTRDClusters->ElementChanged();
1d8ae8b6 881 gTRDColClusters->ElementChanged();
882 }
883
884 // -- Process TRD Histograms
885 else if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
886 iResult = processTRDHistograms( block, gTRDCanvas );
ea48ba6e 887 if ( gTRDCanvas) gTRDCanvas->Update();
cfa641b1 888 }
889
890 else if(block->GetDataType().CompareTo("CALIBRAH")==0){
891 iResult=processTRDCalibHistograms(block,gTRDCalibCanvas);
892 if(gTRDCalibCanvas)gTRDCalibCanvas->Update();
893 }
894
895 else if(block->GetDataType().CompareTo("CALIBEOR")==0){
896 iResult=processTRDCalibHistograms(block,gTRDEORCanvas);
897 if(gTRDEORCanvas)gTRDEORCanvas->Update();
1d8ae8b6 898 }
1d8ae8b6 899 } // else if ( ! block->GetDetector().CompareTo("TRD") ) {
900
1d8ae8b6 901 // ++ MUON BLOCK
902 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
ea48ba6e 903 else if ( ! block->GetDetector().CompareTo("MUON") && gShowMUON ) {
1d8ae8b6 904
ea48ba6e 905 // -- Process MUON Clusters
1d8ae8b6 906 if ( (block->GetDataType().CompareTo("RECHITS") == 0) || (block->GetDataType().CompareTo("TRIGRECS") == 0) ) {
ea48ba6e 907
1d8ae8b6 908 if ( !gMUONClusters ) {
909 gMUONClusters = new TEvePointSet("MUON RecHits");
910 gMUONClusters->SetMainColor(kBlue);
911 gMUONClusters->SetMarkerStyle(20);
912 gEve->AddElement(gMUONClusters);
913 }
914
1d8ae8b6 915 processMUONClusters( block );
ea48ba6e 916 gMUONClusters->ElementChanged();
1d8ae8b6 917
cfa641b1 918 }else if(block->GetDataType().CompareTo("MANTRACK") == 0){
919
920 if ( !gMUONTracks ) {
921 gMUONTracks = new TEveStraightLineSet("MUON Tracks");
922 gMUONTracks->SetMainColor(kRed);
923 gMUONTracks->SetLineWidth(3);
924 gEve->AddElement(gMUONTracks);
925 }
926
927 processMUONTracks( block );
928 gMUONTracks->ElementChanged();
929
930
ea48ba6e 931 }
932 } // else if ( ! block->GetDetector().CompareTo("MUON") && gShowMUON ) {
c5e3aa8e 933
934 // ++ ISPD BLOCK
9e78371d 935 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
936 else if ( ! block->GetDetector().CompareTo("ISPD") ){
937 if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) {
c5e3aa8e 938
939 if(!gSPDClusters){
940 gSPDClusters = new TEvePointSet("SPD Clusters");
941 gSPDClusters->SetMainColor(kBlack);
942 gSPDClusters->SetMarkerStyle((Style_t)kFullDotLarge);
943 gEve->AddElement(gSPDClusters);
944 }
945
946 processITSClusters( block , gSPDClusters);
947 gSPDClusters->ElementChanged();
cfa641b1 948
949 } else if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
950
951 // -- Process Vertex Histos
952 cout << "processvertexhistorgrams"<<endl;
953 processVertexHistograms( block , gVertexCanvas);
954 gVertexCanvas->Update();
9e78371d 955 }
956 } // else if ( ! block->GetDetector().CompareTo("ISPD") ){
c5e3aa8e 957
958 // ++ ISDD BLOCK
959 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
960 else if ( ! block->GetDetector().CompareTo("ISDD") ){
961 if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) {
962
963 if(!gSDDClusters){
964 gSDDClusters = new TEvePointSet("SDD Clusters");
965 gSDDClusters->SetMainColor(kPink);
966 gSDDClusters->SetMarkerStyle((Style_t)kFullDotLarge);
967 gEve->AddElement(gSDDClusters);
968 }
969
970 processITSClusters( block , gSDDClusters);
971 gSDDClusters->ElementChanged();
972 }
973 } // else if ( ! block->GetDetector().CompareTo("ISDD") ){
974
975 // ++ ISSD BLOCK
976 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
977 else if ( ! block->GetDetector().CompareTo("ISSD") ){
978 if ( block->GetDataType().CompareTo("CLUSTERS") == 0 ) {
979
980 if(!gSSDClusters){
981 gSSDClusters = new TEvePointSet("SSD Clusters");
982 gSSDClusters->SetMainColor(kPink);
983 gSSDClusters->SetMarkerStyle((Style_t)kFullDotLarge);
984 gEve->AddElement(gSSDClusters);
985 }
986
987 processITSClusters( block , gSSDClusters);
988 gSSDClusters->ElementChanged();
989 }
990 } // else if ( ! block->GetDetector().CompareTo("ISSD") ){
991
992 // ++ ITS BLOCK
993 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
ea48ba6e 994 else if ( ! block->GetDetector().CompareTo("ITS") ){
f1fefc07 995 if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
c5e3aa8e 996 iResult = processITSHist( block );
f1fefc07 997 }
c5e3aa8e 998 } // else if ( ! block->GetDetector().CompareTo("ITS") ){
ea48ba6e 999
c5e3aa8e 1000 // ++ PHOS BLOCK
1001 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1002 else if ( ! block->GetDetector().CompareTo("PHOS") ) {
1003
1004 // -- Process Digits
cfa641b1 1005 //if ( block->GetDataType().CompareTo("DIGITTYP") == 0 ) {
1006 if ( block->GetDataType().CompareTo("CHANNELT") == 0 ) {
c5e3aa8e 1007
1008 if( !gPHOSElementList ){
1009 gPHOSElementList = new TEveElementList("PHOS Cells");
1010 gEve->AddElement(gPHOSElementList);
1011
1012 TVector3 center;
1013 Float_t angle;
1014
1015 // -- Create boxsets
1016 for(int im = 0; im < 5; im++) {
1017
cfa641b1 1018 TEveRGBAPalette* pal = new TEveRGBAPalette(0,120);
1019 pal->SetLimits(-0.1, 1024);
c5e3aa8e 1020 gPHOSBoxSet[im] = new TEveBoxSet(Form("Cells Module %d" , im));
1021 gPHOSBoxSet[im]->SetPalette(pal);
1022 gPHOSBoxSet[im]->Reset(TEveBoxSet::kBT_AABox, kFALSE, 64);
1023 gPHOSBoxSet[im]->SetOwnIds(kTRUE);
1024
cfa641b1 1025
c5e3aa8e 1026 gPHOSGeom->GetModuleCenter(center, "CPV", im+1);
1027 angle = gPHOSGeom->GetPHOSAngle(im+1)*TMath::Pi()/180;
1028
1029 gPHOSBoxSet[im]->RefitPlex();
1030 TEveTrans& t = gPHOSBoxSet[im]->RefMainTrans();
1031 t.SetupRotation(1, 2, angle );
1032 t.SetPos(center.X(), center.Y(), center.Z());
1033
1034 gPHOSElementList->AddElement(gPHOSBoxSet[im]);
1035 }
1036 } // for(int im = 0; im < 5; im++) {
1037
1038 iResult = processPHOSClusters( block );
1039
1040 for(int im = 0; im < 5; im++)
1041 gPHOSBoxSet[im]->ElementChanged();
1042
1043 } // if ( block->GetDataType().CompareTo("DIGITTYP") == 0 ) {
1044
1045 } // else if ( ! block->GetDetector().CompareTo("PHOS") ){
f1fefc07 1046
cfa641b1 1047 else if ( ! block->GetDetector().CompareTo("EMCAL") ){
1048 if ( block->GetDataType().CompareTo("CHANNELT") == 0 ) {
1049
1050 cout << "EMCAL, setting up digits display"<<endl;
1051
1052 if( !gEMCALElementList ){
1053
1054
1055 gEMCALElementList = new TEveElementList("EMCAL Cells");
1056 gEMCALElementList->SetTitle("Tooltip");
1057 gEve->AddElement(gEMCALElementList);
1058
1059
1060 gStyle->SetPalette(1, 0);
1061 TEveRGBAPalette* pal = new TEveRGBAPalette(0, 512);
1062 pal->SetLimits(0, 1024);
1063
1064
1065 for (Int_t sm=0; sm<12; ++sm) {
1066
1067 TEveBoxSet* q = new TEveBoxSet(Form("SM %d", sm+1));
1068 q->SetOwnIds(kTRUE);
1069
1070 q->Reset(TEveBoxSet::kBT_AABox, kFALSE, 64);
1071 q->RefMainTrans().SetFrom(*gEMCALNode->GetDaughter(sm)->GetMatrix());
1072 q->SetPalette(pal);
1073
1074 gEve->AddElement(q, gEMCALElementList);
1075 gEMCALBoxSet[sm] = q;
1076 }
1077 }
1078
1079
1080 cout << "Processing emcal digits" << endl;
1081 iResult = processEMCALClusters( block );
1082
1083 for(int sm = 0; sm < 12; sm++) {
1084 gEMCALBoxSet[sm]->ElementChanged();
1085 }
1086
1087
1088 }
1089
1090 } // "EMCAL" blocks end
1091
f1fefc07 1092 // ---------------------------------------------------------
9e78371d 1093 } // while ((block = (AliHLTHOMERBlockDesc*)next())) {
1094
cfa641b1 1095
1096 //============================================================================
1097 // Reading out the histograms
1098 //===========================================================================
1099 TIter anext(gHomerManager->GetAsyncBlockList());
49993c6f 1100
cfa641b1 1101 while ( (block = (AliHLTHOMERBlockDesc*)anext()) ) {
1102
1103#if 1 //DEBUG
1104 printf( "------------------- xxxxxxxxxxxxxxx ----------------------\n");
1105 printf( "Detector : %s\n", block->GetDetector().Data() );
1106 printf( "Datatype : %s\n", block->GetDataType().Data() );
1107 if (block->IsTObject() )
1108 printf( "Is TObject of class: %s\n", block->GetClassName().Data() );
1109 printf( "------------------- xxxxxxxxxxxxxxx ----------------------\n");
1110#endif
1111
1112
1113
1114 // ++ ISPD BLOCK
1115 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1116 if ( ! block->GetDetector().CompareTo("ISPD") ){
1117 if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
1118
1119 // -- Process Vertex Histos
1120 cout << "processvertexhistorgrams"<<endl;
1121 processVertexHistograms( block , gVertexCanvas);
1122 gVertexCanvas->Update();
1123 }
1124 }
1125
1126
1127 // ++ PHOS BLOCK
1128 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1129 else if ( ! block->GetDetector().CompareTo("PHOS") ) {
1130
1131 // -- Process Digits
1132 //if ( block->GetDataType().CompareTo("DIGITTYP") == 0 ) {
1133 if ( block->GetDataType().CompareTo("CHANNELT") == 0 ) {
1134
1135 if( !gPHOSElementList ){
1136 gPHOSElementList = new TEveElementList("PHOS Cells");
1137 gEve->AddElement(gPHOSElementList);
1138
1139 TVector3 center;
1140 Float_t angle;
1141
1142 // -- Create boxsets
1143 for(int im = 0; im < 5; im++) {
1144
1145 TEveRGBAPalette* pal = new TEveRGBAPalette(0,120);
1146 pal->SetLimits(-0.1, 1024);
1147 gPHOSBoxSet[im] = new TEveBoxSet(Form("Cells Module %d" , im));
1148 gPHOSBoxSet[im]->SetPalette(pal);
1149 gPHOSBoxSet[im]->Reset(TEveBoxSet::kBT_AABox, kFALSE, 64);
1150 gPHOSBoxSet[im]->SetOwnIds(kTRUE);
1151
1152
1153 gPHOSGeom->GetModuleCenter(center, "CPV", im+1);
1154 angle = gPHOSGeom->GetPHOSAngle(im+1)*TMath::Pi()/180;
1155
1156 gPHOSBoxSet[im]->RefitPlex();
1157 TEveTrans& t = gPHOSBoxSet[im]->RefMainTrans();
1158 t.SetupRotation(1, 2, angle );
1159 t.SetPos(center.X(), center.Y(), center.Z());
1160
1161 gPHOSElementList->AddElement(gPHOSBoxSet[im]);
1162 }
1163 } // for(int im = 0; im < 5; im++) {
1164
1165 iResult = processPHOSClusters( block );
1166
1167 for(int im = 0; im < 5; im++)
1168 gPHOSBoxSet[im]->ElementChanged();
1169
1170 } // if ( block->GetDataType().CompareTo("DIGITTYP") == 0 ) {
1171
1172 } // else if ( ! block->GetDetector().CompareTo("PHOS") ){
1173
1174 else if ( ! block->GetDetector().CompareTo("EMCA") ){
1175 if ( block->GetDataType().CompareTo("CHANNELT") == 0 ) {
1176
1177 cout << "EMCAL, setting up digits display"<<endl;
1178
1179 if( !gEMCALElementList ){
1180
1181
1182 gEMCALElementList = new TEveElementList("EMCAL Cells");
1183 gEMCALElementList->SetTitle("Tooltip");
1184 gEve->AddElement(gEMCALElementList);
1185
1186
1187 gStyle->SetPalette(1, 0);
1188 TEveRGBAPalette* pal = new TEveRGBAPalette(0, 512);
1189 pal->SetLimits(0, 1024);
1190
1191
1192 for (Int_t sm=0; sm<12; ++sm) {
1193
1194 TEveBoxSet* q = new TEveBoxSet(Form("SM %d", sm+1));
1195 q->SetOwnIds(kTRUE);
1196
1197 q->Reset(TEveBoxSet::kBT_AABox, kFALSE, 64);
1198 q->RefMainTrans().SetFrom(*gEMCALNode->GetDaughter(sm)->GetMatrix());
1199 q->SetPalette(pal);
1200
1201 gEve->AddElement(q, gEMCALElementList);
1202 gEMCALBoxSet[sm] = q;
1203 }
1204 }
1205
1206
1207 cout << "Processing emcal digits" << endl;
1208 iResult = processEMCALClusters( block );
1209
1210 for(int sm = 0; sm < 12; sm++) {
1211 gEMCALBoxSet[sm]->ElementChanged();
1212 }
1213
1214
1215 }
1216
1217 } // "EMCAL" blocks end
1218
49993c6f 1219 //Extra TPC clusters set for testing
1220 else if ( ! block->GetDetector().CompareTo("TPC") ) {
1221 if ( ! block->GetDataType().CompareTo("HWCL_ALT") ) {
1222 if(!gTPCTestClusters){
1223
1224 gTPCTestClusters = new TEvePointSet("TPC Clusters Test");
1225 //ggTPCTestClusters->ApplyVizTag("TPC Clusters");
1226 gTPCTestClusters->SetMainColor(kBlue);
1227 gTPCTestClusters->SetMarkerStyle((Style_t)kFullDotSmall);
1228 gEve->AddElement(gTPCTestClusters);
1229 }
1230
1231 iResult = processTPCClusters(block, gTPCTestClusters);
1232 gTPCTestClusters->ElementChanged();
1233 }
1234
1235
1236 }
cfa641b1 1237
1238
1239 }
1240
c5e3aa8e 1241 //==============================================================================
1242 // -- Update Objects
1243 //==============================================================================
1244
1245 // -- TPC Histograms
1246 if ( gTPCCanvas && gTPCCharge && gTPCQMax) {
cfa641b1 1247
c5e3aa8e 1248 gTPCCanvas->Clear();
1249 gTPCCanvas->Divide(1,3);
1250
1251 gTPCCanvas->cd(1);
1252 gTPCCharge->Draw();
1253
1254 gTPCCanvas->cd(2);
1255 gTPCQMax->Draw();
1256
1257 gTPCCanvas->cd(3);
1258 gTPCQMaxOverCharge->Draw();
1259
1260 gTPCCanvas->Update();
1261 }
f1fefc07 1262
9e78371d 1263 if ( gTPCClusters ) gTPCClusters->ResetBBox();
49993c6f 1264 if ( gTPCTestClusters ) gTPCTestClusters->ResetBBox();
1d8ae8b6 1265 if ( gTRDClusters ) gTRDClusters->ResetBBox();
9e78371d 1266 if ( gSPDClusters ) gSPDClusters->ResetBBox();
c5e3aa8e 1267 if ( gSDDClusters ) gSDDClusters->ResetBBox();
1268 if ( gSSDClusters ) gSSDClusters->ResetBBox();
1269 if ( gMUONClusters ) gMUONClusters->ResetBBox();
1270
1271 if ( gPHOSBoxSet[1] )
1272 for(int im = 0; im < 5; im++)
1273 gPHOSBoxSet[im]->ResetBBox();
ea9a0e13 1274
cfa641b1 1275 if ( gEMCALElementList )
1276 for(int sm = 0; sm < 12; sm++)
1277 gEMCALBoxSet[sm]->ResetBBox();
1278
1279
1280
c5e3aa8e 1281 //==============================================================================
ea9a0e13 1282 // -- Set EventID in Window Title
c5e3aa8e 1283 // -- Update Objects
1284 //==============================================================================
1285
ea9a0e13 1286 TString winTitle("Eve Main Window -- Event ID : ");
1287 winTitle += Form("0x%016X ", gHomerManager->GetEventID() );
1288 gEve->GetBrowser()->SetWindowName(winTitle);
9e78371d 1289
c5e3aa8e 1290 //==============================================================================
9e78371d 1291 // -- Set Projections
c5e3aa8e 1292 //==============================================================================
9e78371d 1293
1294 // XXX Primary vertex ... to be retrieved from the ESD
ea48ba6e 1295 Double_t x[3] = { 0, 0, 0 };
1296
f1fefc07 1297 TEveElement* top = gEve->GetCurrentEvent();
ea48ba6e 1298
ea9a0e13 1299 if (gRPhiMgr && top) {
f1fefc07 1300 gRPhiEventScene->DestroyElements();
1301 if (gCenterProjectionsAtPrimaryVertex)
1302 gRPhiMgr->SetCenter(x[0], x[1], x[2]);
1303 gRPhiMgr->ImportElements(top, gRPhiEventScene);
9e78371d 1304 }
ea9a0e13 1305
1306 if (gRhoZMgr && top) {
f1fefc07 1307 gRhoZEventScene->DestroyElements();
1308 if (gCenterProjectionsAtPrimaryVertex)
1309 gRhoZMgr->SetCenter(x[0], x[1], x[2]);
1310 gRhoZMgr->ImportElements(top, gRhoZEventScene);
9e78371d 1311 }
9e78371d 1312
c5e3aa8e 1313 //==============================================================================
ea9a0e13 1314
1315 gEve->Redraw3D(0,1); // (0, 1)
9e78371d 1316 gEve->EnableRedraw();
f1fefc07 1317
9e78371d 1318 return iResult;
1319}
1320
f1fefc07 1321// -----------------------------------------------------------------
c5e3aa8e 1322Int_t processITSHist(AliHLTHOMERBlockDesc* /*block*/) {
f1fefc07 1323 return 0;
1324}
1d8ae8b6 1325
9e78371d 1326// -----------------------------------------------------------------
1d8ae8b6 1327Int_t processHLTRDLST(AliHLTHOMERBlockDesc* /*block*/) {
9e78371d 1328 return 0;
1329}
1330
1331// -----------------------------------------------------------------
1d8ae8b6 1332Int_t processROOTTOBJ(AliHLTHOMERBlockDesc* block, TEveText* /*et*/) {
9e78371d 1333
1334 // -- AliHLTGlobalTriggerDecision
1335 if ( ! block->GetClassName().CompareTo("AliHLTGlobalTriggerDecision") ) {
1336
1d8ae8b6 1337 AliHLTGlobalTriggerDecision *trig = dynamic_cast<AliHLTGlobalTriggerDecision*>( block->GetTObject());
5de5a293 1338 trig->Print();
f1fefc07 1339
ea9a0e13 1340 // et->SetText("balle");;
9e78371d 1341
ea9a0e13 1342 // TEveText* tt = new TEveText("Trigger: Class is known ;-) ");
1343 // gEve->AddElement(tt);
9e78371d 1344
1345 }
1346 else {
1347 printf(" Unknown root object %s",block->GetClassName().Data() );
1348 }
1349
1350 return 0;
1351}
1352
1353// -----------------------------------------------------------------
1354Int_t processEsdTracks( AliHLTHOMERBlockDesc* block, TEveTrackList* cont ) {
1355
cfa641b1 1356 cout << "Adding tracks" << endl;
1357
9e78371d 1358 AliESDEvent* esd = (AliESDEvent *) (block->GetTObject());
1359 esd->GetStdContent();
1360
1361 esd_track_propagator_setup(cont->GetPropagator(),0.1*esd->GetMagneticField(), 520);
1362
cfa641b1 1363 // printf( "Number of ESD Tracks : %d \n", esd->GetNumberOfTracks());
9e78371d 1364
1365 for (Int_t iter = 0; iter < esd->GetNumberOfTracks(); ++iter) {
cfa641b1 1366 cout << "track" << endl;
1367 //AliEveTrack* track = dynamic_cast<AliEveTrack*>(esd_make_track(esd->GetTrack(iter), cont));
1368 AliEveTrack* track = dynamic_cast<AliEveTrack*>(hlt_esd_make_track(esd->GetTrack(iter), cont));
9e78371d 1369 cont->AddElement(track);
1370 }
1371
1372 cont->SetTitle(Form("N=%d", esd->GetNumberOfTracks()) );
1373 cont->MakeTracks();
1374
1375 return 0;
1376}
1377
c5e3aa8e 1378// -----------------------------------------------------------------
cfa641b1 1379Int_t processPHOSClusters(AliHLTHOMERBlockDesc* block) {
c5e3aa8e 1380
cfa641b1 1381
1382
1383 cout << "PHOS PHOS"<<endl;
1384
1385 AliHLTPHOSChannelDataHeaderStruct *chh = reinterpret_cast<AliHLTPHOSChannelDataHeaderStruct*> (block->GetData());
1386
1387
1388 AliHLTPHOSChannelDataStruct *chd = reinterpret_cast<AliHLTPHOSChannelDataStruct*>(chh+1);
1389
1390 for(UInt_t i = 0; i < chh->fNChannels; i++, chd++) {
1391
1392 Int_t gain = (chd->fChannelID >> 12)&0x1;
1393 Int_t module = (chd->fChannelID >> 13)&0x1f;
1394 module = 4 -module;
c5e3aa8e 1395
c5e3aa8e 1396
cfa641b1 1397 if(gain == 0)
1398
1399 {
1400 Float_t x = (static_cast<Float_t>(chd->fChannelID&0x3f) - 32)* 2.2;
1401 Float_t z = (static_cast<Float_t>((chd->fChannelID >> 6)&0x3f) - 28) * 2.2;
1402 // gPHOSBoxSet[ds->fModule]->AddBox(ds->fLocX, 0, ds->fLocZ, 2.2, ds->fEnergy*20, 2.2);
1403 gPHOSBoxSet[module]->AddBox(x, 0, z, 2.2, chd->fEnergy/15, 2.2);
1404 gPHOSBoxSet[module]->DigitValue(static_cast<Int_t>(chd->fEnergy));
1405
1406 caloCell *cs = new caloCell();
1407 cs->phosStruct = *chd;
1408 gPHOSBoxSet[module]->DigitId(cs);
1409 }
c5e3aa8e 1410
cfa641b1 1411
1412
1413 }
1414
1415 return 0;
1416}
1417
1418// // -----------------------------------------------------------------
1419// Int_t processPHOSClusters(AliHLTHOMERBlockDesc* block) {
1420
1421// AliHLTPHOSDigitHeaderStruct *dh = reinterpret_cast<AliHLTPHOSDigitHeaderStruct*> (block->GetData());
1422// //UInt_t nClusters = block->GetSize()/sizeof(AliHLTPHOSDigitDataStruct);
1423
1424// UInt_t nDigits = dh->fNDigits;
1425
1426// AliHLTPHOSDigitDataStruct *ds = reinterpret_cast<AliHLTPHOSDigitDataStruct*>(reinterpret_cast<UChar_t*>(dh)+sizeof(AliHLTPHOSDigitHeaderStruct));
1427
1428// for(UInt_t i = 0; i < nDigits; i++, ds++) {
1429// gPHOSBoxSet[ds->fModule]->AddBox(ds->fLocX, 0, ds->fLocZ, 2.2, ds->fEnergy*20, 2.2);
1430// gPHOSBoxSet[ds->fModule]->DigitValue(static_cast<Int_t>(ds->fEnergy*100));
1431// }
c5e3aa8e 1432
1433// return 0;
1434// }
1435
1436
1437
cfa641b1 1438
1439
1440
1441
1442
1443
c5e3aa8e 1444// -----------------------------------------------------------------
cfa641b1 1445Int_t processEMCALClusters(AliHLTHOMERBlockDesc* block) {
c5e3aa8e 1446
cfa641b1 1447 AliHLTCaloChannelDataHeaderStruct *dhs = reinterpret_cast<AliHLTCaloChannelDataHeaderStruct*> (block->GetData());
1448 Short_t nC = dhs->fNChannels;
1449 AliHLTUInt8_t *ui = reinterpret_cast<AliHLTUInt8_t*>(dhs) + sizeof(AliHLTCaloChannelDataHeaderStruct);
1450 AliHLTCaloChannelDataStruct *ds = reinterpret_cast<AliHLTCaloChannelDataStruct*>(ui);
1451
1452 UShort_t fX =0;
1453 UShort_t fZ =0;
1454 UShort_t fGain =0;
1455 UShort_t fModuleId =0;
1456
c5e3aa8e 1457
c5e3aa8e 1458
cfa641b1 1459 for(Short_t s = 0; s < nC; s++ ) {
1460
1461
1462
1463 // cout << nC << " "<< s << endl;
1464 //cout << ds->fEnergy << " " << ds->fChannelID<<endl;
1465
1466
1467
1468 fX = ds->fChannelID&0x3f;
1469 fZ = (ds->fChannelID >> 6)&0x3f;
1470 fGain = (ds->fChannelID >> 12)&0x1;
1471 fModuleId = (ds->fChannelID >> 13)&0x1f;
1472
1473 // cout << fX << " " << fZ << " " << fGain << " " << fModuleId <<endl;
1474
1475 if ( ( fModuleId > -1 && fModuleId < 12 ) ) {
1476 gEMCALBoxSet[fModuleId]->AddBox(10, fX*6-12*6, fZ*6-24*6, ds->fEnergy/4, 6, 6);
1477 gEMCALBoxSet[fModuleId]->DigitValue(static_cast<Int_t>(ds->fEnergy));
1478 }
1479 ds++;
1480
1481}
1482
1483
1484
c5e3aa8e 1485 return 0;
1486}
1487
cfa641b1 1488
1489
1490
ea9a0e13 1491// -----------------------------------------------------------------
c5e3aa8e 1492Int_t processITSClusters(AliHLTHOMERBlockDesc* block, TEvePointSet* cont) {
1493
1494 AliHLTITSClusterData *cd = reinterpret_cast<AliHLTITSClusterData*> (block->GetData());
1495 UChar_t *data = reinterpret_cast<UChar_t*> (cd->fSpacePoints);
1496
1497 if ( cd->fSpacePointCnt != 0 ) {
1498 for (Int_t iter = 0; iter < cd->fSpacePointCnt; ++iter, data += sizeof(AliHLTITSSpacePointData)) {
1499 AliHLTITSSpacePointData *sp = reinterpret_cast<AliHLTITSSpacePointData*> (data);
f1fefc07 1500
c5e3aa8e 1501 Int_t lab[4] = {0,0,0,0};
1502 Float_t hit[6] = {0,0,0,0,0,0};
1503 Int_t info[3] = {0,0,0};
1504
1505 lab[0] = sp->fTracks[0];
1506 lab[1] = sp->fTracks[1];
1507 lab[2] = sp->fTracks[2];
1508 lab[3] = sp->fIndex;
1509 hit[0] = sp->fY;
1510 hit[1] = sp->fZ;
1511 hit[2] = sp->fSigmaY2;
1512 hit[3] = sp->fSigmaZ2;
1513 hit[4] = sp->fQ;
1514 hit[5] = sp->fSigmaYZ;
1515 info[0] = sp->fNy;
1516 info[1] = sp->fNz;
1517 info[2] = sp->fLayer;
1518
1519 Float_t xyz[3];
1520 AliITSRecPoint recpoint(lab,hit,info);
1521 recpoint.GetGlobalXYZ(xyz);
1522
1523 cont->SetNextPoint(xyz[0], xyz[1], xyz[2]);
1524 }
1525 }
1526 return 0;
1527}
1528
1529// -----------------------------------------------------------------
1530Int_t processTPCClusters(AliHLTHOMERBlockDesc* block, TEvePointSet* cont, TEvePointSetArray *contCol ) {
1531
f1fefc07 1532 Int_t slice = block->GetSubDetector();
9e78371d 1533 Float_t phi = ( slice + 0.5 ) * TMath::Pi() / 9.0;
1534 Float_t cos = TMath::Cos( phi );
1535 Float_t sin = TMath::Sin( phi );
ea9a0e13 1536
1537 AliHLTTPCClusterData *cd = reinterpret_cast<AliHLTTPCClusterData*> (block->GetData());
1538 UChar_t *data = reinterpret_cast<UChar_t*> (cd->fSpacePoints);
9e78371d 1539
ea9a0e13 1540 if ( cd->fSpacePointCnt != 0 ) {
1541 for (Int_t iter = 0; iter < cd->fSpacePointCnt; ++iter, data += sizeof(AliHLTTPCSpacePointData)) {
1542 AliHLTTPCSpacePointData *sp = reinterpret_cast<AliHLTTPCSpacePointData*> (data);
9e78371d 1543 cont->SetNextPoint(cos*sp->fX - sin*sp->fY, sin*sp->fX + cos*sp->fY, sp->fZ);
49993c6f 1544 if (contCol)
1545 contCol->Fill(cos*sp->fX - sin*sp->fY, sin*sp->fX + cos*sp->fY, sp->fZ, sp->fCharge);
c5e3aa8e 1546
1547 gTPCCharge->Fill(sp->fCharge);
1548 gTPCQMax->Fill(sp->fQMax);
1549 gTPCQMaxOverCharge->Fill(((Float_t)sp->fQMax)/((Float_t)sp->fCharge));
9e78371d 1550 }
1551 }
1552
ea9a0e13 1553 return 0;
9e78371d 1554}
1d8ae8b6 1555
ea48ba6e 1556// -----------------------------------------------------------------
1d8ae8b6 1557Int_t processMUONClusters(AliHLTHOMERBlockDesc* block) {
ea48ba6e 1558
1d8ae8b6 1559 Int_t iResult = 0;
1560
1561 unsigned long size = block->GetSize();
ea48ba6e 1562 Int_t * buffer ;
1d8ae8b6 1563
ea48ba6e 1564 buffer = (Int_t *)block->GetData();
1d8ae8b6 1565// cout<<"block size : "<<size<<", buffer : "<<buffer<<", DataType : "<<block->GetDataType()<<endl;
1566
1567// // for(int idata=0;idata<int(size);idata++)
1568// // printf("\tbuffer[%d] : %d\n",idata,buffer[idata]);
1569
1570
1571
1572 if(block->GetDataType().CompareTo("RECHITS") == 0){
1573
1574 AliHLTMUONRecHitsBlockReader trackblock((char*)buffer, size);
1575 const AliHLTMUONRecHitStruct* hit = trackblock.GetArray();
1576
1577 for(AliHLTUInt32_t ientry = 0; ientry < trackblock.Nentries(); ientry++){
1578// cout << setw(13) << left << hit->fX << setw(0);
1579// cout << setw(13) << left << hit->fY << setw(0);
1580// cout << hit->fZ << setw(0) << endl;
1581 if(hit->fX!=0.0 && hit->fY!=0.0 && hit->fZ!=0.0)
1582 gMUONClusters->SetNextPoint(hit->fX,hit->fY,hit->fZ);
1583 hit++;
1584
1585 }// track hit loop
1586 }
1587
1588 else{// if rechits
1589 // if(!strcmp((BlockType(ULong64_t(reader->GetBlockDataType(i)))).Data(),"TRIGRECS")){
1590
1591 AliHLTMUONTriggerRecordsBlockReader trigblock(buffer, size);
1592 const AliHLTMUONTriggerRecordStruct* trigrec = trigblock.GetArray();
1593 for(AliHLTUInt32_t ientry = 0; ientry < trigblock.Nentries(); ientry++){
1594
1595 const AliHLTMUONRecHitStruct* hit = &trigrec->fHit[0];
1596 for(AliHLTUInt32_t ch = 0; ch < 4; ch++)
1597 {
cfa641b1 1598// cout << setw(10) << left << ch + 11 << setw(0);
1599// cout << setw(13) << left << hit->fX << setw(0);
1600// cout << setw(13) << left << hit->fY << setw(0);
1601// cout << hit->fZ << setw(0) << endl;
1d8ae8b6 1602 if(hit->fX!=0.0 && hit->fY!=0.0 && hit->fZ!=0.0)
1603 gMUONClusters->SetNextPoint(hit->fX,hit->fY,hit->fZ);
1604 hit++;
1605 }// trig chamber loop
1606 trigrec++;
1607 }//trig hit loop
1608 }//else trigger
1609
1610 return iResult;
1611}
1612
cfa641b1 1613// -----------------------------------------------------------------
1614Int_t processMUONTracks(AliHLTHOMERBlockDesc* block) {
1615
1616 Int_t iResult = 0;
1617
1618 unsigned long size = block->GetSize();
1619 Int_t * buffer = (Int_t *)block->GetData();
1620 AliHLTMUONRecHitStruct hit1,hit2;
1621 hit1.fX = hit1.fY = hit1.fZ = hit2.fX = hit2.fY = hit2.fZ = 0;
1622 Int_t ch1=0, ch2=0;
1623 Float_t x0=0.0,y0=0.0,z0=0.0;
1624 Float_t x3=0.0,y3=0.0,z3=0.0;
1625 if(block->GetDataType().CompareTo("MANTRACK") == 0){
1626 AliHLTMUONMansoTracksBlockReader mantrackblock(buffer, size);
1627 const AliHLTMUONMansoTrackStruct* mtrack = mantrackblock.GetArray();
1628 for(AliHLTUInt32_t ientry = 0; ientry < mantrackblock.Nentries(); ientry++){
1629 const AliHLTMUONRecHitStruct* hit = &mtrack->fHit[0];
1630 for(AliHLTUInt32_t ch = 0; ch < 4; ch++){
1631 // cout << setw(10) << left << ch + 7 << setw(0);
1632 // cout << setw(13) << left << hit->fX << setw(0);
1633 // cout << setw(13) << left << hit->fY << setw(0);
1634 // cout << hit->fZ << setw(0) << endl;
1635 if(hit->fZ != 0.0){
1636 if(ch==0 || ch==1){
1637 hit1 = *hit; ch1 = ch+6;
1638 }else{
1639 hit2 = *hit; ch2 = ch+6;
1640 }
1641 }
1642 hit++;
1643 }// trig chamber loop
1644 // printf("ch : %d, (X,Y,Z) : (%f,%f,%f)\n",ch1,hit1.fX,hit1.fY,hit1.fZ);
1645 // printf("ch : %d, (X,Y,Z) : (%f,%f,%f)\n",ch2,hit2.fX,hit2.fY,hit2.fZ);
1646 // meminfo();
1647 z3 = AliMUONConstants::DefaultChamberZ(ch2+4);
1648 y3 = hit1.fY - (hit1.fZ-z3)*(hit1.fY - hit2.fY)/(hit1.fZ - hit2.fZ) ;
1649 x3 = hit1.fX - (hit1.fZ-z3)*(hit1.fX - hit2.fX)/(hit1.fZ - hit2.fZ) ;
1650
1651 z0 = AliMUONConstants::DefaultChamberZ(ch1);
1652 y0 = hit1.fY - (hit1.fZ-z0)*(hit1.fY - hit2.fY)/(hit1.fZ - hit2.fZ) ;
1653 x0 = hit1.fX - (hit1.fZ-z0)*(hit1.fX - hit2.fX)/(hit1.fZ - hit2.fZ) ;
1654
1655
1656 gMUONTracks->AddLine(x0,y0,z0,x3,y3,z3);
1657 mtrack++;
1658 }
1659 cout<<"NofManso Tracks : "<<mantrackblock.Nentries()<<endl;
1660 }
1661
1662 return iResult;
1663
1664}
1665
9e78371d 1666
1d8ae8b6 1667// -----------------------------------------------------------------
1668Int_t processTRDClusters(AliHLTHOMERBlockDesc* block, TEvePointSet *cont, TEvePointSetArray *contCol) {
1669
1670 Int_t iResult = 0;
1671
ea48ba6e 1672 Int_t sm = block->GetSubDetector();
1d8ae8b6 1673 if ( sm == 6 ) sm = 7;
ea48ba6e 1674
1d8ae8b6 1675 Float_t phi = ( sm + 0.5 ) * TMath::Pi() / 9.0;
1676 Float_t cos = TMath::Cos( phi );
1677 Float_t sin = TMath::Sin( phi );
1678
ea48ba6e 1679 Byte_t* ptrData = reinterpret_cast<Byte_t*>(block->GetData());
1d8ae8b6 1680 UInt_t ptrSize = block->GetSize();
1681
1682 for (UInt_t size = 0; size+sizeof(AliHLTTRDCluster) <= ptrSize; size+=sizeof(AliHLTTRDCluster) ) {
1683 AliHLTTRDCluster *cluster = reinterpret_cast<AliHLTTRDCluster*>(&(ptrData[size]));
1684
1685 AliTRDcluster *trdCluster = new AliTRDcluster;
1686 cluster->ExportTRDCluster( trdCluster );
1687
1688 contCol->Fill(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
1689 sin*trdCluster->GetX() + cos*trdCluster->GetY(),
1690 trdCluster->GetZ(),
1691 trdCluster->GetQ() );
1692
1693 cont->SetNextPoint(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
ea48ba6e 1694 sin*trdCluster->GetX() + cos*trdCluster->GetY(), trdCluster->GetZ());
1d8ae8b6 1695 }
1696
1697 return iResult;
1698}
1699
1700// -----------------------------------------------------------------
1701Int_t processTRDHistograms(AliHLTHOMERBlockDesc* block, TCanvas * canvas) {
1702
1703 Int_t iResult = 0;
1704
1705 if ( ! block->GetClassName().CompareTo("TH1D")) {
1706 TH1D* histo = reinterpret_cast<TH1D*>(block->GetTObject());
ea48ba6e 1707 ++gTRDHistoCount;
1d8ae8b6 1708
ea48ba6e 1709 TVirtualPad* pad = canvas->cd(gTRDHistoCount);
1d8ae8b6 1710 histo->Draw();
1711 pad->SetGridy();
1712 pad->SetGridx();
1713
1714 if ( ! strcmp(histo->GetName(), "nscls") ) {
1715 gTRDEvents = static_cast<Int_t>(histo->GetEntries());
1716 histo->GetXaxis()->SetRangeUser(0.,15.);
1717 }
1718
1719 if ( ! strcmp(histo->GetName(),"sclsdist") ||
1720 ! strcmp(histo->GetName(),"qClsCand") )
1721 pad->SetLogy();
1722 }
1723 else if ( ! block->GetClassName().CompareTo("TH2F")) {
1724 TH2F *hista = reinterpret_cast<TH2F*>(block->GetTObject());
ea48ba6e 1725 ++gTRDHistoCount;
1d8ae8b6 1726
ea48ba6e 1727 TVirtualPad* pad = canvas->cd(gTRDHistoCount);
1d8ae8b6 1728
1729 if (gTRDEvents > 0)
1730 hista->Scale(1./gTRDEvents);
1731
1732 hista->Draw("COLZ");
1733 pad->SetLogz();
1734 pad->SetGridy();
1735 pad->SetGridx();
1736 }
1737
1738 return iResult;
1739}
1740
cfa641b1 1741
1742// -----------------------------------------------------------------
1743Int_t processVertexHistograms(AliHLTHOMERBlockDesc* block, TCanvas * canvas) {
1744
1745 Int_t iResult = 0;
1746 cout << gVertexHistoCount<<endl;
1747
1748 if ( ! block->GetClassName().CompareTo("TH1F")) {
1749 cout << "TH1F"<<endl;
1750 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
1751 ++gVertexHistoCount;
1752
1753 canvas->cd(gVertexHistoCount);
1754 histo->Draw();
1755// pad->SetGridy();
1756// pad->SetGridx();
1757
1758 } else if ( ! block->GetClassName().CompareTo("TH2F")) {
1759 cout << "TH2F"<<endl;
1760 TH2F *hista = reinterpret_cast<TH2F*>(block->GetTObject());
1761 if (hista) {
1762
1763 ++gVertexHistoCount;
1764
1765 canvas->cd(gVertexHistoCount);
1766 hista->Draw();
1767 }
1768 }
1769 canvas->cd();
1770
1771 cout << "done with histos"<< endl;
1772 return iResult;
1773
1774
1775}
1776
1777//*--------------------------------------------------------------------------------------
1778Int_t processTRDCalibHistograms(AliHLTHOMERBlockDesc* block, TCanvas * canvas) {
1779 Int_t iResult = 0;
1780
1781 TObjArray *HistArray=(TObjArray*)block->GetTObject();
1782 Int_t nCalibHistos=HistArray->GetEntriesFast();
1783 for(Int_t CalibHistoCount=0;CalibHistoCount<nCalibHistos;CalibHistoCount++){
1784 canvas->cd(CalibHistoCount+1);
1785
1786 if(HistArray->At(CalibHistoCount)->InheritsFrom("TH2S")){
1787 TH2S *histCalib=(TH2S*)(HistArray->At(CalibHistoCount));
1788 histCalib->Draw("colz");
1789 }
1790 else if(HistArray->At(CalibHistoCount)->InheritsFrom("TH2")){
1791 //TH2D *histCalib=dynamic_cast<TH2D*>(HistArray->At(CalibHistoCount));
1792 TH2D *histCalib=(TH2D*)(HistArray->At(CalibHistoCount));
1793 histCalib->Draw("lego2");
1794 }
1795 else if(HistArray->At(CalibHistoCount)->InheritsFrom("TH1")){
1796 //TH1D *histCalib=dynamic_cast<TH1D*>(HistArray->At(CalibHistoCount));
1797 TH1D *histCalib=(TH1D*)(HistArray->At(CalibHistoCount));
1798 histCalib->Draw();
1799 }
1800 else if(HistArray->At(CalibHistoCount)->InheritsFrom("AliTRDCalibraVdriftLinearFit")){
1801 //TH2S *histCalib = ((dynamic_cast<AliTRDCalibraVdriftLinearFit*>(HistArray->At(CalibHistoCount)))->GetLinearFitterHisto(10,kTRUE));
1802 TH2S *histCalib =(TH2S*)(((AliTRDCalibraVdriftLinearFit*)HistArray->At(CalibHistoCount))->GetLinearFitterHisto(10,kTRUE));
1803
1804 histCalib->Draw();
1805 }
1806
1807
1808 }
1809 return iResult;
1810}
ea48ba6e 1811//****************************************************************************
1812
cfa641b1 1813void writeToFile(){
1814
1815 cout << "balle " << endl;
1816
1817 TList * bList = gHomerManager->GetBlockList();
1818 TFile * file = TFile::Open(Form("Event_0x%016X_ITS.root", gHomerManager->GetEventID()), "RECREATE");
1819 bList->Write("blockList", TObject::kSingleKey);
1820 file->Close();
1821
1822 bList = gHomerManager->GetAsyncBlockList();
1823 TFile * afile = TFile::Open(Form("Event_0x%016X_Async.root", gHomerManager->GetEventID()), "RECREATE");
1824 bList->Write("blockList", TObject::kSingleKey);
1825 afile->Close();
1826
1827
1828// TIter next(bList);
1829
1830// AliHLTHOMERBlockDesc* block = 0;
1831
1832// // -- Iterate over blocks in the block list
1833// // ------------------------------------------
1834// while ((block = (AliHLTHOMERBlockDesc*)next())) {
1835// cout << "balle " << endl;
1836// }
1837
1838}
1839
1840
ea48ba6e 1841// -----------------------------------------------------------------
1842void loopEvent() {
1843 eventTimer.SetCommand("nextEvent()");
1844 eventTimer.Start(6000);
1845}
1846
1847// -----------------------------------------------------------------
1848void stopLoopEvent() {
1849 eventTimer.Stop();
1850}
1851
1852
1853// -----------------------------------------------------------------
1854void loopEventFast() {
1855 eventTimerFast.SetCommand("nextEvent()");
1856 eventTimerFast.Start(500);
1857}
1858
1859// -----------------------------------------------------------------
1860void stopLoopEventFast() {
1861 eventTimerFast.Stop();
1862}
1863
1d8ae8b6 1864// -----------------------------------------------------------------
1865void EventLoopFast() {
1866
1867 // Start/stop event loop
1868 if ( gEventLoopStarted ) {
1869 loopEventFast();
1870 gEventLoopStarted = kTRUE;
cfa641b1 1871
1872 } else {
1d8ae8b6 1873 stopLoopEventFast();
1874 gEventLoopStarted = kFALSE;
cfa641b1 1875
1d8ae8b6 1876 }
1877}