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