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"
70 // to manage the same zoom on both cathodes
74 ClassImp(AliMUONDisplay)
77 //_____________________________________________________________________________
78 AliMUONDisplay::AliMUONDisplay()
85 fNextCathode = kFALSE;
89 //_____________________________________________________________________________
90 AliMUONDisplay::AliMUONDisplay(Int_t size)
92 // Create an event display object.
93 // A canvas named "edisplay" is created with a vertical size in pixels
95 // A QUICK Overview of the Event Display functions
96 // ===============================================
98 // The event display can ve invoked by executing the macro "display.C"
99 // A canvas like in the picture below will appear.
101 // On the left side of the canvas, the following buttons appear:
102 // *Next* to move to the next event
103 // *Previous* to move to the previous event
105 // *Pick* Select this option to be able to point on a track with the
106 // mouse. Once on the track, use the right button to select
107 // an action. For example, select SetMarkerAttributes to
108 // change the marker type/color/size for the track.
109 // *Zoom* Select this option (default) if you want to zoom.
110 // To zoom, simply select the selected area with the left button.
111 // *UnZoom* To revert to the previous picture size.
113 // slider R On the left side, the vertical slider can be used to
114 // set the default picture size.
116 // When you are in Zoom mode, you can click on the black part of the canvas
117 // to select special options with the right mouse button.
120 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
121 // When you are on a track, select the menu item "InspectParticle"
122 // to display the current particle attributes.
124 // You can activate the Root browser by selecting the Inspect menu
125 // in the canvas tool bar menu. Then select "Start Browser"
126 // This will open a new canvas with the browser. At this point, you may want
127 // to display some histograms (from the Trees). Go to the "File" menu
128 // of the browser and click on "New canvas".
129 // In the browser, click on item "ROOT files" in the left pane.
130 // Click on galice.root.
132 // Click on TPC for example
133 // Click on any variable (eg TPC.fX) to histogram the variable.
135 // If you are lost, you can click on HELP in any Root canvas or browser.
138 <img src="gif/AliMUONDisplay.gif">
145 gAlice->SetDisplay(this);
147 // Initialize display default parameters
149 // Set front view by default
156 fDrawClusters = kTRUE;
166 // Create display canvas
168 if (ysize < 100) ysize = 750;
169 Int_t xsize = Int_t(size*830./ysize);
170 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
171 fCanvas->ToggleEventStatus();
173 // Create main display pad
174 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
177 fPad->SetFillColor(30);
178 fPad->SetBorderSize(2);
183 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
185 fColPad->SetFillColor(17);
186 fColPad->SetBorderSize(2);
191 // Create user interface control pad
195 // Create Range and mode pad
198 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
201 fTrigPad->SetFillColor(22);
202 fTrigPad->SetBorderSize(2);
203 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
204 fRangeSlider->SetObject(this);
205 char pickmode[] = "gAlice->Display()->SetPickMode()";
207 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
208 fPickButton->SetFillColor(38);
210 char zoommode[] = "gAlice->Display()->SetZoomMode()";
211 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
212 fZoomButton->SetFillColor(38);
214 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
215 fArcButton->SetFillColor(kGreen);
217 char butUnzoom[] = "gAlice->Display()->UnZoom()";
218 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
219 button->SetFillColor(38);
221 AppendPad(); // append display object as last object to force selection
224 fTrigPad->SetEditable(kFALSE);
225 fButtons->SetEditable(kFALSE);
227 fNextCathode = kFALSE;
230 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display):AliDisplay(display)
232 // Dummy copy constructor
238 //_____________________________________________________________________________
239 AliMUONDisplay::~AliMUONDisplay()
241 // Delete space point structure
242 if (fPoints) fPoints->Delete();
246 if (fPhits) fPhits->Delete();
250 if (fRpoints) fRpoints->Delete();
255 //_____________________________________________________________________________
256 void AliMUONDisplay::Clear(Option_t *)
258 // Delete graphics temporary objects
261 //_____________________________________________________________________________
262 void AliMUONDisplay::DisplayButtons()
264 // Create the user interface buttons
267 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
269 fButtons->SetFillColor(38);
270 fButtons->SetBorderSize(2);
273 // Int_t butcolor = 33;
274 Float_t dbutton = 0.08;
281 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
282 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
283 button->SetFillColor(38);
287 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
288 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
289 button->SetFillColor(38);
293 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
294 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
295 button->SetFillColor(38);
299 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
300 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
301 button->SetFillColor(38);
305 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
306 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
307 button->SetFillColor(38);
311 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
312 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
313 button->SetFillColor(38);
317 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
318 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
319 button->SetFillColor(38);
323 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
324 diamond->SetFillColor(50);
325 diamond->SetTextAlign(22);
326 diamond->SetTextColor(5);
327 diamond->SetTextSize(0.11);
329 diamond->AddText(".. ");
330 diamond->AddText("ROOT");
331 diamond->AddText("MUON");
332 diamond->AddText("... ");
333 diamond->AddText(" ");
336 //_____________________________________________________________________________
337 void AliMUONDisplay::CreateColors()
339 // Create the colors palette used to display clusters
354 new TColor(color,r,g,b);
364 new TColor(color,r,g,b);
374 new TColor(color,r,g,b);
384 new TColor(color,r,g,b);
394 new TColor(color,r,g,b);
401 //_____________________________________________________________________________
402 void AliMUONDisplay::DisplayColorScale()
404 // Display pulse height color scale
407 Float_t xlow, ylow, xup, yup, hs;
408 Float_t x1, y1, x2, y2;
412 TText *text = new TText(0,0,"");
413 text->SetTextFont(61);
414 text->SetTextSize(0.2);
415 text->SetTextAlign(22);
417 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
418 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
419 AliMUONResponse * response=iChamber->ResponseModel();
421 if (response) adcmax = (Int_t) response->MaxAdc();
426 //*-* draw colortable boxes
427 hs = (y2-y1)/Float_t(22);
431 ylow = y1 + hs*(Float_t(i));
432 yup = y1 + hs*(Float_t(i+1));
434 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
435 Int_t scale=(Int_t)TMath::Exp(logscale);
436 sprintf(label,"%d",scale);
437 box = new TBox(xlow, ylow, xup, yup);
439 box->SetFillColor(color);
440 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
444 //______________________________________________________________________________
445 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
447 // Compute distance from point px,py to objects in event
449 gPad->SetCursor(kCross);
451 if (gPad == fTrigPad) return 9999;
453 const Int_t kBig = 9999;
455 Float_t xmin = gPad->GetX1();
456 Float_t xmax = gPad->GetX2();
457 Float_t dx = 0.02*(xmax - xmin);
458 Float_t x = gPad->AbsPixeltoX(px);
459 if (x < xmin+dx || x > xmax-dx) return dist;
461 if (fZoomMode) return 0;
465 //_____________________________________________________________________________
466 void AliMUONDisplay::Draw(Option_t *)
468 // Display current event
472 DrawView(fTheta, fPhi, fPsi);
473 // Display the event number and title
478 void AliMUONDisplay::DrawSegmentation()
480 // Draw graphical representation of segmenatation
481 // Attention: still experimental code
484 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
485 AliMUONChamber* iChamber;
486 AliSegmentation* seg;
487 iChamber = &(pMUON->Chamber(fChamber));
488 seg=iChamber->SegmentationModel(icat);
489 Float_t zpos=iChamber->Z();
490 Float_t r=iChamber->ROuter();
492 TMarker3DBox *marker;
494 for (Int_t j=0; j<seg->Npy(); j++) {
496 y0=j*seg->Dpy()-seg->Dpy()/2.;
497 for (seg->FirstPad(0.,y0,0,300,0.);
501 if (seg->ISector()==0) continue;
503 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
504 Float_t dpx=seg->Dpx(seg->ISector())/2;
505 Float_t dpy=seg->Dpy(seg->ISector())/2;
506 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
507 marker->SetLineColor(seg->ISector()+1);
508 marker->SetFillStyle(1001);
509 marker->SetFillColor(0);
514 for (Int_t j=0; j<250; j++) {
515 Float_t x0=j*seg->Dpx();
516 Float_t y0=TMath::Sqrt(r*r-x0*x0);
518 for (seg->FirstPad(x0,0,0,0,y0);
522 if (seg->ISector()==0) continue;
525 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
526 Float_t dpx=seg->Dpx(seg->ISector())/2;
527 Float_t dpy=seg->Dpy(seg->ISector())/2;
528 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
529 marker->SetLineColor(seg->ISector()+1);
530 marker->SetFillStyle(1001);
531 marker->SetFillColor(0);
538 //_____________________________________________________________________________
539 void AliMUONDisplay::DrawClusters()
541 // Draw clusters for MUON chambers
543 Int_t ndigits, digit;
551 ndigits = points->GetEntriesFast();
552 for (digit=0;digit<ndigits;digit++){
553 pm = (AliMUONPoints*)points->UncheckedAt(digit);
557 for (Int_t im=0;im<3;im++) {
558 TMarker3DBox *marker=pm->GetMarker(im);
563 fClustersCuts +=pm->GetN();
567 //_____________________________________________________________________________
568 void AliMUONDisplay::DrawHits()
570 // Draw hits for MUON chambers
574 Int_t ntracks, track;
581 ntracks = points->GetEntriesFast();
582 for (track=0;track<ntracks;track++) {
583 pm = (AliMUONPoints*)points->UncheckedAt(track);
586 fHitsCuts += pm->GetN();
591 //_____________________________________________________________________________
592 void AliMUONDisplay::DrawCoG()
594 // Draw hits for MUON chambers
595 if (!fDrawCoG) return;
596 if (fChamber > 10) return;
597 LoadCoG(fChamber,fCathode);
605 ncog = points->GetEntriesFast();
606 for (icog=0;icog<ncog;icog++) {
607 pm = (AliMUONPoints*)points->UncheckedAt(icog);
612 //_____________________________________________________________________________
614 void AliMUONDisplay::DrawTitle(Option_t *option)
616 // Draw the event title
618 Float_t xmin = gPad->GetX1();
619 Float_t xmax = gPad->GetX2();
620 Float_t ymin = gPad->GetY1();
621 Float_t ymax = gPad->GetY2();
622 Float_t dx = xmax-xmin;
623 Float_t dy = ymax-ymin;
626 AliRunLoader * RunLoader = AliRunLoader::GetRunLoader("MUONFolder");
628 if (strlen(option) == 0) {
629 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
630 // title->SetTextSize(0.023932);
631 title->SetTextSize(0.02);
632 title->SetBit(kCanDelete);
633 title->SetFillColor(42);
636 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
637 RunLoader->GetEventNumber(),
638 gAlice->GetHeader()->GetRun(),
641 title->AddText(ptitle);
642 Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast();
643 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
644 nparticles, fHitsCuts,fClustersCuts);
645 title->AddText(ptitle);
647 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
648 label->SetBit(kCanDelete);
649 label->SetFillColor(42);
654 //_____________________________________________________________________________
655 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
657 // Draw a view of MUON clusters
658 printf("\n Draw View");
660 gPad->SetCursor(kWatch);
661 // gPad->SetFillColor(39);
662 gPad->SetFillColor(1);
664 // gPad->SetFillColor(39);
665 gPad->SetFillColor(1);
669 TView *view = new TView(1);
671 Float_t range = fRrange*fRangeSlider->GetMaximum();
672 view->SetRange(-range,-range,-range,range, range, range);
673 // zoom back to full scale only if DrawView not called from NextCathode
682 // Display MUON Chamber Geometry
684 sprintf(nodeName,"MUON%d",100+fChamber);
686 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
687 if (node1) node1->Draw("same");
688 //add clusters to the pad
692 // DrawSegmentation();
693 // add itself to the list (must be last)
695 view->SetView(phi, theta, psi, iret);
699 //______________________________________________________________________________
700 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
702 // Execute action corresponding to the mouse event
704 static Float_t x0, y0, x1, y1;
706 static Int_t pxold, pyold;
707 static Int_t px0, py0;
708 static Int_t linedrawn;
711 if (px == 0 && py == 0) { //when called by sliders
712 if (event == kButton1Up) {
717 if (!fZoomMode && gPad->GetView()) {
718 gPad->GetView()->ExecuteRotateView(event, px, py);
722 // something to zoom ?
723 gPad->SetCursor(kCross);
728 gVirtualX->SetLineColor(-1);
729 gPad->TAttLine::Modify(); //Change line attributes only if necessary
730 x0 = gPad->AbsPixeltoX(px);
731 y0 = gPad->AbsPixeltoY(py);
733 pxold = px; pyold = py;
738 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
742 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
746 gPad->GetCanvas()->FeedbackMode(kFALSE);
747 if (px == px0) return;
748 if (py == py0) return;
749 x1 = gPad->AbsPixeltoX(px);
750 y1 = gPad->AbsPixeltoY(py);
752 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
753 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
754 gPad->Range(x0,y0,x1,y1);
755 if (fZooms < AliMUONConstants::MaxZoom()-1) {
757 fZoomX0[fZooms] = x0;
758 fZoomY0[fZooms] = y0;
759 fZoomX1[fZooms] = x1;
760 fZoomY1[fZooms] = y1;
762 gPad->Modified(kTRUE);
767 //___________________________________________
768 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
770 // Read digits info and store x,y,z info in arrays fPoints
771 // Loop on all detectors
773 if (chamber > 14) return;
774 printf(" chamber %d \n",chamber);
780 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
781 AliMUONChamber* iChamber;
782 AliSegmentation* segmentation;
783 AliMUONResponse* response;
785 TClonesArray *muonDigits = pMUON->GetMUONData()->Digits(chamber-1);
786 if (muonDigits == 0) return;
788 // gAlice->ResetDigits();
791 if (pMUON->GetLoader()->TreeD()) {
792 nent = (Int_t) pMUON->GetLoader()->TreeD()->GetEntries();
793 printf(" entries %d \n", nent);
794 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
795 pMUON->GetMUONData()->GetCathode(cathode-1);
798 Int_t ndigits = muonDigits->GetEntriesFast();
799 if (ndigits == 0) return;
800 if (fPoints == 0) fPoints = new TObjArray(ndigits);
802 iChamber = &(pMUON->Chamber(chamber-1));
804 segmentation = iChamber->SegmentationModel(cathode);
805 response = iChamber->ResponseModel();
806 Float_t zpos = iChamber->Z();
809 AliMUONPoints *points = 0;
810 TMarker3DBox *marker = 0;
812 //loop over all digits and store their position
815 Float_t adcmax = 1024;
816 if (response&&chamber<11) adcmax = response->MaxAdc();
818 for (Int_t digit = 0; digit < ndigits; digit++) {
819 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
820 if (mdig->Cathode() != cathode-1) continue;
823 // First get all needed parameters
825 Int_t charge = mdig->Signal();
826 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
827 Int_t color = 261+index;
828 Int_t colorTrigger = 2;
829 if (color > 282) color = 282;
831 if (chamber > 10) { // trigger chamber
834 for (Int_t icharge = 0; icharge < 10; icharge++) {
835 sumCharge = sumCharge+mdig->TrackCharge(icharge);
837 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
838 if(sumCharge <= 10 || testCharge > 0) {
839 colorTrigger = color;
845 // get the center of the pad - add on x and y half of pad size
846 Float_t xpad, ypad, zpad;
847 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
849 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
850 Float_t dpx = segmentation->Dpx(isec)/2;
851 Float_t dpy = segmentation->Dpy(isec)/2;
853 // segmentation->Dump();
856 // Then set the objects
858 points = new AliMUONPoints(npoints);
859 fPoints->AddAt(points,digit);
861 points->SetMarkerColor(colorTrigger);
863 points->SetMarkerColor(color);
865 points->SetMarkerStyle(21);
866 points->SetMarkerSize(0.5);
867 points->SetParticle(-1);
868 points->SetHitIndex(-1);
869 points->SetTrackIndex(-1);
870 points->SetDigitIndex(digit);
871 points->SetPoint(0,xpad,ypad,zpos);
873 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
874 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
877 marker->SetLineColor(lineColor);
878 marker->SetFillStyle(1001);
879 marker->SetFillColor(color);
880 marker->SetRefObject((TObject*)points);
881 points->Set3DMarker(0, marker);
884 //___________________________________________
885 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/)
887 // Read raw clusters info and store x,y,z info in arrays fRpoints
888 // Loop on all detectors
890 if (chamber > 10) return;
894 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
895 AliMUONChamber* iChamber;
897 TClonesArray *muonRawClusters = pMUON->GetMUONData()->RawClusters(chamber-1);
899 if (muonRawClusters == 0) return;
902 if (pMUON->GetMUONData()->TreeR()) {
903 nent=(Int_t) pMUON->GetMUONData()->TreeR()->GetEntries();
904 pMUON->GetMUONData()->TreeR()->GetEvent(0);
907 Int_t nrawcl = muonRawClusters->GetEntriesFast();
908 if (nrawcl == 0) return;
909 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
911 iChamber = &(pMUON->Chamber(chamber-1));
912 Float_t zpos=iChamber->Z();
913 AliMUONRawCluster *mRaw;
914 AliMUONPoints *points = 0;
916 //loop over all raw clusters and store their position
917 points = new AliMUONPoints(nrawcl);
918 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
919 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
920 fRpoints->AddAt(points,iraw);
921 points->SetMarkerColor(51);
922 points->SetMarkerStyle(2);
923 points->SetMarkerSize(1.);
924 points->SetParticle(-1);
925 points->SetHitIndex(-1);
926 points->SetTrackIndex(-1);
927 points->SetDigitIndex(-1);
928 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
931 //___________________________________________
932 void AliMUONDisplay::LoadHits(Int_t chamber)
934 // Read hits info and store x,y,z info in arrays fPhits
935 // Loop on all detectors
937 if (chamber > 14) return;
944 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
945 AliMUONChamber* iChamber;
947 iChamber = &(pMUON->Chamber(chamber-1));
948 Float_t zpos=iChamber->Z();
950 Int_t ntracks = (Int_t)pMUON->GetMUONData()->TreeH()->GetEntries(); //skowron
952 for (track = 0; track < ntracks; track++) {
953 pMUON->GetMUONData()->ResetHits();
954 pMUON->GetMUONData()->GetTrack(track);//skowron
955 TClonesArray *muonHits = pMUON->GetMUONData()->Hits();
956 if (muonHits == 0) return;
957 nthits += muonHits->GetEntriesFast();
959 if (fPhits == 0) fPhits = new TObjArray(nthits);
961 for (track=0; track<ntracks;track++) {
962 pMUON->GetMUONData()->ResetHits();
963 pMUON->GetMUONData()->GetTrack(track);//skowron
964 TClonesArray *muonHits = pMUON->GetMUONData()->Hits();
965 if (muonHits == 0) return;
966 Int_t nhits = muonHits->GetEntriesFast();
967 if (nhits == 0) continue;
969 AliMUONPoints *points = 0;
971 for (Int_t hit=0;hit<nhits;hit++) {
972 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
973 Int_t nch = mHit->Chamber(); // chamber number
974 if (nch != chamber) continue;
976 // Retrieve info and set the objects
978 points = new AliMUONPoints(npoints);
979 fPhits->AddAt(points,nhold+hit);
980 points->SetMarkerColor(kRed);
981 points->SetMarkerStyle(5);
982 points->SetMarkerSize(1.);
983 points->SetParticle(mHit->Track());
984 points->SetHitIndex(hit);
985 points->SetTrackIndex(track);
986 points->SetDigitIndex(-1);
987 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
993 //_____________________________________________________________________________
994 void AliMUONDisplay::Paint(Option_t *)
996 // Paint miscellaneous items
999 //_____________________________________________________________________________
1000 void AliMUONDisplay::SetPickMode()
1002 // Set parameters for pick mode.
1006 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1007 fTrigPad->Modified();
1010 //_____________________________________________________________________________
1011 void AliMUONDisplay::SetZoomMode()
1013 // Set parameters for zoom mode
1016 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1017 fTrigPad->Modified();
1020 //_____________________________________________________________________________
1021 void AliMUONDisplay::NextChamber(Int_t delta)
1023 // to go from chamber to next chamber if delta = 1
1024 // or previous chamber otherwise
1026 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1028 if (fChamber > 1) fChamber--;
1032 LoadDigits(fChamber, fCathode);
1036 //_____________________________________________________________________________
1037 void AliMUONDisplay::NextCathode()
1039 // to switch to other cathode plane
1042 if (fCathode == 1) {
1043 LoadDigits(fChamber, 2);
1045 LoadDigits(fChamber, 1);
1047 fNextCathode = kTRUE; // to keep the same zoom
1049 fNextCathode = kFALSE;
1050 TPad *pad = (TPad*)gPad->GetPadSave();
1051 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1052 fZoomX1[fZooms], fZoomY1[fZooms]);
1058 //_____________________________________________________________________________
1059 void AliMUONDisplay::Trigger()
1061 // returns Trigger Decision for current event
1062 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1063 decision->Trigger();
1067 //_____________________________________________________________________________
1068 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1070 // Set chamber and cathode number
1076 LoadDigits(chamber,cathode);
1080 void AliMUONDisplay::SetEvent(Int_t newevent)
1083 gAlice->GetEvent(newevent);
1085 if (!gAlice->TreeD()) return;
1088 LoadDigits(fChamber,fCathode);
1092 //_____________________________________________________________________________
1093 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1095 // Set view range along R and Z
1104 //_____________________________________________________________________________
1105 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1107 // change viewing angles for current event
1115 TView *view = gPad->GetView();
1116 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1121 //_____________________________________________________________________________
1122 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1125 AliRunLoader * RunLoader = AliRunLoader::GetRunLoader("MUONFolder");
1127 // Display (current event_number + delta)
1128 // delta = 1 shown next event
1129 // delta = -1 show previous event
1131 //RunLoader->CleanDetectors();
1132 //RunLoader->CleanKinematics();
1133 Int_t currentEvent = RunLoader->GetEventNumber();
1134 Int_t newEvent = currentEvent + delta;
1135 RunLoader->GetEvent(newEvent);
1138 LoadDigits(fChamber, fCathode);
1143 //______________________________________________________________________________
1144 void AliMUONDisplay::UnZoom()
1147 if (fZooms <= 0) return;
1149 TPad *pad = (TPad*)gPad->GetPadSave();
1150 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1154 //_____________________________________________________________________________
1155 void AliMUONDisplay::ResetPoints()
1158 // Reset array of points
1166 //_____________________________________________________________________________
1167 void AliMUONDisplay::ResetPhits()
1170 // Reset array of points
1178 //_____________________________________________________________________________
1179 void AliMUONDisplay::ResetRpoints()
1182 // Reset array of points
1191 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1193 // Dummy assignment operator