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