Fixed bugs that made histograms being drawn on top of each other
[u/mrichter/AliRoot.git] / EVE / hlt-macros / od.C
CommitLineData
33791895 1//-*- Mode: C++ -*-
2
3// ** USED macros :
4// ***************************************************
5// - hlt_alieve_init.C
6// - VizDB_scan.C
7// - geom_gentle_hlt.C
8// - geom_gentle_muon.C
9// ***************************************************
10
11#if !defined(__CINT__) || defined(__MAKECINT__)
12
13//****************** ROOT ******************************************
14#include "TRandom.h"
15#include "TVirtualPad.h"
16#include "TGLViewer.h"
17#include "TThread.h"
18#include "TGFileBrowser.h"
19#include "TStyle.h"
20#include "TList.h"
21#include "TDirectory.h"
22#include "TFile.h"
23#include "TH2.h"
24#include "TCanvas.h"
25#include "TColor.h"
26#include "TVector3.h"
27
28//****************** ROOT/EVE **************************************
29#include "TEveManager.h"
30
31#include "AliEveHOMERManager.h"
32
33#include "geom_gentle_hlt.C"
34
35#endif
36
37
38
39// -----------------------------------------------------------------
40// -- Geometry / Scenes --
41// -----------------------------------------------------------------
42
43TEveGeoShape *gGeomGentle = 0;
44TEveGeoShape *gGeomGentleRPhi = 0;
45TEveGeoShape *gGeomGentleRhoZ = 0;
46TEveGeoShape *gGeomGentleTRD = 0;
47TEveGeoShape *gGeomGentleMUON = 0;
48
49TEveScene *gRPhiGeomScene = 0;
50TEveScene *gRhoZGeomScene = 0;
51TEveScene *gRPhiEventScene = 0;
52TEveScene *gRhoZEventScene = 0;
53
54TEveProjectionManager *gRPhiMgr = 0;
55TEveProjectionManager *gRhoZMgr = 0;
56
57TEveViewer *g3DView = 0;
58TEveViewer *gRPhiView = 0;
59TEveViewer *gRhoZView = 0;
60
61// -----------------------------------------------------------------
62// -- Geometry / Scenes Parameters --
63// -----------------------------------------------------------------
64
65// -- Parameters to show different geometries
66Bool_t gShowMUON = kTRUE;
67Bool_t gShowMUONRPhi = kFALSE;
68Bool_t gShowMUONRhoZ = kTRUE;
69Bool_t gShowTRD = kFALSE;
70
71
72// -----------------------------------------------------------------
73// -- Members --
74// -----------------------------------------------------------------
75
76// -- Timer for automatic event loop
77TTimer eventTimer;
78TTimer eventTimerFast;
79
80// -- HOMERManager
81AliEveHOMERManager* gHomerManager = 0;
82
83// -- Geometry Manager
84TGeoManager* gGeoManager = 0;
85AliPHOSGeometry* gPHOSGeom = 0;
86
87// -- Cluster members
88TEvePointSet* gSPDClusters = 0;
89TEvePointSet* gSSDClusters = 0;
90TEvePointSet* gSDDClusters = 0;
91TEvePointSet* gTRDClusters = 0;
92TEvePointSetArray* gTRDColClusters = 0;
93TEvePointSet* gTPCClusters = 0;
94TEvePointSet* gTPCTestClusters = 0;
95TEvePointSetArray* gTPCColClusters = 0;
96TEveBoxSet* gPHOSBoxSet[5] = {0, 0, 0, 0, 0};
97TEveBoxSet* gEMCALBoxSet[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
98TEvePointSet* gMUONClusters = 0;
99TEveStraightLineSet* gMUONTracks = 0;
100
101// -- Text output members
102TEveText* gHLTText = 0;
103
104// -- Tracks members
105TEveTrackList* gTPCTrack = 0;
106
107// -- Canvas for histograms
108TCanvas* gTRDCanvas = 0;
109TCanvas* gTPCCanvas = 0;
110TCanvas* gTPCClustCanvas = 0;
111TCanvas* gTRDCalibCanvas = 0;
112TCanvas* gTRDEORCanvas = 0;
113TCanvas* gPrimVertexCanvas = 0;
114TCanvas* gSPDVertexCanvas = 0;
115TCanvas* gITSCanvas = 0;
116TCanvas* gSSDCanvas0 = 0;
117TCanvas* gSSDCanvas1 = 0;
118TCanvas* gV0Canvas = 0;
119TCanvas* gPHOSCanvas = NULL;
120TCanvas* gEMCALCanvas = 0;
121
122// -- vertex --
123Int_t gSPDVertexHistoCount = 0;
124
125
126
127// -- TRD --
128Int_t gTRDHistoCount = 0;
129Int_t gTRDEvents = 0;
130Int_t gTRDBins = 12;
131
132// -- TPC --
133Int_t gTPCBins = 15;
134TH1F* gTPCCharge = 0;
135TH1F* gTPCQMax = 0;
136TH1F* gTPCQMaxOverCharge = 0;
137
138TH1F* gTPCPt = 0; // KK
139TH1F* gTPCEta = 0;
140TH1F* gTPCPsi = 0;
141TH1F* gTPCnClusters = 0;
142TH1F* gTPCMult = 0;
143
144// -- PHOS --
145TEveElementList* gPHOSElementList = 0;
146Int_t gPHOSHistoCount =0;
147// -- EMCAL
148TEveElementList* gEMCALElementList = 0;
149TGeoNode* gEMCALNode = 0;
150Int_t gEMCALHistoCount =0;
151
152// --- Flag if eventloop is running
153Bool_t gEventLoopStarted = kFALSE;
154
155
156
157//Container for gGeoManager till it is broken
158TGeoManager *fGeoManager = 0;
159// -----------------------------------------------------------------
160// -- Methods --
161// -----------------------------------------------------------------
162
163Int_t initializeEveViewer( Bool_t showBarrel, Bool_t showMuon );
164
165void writeToFile();
166
167
168// #################################################################
169// #################################################################
170// #################################################################
171
172// -----------------------------------------------------------------
173void od ( Bool_t showBarrel = kTRUE, Bool_t showMuon = kFALSE ) {
174
175 // -- Loading Geometry
176 // ---------------------
177 Int_t run = 67179;
178 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
179 AliCDBManager::Instance()->SetRun(run);
180 AliGeomManager::LoadGeometry();
181
182
183 // Get the pointer to gGeoManager before it's broken (bug in alieve)
184 fGeoManager = gGeoManager;
185
186 // -- Initialize pointsets and add macros
187 // ----------------------------------------
188 //TEveUtil::LoadMacro("hlt_alieve_init.C");
189 //hlt_alieve_init(".", -1);
190
191 // -- Initialize Eve
192 // -------------------
193 initializeEveViewer( showBarrel, showMuon );
194
195 // -- Reset gGeoManager to the original pointer
196 // ----------------------------------------------
197
198 // -- Finalize Eve
199 // -----------------
200 gSystem->ProcessEvents();
201 gEve->Redraw3D(kTRUE);
202
203 // -- Create new hM object
204 // -------------------------
205 gHomerManager = new AliEveHOMERManager();
206 gHomerManager->SetRetryCount(1000,15);
207 gHomerManager->SetEveManager(gEve);
208 gHomerManager->SetGeoManager(gGeoManager);
209 gHomerManager->SetRPhiManager(gRPhiMgr);
210 gHomerManager->SetRPhiEventScene(gRPhiEventScene);
211 gHomerManager->SetRhoZManager(gRhoZMgr);
212 gHomerManager->SetRhoZEventScene(gRhoZEventScene);
213 gHomerManager->SetBarrelFlag(showBarrel);
214 gHomerManager->SetMuonFlag(showMuon);
215
216 Int_t iResult = gHomerManager->Initialize();
217 if (iResult) {
218 printf("Error Initializing AliHLTHOMERManager, quitting");
219 return;
220 }
221
222 // -- Add hM to EveTree
223 // ----------------------
224 gEve->AddToListTree(gHomerManager, kTRUE);
225
226 // -- Create SourceList
227 // ----------------------
228 iResult = gHomerManager->CreateEveSourcesListLoop();
229 if (iResult) {
230 printf ("Couldn't find active services. Giving up. \n");
231 return;
232 }
233
234
235 if ( showBarrel ) {
236 gHomerManager->ConnectEVEtoHOMER("TPC" );
237 } else if ( MUONMode ) {
238 gHomerManager->ConnectEVEtoHOMER("MUON");
239 } else if( TRDMode ) {
240 gHomerManager->ConnectEVEtoHOMER("TRD");
241 } else {
242 cout<<" No detectors selected, nothing will be displayed"<<endl;
243 }
244
245 gGeoManager = fGeoManager;
246
247
248}
249
250// -------------------------------------------------------------------------
251Int_t initializeEveViewer( Bool_t showBarrel, Bool_t showMuon ) {
252
253 //=============================================================================
254 // Visualization database
255 //============================================================================
256
257 TEveUtil::AssertMacro("VizDB_scan.C");
258
259 // alieve_vizdb();
260
261
262
263 //==============================================================================
264 // -- Geometry, scenes, projections and viewers
265 //==============================================================================
266
267 TEveBrowser *browser = gEve->GetBrowser();
268 browser->ShowCloseTab(kFALSE);
269
270 // -- Disable extra geometry
271 // ---------------------------
272 if (!showMuon)
273 gShowMUON = gShowMUONRPhi = gShowMUONRhoZ = kFALSE;
274
275 // -- Load Geometry
276 // ------------------
277 TEveUtil::LoadMacro("geom_gentle_hlt.C");
278 gGeomGentle = geom_gentle_hlt();
279 gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy();
280 gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy();
281 gGeomGentleTRD = geom_gentle_trd();
282
283 gGeoManager = fGeoManager;
284
285 gEMCALNode = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
286
287 TEveGeoTopNode* emcal_re = new TEveGeoTopNode(gGeoManager, gEMCALNode);
288 gEve->AddGlobalElement(emcal_re);
289 gEve->Redraw3D();
290
291 if (gShowMUON)
292 gGeomGentleMUON = geom_gentle_muon(kFALSE);
293
294 // -- Scenes
295 // -----------
296 gRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry",
297 "Scene holding projected geometry for the RPhi view.");
298 gRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry",
299 "Scene holding projected geometry for the RhoZ view.");
300 gRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
301 "Scene holding projected geometry for the RPhi view.");
302 gRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
303 "Scene holding projected geometry for the RhoZ view.");
304
305 // -- Projection managers
306 // ------------------------
307
308 gRPhiMgr = new TEveProjectionManager();
309 gRPhiMgr->SetProjection(TEveProjection::kPT_RPhi);
310 gEve->AddToListTree(gRPhiMgr, kFALSE);
311 {
312 TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr);
313 a->SetMainColor(kWhite);
314 a->SetTitle("R-Phi");
315 a->SetTitleSize(0.05);
316 a->SetTitleFont(102);
317 a->SetLabelSize(0.025);
318 a->SetLabelFont(102);
319 gRPhiGeomScene->AddElement(a);
320 }
321 gRPhiMgr->SetCurrentDepth(-10);
322 gRPhiMgr->ImportElements(gGeomGentleRPhi, gRPhiGeomScene);
323 gRPhiMgr->SetCurrentDepth(0);
324 gRPhiMgr->ImportElements(gGeomGentleTRD, gRPhiGeomScene);
325 if (gShowMUONRPhi) gRPhiMgr->ImportElements(gGeomGentleMUON, gRPhiGeomScene);
326
327 gRhoZMgr = new TEveProjectionManager();
328 gRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ);
329 gEve->AddToListTree(gRhoZMgr, kFALSE);
330 {
331 TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr);
332 a->SetMainColor(kWhite);
333 a->SetTitle("Rho-Z");
334 a->SetTitleSize(0.05);
335 a->SetTitleFont(102);
336 a->SetLabelSize(0.025);
337 a->SetLabelFont(102);
338 gRhoZGeomScene->AddElement(a);
339 }
340 gRhoZMgr->SetCurrentDepth(-10);
341 gRhoZMgr->ImportElements(gGeomGentleRhoZ, gRhoZGeomScene);
342 gRhoZMgr->SetCurrentDepth(0);
343 gRhoZMgr->ImportElements(gGeomGentleTRD, gRhoZGeomScene);
344
345 if (gShowMUONRhoZ) gRhoZMgr->ImportElements(gGeomGentleMUON, gRhoZGeomScene);
346
347 // -- Viewers
348 // ------------
349
350 TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
351 TEveWindowPack *pack = slot->MakePack();
352 pack->SetElementName("Multi View");
353 pack->SetHorizontal();
354 pack->SetShowTitleBar(kFALSE);
355 pack->NewSlot()->MakeCurrent();
356 g3DView = gEve->SpawnNewViewer("3D View", "");
357 g3DView->AddScene(gEve->GetGlobalScene());
358 g3DView->AddScene(gEve->GetEventScene());
359
33791895 360
361 pack = pack->NewSlot()->MakePack();
362 pack->SetShowTitleBar(kFALSE);
363 pack->NewSlot()->MakeCurrent();
364 gRPhiView = gEve->SpawnNewViewer("RPhi View", "");
365 gRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
366 gRPhiView->AddScene(gRPhiGeomScene);
367 gRPhiView->AddScene(gRPhiEventScene);
368
369 pack->NewSlot()->MakeCurrent();
370 gRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
371 gRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
372 gRhoZView->AddScene(gRhoZGeomScene);
373 gRhoZView->AddScene(gRhoZEventScene);
374
375
376
377 //Add HLT Text to windows
378
379 TGLOverlayButton *ob1 = new TGLOverlayButton(g3DView->GetGLViewer(), "HLT", 0, 20, 110, 60);
380 ob1->SetAlphaValues(0.8, 0.8);
381 // cout << "color" << ob1->GetBackColor() << endl;
382 //ob1->SetBackColor(8421631);
383 //ob1->SetBackColor(10492431);
384 TGLOverlayButton *ob2 = new TGLOverlayButton(g3DView->GetGLViewer(), "ALICE", 0, 0, 110, 20);
385 ob2->SetAlphaValues(0.8, 0.8);
386 //ob2->SetBackColor(0.2);
387 TGLOverlayButton *ob3 = new TGLOverlayButton(gEve->GetDefaultGLViewer(), "HLT", 0, 20, 110, 60);
388 ob3->SetAlphaValues(0.8, 0.8);
389 TGLOverlayButton *ob4 = new TGLOverlayButton(gEve->GetDefaultGLViewer(), "ALICE", 0, 0, 110, 20);
390 ob4->SetAlphaValues(0.8, 0.8);
391
392
393 TGLOverlayButton *ne = new TGLOverlayButton(gEve->GetDefaultGLViewer(), "Next Event", 110, 0, 210, 20);
394 ne->SetAlphaValues(0.0, 0.8);
395
396 // -- List of Viewers
397 // --------------------
398
399 TEveViewerList *viewerlist = new TEveViewerList();
400 viewerlist->AddElement(gEve->GetDefaultViewer());
401
402 viewerlist->AddElement(g3DView);
403 viewerlist->AddElement(gRhoZView);
404 viewerlist->AddElement(gRPhiView);
405 viewerlist->SwitchColorSet();
406
407 //==============================================================================
408 // -- Macros / QA histograms
409 //==============================================================================
410
411 // -- Registration of per-event macros
412 // -------------------------------------
413
414 AliEveMacroExecutor *exec = new AliEveMacroExecutor();
415
416
417
418 gStyle->SetPalette(1, 0);
419
420
421
422 return 0;
423}
424
425// -----------------------------------------------------------------
426void nextEvent() {
427
428 if ( gHomerManager->NextEvent() ) {
429 if (gEventLoopStarted) {
430 cout << "HomerManager failed getting next event, trying to reconnect" << endl;
431
432 gHomerManager->DisconnectHOMER();
433 gHomerManager->ConnectEVEtoHOMER();
434 nextEvent();
435
436 } else {
437 return;
438 }
439 }
440
441 // processEvent();
442}
443
444
445
446// -----------------------------------------------------------------
447
448
449Int_t updateDisplay() {
450
451 Int_t iResult = 0;
452
453
454
455 //==============================================================================
456 // -- Set EventID in Window Title
457 // -- Update Objects
458 //==============================================================================
459
460 TString winTitle("Eve Main Window -- Event ID : ");
461 winTitle += Form("0x%016X ", gHomerManager->GetEventID() );
462 gEve->GetBrowser()->SetWindowName(winTitle);
463
464 //==============================================================================
465 // -- Set Projections
466 //==============================================================================
467
468 // XXX Primary vertex ... to be retrieved from the ESD
469 Double_t x[3] = { 0, 0, 0 };
470
471 TEveElement* top = gEve->GetCurrentEvent();
472
473 if (gRPhiMgr && top) {
474 gRPhiEventScene->DestroyElements();
475 if (gCenterProjectionsAtPrimaryVertex)
476 gRPhiMgr->SetCenter(x[0], x[1], x[2]);
477 gRPhiMgr->ImportElements(top, gRPhiEventScene);
478 }
479
480 if (gRhoZMgr && top) {
481 gRhoZEventScene->DestroyElements();
482 if (gCenterProjectionsAtPrimaryVertex)
483 gRhoZMgr->SetCenter(x[0], x[1], x[2]);
484 gRhoZMgr->ImportElements(top, gRhoZEventScene);
485 }
486
487 //==============================================================================
488
489 gEve->Redraw3D(0,1); // (0, 1)
490 gEve->EnableRedraw();
491
492 return iResult;
493
494}
495
496
497
498// -----------------------------------------------------------------
499Int_t processROOTTOBJ(AliHLTHOMERBlockDesc* block, TEveText* /*et*/) {
500
501 // -- AliHLTGlobalTriggerDecision
502 if ( ! block->GetClassName().CompareTo("AliHLTGlobalTriggerDecision") ) {
503
504 AliHLTGlobalTriggerDecision *trig = dynamic_cast<AliHLTGlobalTriggerDecision*>( block->GetTObject());
505 trig->Print();
506
507 // et->SetText("balle");;
508
509 // TEveText* tt = new TEveText("Trigger: Class is known ;-) ");
510 // gEve->AddElement(tt);
511
512 }
513 else {
514 printf(" Unknown root object %s",block->GetClassName().Data() );
515 }
516
517 return 0;
518}
519
520
521// -----------------------------------------------------------------
522Int_t processMUONClusters(AliHLTHOMERBlockDesc* block) {
523
524 Int_t iResult = 0;
525
526 unsigned long size = block->GetSize();
527 Int_t * buffer ;
528
529 buffer = (Int_t *)block->GetData();
530// cout<<"block size : "<<size<<", buffer : "<<buffer<<", DataType : "<<block->GetDataType()<<endl;
531
532// // for(int idata=0;idata<int(size);idata++)
533// // printf("\tbuffer[%d] : %d\n",idata,buffer[idata]);
534
535
536
537 if(block->GetDataType().CompareTo("RECHITS") == 0){
538
539 AliHLTMUONRecHitsBlockReader trackblock((char*)buffer, size);
540 const AliHLTMUONRecHitStruct* hit = trackblock.GetArray();
541
542 for(AliHLTUInt32_t ientry = 0; ientry < trackblock.Nentries(); ientry++){
543// cout << setw(13) << left << hit->fX << setw(0);
544// cout << setw(13) << left << hit->fY << setw(0);
545// cout << hit->fZ << setw(0) << endl;
546 if(hit->fX!=0.0 && hit->fY!=0.0 && hit->fZ!=0.0)
547 gMUONClusters->SetNextPoint(hit->fX,hit->fY,hit->fZ);
548 hit++;
549
550 }// track hit loop
551 }
552
553 else{// if rechits
554 // if(!strcmp((BlockType(ULong64_t(reader->GetBlockDataType(i)))).Data(),"TRIGRECS")){
555
556 AliHLTMUONTriggerRecordsBlockReader trigblock(buffer, size);
557 const AliHLTMUONTriggerRecordStruct* trigrec = trigblock.GetArray();
558 for(AliHLTUInt32_t ientry = 0; ientry < trigblock.Nentries(); ientry++){
559
560 const AliHLTMUONRecHitStruct* hit = &trigrec->fHit[0];
561 for(AliHLTUInt32_t ch = 0; ch < 4; ch++)
562 {
563// cout << setw(10) << left << ch + 11 << setw(0);
564// cout << setw(13) << left << hit->fX << setw(0);
565// cout << setw(13) << left << hit->fY << setw(0);
566// cout << hit->fZ << setw(0) << endl;
567 if(hit->fX!=0.0 && hit->fY!=0.0 && hit->fZ!=0.0)
568 gMUONClusters->SetNextPoint(hit->fX,hit->fY,hit->fZ);
569 hit++;
570 }// trig chamber loop
571 trigrec++;
572 }//trig hit loop
573 }//else trigger
574
575 return iResult;
576}
577
578// -----------------------------------------------------------------
579Int_t processMUONTracks(AliHLTHOMERBlockDesc* block) {
580
581 Int_t iResult = 0;
582
583 unsigned long size = block->GetSize();
584 Int_t * buffer = (Int_t *)block->GetData();
585 AliHLTMUONRecHitStruct hit1,hit2;
586 hit1.fX = hit1.fY = hit1.fZ = hit2.fX = hit2.fY = hit2.fZ = 0;
587 Int_t ch1=0, ch2=0;
588 Float_t x0=0.0,y0=0.0,z0=0.0;
589 Float_t x3=0.0,y3=0.0,z3=0.0;
590 if(block->GetDataType().CompareTo("MANTRACK") == 0){
591 AliHLTMUONMansoTracksBlockReader mantrackblock(buffer, size);
592 const AliHLTMUONMansoTrackStruct* mtrack = mantrackblock.GetArray();
593 for(AliHLTUInt32_t ientry = 0; ientry < mantrackblock.Nentries(); ientry++){
594 const AliHLTMUONRecHitStruct* hit = &mtrack->fHit[0];
595 for(AliHLTUInt32_t ch = 0; ch < 4; ch++){
596 // cout << setw(10) << left << ch + 7 << setw(0);
597 // cout << setw(13) << left << hit->fX << setw(0);
598 // cout << setw(13) << left << hit->fY << setw(0);
599 // cout << hit->fZ << setw(0) << endl;
600 if(hit->fZ != 0.0){
601 if(ch==0 || ch==1){
602 hit1 = *hit; ch1 = ch+6;
603 }else{
604 hit2 = *hit; ch2 = ch+6;
605 }
606 }
607 hit++;
608 }// trig chamber loop
609 // printf("ch : %d, (X,Y,Z) : (%f,%f,%f)\n",ch1,hit1.fX,hit1.fY,hit1.fZ);
610 // printf("ch : %d, (X,Y,Z) : (%f,%f,%f)\n",ch2,hit2.fX,hit2.fY,hit2.fZ);
611 // meminfo();
612 z3 = AliMUONConstants::DefaultChamberZ(ch2+4);
613 y3 = hit1.fY - (hit1.fZ-z3)*(hit1.fY - hit2.fY)/(hit1.fZ - hit2.fZ) ;
614 x3 = hit1.fX - (hit1.fZ-z3)*(hit1.fX - hit2.fX)/(hit1.fZ - hit2.fZ) ;
615
616 z0 = AliMUONConstants::DefaultChamberZ(ch1);
617 y0 = hit1.fY - (hit1.fZ-z0)*(hit1.fY - hit2.fY)/(hit1.fZ - hit2.fZ) ;
618 x0 = hit1.fX - (hit1.fZ-z0)*(hit1.fX - hit2.fX)/(hit1.fZ - hit2.fZ) ;
619
620
621 gMUONTracks->AddLine(x0,y0,z0,x3,y3,z3);
622 mtrack++;
623 }
624 cout<<"NofManso Tracks : "<<mantrackblock.Nentries()<<endl;
625 }
626
627 return iResult;
628
629}
630
631
632// -----------------------------------------------------------------
633Int_t processTRDClusters(AliHLTHOMERBlockDesc* block, TEvePointSet *cont, TEvePointSetArray *contCol) {
634
635 Int_t iResult = 0;
636
637 Int_t sm = block->GetSubDetector();
638 if ( sm == 6 ) sm = 7;
639
640 Float_t phi = ( sm + 0.5 ) * TMath::Pi() / 9.0;
641 Float_t cos = TMath::Cos( phi );
642 Float_t sin = TMath::Sin( phi );
643
644 Byte_t* ptrData = reinterpret_cast<Byte_t*>(block->GetData());
645 UInt_t ptrSize = block->GetSize();
646
647 for (UInt_t size = 0; size+sizeof(AliHLTTRDCluster) <= ptrSize; size+=sizeof(AliHLTTRDCluster) ) {
648 AliHLTTRDCluster *cluster = reinterpret_cast<AliHLTTRDCluster*>(&(ptrData[size]));
649
650 AliTRDcluster *trdCluster = new AliTRDcluster;
651 cluster->ExportTRDCluster( trdCluster );
652
653 contCol->Fill(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
654 sin*trdCluster->GetX() + cos*trdCluster->GetY(),
655 trdCluster->GetZ(),
656 trdCluster->GetQ() );
657
658 cont->SetNextPoint(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
659 sin*trdCluster->GetX() + cos*trdCluster->GetY(), trdCluster->GetZ());
660 }
661
662 return iResult;
663}
664
665// -----------------------------------------------------------------
666Int_t processTRDHistograms(AliHLTHOMERBlockDesc* block, TCanvas * canvas) {
667
668 Int_t iResult = 0;
669
670 if ( ! block->GetClassName().CompareTo("TH1F")) {
671 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
672 ++gTRDHistoCount;
673
674 TVirtualPad* pad = canvas->cd(gTRDHistoCount);
675 histo->Draw();
676 pad->SetGridy();
677 pad->SetGridx();
678
679 if ( ! strcmp(histo->GetName(), "nscls") ) {
680 gTRDEvents = static_cast<Int_t>(histo->GetEntries());
681 histo->GetXaxis()->SetRangeUser(0.,15.);
682 }
683
684 if ( ! strcmp(histo->GetName(),"sclsdist") ||
685 ! strcmp(histo->GetName(),"evSize") )
686 pad->SetLogy();
687 }
688
689 gTRDCanvas->Update();
690
691 return iResult;
692}
693
694// -----------------------------------------------------------------
695Int_t processPrimVertexHistograms(AliHLTHOMERBlockDesc* block, TCanvas * canvas) {
696
697 Int_t iResult = 0;
698
699 if ( ! block->GetClassName().CompareTo("TH1F")) {
700 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
701 if( histo ){
702 TString name(histo->GetName());
703 if( !name.CompareTo("primVertexZ") ){
704 canvas->cd(2);
705 histo->Draw();
706 }else if( !name.CompareTo("primVertexX") ){
707 canvas->cd(3);
708 histo->Draw();
709 }else if( !name.CompareTo("primVertexY") ){
710 canvas->cd(4);
711 histo->Draw();
712 }
713 }
714 } else if ( ! block->GetClassName().CompareTo("TH2F")) {
715 TH2F *hista = reinterpret_cast<TH2F*>(block->GetTObject());
716 if (hista ){
717 TString name(hista->GetName());
718 if( !name.CompareTo("primVertexXY")) {
719 canvas->cd(1);
720 hista->Draw();
721 }
722 }
723 }
724 canvas->cd();
725
726 return iResult;
727}
728
729// -----------------------------------------------------------------
730Int_t processSPDVertexHistograms(AliHLTHOMERBlockDesc* block, TCanvas * canvas) {
731
732 Int_t iResult = 0;
733
734 if ( ! block->GetClassName().CompareTo("TH1F")) {
735 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
736 ++gSPDVertexHistoCount;
737
738 canvas->cd(gSPDVertexHistoCount);
739 histo->Draw();
740
741 }
742 else if ( ! block->GetClassName().CompareTo("TH2F")) {
743 TH2F *hista = reinterpret_cast<TH2F*>(block->GetTObject());
744 if (hista) {
745 ++gSPDVertexHistoCount;
746
747 canvas->cd(gSPDVertexHistoCount);
748 hista->Draw();
749 }
750 }
751 canvas->cd();
752
753 return iResult;
754}
755
756// -----------------------------------------------------------------
757Int_t processV0Histograms(AliHLTHOMERBlockDesc* block, TCanvas * canvas) {
758
759 cout << "Processing to see if it's V0 histogram, !!!!!!!!!"<<endl;
760
761 Int_t iResult = 0;
762 bool update = 0;
763 if ( ! block->GetClassName().CompareTo("TH1F")) {
764 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
765 if( histo ){
766 TString name(histo->GetName());
767 if( !name.CompareTo("hKShort") ){
768 canvas->cd(1);
769 histo->Draw();
770 update = 1;
771 }else if( !name.CompareTo("hLambda") ){
772 canvas->cd(3);
773 histo->Draw();
774 update = 1;
775 }
776 }
777 } else if ( ! block->GetClassName().CompareTo("TH2F")) {
778 TH2F *hista = reinterpret_cast<TH2F*>(block->GetTObject());
779 if (hista ){
780 TString name(hista->GetName());
781 if( !name.CompareTo("hAP")) {
782 canvas->cd(2);
783 hista->Draw();
784 update = 1;
785 }
786 else if( !name.CompareTo("hGammaXY")) {
787 canvas->cd(4);
788 hista->Draw();
789 update = 1;
790 }
791 }
792 }
793 if( update ){
794 canvas->cd();
795 canvas->Update();
796 }
797 return iResult;
798}
799
800
801
802//*--------------------------------------------------------------------------------------
803Int_t processTRDCalibHistograms(AliHLTHOMERBlockDesc* block, TCanvas * canvas) {
804 Int_t iResult = 0;
805
806 TObjArray *HistArray=(TObjArray*)block->GetTObject();
807 Int_t nCalibHistos=HistArray->GetEntriesFast();
808 for(Int_t CalibHistoCount=0;CalibHistoCount<nCalibHistos;CalibHistoCount++){
809 canvas->cd(CalibHistoCount+1);
810
811 if(HistArray->At(CalibHistoCount)->InheritsFrom("TH2S")){
812 TH2S *histCalib=(TH2S*)(HistArray->At(CalibHistoCount));
813 histCalib->Draw("colz");
814 }
815 else if(HistArray->At(CalibHistoCount)->InheritsFrom("TH2")){
816 //TH2D *histCalib=dynamic_cast<TH2D*>(HistArray->At(CalibHistoCount));
817 TH2D *histCalib=(TH2D*)(HistArray->At(CalibHistoCount));
818 histCalib->Draw("lego2");
819 }
820 else if(HistArray->At(CalibHistoCount)->InheritsFrom("TH1")){
821 //TH1D *histCalib=dynamic_cast<TH1D*>(HistArray->At(CalibHistoCount));
822 TH1D *histCalib=(TH1D*)(HistArray->At(CalibHistoCount));
823 histCalib->Draw();
824 }
825 else if(HistArray->At(CalibHistoCount)->InheritsFrom("AliTRDCalibraVdriftLinearFit")){
826 //TH2S *histCalib = ((dynamic_cast<AliTRDCalibraVdriftLinearFit*>(HistArray->At(CalibHistoCount)))->GetLinearFitterHisto(10,kTRUE));
827 TH2S *histCalib =(TH2S*)(((AliTRDCalibraVdriftLinearFit*)HistArray->At(CalibHistoCount))->GetLinearFitterHisto(10,kTRUE));
828
829 histCalib->Draw();
830 }
831
832
833 }
834
835 gTRDCalibCanvas->Update();
836
837 return iResult;
838}
839//****************************************************************************
840
841
842
843
844void writeToFile(){
845
846 TList * bList = gHomerManager->GetBlockList();
847 if(bList){
848 TFile * file = TFile::Open(Form("Event_0x%016X_ITS.root", gHomerManager->GetEventID()), "RECREATE");
849 bList->Write("blockList", TObject::kSingleKey);
850 file->Close();
851 }
852
853 bList = gHomerManager->GetAsyncBlockList();
854 if(bList){
855 TFile * afile = TFile::Open(Form("Event_0x%016X_Async.root", gHomerManager->GetEventID()), "RECREATE");
856 bList->Write("blockList", TObject::kSingleKey);
857 }afile->Close();
858
859}
860
861
862// -----------------------------------------------------------------
863void loopEvent() {
864 eventTimer.SetCommand("nextEvent()");
865 eventTimer.Start(3000);
866}
867
868// -----------------------------------------------------------------
869void stopLoopEvent() {
870 eventTimer.Stop();
871}
872
873
874
875
876Int_t processTRDBlock (AliHLTHOMERBlockDesc * block) {
877
878 Int_t iResult = 0;
879
880 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
881
882 if(!gTRDClusters){
883 gTRDClusters = new TEvePointSet("TRD Clusters");
884 gTRDClusters->SetMainColor(kBlue);
885 gTRDClusters->SetMarkerStyle((Style_t)kFullDotSmall);
886 //gEve->AddElement(gTRDClusters);
887 }
888
889 if(!gTRDColClusters){
890 gTRDColClusters = new TEvePointSetArray("TRD Clusters Colorized");
891 gTRDColClusters->SetMainColor(kRed);
892 gTRDColClusters->SetMarkerStyle(4); // antialiased circle
893 // gTRDColClusters->SetMarkerStyle((Style_t)kFullDotSmall);
894 gTRDColClusters->SetMarkerSize(0.4);
895 gTRDColClusters->InitBins("Cluster Charge", gTRDBins, 0., gTRDBins*100.);
896
897 //TColor::SetPalette(1, 0); // Spectrum palette
898 const Int_t nCol = TColor::GetNumberOfColors();
899 for (Int_t ii = 0; ii < gTRDBins+1; ++ii)
900 gTRDColClusters->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (gTRDBins+2)));
901
902 gEve->AddElement(gTRDColClusters);
903 }
904
905 iResult = processTRDClusters( block, gTRDClusters, gTRDColClusters );
906 //gTRDClusters->ElementChanged();
907 gTRDColClusters->ElementChanged();
908 }
909
910 // -- Process TRD Histograms
911 else if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
912 if(!gTRDCanvas) {
913 gTRDCanvas = createCanvas("TRD", "TRD");
914 gTRDCanvas->Divide(3,2);
915 }
916 iResult = processTRDHistograms( block, gTRDCanvas );
917 }
918
919 else if(block->GetDataType().CompareTo("CALIBRAH")==0){
920
921 if(!gTRDCalibCanvas){
922 gTRDCalibCanvas = createCanvas("TRD Calib", "TRD Calib");
923 gTRDCalibCanvas->Divide(2,2);
924 }
925
926 iResult=processTRDCalibHistograms(block,gTRDCalibCanvas);
927 }
928
929 else if(block->GetDataType().CompareTo("CALIBEOR")==0){
930
931 if(!gTRDEORCanvas){
932 gTRDEORCanvas = createCanvas("TRD QA", "TRD QA");
933 gTRDEORCanvas->Divide(3,2);
934 }
935
936 iResult=processTRDCalibHistograms(block,gTRDEORCanvas);
937 }
938 return iResult;
939}
940
941
942
943
944
945
946void processHLTBlock(AliHLTHOMERBlockDesc * block) {
947
948 if ( ! block->GetDataType().CompareTo("ALIESDV0") ) {
949 if(!gTPCTrack){
950 gTPCTrack = new TEveTrackList("ESD Tracks");
951 gTPCTrack->SetMainColor(6);
952 gEve->AddElement(gTPCTrack);
953 }
954
955 processEsdTracks(block, gTPCTrack);
956 gTPCTrack->ElementChanged();
957 }
958
959 else if ( ! block->GetDataType().CompareTo("ROOTTOBJ") ) {
960 processROOTTOBJ( block, gHLTText );
961 }
962
963 else if ( ! block->GetDataType().CompareTo("HLTRDLST") ) {
964 processHLTRDLST( block );
965 }
966
967 else if ( !block->GetDataType().CompareTo("ROOTHIST") ) {
968 processPrimVertexHistograms( block , gPrimVertexCanvas);
969 gPrimVertexCanvas->Update();
970 }
971
972}