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