]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONDisplay.cxx
Dummy implementation of Alarms
[u/mrichter/AliRoot.git] / MUON / AliMUONDisplay.cxx
CommitLineData
a9e2aefa 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
88cb7938 16/* $Id$ */
a9e2aefa 17
18//////////////////////////////////////////////////////////////////////////
19// //
20// AliDisplay //
21// //
22// Utility class to display ALICE outline, tracks, hits,.. //
23// //
24//////////////////////////////////////////////////////////////////////////
25
a9e2aefa 26#include <TButton.h>
27#include <TColor.h>
28#include <TCanvas.h>
29#include <TView.h>
30#include <TText.h>
a9e2aefa 31#include <TPaveLabel.h>
32#include <TPaveText.h>
a9e2aefa 33#include <TDiamond.h>
34#include <TNode.h>
35#include <TArc.h>
a9e2aefa 36#include <TSlider.h>
a9e2aefa 37#include <TVirtualX.h>
38#include <TMath.h>
94de3818 39#include <TGeometry.h>
a9e2aefa 40#include <TMarker3DBox.h>
572d5bb2 41#include <TParticle.h>
e516b01d 42#include <TPolyLine3D.h>
a9e2aefa 43
30178c30 44#include "AliMUONDisplay.h"
a9e2aefa 45#include "AliRun.h"
a9e2aefa 46#include "AliMUON.h"
a9e2aefa 47#include "AliMUONPoints.h"
d226f81b 48#include "AliMUONGlobalTrigger.h"
9e1a0ddb 49#include "AliHeader.h"
a9e2aefa 50
51#include "AliMUONHit.h"
a9e2aefa 52#include "AliMUONDigit.h"
53#include "AliMUONRawCluster.h"
572d5bb2 54#include "AliMUONTrack.h"
55#include "AliMUONTrackParam.h"
a9e2aefa 56
a30a000f 57#include "AliSegmentation.h"
a9e2aefa 58#include "AliMUONChamber.h"
f665c1ea 59#include "AliMUONConstants.h"
5d12ce38 60#include "AliMC.h"
8c343c7c 61#include "AliLog.h"
a9e2aefa 62// to manage the same zoom on both cathodes
63
64
65
66ClassImp(AliMUONDisplay)
67
68
69//_____________________________________________________________________________
70AliMUONDisplay::AliMUONDisplay()
30178c30 71 : AliDisplay()
a9e2aefa 72{
73// Constructor
d226f81b 74 fPoints = 0;
75 fPhits = 0;
76 fRpoints = 0;
77 fCanvas = 0;
a9e2aefa 78 fNextCathode = kFALSE;
d226f81b 79 fColPad = 0;
a9e2aefa 80}
81
82//_____________________________________________________________________________
307d9d04 83AliMUONDisplay::AliMUONDisplay(Int_t size, AliLoader * loader)
30178c30 84 : AliDisplay()
a9e2aefa 85{
86// Create an event display object.
87// A canvas named "edisplay" is created with a vertical size in pixels
88//
89// A QUICK Overview of the Event Display functions
90// ===============================================
91//
92// The event display can ve invoked by executing the macro "display.C"
93// A canvas like in the picture below will appear.
94//
95// On the left side of the canvas, the following buttons appear:
96// *Next* to move to the next event
97// *Previous* to move to the previous event
98
99// *Pick* Select this option to be able to point on a track with the
100// mouse. Once on the track, use the right button to select
101// an action. For example, select SetMarkerAttributes to
102// change the marker type/color/size for the track.
103// *Zoom* Select this option (default) if you want to zoom.
104// To zoom, simply select the selected area with the left button.
105// *UnZoom* To revert to the previous picture size.
106//
107// slider R On the left side, the vertical slider can be used to
108// set the default picture size.
109//
110// When you are in Zoom mode, you can click on the black part of the canvas
111// to select special options with the right mouse button.
112
113//
114// When you are in pick mode, you can "Inspect" the object pointed by the mouse.
115// When you are on a track, select the menu item "InspectParticle"
116// to display the current particle attributes.
117//
118// You can activate the Root browser by selecting the Inspect menu
119// in the canvas tool bar menu. Then select "Start Browser"
120// This will open a new canvas with the browser. At this point, you may want
121// to display some histograms (from the Trees). Go to the "File" menu
122// of the browser and click on "New canvas".
123// In the browser, click on item "ROOT files" in the left pane.
124// Click on galice.root.
125// Click on TH
126// Click on TPC for example
127// Click on any variable (eg TPC.fX) to histogram the variable.
128//
129// If you are lost, you can click on HELP in any Root canvas or browser.
130//Begin_Html
131/*
132<img src="gif/AliMUONDisplay.gif">
133*/
134//End_Html
135
136
137 fPad = 0;
138
139 gAlice->SetDisplay(this);
140
141 // Initialize display default parameters
142 SetRange(200,2000);
143 // Set front view by default
144 fTheta = 0;
145 fPhi = -90;
146 fPsi = 0;
147 fChamber = 1;
148 fCathode = 1;
149 // fRzone = 1.e10;
150 fDrawClusters = kTRUE;
151 fDrawCoG = kTRUE;
572d5bb2 152 fDrawTracks = kFALSE;
a9e2aefa 153 fZoomMode = 1;
154 fZooms = 0;
155 fClustersCuts = 0;
d226f81b 156 fPoints = 0;
157 fPhits = 0;
158 fRpoints = 0;
a9e2aefa 159 // Create colors
160 CreateColors();
161 // Create display canvas
162 Int_t ysize = size;
163 if (ysize < 100) ysize = 750;
164 Int_t xsize = Int_t(size*830./ysize);
572d5bb2 165 fCanvas = new TCanvas("Canvas", "MUON Display",14,47,xsize,ysize);
a9e2aefa 166 fCanvas->ToggleEventStatus();
167
168 // Create main display pad
169 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
170 fPad->Draw();
171 fPad->Modified();
172 fPad->SetFillColor(30);
173 fPad->SetBorderSize(2);
174
175 fCanvas->cd();
176
177 // Create colors pad
178 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
179 fColPad->Draw();
180 fColPad->SetFillColor(17);
181 fColPad->SetBorderSize(2);
182 fColPad->cd();
183 DisplayColorScale();
184
185 fCanvas->cd();
186 // Create user interface control pad
187 DisplayButtons();
188 fCanvas->cd();
189
190 // Create Range and mode pad
191 Float_t dxtr = 0.15;
192 Float_t dytr = 0.45;
193 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
a9e2aefa 194 fTrigPad->Draw();
195 fTrigPad->cd();
196 fTrigPad->SetFillColor(22);
197 fTrigPad->SetBorderSize(2);
198 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
199 fRangeSlider->SetObject(this);
200 char pickmode[] = "gAlice->Display()->SetPickMode()";
201 Float_t db = 0.09;
202 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
203 fPickButton->SetFillColor(38);
204 fPickButton->Draw();
205 char zoommode[] = "gAlice->Display()->SetZoomMode()";
206 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
207 fZoomButton->SetFillColor(38);
208 fZoomButton->Draw();
209 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
210 fArcButton->SetFillColor(kGreen);
211 fArcButton->Draw();
212 char butUnzoom[] = "gAlice->Display()->UnZoom()";
213 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
214 button->SetFillColor(38);
215 button->Draw();
216 AppendPad(); // append display object as last object to force selection
217
218 fCanvas->cd();
1c4b7942 219 fTrigPad->SetEditable(kFALSE);
220 fButtons->SetEditable(kFALSE);
a9e2aefa 221 fCanvas->Update();
222 fNextCathode = kFALSE;
307d9d04 223 fLoader = loader;
d226f81b 224 // initialize container
225 if(fLoader)
226 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
227 else
228 fMUONData =0x0;
a9e2aefa 229}
230
30178c30 231AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
232 : AliDisplay(display)
a9e2aefa 233{
30178c30 234// Protected copy constructor
235
8c343c7c 236 AliFatal("Not implemented.");
a9e2aefa 237}
238
239
240
241//_____________________________________________________________________________
242AliMUONDisplay::~AliMUONDisplay()
243{
244 // Delete space point structure
245 if (fPoints) fPoints->Delete();
246 delete fPoints;
247 fPoints = 0;
248 //
249 if (fPhits) fPhits->Delete();
250 delete fPhits;
251 fPhits = 0;
252 //
d226f81b 253 if (fRpoints) fRpoints->Delete();
a9e2aefa 254 delete fRpoints;
d226f81b 255 fRpoints = 0;
a9e2aefa 256}
257
258//_____________________________________________________________________________
259void AliMUONDisplay::Clear(Option_t *)
260{
261// Delete graphics temporary objects
262}
263
264//_____________________________________________________________________________
265void AliMUONDisplay::DisplayButtons()
266{
267// Create the user interface buttons
268
269
270 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
a9e2aefa 271 fButtons->Draw();
272 fButtons->SetFillColor(38);
273 fButtons->SetBorderSize(2);
274 fButtons->cd();
275
276// Int_t butcolor = 33;
277 Float_t dbutton = 0.08;
278 Float_t y = 0.96;
279 Float_t dy = 0.014;
280 Float_t x0 = 0.05;
281 Float_t x1 = 0.95;
282
283 TButton *button;
284 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
285 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
286 button->SetFillColor(38);
287 button->Draw();
288
289 y -= dbutton + dy;
290 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
291 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
292 button->SetFillColor(38);
293 button->Draw();
294
295 y -= dbutton + dy;
296 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
297 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
298 button->SetFillColor(38);
299 button->Draw();
300
301 y -= dbutton + dy;
302 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
303 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
304 button->SetFillColor(38);
305 button->Draw();
306
307 y -= dbutton + dy;
308 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
309 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
310 button->SetFillColor(38);
311 button->Draw();
312
313 y -= dbutton + dy;
314 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
315 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
316 button->SetFillColor(38);
317 button->Draw();
318
319 y -= dbutton + dy;
320 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
321 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
322 button->SetFillColor(38);
323 button->Draw();
324
572d5bb2 325 y -= dbutton + dy;
326 char but8[] = "((AliMUONDisplay*)(gAlice->Display()))->DrawReco()";
327 button = new TButton("Tracking", but8, x0, y - dbutton, x1, y);
328 button->SetFillColor(38);
329 button->Draw();
330
a9e2aefa 331 // display logo
332 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
333 diamond->SetFillColor(50);
334 diamond->SetTextAlign(22);
335 diamond->SetTextColor(5);
336 diamond->SetTextSize(0.11);
337 diamond->Draw();
338 diamond->AddText(".. ");
339 diamond->AddText("ROOT");
340 diamond->AddText("MUON");
341 diamond->AddText("... ");
342 diamond->AddText(" ");
343}
344
345//_____________________________________________________________________________
30178c30 346void AliMUONDisplay::CreateColors() const
a9e2aefa 347{
348// Create the colors palette used to display clusters
349
350 Int_t k,i;
351 Int_t color;
352 Float_t r,g,b;
353
354 for (k=1;k<=5;k++) {
355 switch(k) {
356 case 1:
357 for (i=1;i<=5;i++) {
358 r=1.;
359 g=i*0.2;
360 b=0.;
361 color=i;
362 color=260+23-color;
363 new TColor(color,r,g,b);
364 }
365 break;
366 case 2:
367 for (i=1;i<=4;i++) {
368 r=1.1-i*0.2;
369 g=1.;
370 b=0.;
371 color=i+5;
372 color=260+23-color;
373 new TColor(color,r,g,b);
374 }
375 break;
376 case 3:
377 for (i=1;i<=4;i++) {
378 r=0.;
379 g=1.;
380 b=i*0.2+0.2;
381 color=i+9;
382 color=260+23-color;
383 new TColor(color,r,g,b);
384 }
385 break;
386 case 4:
387 for (i=1;i<=4;i++) {
388 r=0.;
389 g=1.1-i*0.2;
390 b=1.;
391 color=i+13;
392 color=260+23-color;
393 new TColor(color,r,g,b);
394 }
395 break;
396 case 5:
397 for (i=1;i<=5;i++) {
398 r=i*0.2;
399 g=0.;
400 b=1.;
401 color=i+17;
402 color=260+23-color;
403 new TColor(color,r,g,b);
404 }
405 break;
406 }
407 }
408}
409
410//_____________________________________________________________________________
411void AliMUONDisplay::DisplayColorScale()
412{
413// Display pulse height color scale
414 Int_t i;
415 Int_t color;
416 Float_t xlow, ylow, xup, yup, hs;
417 Float_t x1, y1, x2, y2;
418 x1 = y1 = 0;
419 x2 = y2 = 1.0;
420
421 TText *text = new TText(0,0,"");
422 text->SetTextFont(61);
423 text->SetTextSize(0.2);
424 text->SetTextAlign(22);
425
7e4a628d 426
427 Int_t adcmax=4096; // default 12 bits ADC
428
a9e2aefa 429
430
431 TBox *box;
432 char label[8];
433//*-* draw colortable boxes
434 hs = (y2-y1)/Float_t(22);
435 xlow=x1+.05;
436 xup=x2-0.5;
437 for (i=0;i<22;i++) {
438 ylow = y1 + hs*(Float_t(i));
439 yup = y1 + hs*(Float_t(i+1));
440 color = 261+i;
441 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
442 Int_t scale=(Int_t)TMath::Exp(logscale);
443 sprintf(label,"%d",scale);
444 box = new TBox(xlow, ylow, xup, yup);
445 box->Draw();
446 box->SetFillColor(color);
447 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
448 }
449}
450
451//______________________________________________________________________________
452Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
453{
454// Compute distance from point px,py to objects in event
455
456 gPad->SetCursor(kCross);
457
458 if (gPad == fTrigPad) return 9999;
459
460 const Int_t kBig = 9999;
461 Int_t dist = kBig;
462 Float_t xmin = gPad->GetX1();
463 Float_t xmax = gPad->GetX2();
464 Float_t dx = 0.02*(xmax - xmin);
465 Float_t x = gPad->AbsPixeltoX(px);
466 if (x < xmin+dx || x > xmax-dx) return dist;
467
468 if (fZoomMode) return 0;
469 else return 7;
470}
471
472//_____________________________________________________________________________
473void AliMUONDisplay::Draw(Option_t *)
474{
475// Display current event
476
572d5bb2 477 if (!fDrawTracks)
478 DrawChamber();
479 else
480 DrawReco();
481
482}
483//_____________________________________________________________________________
484void AliMUONDisplay::DrawChamber()
485{
a9e2aefa 486
572d5bb2 487 fDrawTracks = kFALSE;
488 fPad->cd();
489 DrawView(fTheta, fPhi, fPsi);
490 // Display the event number and title
491 fPad->cd();
492 DrawTitle();
493
494}
495//_____________________________________________________________________________
496void AliMUONDisplay::DrawReco(Option_t *)
497{
498// Display current event
499
500 fDrawTracks = kTRUE;
501 // print kinematics of generated particles
502 PrintKinematics();
503 // Draw global view of muon system
504 fPad->cd();
505 DrawGlobalView(135, -50, -140);
506
a9e2aefa 507 // Display the event number and title
508 fPad->cd();
509 DrawTitle();
510}
511
572d5bb2 512//_____________________________________________________________________________
513void AliMUONDisplay::PrintKinematics()
514{
515 AliRunLoader * runLoader;
516 TParticle *particle = new TParticle();
517 Int_t nPart;
518 Float_t vertex[3], momentum[3];
519
520 if (fLoader)
521 runLoader = fLoader->GetRunLoader();
522 else
523 runLoader = 0x0;
524
525 printf("****** Event # %d ******\n",runLoader->GetEventNumber());
526 runLoader->TreeK()->GetBranch("Particles")->SetAddress(&particle);
527 nPart = (Int_t)runLoader->TreeK()->GetEntries();
528 for(Int_t iPart = 0; iPart < nPart; iPart++) {
529 runLoader->TreeK()->GetEvent(iPart);
530 vertex[0] = particle->Vx();
531 vertex[1] = particle->Vy();
532 vertex[2] = particle->Vz();
533 momentum[0] = particle->Px();
534 momentum[1] = particle->Py();
535 momentum[2] = particle->Pz();
536
537 printf("===================================================\n");
538 printf(" Generated particle # %d \n",iPart);
539 printf(" name: %s \n",particle->GetName());
540 printf(" vertex x,y,z (cm): %f %f %f \n",vertex[0],vertex[1],vertex[2]);
541 printf(" momentum Px,Py,Pz (GeV/c): %f %f %f \n",momentum[0],momentum[1],momentum[2]);
542 }
543 delete particle;
544}
545
a9e2aefa 546void AliMUONDisplay::DrawSegmentation()
547{
548// Draw graphical representation of segmenatation
549// Attention: still experimental code
550 Int_t icat=1;
551
552 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
a30a000f 553 AliMUONChamber* iChamber;
554 AliSegmentation* seg;
a9e2aefa 555 iChamber = &(pMUON->Chamber(fChamber));
556 seg=iChamber->SegmentationModel(icat);
557 Float_t zpos=iChamber->Z();
558 Float_t r=iChamber->ROuter();
559
560 TMarker3DBox *marker;
561 if (icat == 1) {
562 for (Int_t j=0; j<seg->Npy(); j++) {
563 Float_t y0;
564 y0=j*seg->Dpy()-seg->Dpy()/2.;
802a864d 565 for (seg->FirstPad(0.,y0,0,300,0.);
a9e2aefa 566 seg->MorePads();
567 seg->NextPad())
568 {
569 if (seg->ISector()==0) continue;
802a864d 570 Float_t x,y,z;
a30a000f 571 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
a9e2aefa 572 Float_t dpx=seg->Dpx(seg->ISector())/2;
573 Float_t dpy=seg->Dpy(seg->ISector())/2;
574 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
575 marker->SetLineColor(seg->ISector()+1);
576 marker->SetFillStyle(1001);
577 marker->SetFillColor(0);
578 marker->Draw();
579 }
580 }
581 } else {
582 for (Int_t j=0; j<250; j++) {
583 Float_t x0=j*seg->Dpx();
584 Float_t y0=TMath::Sqrt(r*r-x0*x0);
585
802a864d 586 for (seg->FirstPad(x0,0,0,0,y0);
a9e2aefa 587 seg->MorePads();
588 seg->NextPad())
589 {
590 if (seg->ISector()==0) continue;
591
802a864d 592 Float_t x,y,z;
a30a000f 593 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
a9e2aefa 594 Float_t dpx=seg->Dpx(seg->ISector())/2;
595 Float_t dpy=seg->Dpy(seg->ISector())/2;
596 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
597 marker->SetLineColor(seg->ISector()+1);
598 marker->SetFillStyle(1001);
599 marker->SetFillColor(0);
600 marker->Draw();
601 }
602 }
603 }
604}
605
606//_____________________________________________________________________________
607void AliMUONDisplay::DrawClusters()
608{
609// Draw clusters for MUON chambers
610
611 Int_t ndigits, digit;
612 TObjArray *points;
613 AliMUONPoints *pm;
614
615
616 fClustersCuts = 0;
617 points = Points();
618 if (!points) return;
619 ndigits = points->GetEntriesFast();
620 for (digit=0;digit<ndigits;digit++){
621 pm = (AliMUONPoints*)points->UncheckedAt(digit);
622 if (!pm) continue;
623 Float_t *pxyz;
624 pxyz=pm->GetP();
625 for (Int_t im=0;im<3;im++) {
626 TMarker3DBox *marker=pm->GetMarker(im);
627 if (marker)
628 marker->Draw();
629 }
630 pm->Draw();
631 fClustersCuts +=pm->GetN();
632 }
633}
634
635//_____________________________________________________________________________
636void AliMUONDisplay::DrawHits()
637{
638// Draw hits for MUON chambers
639
640 LoadHits(fChamber);
641
642 Int_t ntracks, track;
643 TObjArray *points;
644 AliMUONPoints *pm;
645
646 fHitsCuts = 0;
647 points = Phits();
648 if (!points) return;
649 ntracks = points->GetEntriesFast();
650 for (track=0;track<ntracks;track++) {
651 pm = (AliMUONPoints*)points->UncheckedAt(track);
652 if (!pm) continue;
653 pm->Draw();
654 fHitsCuts += pm->GetN();
655 }
656}
657
658
659//_____________________________________________________________________________
660void AliMUONDisplay::DrawCoG()
661{
662// Draw hits for MUON chambers
663 if (!fDrawCoG) return;
664 if (fChamber > 10) return;
665 LoadCoG(fChamber,fCathode);
666
667 Int_t ncog, icog;
668 TObjArray *points;
669 AliMUONPoints *pm;
670
671 points = Rpoints();
672 if (!points) return;
673 ncog = points->GetEntriesFast();
674 for (icog=0;icog<ncog;icog++) {
675 pm = (AliMUONPoints*)points->UncheckedAt(icog);
676 if (!pm) continue;
677 pm->Draw();
678 }
679}
a9e2aefa 680//_____________________________________________________________________________
572d5bb2 681void AliMUONDisplay::DrawTracks()
682{
683// Draw tracks
684 if (!fDrawTracks) return;
685 LoadTracks();
686
687 Int_t nTrack, iTrack;
688 TObjArray *points;
689 TPolyLine3D *pm;
690
691 points = Rpoints();
692 if (!points) return;
693 nTrack = points->GetEntriesFast();
694 for ( iTrack = 0; iTrack < nTrack; iTrack++) {
695 pm = (TPolyLine3D*)points->UncheckedAt(iTrack);
696 if (!pm) continue;
697 pm->Draw();
698 }
699}
700//_____________________________________________________________________________
a9e2aefa 701
702void AliMUONDisplay::DrawTitle(Option_t *option)
703{
704// Draw the event title
705
706 Float_t xmin = gPad->GetX1();
707 Float_t xmax = gPad->GetX2();
708 Float_t ymin = gPad->GetY1();
709 Float_t ymax = gPad->GetY2();
710 Float_t dx = xmax-xmin;
711 Float_t dy = ymax-ymin;
712
30178c30 713 AliRunLoader * runLoader;
307d9d04 714 if (fLoader)
30178c30 715 runLoader = fLoader->GetRunLoader();
307d9d04 716 else
30178c30 717 runLoader = 0x0;
7985603c 718
719
a9e2aefa 720 if (strlen(option) == 0) {
721 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
722// title->SetTextSize(0.023932);
723 title->SetTextSize(0.02);
724 title->SetBit(kCanDelete);
725 title->SetFillColor(42);
726 title->Draw();
727 char ptitle[100];
728 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
30178c30 729 runLoader->GetEventNumber(),
a9e2aefa 730 gAlice->GetHeader()->GetRun(),
731 fChamber,
732 fCathode);
733 title->AddText(ptitle);
5d12ce38 734 Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast();
a9e2aefa 735 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
736 nparticles, fHitsCuts,fClustersCuts);
737 title->AddText(ptitle);
738 } else {
739 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
740 label->SetBit(kCanDelete);
741 label->SetFillColor(42);
742 label->Draw();
743 }
744}
745
746//_____________________________________________________________________________
747void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
748{
749// Draw a view of MUON clusters
c177f73d 750 AliInfo(" Draw View");
a9e2aefa 751
752 gPad->SetCursor(kWatch);
753 // gPad->SetFillColor(39);
754 gPad->SetFillColor(1);
755 gPad->Clear();
756 // gPad->SetFillColor(39);
757 gPad->SetFillColor(1);
758
759
760 Int_t iret=0;
761 TView *view = new TView(1);
762
763 Float_t range = fRrange*fRangeSlider->GetMaximum();
764 view->SetRange(-range,-range,-range,range, range, range);
765 // zoom back to full scale only if DrawView not called from NextCathode
766 if (!fNextCathode) {
767 fZoomX0[0] = -1;
768 fZoomY0[0] = -1;
769 fZoomX1[0] = 1;
770 fZoomY1[0] = 1;
771 fZooms = 0;
772 }
773
774// Display MUON Chamber Geometry
a9e2aefa 775 char nodeName[7];
776 sprintf(nodeName,"MUON%d",100+fChamber);
a9e2aefa 777
778 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
779 if (node1) node1->Draw("same");
780//add clusters to the pad
781 DrawClusters();
a9e2aefa 782 DrawHits();
783 DrawCoG();
a9e2aefa 784// DrawSegmentation();
785 // add itself to the list (must be last)
786 AppendPad();
787 view->SetView(phi, theta, psi, iret);
788}
789
572d5bb2 790//_____________________________________________________________________________
791void AliMUONDisplay::DrawGlobalView(Float_t theta, Float_t phi, Float_t psi)
792{
793// Draw a view of muons chambers with tracks
794
795 gPad->SetCursor(kWatch);
796 // gPad->SetFillColor(39);
797 gPad->SetFillColor(1);
798 gPad->Clear();
799 // gPad->SetFillColor(39);
800 gPad->SetFillColor(1);
801
802
803 Int_t iret=0;
804 TView *view = new TView(1);
805
806 Float_t range = fRrange*fRangeSlider->GetMaximum()*3.;
807 view->SetRange(-range,-range,-range,range,range,range);
808
809// Display all MUON Chambers segmentation
810 char nodeName[7];
811 TNode *node1;
812 sprintf(nodeName,"alice");
813
814 node1=gAlice->GetGeometry()->GetNode(nodeName);
815 if (node1) node1->Draw("same");
816
817
818// Draw clusters for all chambers
819 Int_t chamberSave = fChamber;
820 for (fChamber = 1; fChamber <= 10; fChamber++){
821 DrawCoG();
822 }
823 fChamber = chamberSave;
824// Draw reconstructed tracks
825 DrawTracks();
826
827 AppendPad();
828
829 Float_t zoom = 2.;
830 Float_t shift = 0.9;
831 Float_t x0 = (-1+shift)/zoom;
832 Float_t y0 = (-1+shift)/zoom;
833 Float_t x1 = (1+shift)/zoom;
834 Float_t y1 = (1+shift)/zoom;
835 gPad->Range(x0,y0,x1,y1);
836 view->SetView(phi, theta, psi, iret);
837
838}
a9e2aefa 839
840//______________________________________________________________________________
841void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
842{
843// Execute action corresponding to the mouse event
844
845 static Float_t x0, y0, x1, y1;
846
847 static Int_t pxold, pyold;
848 static Int_t px0, py0;
849 static Int_t linedrawn;
850 Float_t temp;
851
852 if (px == 0 && py == 0) { //when called by sliders
853 if (event == kButton1Up) {
854 Draw();
855 }
856 return;
857 }
858 if (!fZoomMode && gPad->GetView()) {
859 gPad->GetView()->ExecuteRotateView(event, px, py);
860 return;
861 }
862
863 // something to zoom ?
864 gPad->SetCursor(kCross);
865
866 switch (event) {
867
868 case kButton1Down:
869 gVirtualX->SetLineColor(-1);
870 gPad->TAttLine::Modify(); //Change line attributes only if necessary
871 x0 = gPad->AbsPixeltoX(px);
872 y0 = gPad->AbsPixeltoY(py);
873 px0 = px; py0 = py;
874 pxold = px; pyold = py;
875 linedrawn = 0;
876 return;
877
878 case kButton1Motion:
879 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
880 pxold = px;
881 pyold = py;
882 linedrawn = 1;
883 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
884 return;
885
886 case kButton1Up:
887 gPad->GetCanvas()->FeedbackMode(kFALSE);
888 if (px == px0) return;
889 if (py == py0) return;
890 x1 = gPad->AbsPixeltoX(px);
891 y1 = gPad->AbsPixeltoY(py);
892
893 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
894 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
895 gPad->Range(x0,y0,x1,y1);
97ccf8cb 896 if (fZooms < AliMUONConstants::MaxZoom()-1) {
a9e2aefa 897 fZooms++;
898 fZoomX0[fZooms] = x0;
899 fZoomY0[fZooms] = y0;
900 fZoomX1[fZooms] = x1;
901 fZoomY1[fZooms] = y1;
902 }
903 gPad->Modified(kTRUE);
904 return;
905 }
906}
907
908//___________________________________________
909void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
910{
911// Read digits info and store x,y,z info in arrays fPoints
912// Loop on all detectors
913
914 if (chamber > 14) return;
08a636a8 915 fChamber = chamber;
916 fCathode = cathode;
a9e2aefa 917
918 ResetPoints();
919
08a636a8 920 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
a9e2aefa 921 AliMUONChamber* iChamber;
a30a000f 922 AliSegmentation* segmentation;
307d9d04 923
d226f81b 924 GetMUONData()->SetTreeAddress("D");
a9e2aefa 925
d226f81b 926 TClonesArray *muonDigits = GetMUONData()->Digits(chamber-1);
a9e2aefa 927 if (muonDigits == 0) return;
928
d226f81b 929 gAlice->ResetDigits();
00f56532 930 Int_t nent = 0;
931
307d9d04 932 if (GetLoader()->TreeD()) {
933 nent = (Int_t) GetLoader()->TreeD()->GetEntries();
49b640e7 934 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
d226f81b 935 GetMUONData()->GetCathode(cathode-1);
00f56532 936 }
937
a9e2aefa 938 Int_t ndigits = muonDigits->GetEntriesFast();
939 if (ndigits == 0) return;
940 if (fPoints == 0) fPoints = new TObjArray(ndigits);
941
942 iChamber = &(pMUON->Chamber(chamber-1));
943
944 segmentation = iChamber->SegmentationModel(cathode);
08a636a8 945 Float_t zpos = iChamber->Z();
946
a9e2aefa 947 AliMUONDigit *mdig;
08a636a8 948 AliMUONPoints *points = 0;
949 TMarker3DBox *marker = 0;
a9e2aefa 950 //
951 //loop over all digits and store their position
952
08a636a8 953 Int_t npoints = 1;
7e4a628d 954 Float_t adcmax = 1024; // default
955 if (chamber<11) adcmax = 4096;
a9e2aefa 956
08a636a8 957 for (Int_t digit = 0; digit < ndigits; digit++) {
a9e2aefa 958 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
08a636a8 959 if (mdig->Cathode() != cathode-1) continue;
4554f81d 960
a9e2aefa 961 //
962 // First get all needed parameters
963 //
08a636a8 964 Int_t charge = mdig->Signal();
965 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
966 Int_t color = 261+index;
967 Int_t colorTrigger = 2;
968 if (color > 282) color = 282;
a9e2aefa 969
970 if (chamber > 10) { // trigger chamber
4554f81d 971
08a636a8 972 Int_t sumCharge = 0;
973 for (Int_t icharge = 0; icharge < 10; icharge++) {
974 sumCharge = sumCharge+mdig->TrackCharge(icharge);
a9e2aefa 975 }
08a636a8 976 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
977 if(sumCharge <= 10 || testCharge > 0) {
978 colorTrigger = color;
a9e2aefa 979 } else {
08a636a8 980 colorTrigger = 5;
a9e2aefa 981 }
982 }
983
984 // get the center of the pad - add on x and y half of pad size
802a864d 985 Float_t xpad, ypad, zpad;
08a636a8 986 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
987
988 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
989 Float_t dpx = segmentation->Dpx(isec)/2;
990 Float_t dpy = segmentation->Dpy(isec)/2;
991//
992// segmentation->Dump();
a9e2aefa 993
a9e2aefa 994 //
995 // Then set the objects
996 //
997 points = new AliMUONPoints(npoints);
998 fPoints->AddAt(points,digit);
999 if (chamber > 10) {
1000 points->SetMarkerColor(colorTrigger);
1001 } else {
1002 points->SetMarkerColor(color);
1003 }
1004 points->SetMarkerStyle(21);
1005 points->SetMarkerSize(0.5);
1006 points->SetParticle(-1);
1007 points->SetHitIndex(-1);
1008 points->SetTrackIndex(-1);
1009 points->SetDigitIndex(digit);
4554f81d 1010 points->SetPoint(0,xpad,ypad,zpos);
1011
08a636a8 1012 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
1013 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
1014
1015
1016 marker->SetLineColor(lineColor);
1017 marker->SetFillStyle(1001);
1018 marker->SetFillColor(color);
1019 marker->SetRefObject((TObject*)points);
1020 points->Set3DMarker(0, marker);
a9e2aefa 1021 }
1022}
1023//___________________________________________
e0875ac1 1024void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/)
a9e2aefa 1025{
d226f81b 1026// Read raw clusters info and store x,y,z info in arrays fRpoints
1027// Loop on all detectors
a9e2aefa 1028
1029 if (chamber > 10) return;
1030
1031 ResetRpoints();
1032
1033 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1034 AliMUONChamber* iChamber;
1035
d226f81b 1036 GetMUONData()->SetTreeAddress("RC");
1037 TClonesArray *muonRawClusters = GetMUONData()->RawClusters(chamber-1);
a9e2aefa 1038
7985603c 1039 if (muonRawClusters == 0) return;
a9e2aefa 1040
00f56532 1041 Int_t nent = 0;
d226f81b 1042 if (GetMUONData()->TreeR()) {
1043 nent=(Int_t) GetMUONData()->TreeR()->GetEntries();
1044 GetMUONData()->TreeR()->GetEvent(0);
00f56532 1045 }
1046
a9e2aefa 1047 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1048 if (nrawcl == 0) return;
d226f81b 1049 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
a9e2aefa 1050
1051 iChamber = &(pMUON->Chamber(chamber-1));
1052 Float_t zpos=iChamber->Z();
1053 AliMUONRawCluster *mRaw;
1054 AliMUONPoints *points = 0;
1055 //
1056 //loop over all raw clusters and store their position
1057 points = new AliMUONPoints(nrawcl);
1058 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1059 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
a9e2aefa 1060 points->SetMarkerColor(51);
1061 points->SetMarkerStyle(2);
1062 points->SetMarkerSize(1.);
1063 points->SetParticle(-1);
1064 points->SetHitIndex(-1);
1065 points->SetTrackIndex(-1);
1066 points->SetDigitIndex(-1);
ba12c242 1067 points->SetPoint(iraw,mRaw->GetX(0),mRaw->GetY(0),zpos);
d226f81b 1068 fRpoints->AddAt(points,iraw);
ba12c242 1069 // printf("%f and %f and %f\n",mRaw->GetX(0),mRaw->GetY(0),mRaw->GetZ(0));
a9e2aefa 1070 }
1071}
572d5bb2 1072
1073//___________________________________________
1074void AliMUONDisplay::LoadTracks()
1075{
1076// Load tracks
1077 AliMUONTrack* recTrack = 0;
1078 AliMUONTrackParam* trackParam = 0;
1079 TClonesArray * trackParamAtHit = 0;
1080
1081 ResetRpoints();
1082
1083 GetMUONData()->SetTreeAddress("RT");
1084 TClonesArray* recTracksArray = GetMUONData()->RecTracks();
1085 if (recTracksArray == NULL) return;
1086 GetMUONData()->GetRecTracks();
1087
1088 Int_t nRecTracks = 0;
1089 if (recTracksArray)
1090 nRecTracks = (Int_t) recTracksArray->GetEntriesFast();
1091
1092
1093 if (fRpoints == 0) fRpoints = new TObjArray(nRecTracks);
1094
1095 for (Int_t iRecTracks = 0; iRecTracks < nRecTracks; iRecTracks++) {
1096 // reading info from tracks
1097 recTrack = (AliMUONTrack*) recTracksArray->At(iRecTracks);
1098
1099 Int_t nTrackHits = recTrack->GetNTrackHits();
1100
1101 if (nTrackHits == 0) continue;
1102
1103 Int_t iPoint = 0;
1104 TPolyLine3D *points = new TPolyLine3D(nTrackHits+1);
1105 points->SetLineColor(6);
1106 points->SetLineWidth(1);
1107 fRpoints->AddAt(points,iRecTracks);
1108
1109 Float_t xRec=0;
1110 Float_t yRec=0;
1111 Float_t zRec=0;
1112
1113 trackParam = recTrack->GetTrackParamAtVertex();
1114 xRec = trackParam->GetNonBendingCoor();
1115 yRec = trackParam->GetBendingCoor();
1116 zRec = trackParam->GetZ();
1117 points->SetPoint(iPoint,xRec,yRec,zRec);
1118 iPoint++;
1119
1120 for (Int_t iHit = 0; iHit < nTrackHits; iHit++){
1121 trackParamAtHit = recTrack->GetTrackParamAtHit();
1122 trackParam = (AliMUONTrackParam*) trackParamAtHit->At(iHit);
1123 xRec = trackParam->GetNonBendingCoor();
1124 yRec = trackParam->GetBendingCoor();
1125 zRec = trackParam->GetZ();
1126 points->SetPoint(iPoint,xRec,yRec,zRec);
1127 iPoint++;
1128 } // end loop rec. hits
1129 PrintTrack(iRecTracks,recTrack);
1130 } // end loop tracks
1131
1132
1133}
1134
1135void AliMUONDisplay::PrintTrack(Int_t iRecTracks, AliMUONTrack *recTrack)
1136{
1137 AliMUONTrackParam *trackParam;
1138 Float_t vertex[3], momentum[3];
1139 Float_t pYZ, bendingSlope, nonBendingSlope, chi2dof;
1140 Int_t charge;
1141
1142 trackParam = recTrack->GetTrackParamAtVertex();
1143 vertex[0] = trackParam->GetNonBendingCoor();
1144 vertex[1] = trackParam->GetBendingCoor();
1145 vertex[2] = trackParam->GetZ();
1146 pYZ = 1./TMath::Abs(trackParam->GetInverseBendingMomentum());
1147 bendingSlope = trackParam->GetBendingSlope();
1148 nonBendingSlope = trackParam->GetNonBendingSlope();
1149 momentum[2] = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);
1150 momentum[0] = momentum[2] * nonBendingSlope;
1151 momentum[1] = momentum[2] * bendingSlope;
1152 charge = Int_t(TMath::Sign(1.,trackParam->GetInverseBendingMomentum()));
1153 chi2dof = recTrack->GetFitFMin()/(2.0 * recTrack->GetNTrackHits() - 5.);
1154
1155 printf("===================================================\n");
1156 printf(" Reconstructed track # %d \n",iRecTracks);
1157 printf(" charge: %d \n",charge);
1158 printf(" vertex x,y,z (cm): %f %f %f \n",vertex[0],vertex[1],vertex[2]);
1159 printf(" momentum Px,Py,Pz (GeV/c): %f %f %f \n",momentum[0],momentum[1],momentum[2]);
1160 printf(" track chi2/dof: %f \n",chi2dof);
1161
1162}
1163
a9e2aefa 1164//___________________________________________
a9e2aefa 1165void AliMUONDisplay::LoadHits(Int_t chamber)
1166{
307d9d04 1167 // Read hits info and store x,y,z info in arrays fPhits
1168 // Loop on all detectors
a9e2aefa 1169
1170 if (chamber > 14) return;
1171 Int_t track;
1172
1173 fChamber=chamber;
1174
1175 ResetPhits();
1176
1177 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1178 AliMUONChamber* iChamber;
1179
1180 iChamber = &(pMUON->Chamber(chamber-1));
1181 Float_t zpos=iChamber->Z();
1182
c856e086 1183
1184 if (GetMUONData()->TreeH()) {
1185 GetMUONData()->SetTreeAddress("H");
1186 Int_t ntracks = (Int_t)GetMUONData()->TreeH()->GetEntries(); //skowron
1187 Int_t nthits = 0;
1188 for (track = 0; track < ntracks; track++) {
d226f81b 1189 GetMUONData()->ResetHits();
1190 GetMUONData()->GetTrack(track);//skowron
1191 TClonesArray *muonHits = GetMUONData()->Hits();
a9e2aefa 1192 if (muonHits == 0) return;
1193 nthits += muonHits->GetEntriesFast();
c856e086 1194 }
1195 if (fPhits == 0) fPhits = new TObjArray(nthits);
1196 Int_t nhold=0;
1197 for (track=0; track<ntracks;track++) {
d226f81b 1198 GetMUONData()->ResetHits();
1199 GetMUONData()->GetTrack(track);//skowron
1200 TClonesArray *muonHits = GetMUONData()->Hits();
a9e2aefa 1201 if (muonHits == 0) return;
1202 Int_t nhits = muonHits->GetEntriesFast();
1203 if (nhits == 0) continue;
1204 AliMUONHit *mHit;
1205 AliMUONPoints *points = 0;
1206 Int_t npoints=1;
1207 for (Int_t hit=0;hit<nhits;hit++) {
c856e086 1208 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1209 Int_t nch = mHit->Chamber(); // chamber number
1210 if (nch != chamber) continue;
1211 //
1212 // Retrieve info and set the objects
1213 //
1214 points = new AliMUONPoints(npoints);
1215 fPhits->AddAt(points,nhold+hit);
1216 points->SetMarkerColor(kRed);
1217 points->SetMarkerStyle(5);
1218 points->SetMarkerSize(1.);
1219 points->SetParticle(mHit->Track());
1220 points->SetHitIndex(hit);
1221 points->SetTrackIndex(track);
1222 points->SetDigitIndex(-1);
1223 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
1224 // printf("%f and %f and %f\n",mHit->X(),mHit->Y(),mHit->Z());
a9e2aefa 1225 }
1226 nhold+=nhits;
c856e086 1227 }
a9e2aefa 1228 }
1229}
1230
1231//_____________________________________________________________________________
1232void AliMUONDisplay::Paint(Option_t *)
1233{
1234// Paint miscellaneous items
1235}
1236
1237//_____________________________________________________________________________
1238void AliMUONDisplay::SetPickMode()
1239{
1240// Set parameters for pick mode.
1241//
1242 fZoomMode = 0;
1243
1244 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1245 fTrigPad->Modified();
1246}
1247
1248//_____________________________________________________________________________
1249void AliMUONDisplay::SetZoomMode()
1250{
1251// Set parameters for zoom mode
1252 fZoomMode = 1;
1253
1254 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1255 fTrigPad->Modified();
1256}
1257
1258//_____________________________________________________________________________
1259void AliMUONDisplay::NextChamber(Int_t delta)
1260{
1261 // to go from chamber to next chamber if delta = 1
1262 // or previous chamber otherwise
1263 if (delta == 1) {
f665c1ea 1264 if (fChamber < AliMUONConstants::NCh()) fChamber++;
a9e2aefa 1265 } else {
1266 if (fChamber > 1) fChamber--;
1267 }
1268 if (!fPad) return;
1269 fPad->Clear();
1270 LoadDigits(fChamber, fCathode);
572d5bb2 1271 DrawChamber();
a9e2aefa 1272}
1273
1274//_____________________________________________________________________________
1275void AliMUONDisplay::NextCathode()
1276{
1277 // to switch to other cathode plane
1278 if (!fPad) return;
1279 fPad->Clear();
1280 if (fCathode == 1) {
1281 LoadDigits(fChamber, 2);
1282 } else {
1283 LoadDigits(fChamber, 1);
1284 }
1285 fNextCathode = kTRUE; // to keep the same zoom
572d5bb2 1286 DrawChamber();
a9e2aefa 1287 fNextCathode = kFALSE;
1288 TPad *pad = (TPad*)gPad->GetPadSave();
1289 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1290 fZoomX1[fZooms], fZoomY1[fZooms]);
1291 pad->Modified();
1292 fPad->cd();
1293 DrawTitle();
1294}
1295
1296//_____________________________________________________________________________
1297void AliMUONDisplay::Trigger()
1298{
52c9bc11 1299
d226f81b 1300 AliMUONGlobalTrigger* globalTrig;
1301
1302 GetMUONData()->SetTreeAddress("GLT");
95e68a13 1303 GetMUONData()->GetTriggerD();
d226f81b 1304
1305 globalTrig = (AliMUONGlobalTrigger*)GetMUONData()->GlobalTrigger()->UncheckedAt(0);
1306 if (globalTrig == 0) return;
1307
1308 printf("===================================================\n");
1309 printf(" Global Trigger output Low pt High pt All\n");
1310
1311 printf(" number of Single Plus :\t");
1312 printf("%i\t",globalTrig->SinglePlusLpt());
1313 printf("%i\t",globalTrig->SinglePlusHpt());
1314 printf("%i\t",globalTrig->SinglePlusApt());
1315 printf("\n");
1316
1317 printf(" number of Single Minus :\t");
1318 printf("%i\t",globalTrig->SingleMinusLpt());
1319 printf("%i\t",globalTrig->SingleMinusHpt());
1320 printf("%i\t",globalTrig->SingleMinusApt());
1321 printf("\n");
1322
1323 printf(" number of Single Undefined :\t");
1324 printf("%i\t",globalTrig->SingleUndefLpt());
1325 printf("%i\t",globalTrig->SingleUndefHpt());
1326 printf("%i\t",globalTrig->SingleUndefApt());
1327 printf("\n");
1328
1329 printf(" number of UnlikeSign pair :\t");
1330 printf("%i\t",globalTrig->PairUnlikeLpt());
1331 printf("%i\t",globalTrig->PairUnlikeHpt());
1332 printf("%i\t",globalTrig->PairUnlikeApt());
1333 printf("\n");
1334
1335 printf(" number of LikeSign pair :\t");
1336 printf("%i\t",globalTrig->PairLikeLpt());
1337 printf("%i\t",globalTrig->PairLikeHpt());
1338 printf("%i\t",globalTrig->PairLikeApt());
1339 printf("\n");
1340 printf("===================================================\n");
1341 printf("\n");
1342
1343
1344 // // returns Trigger Decision for current event
1345// AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(GetLoader(),1);
1346
1347// // AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1348// AliMUONData* muonData = decision->GetMUONData();
1349// muonData->SetTreeAddress("D");
1350// decision->Trigger();
a9e2aefa 1351}
a9e2aefa 1352//_____________________________________________________________________________
1353void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1354{
1355// Set chamber and cathode number
1356 fChamber = chamber;
1357 fCathode = cathode;
1358
1359 if (!fPad) return;
1360 fPad->Clear();
1361 LoadDigits(chamber,cathode);
572d5bb2 1362 DrawChamber();
a9e2aefa 1363}
1364
1365void AliMUONDisplay::SetEvent(Int_t newevent)
1366{
1367// Chose event
1368 gAlice->GetEvent(newevent);
1369 fEvent=newevent;
1370 if (!gAlice->TreeD()) return;
1371 if (!fPad) return;
1372 fPad->Clear();
1373 LoadDigits(fChamber,fCathode);
1374 Draw();
1375}
1376
1377//_____________________________________________________________________________
1378void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1379{
1380// Set view range along R and Z
1381 fRrange = rrange;
1382 fZrange = zrange;
1383
1384 if (!fPad) return;
1385 fPad->Clear();
1386 Draw();
1387}
1388
1389//_____________________________________________________________________________
1390void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1391{
1392// change viewing angles for current event
1393
1394 fPad->cd();
1395 fPhi = phi;
1396 fTheta = theta;
1397 fPsi = psi;
1398 Int_t iret = 0;
1399
1400 TView *view = gPad->GetView();
1401 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1402 else Draw();
1403 gPad->Modified();
1404}
1405
1406//_____________________________________________________________________________
1407void AliMUONDisplay::ShowNextEvent(Int_t delta)
1408{
30178c30 1409 AliRunLoader * runLoader;
307d9d04 1410 if (fLoader)
30178c30 1411 runLoader = fLoader->GetRunLoader();
307d9d04 1412 else
30178c30 1413 runLoader = 0x0;
1391e633 1414
a9e2aefa 1415// Display (current event_number + delta)
1416// delta = 1 shown next event
1417// delta = -1 show previous event
1418 if (delta) {
30178c30 1419 //runLoader->CleanDetectors();
1420 //runLoader->CleanKinematics();
1421 Int_t currentEvent = runLoader->GetEventNumber();
1391e633 1422 Int_t newEvent = currentEvent + delta;
30178c30 1423 runLoader->GetEvent(newEvent);
1391e633 1424 fEvent=newEvent;
a9e2aefa 1425 }
a9e2aefa 1426 LoadDigits(fChamber, fCathode);
1427 fPad->cd();
1428 Draw();
1429}
1430
1431//______________________________________________________________________________
1432void AliMUONDisplay::UnZoom()
1433{
1434// Unzoom
1435 if (fZooms <= 0) return;
1436 fZooms--;
1437 TPad *pad = (TPad*)gPad->GetPadSave();
1438 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1439 pad->Modified();
1440}
1441
1442//_____________________________________________________________________________
1443void AliMUONDisplay::ResetPoints()
1444{
1445 //
1446 // Reset array of points
1447 //
1448 if (fPoints) {
1449 fPoints->Delete();
1450 delete fPoints;
1451 fPoints = 0;
1452 }
1453}
1454//_____________________________________________________________________________
1455void AliMUONDisplay::ResetPhits()
1456{
1457 //
1458 // Reset array of points
1459 //
1460 if (fPhits) {
1461 fPhits->Delete();
1462 delete fPhits;
1463 fPhits = 0;
1464 }
1465}
1466//_____________________________________________________________________________
1467void AliMUONDisplay::ResetRpoints()
1468{
1469 //
1470 // Reset array of points
1471 //
d226f81b 1472 if (fRpoints) {
1473 fRpoints->Clear();
1474 // delete fRpoints;
1475 fRpoints = 0;
a9e2aefa 1476 }
1477}
a9e2aefa 1478
30178c30 1479AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay & rhs)
a9e2aefa 1480{
30178c30 1481// Protected assignement operator
1482
1483 if (this == &rhs) return *this;
1484
8c343c7c 1485 AliFatal("Not implemented.");
30178c30 1486
1487 return *this;
a9e2aefa 1488}
1489
1490
1491
1492
1493
1494
1495
1496
1497