1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //////////////////////////////////////////////////////////////////////////
22 // Utility class to display ALICE outline, tracks, hits,.. //
24 //////////////////////////////////////////////////////////////////////////
33 #include <TPolyMarker3D.h>
34 #include <TPaveLabel.h>
35 #include <TPaveText.h>
42 #include <TSliderBox.h>
44 #include <TVirtualX.h>
47 #include <TGeometry.h>
48 #include <X3DBuffer.h>
49 #include <TMarker3DBox.h>
52 #include "AliDetector.h"
54 #include "AliMUONDisplay.h"
55 #include "AliMUONPoints.h"
56 #include "TParticle.h"
57 #include "AliMUONTriggerDecision.h"
58 #include "AliHeader.h"
60 #include "AliMUONHit.h"
61 #include "AliMUONPadHit.h"
62 #include "AliMUONDigit.h"
63 #include "AliMUONRawCluster.h"
65 #include "AliSegmentation.h"
66 #include "AliMUONResponse.h"
67 #include "AliMUONChamber.h"
68 #include "AliMUONConstants.h"
69 // to manage the same zoom on both cathodes
73 ClassImp(AliMUONDisplay)
76 //_____________________________________________________________________________
77 AliMUONDisplay::AliMUONDisplay()
84 fNextCathode = kFALSE;
88 //_____________________________________________________________________________
89 AliMUONDisplay::AliMUONDisplay(Int_t size)
91 // Create an event display object.
92 // A canvas named "edisplay" is created with a vertical size in pixels
94 // A QUICK Overview of the Event Display functions
95 // ===============================================
97 // The event display can ve invoked by executing the macro "display.C"
98 // A canvas like in the picture below will appear.
100 // On the left side of the canvas, the following buttons appear:
101 // *Next* to move to the next event
102 // *Previous* to move to the previous event
104 // *Pick* Select this option to be able to point on a track with the
105 // mouse. Once on the track, use the right button to select
106 // an action. For example, select SetMarkerAttributes to
107 // change the marker type/color/size for the track.
108 // *Zoom* Select this option (default) if you want to zoom.
109 // To zoom, simply select the selected area with the left button.
110 // *UnZoom* To revert to the previous picture size.
112 // slider R On the left side, the vertical slider can be used to
113 // set the default picture size.
115 // When you are in Zoom mode, you can click on the black part of the canvas
116 // to select special options with the right mouse button.
119 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
120 // When you are on a track, select the menu item "InspectParticle"
121 // to display the current particle attributes.
123 // You can activate the Root browser by selecting the Inspect menu
124 // in the canvas tool bar menu. Then select "Start Browser"
125 // This will open a new canvas with the browser. At this point, you may want
126 // to display some histograms (from the Trees). Go to the "File" menu
127 // of the browser and click on "New canvas".
128 // In the browser, click on item "ROOT files" in the left pane.
129 // Click on galice.root.
131 // Click on TPC for example
132 // Click on any variable (eg TPC.fX) to histogram the variable.
134 // If you are lost, you can click on HELP in any Root canvas or browser.
137 <img src="gif/AliMUONDisplay.gif">
144 gAlice->SetDisplay(this);
146 // Initialize display default parameters
148 // Set front view by default
155 fDrawClusters = kTRUE;
165 // Create display canvas
167 if (ysize < 100) ysize = 750;
168 Int_t xsize = Int_t(size*830./ysize);
169 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
170 fCanvas->ToggleEventStatus();
172 // Create main display pad
173 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
176 fPad->SetFillColor(30);
177 fPad->SetBorderSize(2);
182 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
184 fColPad->SetFillColor(17);
185 fColPad->SetBorderSize(2);
190 // Create user interface control pad
194 // Create Range and mode pad
197 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
200 fTrigPad->SetFillColor(22);
201 fTrigPad->SetBorderSize(2);
202 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
203 fRangeSlider->SetObject(this);
204 char pickmode[] = "gAlice->Display()->SetPickMode()";
206 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
207 fPickButton->SetFillColor(38);
209 char zoommode[] = "gAlice->Display()->SetZoomMode()";
210 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
211 fZoomButton->SetFillColor(38);
213 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
214 fArcButton->SetFillColor(kGreen);
216 char butUnzoom[] = "gAlice->Display()->UnZoom()";
217 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
218 button->SetFillColor(38);
220 AppendPad(); // append display object as last object to force selection
223 fTrigPad->SetEditable(kFALSE);
224 fButtons->SetEditable(kFALSE);
226 fNextCathode = kFALSE;
229 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display):AliDisplay(display)
231 // Dummy copy constructor
237 //_____________________________________________________________________________
238 AliMUONDisplay::~AliMUONDisplay()
240 // Delete space point structure
241 if (fPoints) fPoints->Delete();
245 if (fPhits) fPhits->Delete();
249 if (fRpoints) fRpoints->Delete();
254 //_____________________________________________________________________________
255 void AliMUONDisplay::Clear(Option_t *)
257 // Delete graphics temporary objects
260 //_____________________________________________________________________________
261 void AliMUONDisplay::DisplayButtons()
263 // Create the user interface buttons
266 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
268 fButtons->SetFillColor(38);
269 fButtons->SetBorderSize(2);
272 // Int_t butcolor = 33;
273 Float_t dbutton = 0.08;
280 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
281 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
282 button->SetFillColor(38);
286 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
287 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
288 button->SetFillColor(38);
292 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
293 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
294 button->SetFillColor(38);
298 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
299 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
300 button->SetFillColor(38);
304 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
305 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
306 button->SetFillColor(38);
310 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
311 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
312 button->SetFillColor(38);
316 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
317 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
318 button->SetFillColor(38);
322 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
323 diamond->SetFillColor(50);
324 diamond->SetTextAlign(22);
325 diamond->SetTextColor(5);
326 diamond->SetTextSize(0.11);
328 diamond->AddText(".. ");
329 diamond->AddText("ROOT");
330 diamond->AddText("MUON");
331 diamond->AddText("... ");
332 diamond->AddText(" ");
335 //_____________________________________________________________________________
336 void AliMUONDisplay::CreateColors()
338 // Create the colors palette used to display clusters
353 new TColor(color,r,g,b);
363 new TColor(color,r,g,b);
373 new TColor(color,r,g,b);
383 new TColor(color,r,g,b);
393 new TColor(color,r,g,b);
400 //_____________________________________________________________________________
401 void AliMUONDisplay::DisplayColorScale()
403 // Display pulse height color scale
406 Float_t xlow, ylow, xup, yup, hs;
407 Float_t x1, y1, x2, y2;
411 TText *text = new TText(0,0,"");
412 text->SetTextFont(61);
413 text->SetTextSize(0.2);
414 text->SetTextAlign(22);
416 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
417 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
418 AliMUONResponse * response=iChamber->ResponseModel();
420 if (response) adcmax = (Int_t) response->MaxAdc();
425 //*-* draw colortable boxes
426 hs = (y2-y1)/Float_t(22);
430 ylow = y1 + hs*(Float_t(i));
431 yup = y1 + hs*(Float_t(i+1));
433 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
434 Int_t scale=(Int_t)TMath::Exp(logscale);
435 sprintf(label,"%d",scale);
436 box = new TBox(xlow, ylow, xup, yup);
438 box->SetFillColor(color);
439 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
443 //______________________________________________________________________________
444 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
446 // Compute distance from point px,py to objects in event
448 gPad->SetCursor(kCross);
450 if (gPad == fTrigPad) return 9999;
452 const Int_t kBig = 9999;
454 Float_t xmin = gPad->GetX1();
455 Float_t xmax = gPad->GetX2();
456 Float_t dx = 0.02*(xmax - xmin);
457 Float_t x = gPad->AbsPixeltoX(px);
458 if (x < xmin+dx || x > xmax-dx) return dist;
460 if (fZoomMode) return 0;
464 //_____________________________________________________________________________
465 void AliMUONDisplay::Draw(Option_t *)
467 // Display current event
471 DrawView(fTheta, fPhi, fPsi);
472 // Display the event number and title
477 void AliMUONDisplay::DrawSegmentation()
479 // Draw graphical representation of segmenatation
480 // Attention: still experimental code
483 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
484 AliMUONChamber* iChamber;
485 AliSegmentation* seg;
486 iChamber = &(pMUON->Chamber(fChamber));
487 seg=iChamber->SegmentationModel(icat);
488 Float_t zpos=iChamber->Z();
489 Float_t r=iChamber->ROuter();
491 TMarker3DBox *marker;
493 for (Int_t j=0; j<seg->Npy(); j++) {
495 y0=j*seg->Dpy()-seg->Dpy()/2.;
496 for (seg->FirstPad(0.,y0,0,300,0.);
500 if (seg->ISector()==0) continue;
502 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
503 Float_t dpx=seg->Dpx(seg->ISector())/2;
504 Float_t dpy=seg->Dpy(seg->ISector())/2;
505 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
506 marker->SetLineColor(seg->ISector()+1);
507 marker->SetFillStyle(1001);
508 marker->SetFillColor(0);
513 for (Int_t j=0; j<250; j++) {
514 Float_t x0=j*seg->Dpx();
515 Float_t y0=TMath::Sqrt(r*r-x0*x0);
517 for (seg->FirstPad(x0,0,0,0,y0);
521 if (seg->ISector()==0) continue;
524 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
525 Float_t dpx=seg->Dpx(seg->ISector())/2;
526 Float_t dpy=seg->Dpy(seg->ISector())/2;
527 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
528 marker->SetLineColor(seg->ISector()+1);
529 marker->SetFillStyle(1001);
530 marker->SetFillColor(0);
537 //_____________________________________________________________________________
538 void AliMUONDisplay::DrawClusters()
540 // Draw clusters for MUON chambers
542 Int_t ndigits, digit;
550 ndigits = points->GetEntriesFast();
551 for (digit=0;digit<ndigits;digit++){
552 pm = (AliMUONPoints*)points->UncheckedAt(digit);
556 for (Int_t im=0;im<3;im++) {
557 TMarker3DBox *marker=pm->GetMarker(im);
562 fClustersCuts +=pm->GetN();
566 //_____________________________________________________________________________
567 void AliMUONDisplay::DrawHits()
569 // Draw hits for MUON chambers
573 Int_t ntracks, track;
580 ntracks = points->GetEntriesFast();
581 for (track=0;track<ntracks;track++) {
582 pm = (AliMUONPoints*)points->UncheckedAt(track);
585 fHitsCuts += pm->GetN();
590 //_____________________________________________________________________________
591 void AliMUONDisplay::DrawCoG()
593 // Draw hits for MUON chambers
594 if (!fDrawCoG) return;
595 if (fChamber > 10) return;
596 LoadCoG(fChamber,fCathode);
604 ncog = points->GetEntriesFast();
605 for (icog=0;icog<ncog;icog++) {
606 pm = (AliMUONPoints*)points->UncheckedAt(icog);
611 //_____________________________________________________________________________
613 void AliMUONDisplay::DrawTitle(Option_t *option)
615 // Draw the event title
617 Float_t xmin = gPad->GetX1();
618 Float_t xmax = gPad->GetX2();
619 Float_t ymin = gPad->GetY1();
620 Float_t ymax = gPad->GetY2();
621 Float_t dx = xmax-xmin;
622 Float_t dy = ymax-ymin;
624 if (strlen(option) == 0) {
625 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
626 // title->SetTextSize(0.023932);
627 title->SetTextSize(0.02);
628 title->SetBit(kCanDelete);
629 title->SetFillColor(42);
632 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
633 gAlice->GetHeader()->GetEvent(),
634 gAlice->GetHeader()->GetRun(),
637 title->AddText(ptitle);
638 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
639 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
640 nparticles, fHitsCuts,fClustersCuts);
641 title->AddText(ptitle);
643 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
644 label->SetBit(kCanDelete);
645 label->SetFillColor(42);
650 //_____________________________________________________________________________
651 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
653 // Draw a view of MUON clusters
654 printf("\n Draw View");
656 gPad->SetCursor(kWatch);
657 // gPad->SetFillColor(39);
658 gPad->SetFillColor(1);
660 // gPad->SetFillColor(39);
661 gPad->SetFillColor(1);
665 TView *view = new TView(1);
667 Float_t range = fRrange*fRangeSlider->GetMaximum();
668 view->SetRange(-range,-range,-range,range, range, range);
669 // zoom back to full scale only if DrawView not called from NextCathode
678 // Display MUON Chamber Geometry
680 sprintf(nodeName,"MUON%d",100+fChamber);
682 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
683 if (node1) node1->Draw("same");
684 //add clusters to the pad
688 // DrawSegmentation();
689 // add itself to the list (must be last)
691 view->SetView(phi, theta, psi, iret);
695 //______________________________________________________________________________
696 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
698 // Execute action corresponding to the mouse event
700 static Float_t x0, y0, x1, y1;
702 static Int_t pxold, pyold;
703 static Int_t px0, py0;
704 static Int_t linedrawn;
707 if (px == 0 && py == 0) { //when called by sliders
708 if (event == kButton1Up) {
713 if (!fZoomMode && gPad->GetView()) {
714 gPad->GetView()->ExecuteRotateView(event, px, py);
718 // something to zoom ?
719 gPad->SetCursor(kCross);
724 gVirtualX->SetLineColor(-1);
725 gPad->TAttLine::Modify(); //Change line attributes only if necessary
726 x0 = gPad->AbsPixeltoX(px);
727 y0 = gPad->AbsPixeltoY(py);
729 pxold = px; pyold = py;
734 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
738 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
742 gPad->GetCanvas()->FeedbackMode(kFALSE);
743 if (px == px0) return;
744 if (py == py0) return;
745 x1 = gPad->AbsPixeltoX(px);
746 y1 = gPad->AbsPixeltoY(py);
748 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
749 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
750 gPad->Range(x0,y0,x1,y1);
751 if (fZooms < AliMUONConstants::MaxZoom()-1) {
753 fZoomX0[fZooms] = x0;
754 fZoomY0[fZooms] = y0;
755 fZoomX1[fZooms] = x1;
756 fZoomY1[fZooms] = y1;
758 gPad->Modified(kTRUE);
763 //___________________________________________
764 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
766 // Read digits info and store x,y,z info in arrays fPoints
767 // Loop on all detectors
769 if (chamber > 14) return;
770 printf(" chamber %d \n",chamber);
776 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
777 AliMUONChamber* iChamber;
778 AliSegmentation* segmentation;
779 AliMUONResponse* response;
781 TClonesArray *muonDigits = pMUON->GetMUONData()->Digits(chamber-1,0);
782 if (muonDigits == 0) return;
784 // gAlice->ResetDigits();
787 if (gAlice->TreeD()) {
788 nent = (Int_t) gAlice->TreeD()->GetEntries();
789 printf(" entries %d \n", nent);
790 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
791 gAlice->TreeD()->GetEvent(cathode-1);
794 Int_t ndigits = muonDigits->GetEntriesFast();
795 if (ndigits == 0) return;
796 if (fPoints == 0) fPoints = new TObjArray(ndigits);
798 iChamber = &(pMUON->Chamber(chamber-1));
800 segmentation = iChamber->SegmentationModel(cathode);
801 response = iChamber->ResponseModel();
802 Float_t zpos = iChamber->Z();
805 AliMUONPoints *points = 0;
806 TMarker3DBox *marker = 0;
808 //loop over all digits and store their position
811 Float_t adcmax = 1024;
812 if (response) adcmax = response->MaxAdc();
814 for (Int_t digit = 0; digit < ndigits; digit++) {
815 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
816 if (mdig->Cathode() != cathode-1) continue;
819 // First get all needed parameters
821 Int_t charge = mdig->Signal();
822 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
823 Int_t color = 261+index;
824 Int_t colorTrigger = 2;
825 if (color > 282) color = 282;
827 if (chamber > 10) { // trigger chamber
829 for (Int_t icharge = 0; icharge < 10; icharge++) {
830 sumCharge = sumCharge+mdig->TrackCharge(icharge);
832 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
833 if(sumCharge <= 10 || testCharge > 0) {
834 colorTrigger = color;
840 // get the center of the pad - add on x and y half of pad size
841 Float_t xpad, ypad, zpad;
842 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
844 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
845 Float_t dpx = segmentation->Dpx(isec)/2;
846 Float_t dpy = segmentation->Dpy(isec)/2;
848 // segmentation->Dump();
851 // Then set the objects
853 points = new AliMUONPoints(npoints);
854 fPoints->AddAt(points,digit);
856 points->SetMarkerColor(colorTrigger);
858 points->SetMarkerColor(color);
860 points->SetMarkerStyle(21);
861 points->SetMarkerSize(0.5);
862 points->SetParticle(-1);
863 points->SetHitIndex(-1);
864 points->SetTrackIndex(-1);
865 points->SetDigitIndex(digit);
866 points->SetPoint(0,xpad,ypad,zpos);
868 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
869 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
872 marker->SetLineColor(lineColor);
873 marker->SetFillStyle(1001);
874 marker->SetFillColor(color);
875 marker->SetRefObject((TObject*)points);
876 points->Set3DMarker(0, marker);
879 //___________________________________________
880 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/)
882 // Read raw clusters info and store x,y,z info in arrays fRpoints
883 // Loop on all detectors
885 if (chamber > 10) return;
889 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
890 AliMUONChamber* iChamber;
892 TClonesArray *muonRawClusters = pMUON->GetMUONData()->RawClusters(chamber-1);
893 if (muonRawClusters == 0) return;
895 // pMUON->ResetRawClusters();
898 if (gAlice->TreeR()) {
899 nent=(Int_t)gAlice->TreeR()->GetEntries();
900 gAlice->TreeR()->GetEvent(0);
903 Int_t nrawcl = muonRawClusters->GetEntriesFast();
904 if (nrawcl == 0) return;
905 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
907 iChamber = &(pMUON->Chamber(chamber-1));
908 Float_t zpos=iChamber->Z();
909 AliMUONRawCluster *mRaw;
910 AliMUONPoints *points = 0;
912 //loop over all raw clusters and store their position
913 points = new AliMUONPoints(nrawcl);
914 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
915 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
916 fRpoints->AddAt(points,iraw);
917 points->SetMarkerColor(51);
918 points->SetMarkerStyle(2);
919 points->SetMarkerSize(1.);
920 points->SetParticle(-1);
921 points->SetHitIndex(-1);
922 points->SetTrackIndex(-1);
923 points->SetDigitIndex(-1);
924 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
927 //___________________________________________
928 void AliMUONDisplay::LoadHits(Int_t chamber)
930 // Read hits info and store x,y,z info in arrays fPhits
931 // Loop on all detectors
933 if (chamber > 14) return;
940 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
941 AliMUONChamber* iChamber;
943 iChamber = &(pMUON->Chamber(chamber-1));
944 Float_t zpos=iChamber->Z();
946 Int_t ntracks = (Int_t)pMUON->TreeH()->GetEntries(); //skowron
948 for (track = 0; track < ntracks; track++) {
950 pMUON->TreeH()->GetEvent(track);//skowron
951 TClonesArray *muonHits = pMUON->Hits();
952 if (muonHits == 0) return;
953 nthits += muonHits->GetEntriesFast();
955 if (fPhits == 0) fPhits = new TObjArray(nthits);
957 for (track=0; track<ntracks;track++) {
959 pMUON->TreeH()->GetEvent(track);//skowron
960 TClonesArray *muonHits = pMUON->Hits();
961 if (muonHits == 0) return;
962 Int_t nhits = muonHits->GetEntriesFast();
963 if (nhits == 0) continue;
965 AliMUONPoints *points = 0;
967 for (Int_t hit=0;hit<nhits;hit++) {
968 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
969 Int_t nch = mHit->Chamber(); // chamber number
970 if (nch != chamber) continue;
972 // Retrieve info and set the objects
974 points = new AliMUONPoints(npoints);
975 fPhits->AddAt(points,nhold+hit);
976 points->SetMarkerColor(kRed);
977 points->SetMarkerStyle(5);
978 points->SetMarkerSize(1.);
979 points->SetParticle(mHit->Track());
980 points->SetHitIndex(hit);
981 points->SetTrackIndex(track);
982 points->SetDigitIndex(-1);
983 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
989 //_____________________________________________________________________________
990 void AliMUONDisplay::Paint(Option_t *)
992 // Paint miscellaneous items
995 //_____________________________________________________________________________
996 void AliMUONDisplay::SetPickMode()
998 // Set parameters for pick mode.
1002 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1003 fTrigPad->Modified();
1006 //_____________________________________________________________________________
1007 void AliMUONDisplay::SetZoomMode()
1009 // Set parameters for zoom mode
1012 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1013 fTrigPad->Modified();
1016 //_____________________________________________________________________________
1017 void AliMUONDisplay::NextChamber(Int_t delta)
1019 // to go from chamber to next chamber if delta = 1
1020 // or previous chamber otherwise
1022 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1024 if (fChamber > 1) fChamber--;
1028 LoadDigits(fChamber, fCathode);
1032 //_____________________________________________________________________________
1033 void AliMUONDisplay::NextCathode()
1035 // to switch to other cathode plane
1038 if (fCathode == 1) {
1039 LoadDigits(fChamber, 2);
1041 LoadDigits(fChamber, 1);
1043 fNextCathode = kTRUE; // to keep the same zoom
1045 fNextCathode = kFALSE;
1046 TPad *pad = (TPad*)gPad->GetPadSave();
1047 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1048 fZoomX1[fZooms], fZoomY1[fZooms]);
1054 //_____________________________________________________________________________
1055 void AliMUONDisplay::Trigger()
1057 // returns Trigger Decision for current event
1058 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1059 decision->Trigger();
1063 //_____________________________________________________________________________
1064 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1066 // Set chamber and cathode number
1072 LoadDigits(chamber,cathode);
1076 void AliMUONDisplay::SetEvent(Int_t newevent)
1079 gAlice->GetEvent(newevent);
1081 if (!gAlice->TreeD()) return;
1084 LoadDigits(fChamber,fCathode);
1088 //_____________________________________________________________________________
1089 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1091 // Set view range along R and Z
1100 //_____________________________________________________________________________
1101 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1103 // change viewing angles for current event
1111 TView *view = gPad->GetView();
1112 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1117 //_____________________________________________________________________________
1118 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1120 // Display (current event_number + delta)
1121 // delta = 1 shown next event
1122 // delta = -1 show previous event
1125 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1126 Int_t newEvent = currentEvent + delta;
1127 gAlice->GetEvent(newEvent);
1129 if (!gAlice->TreeD()) return;
1132 LoadDigits(fChamber, fCathode);
1137 //______________________________________________________________________________
1138 void AliMUONDisplay::UnZoom()
1141 if (fZooms <= 0) return;
1143 TPad *pad = (TPad*)gPad->GetPadSave();
1144 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1148 //_____________________________________________________________________________
1149 void AliMUONDisplay::ResetPoints()
1152 // Reset array of points
1160 //_____________________________________________________________________________
1161 void AliMUONDisplay::ResetPhits()
1164 // Reset array of points
1172 //_____________________________________________________________________________
1173 void AliMUONDisplay::ResetRpoints()
1176 // Reset array of points
1185 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1187 // Dummy assignment operator