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