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 Revision 1.14 2001/04/05 08:30:48 gosset
19 Cleaning: suppression of Cpoints and (R2points + CoG2)
20 Correction: TreeR->GetEvent(0) for raw clusters
22 Revision 1.13 2001/03/30 13:01:50 gosset
23 Centroid of raw clusters displayed for each cathode plane
25 Revision 1.12 2001/03/05 23:50:08 morsch
26 Correct access to digit and recpoint data.
28 Revision 1.11 2001/01/26 21:41:55 morsch
29 Use access functions to AliMUONDigit member data.
31 Revision 1.10 2001/01/25 20:41:56 morsch
32 Protect against empty TreeD and TreeR.
34 Revision 1.9 2001/01/23 18:58:19 hristov
35 Initialisation of some pointers
37 Revision 1.8 2000/10/06 09:09:01 morsch
38 Pad colour according to z-position (slats).
40 Revision 1.7 2000/10/02 21:28:09 fca
41 Removal of useless dependecies via forward declarations
43 Revision 1.6 2000/07/03 11:54:57 morsch
44 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
45 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
47 Revision 1.5 2000/06/28 15:16:35 morsch
48 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
49 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
50 framework. The changes should have no side effects (mostly dummy arguments).
51 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
52 of chambers with overlapping modules (MakePadHits, Disintegration).
54 Revision 1.4 2000/06/27 09:46:57 morsch
55 kMAXZOOM global constant now in AliMUONConstants
57 Revision 1.3 2000/06/26 14:02:38 morsch
58 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
60 Revision 1.2 2000/06/15 07:58:48 morsch
61 Code from MUON-dev joined
63 Revision 1.1.2.15 2000/06/14 14:37:53 morsch
64 method Trigger() modified
66 Revision 1.1.2.14 2000/06/09 21:57:09 morsch
67 Bug in color scale diplay corrected.
68 Most coding rule violations corrected.
70 Revision 1.1.2.13 2000/05/02 11:57:27 morsch
71 Coding rules RN3, RN13, RN17 violations corrected.
73 Revision 1.1.2.12 2000/04/26 12:27:33 morsch
74 Mods for trigger display (P. Crochet):
75 - color code versus time for pad hits in trigger chambers
76 - call to TriggerDecision corrected
78 Revision 1.1.2.11 2000/04/26 09:04:46 morsch
79 Obsolete cathode correlation related code removed.
81 Revision 1.1.2.10 2000/04/19 19:43:47 morsch
82 change NCH to kNCH as in AliMUON.h
83 no more TreeC related methods
85 Revision 1.1.2.9 2000/03/20 18:10:33 morsch
86 Trigger method for "online" trigger decission added
88 Revision 1.1.2.8 2000/02/23 10:12:01 morsch
89 Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
90 General clean-up of commented code.
92 Revision 1.1.2.7 2000/02/17 14:36:55 morsch
93 Display of Trigger hits and clusters added.
94 Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
96 Revision 1.1.2.6 2000/02/15 10:19:42 morsch
97 Previous log messages included
99 Revision 1.1.2.5 2000/02/15 10:09:09 morsch
102 Revision 1.1.2.4 2000/02/08 09:17:16 gosset
103 One more improvement of MUON display:
104 same zoom for both cathode planes in a chamber
106 Revision 1.1.2.3 2000/02/07 15:37:21 gosset
107 A few improvements of the MUON display:
108 new buttons to change either chamber or cathode,
109 added to the more complicated way
110 (right mouse click and explicit filling of chamber and cathode)
112 Revision 1.1.2.2 2000/02/04 10:57:34 gosset
113 Z position of the chambers:
114 it was the Z position of the stations;
115 it is now really the Z position of the chambers.
116 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
117 !!!! AND "AliMUONChamber::ZPosition"
118 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
119 !!!! AND "AliMUONChamber::Z"
122 //////////////////////////////////////////////////////////////////////////
126 // Utility class to display ALICE outline, tracks, hits,.. //
128 //////////////////////////////////////////////////////////////////////////
137 #include <TPolyMarker3D.h>
138 #include <TPaveLabel.h>
139 #include <TPaveText.h>
141 #include <TDiamond.h>
146 #include <TSliderBox.h>
148 #include <TVirtualX.h>
151 #include <TGeometry.h>
152 #include <X3DBuffer.h>
153 #include <TMarker3DBox.h>
156 #include "AliDetector.h"
158 #include "AliMUONDisplay.h"
159 #include "AliMUONPoints.h"
160 #include "TParticle.h"
161 #include "AliMUONTriggerDecision.h"
162 #include "AliHeader.h"
164 #include "AliMUONHit.h"
165 #include "AliMUONPadHit.h"
166 #include "AliMUONDigit.h"
167 #include "AliMUONRawCluster.h"
169 #include "AliSegmentation.h"
170 #include "AliMUONResponse.h"
171 #include "AliMUONChamber.h"
172 #include "AliMUONConstants.h"
173 // to manage the same zoom on both cathodes
177 ClassImp(AliMUONDisplay)
180 //_____________________________________________________________________________
181 AliMUONDisplay::AliMUONDisplay()
188 fNextCathode = kFALSE;
192 //_____________________________________________________________________________
193 AliMUONDisplay::AliMUONDisplay(Int_t size)
195 // Create an event display object.
196 // A canvas named "edisplay" is created with a vertical size in pixels
198 // A QUICK Overview of the Event Display functions
199 // ===============================================
201 // The event display can ve invoked by executing the macro "display.C"
202 // A canvas like in the picture below will appear.
204 // On the left side of the canvas, the following buttons appear:
205 // *Next* to move to the next event
206 // *Previous* to move to the previous event
208 // *Pick* Select this option to be able to point on a track with the
209 // mouse. Once on the track, use the right button to select
210 // an action. For example, select SetMarkerAttributes to
211 // change the marker type/color/size for the track.
212 // *Zoom* Select this option (default) if you want to zoom.
213 // To zoom, simply select the selected area with the left button.
214 // *UnZoom* To revert to the previous picture size.
216 // slider R On the left side, the vertical slider can be used to
217 // set the default picture size.
219 // When you are in Zoom mode, you can click on the black part of the canvas
220 // to select special options with the right mouse button.
223 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
224 // When you are on a track, select the menu item "InspectParticle"
225 // to display the current particle attributes.
227 // You can activate the Root browser by selecting the Inspect menu
228 // in the canvas tool bar menu. Then select "Start Browser"
229 // This will open a new canvas with the browser. At this point, you may want
230 // to display some histograms (from the Trees). Go to the "File" menu
231 // of the browser and click on "New canvas".
232 // In the browser, click on item "ROOT files" in the left pane.
233 // Click on galice.root.
235 // Click on TPC for example
236 // Click on any variable (eg TPC.fX) to histogram the variable.
238 // If you are lost, you can click on HELP in any Root canvas or browser.
241 <img src="gif/AliMUONDisplay.gif">
248 gAlice->SetDisplay(this);
250 // Initialize display default parameters
252 // Set front view by default
259 fDrawClusters = kTRUE;
269 // Create display canvas
271 if (ysize < 100) ysize = 750;
272 Int_t xsize = Int_t(size*830./ysize);
273 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
274 fCanvas->ToggleEventStatus();
276 // Create main display pad
277 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
280 fPad->SetFillColor(30);
281 fPad->SetBorderSize(2);
286 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
288 fColPad->SetFillColor(17);
289 fColPad->SetBorderSize(2);
294 // Create user interface control pad
298 // Create Range and mode pad
301 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
302 fTrigPad->SetEditable(kFALSE);
305 fTrigPad->SetFillColor(22);
306 fTrigPad->SetBorderSize(2);
307 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
308 fRangeSlider->SetObject(this);
309 char pickmode[] = "gAlice->Display()->SetPickMode()";
311 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
312 fPickButton->SetFillColor(38);
314 char zoommode[] = "gAlice->Display()->SetZoomMode()";
315 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
316 fZoomButton->SetFillColor(38);
318 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
319 fArcButton->SetFillColor(kGreen);
321 char butUnzoom[] = "gAlice->Display()->UnZoom()";
322 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
323 button->SetFillColor(38);
325 AppendPad(); // append display object as last object to force selection
329 fNextCathode = kFALSE;
332 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
334 // Dummy copy constructor
340 //_____________________________________________________________________________
341 AliMUONDisplay::~AliMUONDisplay()
343 // Delete space point structure
344 if (fPoints) fPoints->Delete();
348 if (fPhits) fPhits->Delete();
352 if (fRpoints) fRpoints->Delete();
357 //_____________________________________________________________________________
358 void AliMUONDisplay::Clear(Option_t *)
360 // Delete graphics temporary objects
363 //_____________________________________________________________________________
364 void AliMUONDisplay::DisplayButtons()
366 // Create the user interface buttons
369 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
370 fButtons->SetEditable(kFALSE);
372 fButtons->SetFillColor(38);
373 fButtons->SetBorderSize(2);
376 // Int_t butcolor = 33;
377 Float_t dbutton = 0.08;
384 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
385 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
386 button->SetFillColor(38);
390 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
391 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
392 button->SetFillColor(38);
396 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
397 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
398 button->SetFillColor(38);
402 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
403 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
404 button->SetFillColor(38);
408 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
409 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
410 button->SetFillColor(38);
414 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
415 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
416 button->SetFillColor(38);
420 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
421 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
422 button->SetFillColor(38);
426 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
427 diamond->SetFillColor(50);
428 diamond->SetTextAlign(22);
429 diamond->SetTextColor(5);
430 diamond->SetTextSize(0.11);
432 diamond->AddText(".. ");
433 diamond->AddText("ROOT");
434 diamond->AddText("MUON");
435 diamond->AddText("... ");
436 diamond->AddText(" ");
439 //_____________________________________________________________________________
440 void AliMUONDisplay::CreateColors()
442 // Create the colors palette used to display clusters
457 new TColor(color,r,g,b);
467 new TColor(color,r,g,b);
477 new TColor(color,r,g,b);
487 new TColor(color,r,g,b);
497 new TColor(color,r,g,b);
504 //_____________________________________________________________________________
505 void AliMUONDisplay::DisplayColorScale()
507 // Display pulse height color scale
510 Float_t xlow, ylow, xup, yup, hs;
511 Float_t x1, y1, x2, y2;
515 TText *text = new TText(0,0,"");
516 text->SetTextFont(61);
517 text->SetTextSize(0.2);
518 text->SetTextAlign(22);
520 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
521 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
522 AliMUONResponse * response=iChamber->ResponseModel();
524 if (response) adcmax = (Int_t) response->MaxAdc();
529 //*-* draw colortable boxes
530 hs = (y2-y1)/Float_t(22);
534 ylow = y1 + hs*(Float_t(i));
535 yup = y1 + hs*(Float_t(i+1));
537 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
538 Int_t scale=(Int_t)TMath::Exp(logscale);
539 sprintf(label,"%d",scale);
540 box = new TBox(xlow, ylow, xup, yup);
542 box->SetFillColor(color);
543 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
547 //______________________________________________________________________________
548 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
550 // Compute distance from point px,py to objects in event
552 gPad->SetCursor(kCross);
554 if (gPad == fTrigPad) return 9999;
556 const Int_t kBig = 9999;
558 Float_t xmin = gPad->GetX1();
559 Float_t xmax = gPad->GetX2();
560 Float_t dx = 0.02*(xmax - xmin);
561 Float_t x = gPad->AbsPixeltoX(px);
562 if (x < xmin+dx || x > xmax-dx) return dist;
564 if (fZoomMode) return 0;
568 //_____________________________________________________________________________
569 void AliMUONDisplay::Draw(Option_t *)
571 // Display current event
575 DrawView(fTheta, fPhi, fPsi);
576 // Display the event number and title
581 void AliMUONDisplay::DrawSegmentation()
583 // Draw graphical representation of segmenatation
584 // Attention: still experimental code
587 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
588 AliMUONChamber* iChamber;
589 AliSegmentation* seg;
590 iChamber = &(pMUON->Chamber(fChamber));
591 seg=iChamber->SegmentationModel(icat);
592 Float_t zpos=iChamber->Z();
593 Float_t r=iChamber->ROuter();
595 TMarker3DBox *marker;
597 for (Int_t j=0; j<seg->Npy(); j++) {
599 y0=j*seg->Dpy()-seg->Dpy()/2.;
600 for (seg->FirstPad(0.,y0,0,300,0.);
604 if (seg->ISector()==0) continue;
606 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
607 Float_t dpx=seg->Dpx(seg->ISector())/2;
608 Float_t dpy=seg->Dpy(seg->ISector())/2;
609 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
610 marker->SetLineColor(seg->ISector()+1);
611 marker->SetFillStyle(1001);
612 marker->SetFillColor(0);
617 for (Int_t j=0; j<250; j++) {
618 Float_t x0=j*seg->Dpx();
619 Float_t y0=TMath::Sqrt(r*r-x0*x0);
621 for (seg->FirstPad(x0,0,0,0,y0);
625 if (seg->ISector()==0) continue;
628 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
629 Float_t dpx=seg->Dpx(seg->ISector())/2;
630 Float_t dpy=seg->Dpy(seg->ISector())/2;
631 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
632 marker->SetLineColor(seg->ISector()+1);
633 marker->SetFillStyle(1001);
634 marker->SetFillColor(0);
641 //_____________________________________________________________________________
642 void AliMUONDisplay::DrawClusters()
644 // Draw clusters for MUON chambers
646 Int_t ndigits, digit;
654 ndigits = points->GetEntriesFast();
655 for (digit=0;digit<ndigits;digit++){
656 pm = (AliMUONPoints*)points->UncheckedAt(digit);
660 for (Int_t im=0;im<3;im++) {
661 TMarker3DBox *marker=pm->GetMarker(im);
666 fClustersCuts +=pm->GetN();
670 //_____________________________________________________________________________
671 void AliMUONDisplay::DrawHits()
673 // Draw hits for MUON chambers
677 Int_t ntracks, track;
684 ntracks = points->GetEntriesFast();
685 for (track=0;track<ntracks;track++) {
686 pm = (AliMUONPoints*)points->UncheckedAt(track);
689 fHitsCuts += pm->GetN();
694 //_____________________________________________________________________________
695 void AliMUONDisplay::DrawCoG()
697 // Draw hits for MUON chambers
698 if (!fDrawCoG) return;
699 if (fChamber > 10) return;
700 LoadCoG(fChamber,fCathode);
708 ncog = points->GetEntriesFast();
709 for (icog=0;icog<ncog;icog++) {
710 pm = (AliMUONPoints*)points->UncheckedAt(icog);
715 //_____________________________________________________________________________
717 void AliMUONDisplay::DrawTitle(Option_t *option)
719 // Draw the event title
721 Float_t xmin = gPad->GetX1();
722 Float_t xmax = gPad->GetX2();
723 Float_t ymin = gPad->GetY1();
724 Float_t ymax = gPad->GetY2();
725 Float_t dx = xmax-xmin;
726 Float_t dy = ymax-ymin;
728 if (strlen(option) == 0) {
729 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
730 // title->SetTextSize(0.023932);
731 title->SetTextSize(0.02);
732 title->SetBit(kCanDelete);
733 title->SetFillColor(42);
736 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
737 gAlice->GetHeader()->GetEvent(),
738 gAlice->GetHeader()->GetRun(),
741 title->AddText(ptitle);
742 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
743 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
744 nparticles, fHitsCuts,fClustersCuts);
745 title->AddText(ptitle);
747 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
748 label->SetBit(kCanDelete);
749 label->SetFillColor(42);
754 //_____________________________________________________________________________
755 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
757 // Draw a view of MUON clusters
758 printf("\n Draw View");
760 gPad->SetCursor(kWatch);
761 // gPad->SetFillColor(39);
762 gPad->SetFillColor(1);
764 // gPad->SetFillColor(39);
765 gPad->SetFillColor(1);
769 TView *view = new TView(1);
771 Float_t range = fRrange*fRangeSlider->GetMaximum();
772 view->SetRange(-range,-range,-range,range, range, range);
773 // zoom back to full scale only if DrawView not called from NextCathode
782 // Display MUON Chamber Geometry
784 sprintf(nodeName,"MUON%d",100+fChamber);
786 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
787 if (node1) node1->Draw("same");
788 //add clusters to the pad
792 // DrawSegmentation();
793 // add itself to the list (must be last)
795 view->SetView(phi, theta, psi, iret);
799 //______________________________________________________________________________
800 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
802 // Execute action corresponding to the mouse event
804 static Float_t x0, y0, x1, y1;
806 static Int_t pxold, pyold;
807 static Int_t px0, py0;
808 static Int_t linedrawn;
811 if (px == 0 && py == 0) { //when called by sliders
812 if (event == kButton1Up) {
817 if (!fZoomMode && gPad->GetView()) {
818 gPad->GetView()->ExecuteRotateView(event, px, py);
822 // something to zoom ?
823 gPad->SetCursor(kCross);
828 gVirtualX->SetLineColor(-1);
829 gPad->TAttLine::Modify(); //Change line attributes only if necessary
830 x0 = gPad->AbsPixeltoX(px);
831 y0 = gPad->AbsPixeltoY(py);
833 pxold = px; pyold = py;
838 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
842 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
846 gPad->GetCanvas()->FeedbackMode(kFALSE);
847 if (px == px0) return;
848 if (py == py0) return;
849 x1 = gPad->AbsPixeltoX(px);
850 y1 = gPad->AbsPixeltoY(py);
852 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
853 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
854 gPad->Range(x0,y0,x1,y1);
855 if (fZooms < AliMUONConstants::MaxZoom()-1) {
857 fZoomX0[fZooms] = x0;
858 fZoomY0[fZooms] = y0;
859 fZoomX1[fZooms] = x1;
860 fZoomY1[fZooms] = y1;
862 gPad->Modified(kTRUE);
867 //___________________________________________
868 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
870 // Read digits info and store x,y,z info in arrays fPoints
871 // Loop on all detectors
873 if (chamber > 14) return;
874 printf(" chamber %d \n",chamber);
880 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
881 AliMUONChamber* iChamber;
882 AliSegmentation* segmentation;
883 AliMUONResponse* response;
885 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
886 if (muonDigits == 0) return;
888 gAlice->ResetDigits();
891 if (gAlice->TreeD()) {
892 nent = (Int_t) gAlice->TreeD()->GetEntries();
893 printf(" entries %d \n", nent);
894 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
895 gAlice->TreeD()->GetEvent(cathode-1);
898 Int_t ndigits = muonDigits->GetEntriesFast();
899 if (ndigits == 0) return;
900 if (fPoints == 0) fPoints = new TObjArray(ndigits);
902 iChamber = &(pMUON->Chamber(chamber-1));
904 segmentation = iChamber->SegmentationModel(cathode);
905 response = iChamber->ResponseModel();
906 Float_t zpos = iChamber->Z();
909 AliMUONPoints *points = 0;
910 TMarker3DBox *marker = 0;
912 //loop over all digits and store their position
915 Float_t adcmax = 1024;
916 if (response) adcmax = response->MaxAdc();
918 for (Int_t digit = 0; digit < ndigits; digit++) {
919 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
920 if (mdig->Cathode() != cathode-1) continue;
923 // First get all needed parameters
925 Int_t charge = mdig->Signal();
926 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
927 Int_t color = 261+index;
928 Int_t colorTrigger = 2;
929 if (color > 282) color = 282;
931 if (chamber > 10) { // trigger chamber
933 for (Int_t icharge = 0; icharge < 10; icharge++) {
934 sumCharge = sumCharge+mdig->TrackCharge(icharge);
936 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
937 if(sumCharge <= 10 || testCharge > 0) {
938 colorTrigger = color;
944 // get the center of the pad - add on x and y half of pad size
945 Float_t xpad, ypad, zpad;
946 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
948 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
949 Float_t dpx = segmentation->Dpx(isec)/2;
950 Float_t dpy = segmentation->Dpy(isec)/2;
952 // segmentation->Dump();
955 // Then set the objects
957 points = new AliMUONPoints(npoints);
958 fPoints->AddAt(points,digit);
960 points->SetMarkerColor(colorTrigger);
962 points->SetMarkerColor(color);
964 points->SetMarkerStyle(21);
965 points->SetMarkerSize(0.5);
966 points->SetParticle(-1);
967 points->SetHitIndex(-1);
968 points->SetTrackIndex(-1);
969 points->SetDigitIndex(digit);
970 points->SetPoint(0,xpad,ypad,zpos);
972 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
973 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
976 marker->SetLineColor(lineColor);
977 marker->SetFillStyle(1001);
978 marker->SetFillColor(color);
979 marker->SetRefObject((TObject*)points);
980 points->Set3DMarker(0, marker);
983 //___________________________________________
984 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
986 // Read raw clusters info and store x,y,z info in arrays fRpoints
987 // Loop on all detectors
989 if (chamber > 10) return;
993 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
994 AliMUONChamber* iChamber;
996 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
997 if (muonRawClusters == 0) return;
999 pMUON->ResetRawClusters();
1002 if (gAlice->TreeR()) {
1003 nent=(Int_t)gAlice->TreeR()->GetEntries();
1004 gAlice->TreeR()->GetEvent(0);
1007 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1008 if (nrawcl == 0) return;
1009 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
1011 iChamber = &(pMUON->Chamber(chamber-1));
1012 Float_t zpos=iChamber->Z();
1013 AliMUONRawCluster *mRaw;
1014 AliMUONPoints *points = 0;
1016 //loop over all raw clusters and store their position
1017 points = new AliMUONPoints(nrawcl);
1018 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1019 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1020 fRpoints->AddAt(points,iraw);
1021 points->SetMarkerColor(51);
1022 points->SetMarkerStyle(2);
1023 points->SetMarkerSize(1.);
1024 points->SetParticle(-1);
1025 points->SetHitIndex(-1);
1026 points->SetTrackIndex(-1);
1027 points->SetDigitIndex(-1);
1028 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1031 //___________________________________________
1032 void AliMUONDisplay::LoadHits(Int_t chamber)
1034 // Read hits info and store x,y,z info in arrays fPhits
1035 // Loop on all detectors
1037 if (chamber > 14) return;
1044 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1045 AliMUONChamber* iChamber;
1047 iChamber = &(pMUON->Chamber(chamber-1));
1048 Float_t zpos=iChamber->Z();
1050 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1052 for (track = 0; track < ntracks; track++) {
1053 gAlice->ResetHits();
1054 gAlice->TreeH()->GetEvent(track);
1055 TClonesArray *muonHits = pMUON->Hits();
1056 if (muonHits == 0) return;
1057 nthits += muonHits->GetEntriesFast();
1059 if (fPhits == 0) fPhits = new TObjArray(nthits);
1061 for (track=0; track<ntracks;track++) {
1062 gAlice->ResetHits();
1063 gAlice->TreeH()->GetEvent(track);
1064 TClonesArray *muonHits = pMUON->Hits();
1065 if (muonHits == 0) return;
1066 Int_t nhits = muonHits->GetEntriesFast();
1067 if (nhits == 0) continue;
1069 AliMUONPoints *points = 0;
1071 for (Int_t hit=0;hit<nhits;hit++) {
1072 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1073 Int_t nch = mHit->Chamber(); // chamber number
1074 if (nch != chamber) continue;
1076 // Retrieve info and set the objects
1078 points = new AliMUONPoints(npoints);
1079 fPhits->AddAt(points,nhold+hit);
1080 points->SetMarkerColor(kRed);
1081 points->SetMarkerStyle(5);
1082 points->SetMarkerSize(1.);
1083 points->SetParticle(mHit->Track());
1084 points->SetHitIndex(hit);
1085 points->SetTrackIndex(track);
1086 points->SetDigitIndex(-1);
1087 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
1093 //_____________________________________________________________________________
1094 void AliMUONDisplay::Paint(Option_t *)
1096 // Paint miscellaneous items
1099 //_____________________________________________________________________________
1100 void AliMUONDisplay::SetPickMode()
1102 // Set parameters for pick mode.
1106 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1107 fTrigPad->Modified();
1110 //_____________________________________________________________________________
1111 void AliMUONDisplay::SetZoomMode()
1113 // Set parameters for zoom mode
1116 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1117 fTrigPad->Modified();
1120 //_____________________________________________________________________________
1121 void AliMUONDisplay::NextChamber(Int_t delta)
1123 // to go from chamber to next chamber if delta = 1
1124 // or previous chamber otherwise
1126 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1128 if (fChamber > 1) fChamber--;
1132 LoadDigits(fChamber, fCathode);
1136 //_____________________________________________________________________________
1137 void AliMUONDisplay::NextCathode()
1139 // to switch to other cathode plane
1142 if (fCathode == 1) {
1143 LoadDigits(fChamber, 2);
1145 LoadDigits(fChamber, 1);
1147 fNextCathode = kTRUE; // to keep the same zoom
1149 fNextCathode = kFALSE;
1150 TPad *pad = (TPad*)gPad->GetPadSave();
1151 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1152 fZoomX1[fZooms], fZoomY1[fZooms]);
1158 //_____________________________________________________________________________
1159 void AliMUONDisplay::Trigger()
1161 // returns Trigger Decision for current event
1162 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1163 decision->Trigger();
1167 //_____________________________________________________________________________
1168 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1170 // Set chamber and cathode number
1176 LoadDigits(chamber,cathode);
1180 void AliMUONDisplay::SetEvent(Int_t newevent)
1183 gAlice->GetEvent(newevent);
1185 if (!gAlice->TreeD()) return;
1188 LoadDigits(fChamber,fCathode);
1192 //_____________________________________________________________________________
1193 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1195 // Set view range along R and Z
1204 //_____________________________________________________________________________
1205 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1207 // change viewing angles for current event
1215 TView *view = gPad->GetView();
1216 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1221 //_____________________________________________________________________________
1222 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1224 // Display (current event_number + delta)
1225 // delta = 1 shown next event
1226 // delta = -1 show previous event
1229 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1230 Int_t newEvent = currentEvent + delta;
1231 gAlice->GetEvent(newEvent);
1233 if (!gAlice->TreeD()) return;
1236 LoadDigits(fChamber, fCathode);
1241 //______________________________________________________________________________
1242 void AliMUONDisplay::UnZoom()
1245 if (fZooms <= 0) return;
1247 TPad *pad = (TPad*)gPad->GetPadSave();
1248 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1252 //_____________________________________________________________________________
1253 void AliMUONDisplay::ResetPoints()
1256 // Reset array of points
1264 //_____________________________________________________________________________
1265 void AliMUONDisplay::ResetPhits()
1268 // Reset array of points
1276 //_____________________________________________________________________________
1277 void AliMUONDisplay::ResetRpoints()
1280 // Reset array of points
1289 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1291 // Dummy assignment operator