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