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.13 2001/03/30 13:01:50 gosset
19 Centroid of raw clusters displayed for each cathode plane
21 Revision 1.12 2001/03/05 23:50:08 morsch
22 Correct access to digit and recpoint data.
24 Revision 1.11 2001/01/26 21:41:55 morsch
25 Use access functions to AliMUONDigit member data.
27 Revision 1.10 2001/01/25 20:41:56 morsch
28 Protect against empty TreeD and TreeR.
30 Revision 1.9 2001/01/23 18:58:19 hristov
31 Initialisation of some pointers
33 Revision 1.8 2000/10/06 09:09:01 morsch
34 Pad colour according to z-position (slats).
36 Revision 1.7 2000/10/02 21:28:09 fca
37 Removal of useless dependecies via forward declarations
39 Revision 1.6 2000/07/03 11:54:57 morsch
40 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
41 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
43 Revision 1.5 2000/06/28 15:16:35 morsch
44 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
45 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
46 framework. The changes should have no side effects (mostly dummy arguments).
47 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
48 of chambers with overlapping modules (MakePadHits, Disintegration).
50 Revision 1.4 2000/06/27 09:46:57 morsch
51 kMAXZOOM global constant now in AliMUONConstants
53 Revision 1.3 2000/06/26 14:02:38 morsch
54 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
56 Revision 1.2 2000/06/15 07:58:48 morsch
57 Code from MUON-dev joined
59 Revision 1.1.2.15 2000/06/14 14:37:53 morsch
60 method Trigger() modified
62 Revision 1.1.2.14 2000/06/09 21:57:09 morsch
63 Bug in color scale diplay corrected.
64 Most coding rule violations corrected.
66 Revision 1.1.2.13 2000/05/02 11:57:27 morsch
67 Coding rules RN3, RN13, RN17 violations corrected.
69 Revision 1.1.2.12 2000/04/26 12:27:33 morsch
70 Mods for trigger display (P. Crochet):
71 - color code versus time for pad hits in trigger chambers
72 - call to TriggerDecision corrected
74 Revision 1.1.2.11 2000/04/26 09:04:46 morsch
75 Obsolete cathode correlation related code removed.
77 Revision 1.1.2.10 2000/04/19 19:43:47 morsch
78 change NCH to kNCH as in AliMUON.h
79 no more TreeC related methods
81 Revision 1.1.2.9 2000/03/20 18:10:33 morsch
82 Trigger method for "online" trigger decission added
84 Revision 1.1.2.8 2000/02/23 10:12:01 morsch
85 Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
86 General clean-up of commented code.
88 Revision 1.1.2.7 2000/02/17 14:36:55 morsch
89 Display of Trigger hits and clusters added.
90 Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
92 Revision 1.1.2.6 2000/02/15 10:19:42 morsch
93 Previous log messages included
95 Revision 1.1.2.5 2000/02/15 10:09:09 morsch
98 Revision 1.1.2.4 2000/02/08 09:17:16 gosset
99 One more improvement of MUON display:
100 same zoom for both cathode planes in a chamber
102 Revision 1.1.2.3 2000/02/07 15:37:21 gosset
103 A few improvements of the MUON display:
104 new buttons to change either chamber or cathode,
105 added to the more complicated way
106 (right mouse click and explicit filling of chamber and cathode)
108 Revision 1.1.2.2 2000/02/04 10:57:34 gosset
109 Z position of the chambers:
110 it was the Z position of the stations;
111 it is now really the Z position of the chambers.
112 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
113 !!!! AND "AliMUONChamber::ZPosition"
114 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
115 !!!! AND "AliMUONChamber::Z"
118 //////////////////////////////////////////////////////////////////////////
122 // Utility class to display ALICE outline, tracks, hits,.. //
124 //////////////////////////////////////////////////////////////////////////
133 #include <TPolyMarker3D.h>
134 #include <TPaveLabel.h>
135 #include <TPaveText.h>
137 #include <TDiamond.h>
142 #include <TSliderBox.h>
144 #include <TVirtualX.h>
147 #include <TGeometry.h>
148 #include <X3DBuffer.h>
149 #include <TMarker3DBox.h>
152 #include "AliDetector.h"
154 #include "AliMUONDisplay.h"
155 #include "AliMUONPoints.h"
156 #include "TParticle.h"
157 #include "AliMUONTriggerDecision.h"
159 #include "AliMUONHit.h"
160 #include "AliMUONPadHit.h"
161 #include "AliMUONDigit.h"
162 #include "AliMUONRawCluster.h"
164 #include "AliSegmentation.h"
165 #include "AliMUONResponse.h"
166 #include "AliMUONChamber.h"
167 #include "AliMUONConstants.h"
168 // to manage the same zoom on both cathodes
172 ClassImp(AliMUONDisplay)
175 //_____________________________________________________________________________
176 AliMUONDisplay::AliMUONDisplay()
183 fNextCathode = kFALSE;
187 //_____________________________________________________________________________
188 AliMUONDisplay::AliMUONDisplay(Int_t size)
190 // Create an event display object.
191 // A canvas named "edisplay" is created with a vertical size in pixels
193 // A QUICK Overview of the Event Display functions
194 // ===============================================
196 // The event display can ve invoked by executing the macro "display.C"
197 // A canvas like in the picture below will appear.
199 // On the left side of the canvas, the following buttons appear:
200 // *Next* to move to the next event
201 // *Previous* to move to the previous event
203 // *Pick* Select this option to be able to point on a track with the
204 // mouse. Once on the track, use the right button to select
205 // an action. For example, select SetMarkerAttributes to
206 // change the marker type/color/size for the track.
207 // *Zoom* Select this option (default) if you want to zoom.
208 // To zoom, simply select the selected area with the left button.
209 // *UnZoom* To revert to the previous picture size.
211 // slider R On the left side, the vertical slider can be used to
212 // set the default picture size.
214 // When you are in Zoom mode, you can click on the black part of the canvas
215 // to select special options with the right mouse button.
218 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
219 // When you are on a track, select the menu item "InspectParticle"
220 // to display the current particle attributes.
222 // You can activate the Root browser by selecting the Inspect menu
223 // in the canvas tool bar menu. Then select "Start Browser"
224 // This will open a new canvas with the browser. At this point, you may want
225 // to display some histograms (from the Trees). Go to the "File" menu
226 // of the browser and click on "New canvas".
227 // In the browser, click on item "ROOT files" in the left pane.
228 // Click on galice.root.
230 // Click on TPC for example
231 // Click on any variable (eg TPC.fX) to histogram the variable.
233 // If you are lost, you can click on HELP in any Root canvas or browser.
236 <img src="gif/AliMUONDisplay.gif">
243 gAlice->SetDisplay(this);
245 // Initialize display default parameters
247 // Set front view by default
254 fDrawClusters = kTRUE;
264 // Create display canvas
266 if (ysize < 100) ysize = 750;
267 Int_t xsize = Int_t(size*830./ysize);
268 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
269 fCanvas->ToggleEventStatus();
271 // Create main display pad
272 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
275 fPad->SetFillColor(30);
276 fPad->SetBorderSize(2);
281 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
283 fColPad->SetFillColor(17);
284 fColPad->SetBorderSize(2);
289 // Create user interface control pad
293 // Create Range and mode pad
296 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
297 fTrigPad->SetEditable(kFALSE);
300 fTrigPad->SetFillColor(22);
301 fTrigPad->SetBorderSize(2);
302 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
303 fRangeSlider->SetObject(this);
304 char pickmode[] = "gAlice->Display()->SetPickMode()";
306 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
307 fPickButton->SetFillColor(38);
309 char zoommode[] = "gAlice->Display()->SetZoomMode()";
310 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
311 fZoomButton->SetFillColor(38);
313 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
314 fArcButton->SetFillColor(kGreen);
316 char butUnzoom[] = "gAlice->Display()->UnZoom()";
317 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
318 button->SetFillColor(38);
320 AppendPad(); // append display object as last object to force selection
324 fNextCathode = kFALSE;
327 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
329 // Dummy copy constructor
335 //_____________________________________________________________________________
336 AliMUONDisplay::~AliMUONDisplay()
338 // Delete space point structure
339 if (fPoints) fPoints->Delete();
343 if (fPhits) fPhits->Delete();
347 if (fRpoints) fRpoints->Delete();
352 //_____________________________________________________________________________
353 void AliMUONDisplay::Clear(Option_t *)
355 // Delete graphics temporary objects
358 //_____________________________________________________________________________
359 void AliMUONDisplay::DisplayButtons()
361 // Create the user interface buttons
364 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
365 fButtons->SetEditable(kFALSE);
367 fButtons->SetFillColor(38);
368 fButtons->SetBorderSize(2);
371 // Int_t butcolor = 33;
372 Float_t dbutton = 0.08;
379 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
380 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
381 button->SetFillColor(38);
385 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
386 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
387 button->SetFillColor(38);
391 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
392 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
393 button->SetFillColor(38);
397 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
398 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
399 button->SetFillColor(38);
403 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
404 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
405 button->SetFillColor(38);
409 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
410 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
411 button->SetFillColor(38);
415 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
416 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
417 button->SetFillColor(38);
421 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
422 diamond->SetFillColor(50);
423 diamond->SetTextAlign(22);
424 diamond->SetTextColor(5);
425 diamond->SetTextSize(0.11);
427 diamond->AddText(".. ");
428 diamond->AddText("ROOT");
429 diamond->AddText("MUON");
430 diamond->AddText("... ");
431 diamond->AddText(" ");
434 //_____________________________________________________________________________
435 void AliMUONDisplay::CreateColors()
437 // Create the colors palette used to display clusters
452 new TColor(color,r,g,b);
462 new TColor(color,r,g,b);
472 new TColor(color,r,g,b);
482 new TColor(color,r,g,b);
492 new TColor(color,r,g,b);
499 //_____________________________________________________________________________
500 void AliMUONDisplay::DisplayColorScale()
502 // Display pulse height color scale
505 Float_t xlow, ylow, xup, yup, hs;
506 Float_t x1, y1, x2, y2;
510 TText *text = new TText(0,0,"");
511 text->SetTextFont(61);
512 text->SetTextSize(0.2);
513 text->SetTextAlign(22);
515 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
516 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
517 AliMUONResponse * response=iChamber->ResponseModel();
519 if (response) adcmax = (Int_t) response->MaxAdc();
524 //*-* draw colortable boxes
525 hs = (y2-y1)/Float_t(22);
529 ylow = y1 + hs*(Float_t(i));
530 yup = y1 + hs*(Float_t(i+1));
532 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
533 Int_t scale=(Int_t)TMath::Exp(logscale);
534 sprintf(label,"%d",scale);
535 box = new TBox(xlow, ylow, xup, yup);
537 box->SetFillColor(color);
538 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
542 //______________________________________________________________________________
543 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
545 // Compute distance from point px,py to objects in event
547 gPad->SetCursor(kCross);
549 if (gPad == fTrigPad) return 9999;
551 const Int_t kBig = 9999;
553 Float_t xmin = gPad->GetX1();
554 Float_t xmax = gPad->GetX2();
555 Float_t dx = 0.02*(xmax - xmin);
556 Float_t x = gPad->AbsPixeltoX(px);
557 if (x < xmin+dx || x > xmax-dx) return dist;
559 if (fZoomMode) return 0;
563 //_____________________________________________________________________________
564 void AliMUONDisplay::Draw(Option_t *)
566 // Display current event
570 DrawView(fTheta, fPhi, fPsi);
571 // Display the event number and title
576 void AliMUONDisplay::DrawSegmentation()
578 // Draw graphical representation of segmenatation
579 // Attention: still experimental code
582 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
583 AliMUONChamber* iChamber;
584 AliSegmentation* seg;
585 iChamber = &(pMUON->Chamber(fChamber));
586 seg=iChamber->SegmentationModel(icat);
587 Float_t zpos=iChamber->Z();
588 Float_t r=iChamber->ROuter();
590 TMarker3DBox *marker;
592 for (Int_t j=0; j<seg->Npy(); j++) {
594 y0=j*seg->Dpy()-seg->Dpy()/2.;
595 for (seg->FirstPad(0.,y0,0,300,0.);
599 if (seg->ISector()==0) continue;
601 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
602 Float_t dpx=seg->Dpx(seg->ISector())/2;
603 Float_t dpy=seg->Dpy(seg->ISector())/2;
604 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
605 marker->SetLineColor(seg->ISector()+1);
606 marker->SetFillStyle(1001);
607 marker->SetFillColor(0);
612 for (Int_t j=0; j<250; j++) {
613 Float_t x0=j*seg->Dpx();
614 Float_t y0=TMath::Sqrt(r*r-x0*x0);
616 for (seg->FirstPad(x0,0,0,0,y0);
620 if (seg->ISector()==0) continue;
623 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
624 Float_t dpx=seg->Dpx(seg->ISector())/2;
625 Float_t dpy=seg->Dpy(seg->ISector())/2;
626 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
627 marker->SetLineColor(seg->ISector()+1);
628 marker->SetFillStyle(1001);
629 marker->SetFillColor(0);
636 //_____________________________________________________________________________
637 void AliMUONDisplay::DrawClusters()
639 // Draw clusters for MUON chambers
641 Int_t ndigits, digit;
649 ndigits = points->GetEntriesFast();
650 for (digit=0;digit<ndigits;digit++){
651 pm = (AliMUONPoints*)points->UncheckedAt(digit);
655 for (Int_t im=0;im<3;im++) {
656 TMarker3DBox *marker=pm->GetMarker(im);
661 fClustersCuts +=pm->GetN();
665 //_____________________________________________________________________________
666 void AliMUONDisplay::DrawHits()
668 // Draw hits for MUON chambers
672 Int_t ntracks, track;
679 ntracks = points->GetEntriesFast();
680 for (track=0;track<ntracks;track++) {
681 pm = (AliMUONPoints*)points->UncheckedAt(track);
684 fHitsCuts += pm->GetN();
689 //_____________________________________________________________________________
690 void AliMUONDisplay::DrawCoG()
692 // Draw hits for MUON chambers
693 if (!fDrawCoG) return;
694 if (fChamber > 10) return;
695 LoadCoG(fChamber,fCathode);
703 ncog = points->GetEntriesFast();
704 for (icog=0;icog<ncog;icog++) {
705 pm = (AliMUONPoints*)points->UncheckedAt(icog);
710 //_____________________________________________________________________________
712 void AliMUONDisplay::DrawTitle(Option_t *option)
714 // Draw the event title
716 Float_t xmin = gPad->GetX1();
717 Float_t xmax = gPad->GetX2();
718 Float_t ymin = gPad->GetY1();
719 Float_t ymax = gPad->GetY2();
720 Float_t dx = xmax-xmin;
721 Float_t dy = ymax-ymin;
723 if (strlen(option) == 0) {
724 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
725 // title->SetTextSize(0.023932);
726 title->SetTextSize(0.02);
727 title->SetBit(kCanDelete);
728 title->SetFillColor(42);
731 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
732 gAlice->GetHeader()->GetEvent(),
733 gAlice->GetHeader()->GetRun(),
736 title->AddText(ptitle);
737 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
738 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
739 nparticles, fHitsCuts,fClustersCuts);
740 title->AddText(ptitle);
742 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
743 label->SetBit(kCanDelete);
744 label->SetFillColor(42);
749 //_____________________________________________________________________________
750 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
752 // Draw a view of MUON clusters
753 printf("\n Draw View");
755 gPad->SetCursor(kWatch);
756 // gPad->SetFillColor(39);
757 gPad->SetFillColor(1);
759 // gPad->SetFillColor(39);
760 gPad->SetFillColor(1);
764 TView *view = new TView(1);
766 Float_t range = fRrange*fRangeSlider->GetMaximum();
767 view->SetRange(-range,-range,-range,range, range, range);
768 // zoom back to full scale only if DrawView not called from NextCathode
777 // Display MUON Chamber Geometry
779 sprintf(nodeName,"MUON%d",100+fChamber);
781 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
782 if (node1) node1->Draw("same");
783 //add clusters to the pad
787 // DrawSegmentation();
788 // add itself to the list (must be last)
790 view->SetView(phi, theta, psi, iret);
794 //______________________________________________________________________________
795 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
797 // Execute action corresponding to the mouse event
799 static Float_t x0, y0, x1, y1;
801 static Int_t pxold, pyold;
802 static Int_t px0, py0;
803 static Int_t linedrawn;
806 if (px == 0 && py == 0) { //when called by sliders
807 if (event == kButton1Up) {
812 if (!fZoomMode && gPad->GetView()) {
813 gPad->GetView()->ExecuteRotateView(event, px, py);
817 // something to zoom ?
818 gPad->SetCursor(kCross);
823 gVirtualX->SetLineColor(-1);
824 gPad->TAttLine::Modify(); //Change line attributes only if necessary
825 x0 = gPad->AbsPixeltoX(px);
826 y0 = gPad->AbsPixeltoY(py);
828 pxold = px; pyold = py;
833 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
837 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
841 gPad->GetCanvas()->FeedbackMode(kFALSE);
842 if (px == px0) return;
843 if (py == py0) return;
844 x1 = gPad->AbsPixeltoX(px);
845 y1 = gPad->AbsPixeltoY(py);
847 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
848 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
849 gPad->Range(x0,y0,x1,y1);
850 if (fZooms < AliMUONConstants::MaxZoom()-1) {
852 fZoomX0[fZooms] = x0;
853 fZoomY0[fZooms] = y0;
854 fZoomX1[fZooms] = x1;
855 fZoomY1[fZooms] = y1;
857 gPad->Modified(kTRUE);
862 //___________________________________________
863 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
865 // Read digits info and store x,y,z info in arrays fPoints
866 // Loop on all detectors
868 if (chamber > 14) return;
869 printf(" chamber %d \n",chamber);
875 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
876 AliMUONChamber* iChamber;
877 AliSegmentation* segmentation;
878 AliMUONResponse* response;
880 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
881 if (muonDigits == 0) return;
883 gAlice->ResetDigits();
886 if (gAlice->TreeD()) {
887 nent = (Int_t) gAlice->TreeD()->GetEntries();
888 printf(" entries %d \n", nent);
889 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
890 gAlice->TreeD()->GetEvent(cathode-1);
893 Int_t ndigits = muonDigits->GetEntriesFast();
894 if (ndigits == 0) return;
895 if (fPoints == 0) fPoints = new TObjArray(ndigits);
897 iChamber = &(pMUON->Chamber(chamber-1));
899 segmentation = iChamber->SegmentationModel(cathode);
900 response = iChamber->ResponseModel();
901 Float_t zpos = iChamber->Z();
904 AliMUONPoints *points = 0;
905 TMarker3DBox *marker = 0;
907 //loop over all digits and store their position
910 Float_t adcmax = 1024;
911 if (response) adcmax = response->MaxAdc();
913 for (Int_t digit = 0; digit < ndigits; digit++) {
914 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
915 if (mdig->Cathode() != cathode-1) continue;
918 // First get all needed parameters
920 Int_t charge = mdig->Signal();
921 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
922 Int_t color = 261+index;
923 Int_t colorTrigger = 2;
924 if (color > 282) color = 282;
926 if (chamber > 10) { // trigger chamber
928 for (Int_t icharge = 0; icharge < 10; icharge++) {
929 sumCharge = sumCharge+mdig->TrackCharge(icharge);
931 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
932 if(sumCharge <= 10 || testCharge > 0) {
933 colorTrigger = color;
939 // get the center of the pad - add on x and y half of pad size
940 Float_t xpad, ypad, zpad;
941 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
943 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
944 Float_t dpx = segmentation->Dpx(isec)/2;
945 Float_t dpy = segmentation->Dpy(isec)/2;
947 // segmentation->Dump();
950 // Then set the objects
952 points = new AliMUONPoints(npoints);
953 fPoints->AddAt(points,digit);
955 points->SetMarkerColor(colorTrigger);
957 points->SetMarkerColor(color);
959 points->SetMarkerStyle(21);
960 points->SetMarkerSize(0.5);
961 points->SetParticle(-1);
962 points->SetHitIndex(-1);
963 points->SetTrackIndex(-1);
964 points->SetDigitIndex(digit);
965 points->SetPoint(0,xpad,ypad,zpos);
967 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
968 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
971 marker->SetLineColor(lineColor);
972 marker->SetFillStyle(1001);
973 marker->SetFillColor(color);
974 marker->SetRefObject((TObject*)points);
975 points->Set3DMarker(0, marker);
978 //___________________________________________
979 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
981 // Read raw clusters info and store x,y,z info in arrays fRpoints
982 // Loop on all detectors
984 if (chamber > 10) return;
988 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
989 AliMUONChamber* iChamber;
991 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
992 if (muonRawClusters == 0) return;
994 pMUON->ResetRawClusters();
997 if (gAlice->TreeR()) {
998 nent=(Int_t)gAlice->TreeR()->GetEntries();
999 gAlice->TreeR()->GetEvent(0);
1002 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1003 if (nrawcl == 0) return;
1004 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
1006 iChamber = &(pMUON->Chamber(chamber-1));
1007 Float_t zpos=iChamber->Z();
1008 AliMUONRawCluster *mRaw;
1009 AliMUONPoints *points = 0;
1011 //loop over all raw clusters and store their position
1012 points = new AliMUONPoints(nrawcl);
1013 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1014 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1015 fRpoints->AddAt(points,iraw);
1016 points->SetMarkerColor(51);
1017 points->SetMarkerStyle(2);
1018 points->SetMarkerSize(1.);
1019 points->SetParticle(-1);
1020 points->SetHitIndex(-1);
1021 points->SetTrackIndex(-1);
1022 points->SetDigitIndex(-1);
1023 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1026 //___________________________________________
1027 void AliMUONDisplay::LoadHits(Int_t chamber)
1029 // Read hits info and store x,y,z info in arrays fPhits
1030 // Loop on all detectors
1032 if (chamber > 14) return;
1039 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1040 AliMUONChamber* iChamber;
1042 iChamber = &(pMUON->Chamber(chamber-1));
1043 Float_t zpos=iChamber->Z();
1045 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1047 for (track = 0; track < ntracks; track++) {
1048 gAlice->ResetHits();
1049 gAlice->TreeH()->GetEvent(track);
1050 TClonesArray *muonHits = pMUON->Hits();
1051 if (muonHits == 0) return;
1052 nthits += muonHits->GetEntriesFast();
1054 if (fPhits == 0) fPhits = new TObjArray(nthits);
1056 for (track=0; track<ntracks;track++) {
1057 gAlice->ResetHits();
1058 gAlice->TreeH()->GetEvent(track);
1059 TClonesArray *muonHits = pMUON->Hits();
1060 if (muonHits == 0) return;
1061 Int_t nhits = muonHits->GetEntriesFast();
1062 if (nhits == 0) continue;
1064 AliMUONPoints *points = 0;
1066 for (Int_t hit=0;hit<nhits;hit++) {
1067 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1068 Int_t nch = mHit->Chamber(); // chamber number
1069 if (nch != chamber) continue;
1071 // Retrieve info and set the objects
1073 points = new AliMUONPoints(npoints);
1074 fPhits->AddAt(points,nhold+hit);
1075 points->SetMarkerColor(kRed);
1076 points->SetMarkerStyle(5);
1077 points->SetMarkerSize(1.);
1078 points->SetParticle(mHit->Track());
1079 points->SetHitIndex(hit);
1080 points->SetTrackIndex(track);
1081 points->SetDigitIndex(-1);
1082 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
1088 //_____________________________________________________________________________
1089 void AliMUONDisplay::Paint(Option_t *)
1091 // Paint miscellaneous items
1094 //_____________________________________________________________________________
1095 void AliMUONDisplay::SetPickMode()
1097 // Set parameters for pick mode.
1101 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1102 fTrigPad->Modified();
1105 //_____________________________________________________________________________
1106 void AliMUONDisplay::SetZoomMode()
1108 // Set parameters for zoom mode
1111 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1112 fTrigPad->Modified();
1115 //_____________________________________________________________________________
1116 void AliMUONDisplay::NextChamber(Int_t delta)
1118 // to go from chamber to next chamber if delta = 1
1119 // or previous chamber otherwise
1121 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1123 if (fChamber > 1) fChamber--;
1127 LoadDigits(fChamber, fCathode);
1131 //_____________________________________________________________________________
1132 void AliMUONDisplay::NextCathode()
1134 // to switch to other cathode plane
1137 if (fCathode == 1) {
1138 LoadDigits(fChamber, 2);
1140 LoadDigits(fChamber, 1);
1142 fNextCathode = kTRUE; // to keep the same zoom
1144 fNextCathode = kFALSE;
1145 TPad *pad = (TPad*)gPad->GetPadSave();
1146 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1147 fZoomX1[fZooms], fZoomY1[fZooms]);
1153 //_____________________________________________________________________________
1154 void AliMUONDisplay::Trigger()
1156 // returns Trigger Decision for current event
1157 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1158 decision->Trigger();
1162 //_____________________________________________________________________________
1163 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1165 // Set chamber and cathode number
1171 LoadDigits(chamber,cathode);
1175 void AliMUONDisplay::SetEvent(Int_t newevent)
1178 gAlice->GetEvent(newevent);
1180 if (!gAlice->TreeD()) return;
1183 LoadDigits(fChamber,fCathode);
1187 //_____________________________________________________________________________
1188 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1190 // Set view range along R and Z
1199 //_____________________________________________________________________________
1200 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1202 // change viewing angles for current event
1210 TView *view = gPad->GetView();
1211 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1216 //_____________________________________________________________________________
1217 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1219 // Display (current event_number + delta)
1220 // delta = 1 shown next event
1221 // delta = -1 show previous event
1224 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1225 Int_t newEvent = currentEvent + delta;
1226 gAlice->GetEvent(newEvent);
1228 if (!gAlice->TreeD()) return;
1231 LoadDigits(fChamber, fCathode);
1236 //______________________________________________________________________________
1237 void AliMUONDisplay::UnZoom()
1240 if (fZooms <= 0) return;
1242 TPad *pad = (TPad*)gPad->GetPadSave();
1243 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1247 //_____________________________________________________________________________
1248 void AliMUONDisplay::ResetPoints()
1251 // Reset array of points
1259 //_____________________________________________________________________________
1260 void AliMUONDisplay::ResetPhits()
1263 // Reset array of points
1271 //_____________________________________________________________________________
1272 void AliMUONDisplay::ResetRpoints()
1275 // Reset array of points
1284 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1286 // Dummy assignment operator