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.12 2001/03/05 23:50:08 morsch
19 Correct access to digit and recpoint data.
21 Revision 1.11 2001/01/26 21:41:55 morsch
22 Use access functions to AliMUONDigit member data.
24 Revision 1.10 2001/01/25 20:41:56 morsch
25 Protect against empty TreeD and TreeR.
27 Revision 1.9 2001/01/23 18:58:19 hristov
28 Initialisation of some pointers
30 Revision 1.8 2000/10/06 09:09:01 morsch
31 Pad colour according to z-position (slats).
33 Revision 1.7 2000/10/02 21:28:09 fca
34 Removal of useless dependecies via forward declarations
36 Revision 1.6 2000/07/03 11:54:57 morsch
37 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
38 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
40 Revision 1.5 2000/06/28 15:16:35 morsch
41 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
42 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
43 framework. The changes should have no side effects (mostly dummy arguments).
44 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
45 of chambers with overlapping modules (MakePadHits, Disintegration).
47 Revision 1.4 2000/06/27 09:46:57 morsch
48 kMAXZOOM global constant now in AliMUONConstants
50 Revision 1.3 2000/06/26 14:02:38 morsch
51 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
53 Revision 1.2 2000/06/15 07:58:48 morsch
54 Code from MUON-dev joined
56 Revision 1.1.2.15 2000/06/14 14:37:53 morsch
57 method Trigger() modified
59 Revision 1.1.2.14 2000/06/09 21:57:09 morsch
60 Bug in color scale diplay corrected.
61 Most coding rule violations corrected.
63 Revision 1.1.2.13 2000/05/02 11:57:27 morsch
64 Coding rules RN3, RN13, RN17 violations corrected.
66 Revision 1.1.2.12 2000/04/26 12:27:33 morsch
67 Mods for trigger display (P. Crochet):
68 - color code versus time for pad hits in trigger chambers
69 - call to TriggerDecision corrected
71 Revision 1.1.2.11 2000/04/26 09:04:46 morsch
72 Obsolete cathode correlation related code removed.
74 Revision 1.1.2.10 2000/04/19 19:43:47 morsch
75 change NCH to kNCH as in AliMUON.h
76 no more TreeC related methods
78 Revision 1.1.2.9 2000/03/20 18:10:33 morsch
79 Trigger method for "online" trigger decission added
81 Revision 1.1.2.8 2000/02/23 10:12:01 morsch
82 Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
83 General clean-up of commented code.
85 Revision 1.1.2.7 2000/02/17 14:36:55 morsch
86 Display of Trigger hits and clusters added.
87 Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
89 Revision 1.1.2.6 2000/02/15 10:19:42 morsch
90 Previous log messages included
92 Revision 1.1.2.5 2000/02/15 10:09:09 morsch
95 Revision 1.1.2.4 2000/02/08 09:17:16 gosset
96 One more improvement of MUON display:
97 same zoom for both cathode planes in a chamber
99 Revision 1.1.2.3 2000/02/07 15:37:21 gosset
100 A few improvements of the MUON display:
101 new buttons to change either chamber or cathode,
102 added to the more complicated way
103 (right mouse click and explicit filling of chamber and cathode)
105 Revision 1.1.2.2 2000/02/04 10:57:34 gosset
106 Z position of the chambers:
107 it was the Z position of the stations;
108 it is now really the Z position of the chambers.
109 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
110 !!!! AND "AliMUONChamber::ZPosition"
111 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
112 !!!! AND "AliMUONChamber::Z"
115 //////////////////////////////////////////////////////////////////////////
119 // Utility class to display ALICE outline, tracks, hits,.. //
121 //////////////////////////////////////////////////////////////////////////
130 #include <TPolyMarker3D.h>
131 #include <TPaveLabel.h>
132 #include <TPaveText.h>
134 #include <TDiamond.h>
139 #include <TSliderBox.h>
141 #include <TVirtualX.h>
144 #include <TGeometry.h>
145 #include <X3DBuffer.h>
146 #include <TMarker3DBox.h>
149 #include "AliDetector.h"
151 #include "AliMUONDisplay.h"
152 #include "AliMUONPoints.h"
153 #include "TParticle.h"
154 #include "AliMUONTriggerDecision.h"
156 #include "AliMUONHit.h"
157 #include "AliMUONPadHit.h"
158 #include "AliMUONDigit.h"
159 #include "AliMUONRawCluster.h"
161 #include "AliSegmentation.h"
162 #include "AliMUONResponse.h"
163 #include "AliMUONChamber.h"
164 #include "AliMUONConstants.h"
165 // to manage the same zoom on both cathodes
169 ClassImp(AliMUONDisplay)
172 //_____________________________________________________________________________
173 AliMUONDisplay::AliMUONDisplay()
182 fNextCathode = kFALSE;
186 //_____________________________________________________________________________
187 AliMUONDisplay::AliMUONDisplay(Int_t size)
189 // Create an event display object.
190 // A canvas named "edisplay" is created with a vertical size in pixels
192 // A QUICK Overview of the Event Display functions
193 // ===============================================
195 // The event display can ve invoked by executing the macro "display.C"
196 // A canvas like in the picture below will appear.
198 // On the left side of the canvas, the following buttons appear:
199 // *Next* to move to the next event
200 // *Previous* to move to the previous event
202 // *Pick* Select this option to be able to point on a track with the
203 // mouse. Once on the track, use the right button to select
204 // an action. For example, select SetMarkerAttributes to
205 // change the marker type/color/size for the track.
206 // *Zoom* Select this option (default) if you want to zoom.
207 // To zoom, simply select the selected area with the left button.
208 // *UnZoom* To revert to the previous picture size.
210 // slider R On the left side, the vertical slider can be used to
211 // set the default picture size.
213 // When you are in Zoom mode, you can click on the black part of the canvas
214 // to select special options with the right mouse button.
217 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
218 // When you are on a track, select the menu item "InspectParticle"
219 // to display the current particle attributes.
221 // You can activate the Root browser by selecting the Inspect menu
222 // in the canvas tool bar menu. Then select "Start Browser"
223 // This will open a new canvas with the browser. At this point, you may want
224 // to display some histograms (from the Trees). Go to the "File" menu
225 // of the browser and click on "New canvas".
226 // In the browser, click on item "ROOT files" in the left pane.
227 // Click on galice.root.
229 // Click on TPC for example
230 // Click on any variable (eg TPC.fX) to histogram the variable.
232 // If you are lost, you can click on HELP in any Root canvas or browser.
235 <img src="gif/AliMUONDisplay.gif">
242 gAlice->SetDisplay(this);
244 // Initialize display default parameters
246 // Set front view by default
253 fDrawClusters = kTRUE;
266 // Create display canvas
268 if (ysize < 100) ysize = 750;
269 Int_t xsize = Int_t(size*830./ysize);
270 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
271 fCanvas->ToggleEventStatus();
273 // Create main display pad
274 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
277 fPad->SetFillColor(30);
278 fPad->SetBorderSize(2);
283 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
285 fColPad->SetFillColor(17);
286 fColPad->SetBorderSize(2);
291 // Create user interface control pad
295 // Create Range and mode pad
298 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
299 fTrigPad->SetEditable(kFALSE);
302 fTrigPad->SetFillColor(22);
303 fTrigPad->SetBorderSize(2);
304 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
305 fRangeSlider->SetObject(this);
306 char pickmode[] = "gAlice->Display()->SetPickMode()";
308 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
309 fPickButton->SetFillColor(38);
311 char zoommode[] = "gAlice->Display()->SetZoomMode()";
312 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
313 fZoomButton->SetFillColor(38);
315 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
316 fArcButton->SetFillColor(kGreen);
318 char butUnzoom[] = "gAlice->Display()->UnZoom()";
319 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
320 button->SetFillColor(38);
322 AppendPad(); // append display object as last object to force selection
326 fNextCathode = kFALSE;
329 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
331 // Dummy copy constructor
337 //_____________________________________________________________________________
338 AliMUONDisplay::~AliMUONDisplay()
340 // Delete space point structure
341 if (fPoints) fPoints->Delete();
345 if (fPhits) fPhits->Delete();
349 if (fRpoints) fRpoints->Delete();
353 if (fR2points) fR2points->Delete();
357 if (fCpoints) fCpoints->Delete();
362 //_____________________________________________________________________________
363 void AliMUONDisplay::Clear(Option_t *)
365 // Delete graphics temporary objects
368 //_____________________________________________________________________________
369 void AliMUONDisplay::DisplayButtons()
371 // Create the user interface buttons
374 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
375 fButtons->SetEditable(kFALSE);
377 fButtons->SetFillColor(38);
378 fButtons->SetBorderSize(2);
381 // Int_t butcolor = 33;
382 Float_t dbutton = 0.08;
389 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
390 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
391 button->SetFillColor(38);
395 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
396 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
397 button->SetFillColor(38);
401 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
402 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
403 button->SetFillColor(38);
407 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
408 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
409 button->SetFillColor(38);
413 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
414 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
415 button->SetFillColor(38);
419 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
420 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
421 button->SetFillColor(38);
425 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
426 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
427 button->SetFillColor(38);
431 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
432 diamond->SetFillColor(50);
433 diamond->SetTextAlign(22);
434 diamond->SetTextColor(5);
435 diamond->SetTextSize(0.11);
437 diamond->AddText(".. ");
438 diamond->AddText("ROOT");
439 diamond->AddText("MUON");
440 diamond->AddText("... ");
441 diamond->AddText(" ");
444 //_____________________________________________________________________________
445 void AliMUONDisplay::CreateColors()
447 // Create the colors palette used to display clusters
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);
502 new TColor(color,r,g,b);
509 //_____________________________________________________________________________
510 void AliMUONDisplay::DisplayColorScale()
512 // Display pulse height color scale
515 Float_t xlow, ylow, xup, yup, hs;
516 Float_t x1, y1, x2, y2;
520 TText *text = new TText(0,0,"");
521 text->SetTextFont(61);
522 text->SetTextSize(0.2);
523 text->SetTextAlign(22);
525 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
526 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
527 AliMUONResponse * response=iChamber->ResponseModel();
529 if (response) adcmax = (Int_t) response->MaxAdc();
534 //*-* draw colortable boxes
535 hs = (y2-y1)/Float_t(22);
539 ylow = y1 + hs*(Float_t(i));
540 yup = y1 + hs*(Float_t(i+1));
542 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
543 Int_t scale=(Int_t)TMath::Exp(logscale);
544 sprintf(label,"%d",scale);
545 box = new TBox(xlow, ylow, xup, yup);
547 box->SetFillColor(color);
548 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
552 //______________________________________________________________________________
553 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
555 // Compute distance from point px,py to objects in event
557 gPad->SetCursor(kCross);
559 if (gPad == fTrigPad) return 9999;
561 const Int_t kBig = 9999;
563 Float_t xmin = gPad->GetX1();
564 Float_t xmax = gPad->GetX2();
565 Float_t dx = 0.02*(xmax - xmin);
566 Float_t x = gPad->AbsPixeltoX(px);
567 if (x < xmin+dx || x > xmax-dx) return dist;
569 if (fZoomMode) return 0;
573 //_____________________________________________________________________________
574 void AliMUONDisplay::Draw(Option_t *)
576 // Display current event
580 DrawView(fTheta, fPhi, fPsi);
581 // Display the event number and title
586 void AliMUONDisplay::DrawSegmentation()
588 // Draw graphical representation of segmenatation
589 // Attention: still experimental code
592 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
593 AliMUONChamber* iChamber;
594 AliSegmentation* seg;
595 iChamber = &(pMUON->Chamber(fChamber));
596 seg=iChamber->SegmentationModel(icat);
597 Float_t zpos=iChamber->Z();
598 Float_t r=iChamber->ROuter();
600 TMarker3DBox *marker;
602 for (Int_t j=0; j<seg->Npy(); j++) {
604 y0=j*seg->Dpy()-seg->Dpy()/2.;
605 for (seg->FirstPad(0.,y0,0,300,0.);
609 if (seg->ISector()==0) continue;
611 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
612 Float_t dpx=seg->Dpx(seg->ISector())/2;
613 Float_t dpy=seg->Dpy(seg->ISector())/2;
614 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
615 marker->SetLineColor(seg->ISector()+1);
616 marker->SetFillStyle(1001);
617 marker->SetFillColor(0);
622 for (Int_t j=0; j<250; j++) {
623 Float_t x0=j*seg->Dpx();
624 Float_t y0=TMath::Sqrt(r*r-x0*x0);
626 for (seg->FirstPad(x0,0,0,0,y0);
630 if (seg->ISector()==0) continue;
633 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
634 Float_t dpx=seg->Dpx(seg->ISector())/2;
635 Float_t dpy=seg->Dpy(seg->ISector())/2;
636 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
637 marker->SetLineColor(seg->ISector()+1);
638 marker->SetFillStyle(1001);
639 marker->SetFillColor(0);
646 //_____________________________________________________________________________
647 void AliMUONDisplay::DrawClusters()
649 // Draw clusters for MUON chambers
651 Int_t ndigits, digit;
659 ndigits = points->GetEntriesFast();
660 for (digit=0;digit<ndigits;digit++){
661 pm = (AliMUONPoints*)points->UncheckedAt(digit);
665 for (Int_t im=0;im<3;im++) {
666 TMarker3DBox *marker=pm->GetMarker(im);
671 fClustersCuts +=pm->GetN();
675 //_____________________________________________________________________________
676 void AliMUONDisplay::DrawHits()
678 // Draw hits for MUON chambers
682 Int_t ntracks, track;
689 ntracks = points->GetEntriesFast();
690 for (track=0;track<ntracks;track++) {
691 pm = (AliMUONPoints*)points->UncheckedAt(track);
694 fHitsCuts += pm->GetN();
699 //_____________________________________________________________________________
700 void AliMUONDisplay::DrawCoG()
702 // Draw hits for MUON chambers
703 if (!fDrawCoG) return;
704 if (fChamber > 10) return;
705 LoadCoG(fChamber,fCathode);
713 ncog = points->GetEntriesFast();
714 for (icog=0;icog<ncog;icog++) {
715 pm = (AliMUONPoints*)points->UncheckedAt(icog);
720 void AliMUONDisplay::DrawCoG2()
722 // Draw hits for MUON chambers
724 if (!fDrawCoG) return;
725 if (fChamber > 10) return;
728 LoadCoG2(fChamber,2);
729 } else if (fCathode==2) {
730 LoadCoG2(fChamber,1);
739 ncog = points->GetEntriesFast();
740 for (icog=0;icog<ncog;icog++) {
741 pm = (AliMUONPoints*)points->UncheckedAt(icog);
746 //_____________________________________________________________________________
748 void AliMUONDisplay::DrawTitle(Option_t *option)
750 // Draw the event title
752 Float_t xmin = gPad->GetX1();
753 Float_t xmax = gPad->GetX2();
754 Float_t ymin = gPad->GetY1();
755 Float_t ymax = gPad->GetY2();
756 Float_t dx = xmax-xmin;
757 Float_t dy = ymax-ymin;
759 if (strlen(option) == 0) {
760 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
761 // title->SetTextSize(0.023932);
762 title->SetTextSize(0.02);
763 title->SetBit(kCanDelete);
764 title->SetFillColor(42);
767 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
768 gAlice->GetHeader()->GetEvent(),
769 gAlice->GetHeader()->GetRun(),
772 title->AddText(ptitle);
773 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
774 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
775 nparticles, fHitsCuts,fClustersCuts);
776 title->AddText(ptitle);
778 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
779 label->SetBit(kCanDelete);
780 label->SetFillColor(42);
785 //_____________________________________________________________________________
786 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
788 // Draw a view of MUON clusters
789 printf("\n Draw View");
791 gPad->SetCursor(kWatch);
792 // gPad->SetFillColor(39);
793 gPad->SetFillColor(1);
795 // gPad->SetFillColor(39);
796 gPad->SetFillColor(1);
800 TView *view = new TView(1);
802 Float_t range = fRrange*fRangeSlider->GetMaximum();
803 view->SetRange(-range,-range,-range,range, range, range);
804 // zoom back to full scale only if DrawView not called from NextCathode
813 // Display MUON Chamber Geometry
815 sprintf(nodeName,"MUON%d",100+fChamber);
817 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
818 if (node1) node1->Draw("same");
819 //add clusters to the pad
824 // DrawSegmentation();
825 // add itself to the list (must be last)
827 view->SetView(phi, theta, psi, iret);
831 //______________________________________________________________________________
832 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
834 // Execute action corresponding to the mouse event
836 static Float_t x0, y0, x1, y1;
838 static Int_t pxold, pyold;
839 static Int_t px0, py0;
840 static Int_t linedrawn;
843 if (px == 0 && py == 0) { //when called by sliders
844 if (event == kButton1Up) {
849 if (!fZoomMode && gPad->GetView()) {
850 gPad->GetView()->ExecuteRotateView(event, px, py);
854 // something to zoom ?
855 gPad->SetCursor(kCross);
860 gVirtualX->SetLineColor(-1);
861 gPad->TAttLine::Modify(); //Change line attributes only if necessary
862 x0 = gPad->AbsPixeltoX(px);
863 y0 = gPad->AbsPixeltoY(py);
865 pxold = px; pyold = py;
870 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
874 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
878 gPad->GetCanvas()->FeedbackMode(kFALSE);
879 if (px == px0) return;
880 if (py == py0) return;
881 x1 = gPad->AbsPixeltoX(px);
882 y1 = gPad->AbsPixeltoY(py);
884 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
885 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
886 gPad->Range(x0,y0,x1,y1);
887 if (fZooms < AliMUONConstants::MaxZoom()-1) {
889 fZoomX0[fZooms] = x0;
890 fZoomY0[fZooms] = y0;
891 fZoomX1[fZooms] = x1;
892 fZoomY1[fZooms] = y1;
894 gPad->Modified(kTRUE);
899 //___________________________________________
900 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
902 // Read digits info and store x,y,z info in arrays fPoints
903 // Loop on all detectors
905 if (chamber > 14) return;
906 printf(" chamber %d \n",chamber);
912 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
913 AliMUONChamber* iChamber;
914 AliSegmentation* segmentation;
915 AliMUONResponse* response;
917 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
918 if (muonDigits == 0) return;
920 gAlice->ResetDigits();
923 if (gAlice->TreeD()) {
924 nent = (Int_t) gAlice->TreeD()->GetEntries();
925 printf(" entries %d \n", nent);
926 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
927 gAlice->TreeD()->GetEvent(cathode-1);
930 Int_t ndigits = muonDigits->GetEntriesFast();
931 if (ndigits == 0) return;
932 if (fPoints == 0) fPoints = new TObjArray(ndigits);
934 iChamber = &(pMUON->Chamber(chamber-1));
936 segmentation = iChamber->SegmentationModel(cathode);
937 response = iChamber->ResponseModel();
938 Float_t zpos = iChamber->Z();
941 AliMUONPoints *points = 0;
942 TMarker3DBox *marker = 0;
944 //loop over all digits and store their position
947 Float_t adcmax = 1024;
948 if (response) adcmax = response->MaxAdc();
950 for (Int_t digit = 0; digit < ndigits; digit++) {
951 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
952 if (mdig->Cathode() != cathode-1) continue;
955 // First get all needed parameters
957 Int_t charge = mdig->Signal();
958 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
959 Int_t color = 261+index;
960 Int_t colorTrigger = 2;
961 if (color > 282) color = 282;
963 if (chamber > 10) { // trigger chamber
965 for (Int_t icharge = 0; icharge < 10; icharge++) {
966 sumCharge = sumCharge+mdig->TrackCharge(icharge);
968 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
969 if(sumCharge <= 10 || testCharge > 0) {
970 colorTrigger = color;
976 // get the center of the pad - add on x and y half of pad size
977 Float_t xpad, ypad, zpad;
978 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
980 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
981 Float_t dpx = segmentation->Dpx(isec)/2;
982 Float_t dpy = segmentation->Dpy(isec)/2;
984 // segmentation->Dump();
987 // Then set the objects
989 points = new AliMUONPoints(npoints);
990 fPoints->AddAt(points,digit);
992 points->SetMarkerColor(colorTrigger);
994 points->SetMarkerColor(color);
996 points->SetMarkerStyle(21);
997 points->SetMarkerSize(0.5);
998 points->SetParticle(-1);
999 points->SetHitIndex(-1);
1000 points->SetTrackIndex(-1);
1001 points->SetDigitIndex(digit);
1002 points->SetPoint(0,xpad,ypad,zpos);
1004 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
1005 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
1008 marker->SetLineColor(lineColor);
1009 marker->SetFillStyle(1001);
1010 marker->SetFillColor(color);
1011 marker->SetRefObject((TObject*)points);
1012 points->Set3DMarker(0, marker);
1015 //___________________________________________
1016 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
1018 // Read raw clusters info and store x,y,z info in arrays fRpoints
1019 // Loop on all detectors
1021 if (chamber > 10) return;
1025 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1026 AliMUONChamber* iChamber;
1028 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1029 if (muonRawClusters == 0) return;
1031 pMUON->ResetRawClusters();
1034 if (gAlice->TreeR()) {
1035 nent=(Int_t)gAlice->TreeR()->GetEntries();
1036 gAlice->TreeR()->GetEvent(cathode-1);
1039 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1040 if (nrawcl == 0) return;
1041 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
1043 iChamber = &(pMUON->Chamber(chamber-1));
1044 Float_t zpos=iChamber->Z();
1045 AliMUONRawCluster *mRaw;
1046 AliMUONPoints *points = 0;
1048 //loop over all raw clusters and store their position
1049 points = new AliMUONPoints(nrawcl);
1050 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1051 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1052 fRpoints->AddAt(points,iraw);
1053 points->SetMarkerColor(51);
1054 points->SetMarkerStyle(2);
1055 points->SetMarkerSize(1.);
1056 points->SetParticle(-1);
1057 points->SetHitIndex(-1);
1058 points->SetTrackIndex(-1);
1059 points->SetDigitIndex(-1);
1060 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1063 //___________________________________________
1064 void AliMUONDisplay::LoadCoG2(Int_t chamber, Int_t cathode)
1066 // Read raw clusters info and store x,y,z info in arrays fRpoints
1067 // Loop on all detectors
1069 if (chamber > 10) return;
1073 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1074 AliMUONChamber* iChamber;
1076 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1077 if (muonRawClusters == 0) return;
1079 pMUON->ResetRawClusters();
1082 if (gAlice->TreeR()) {
1083 nent=(Int_t)gAlice->TreeR()->GetEntries();
1084 // gAlice->TreeR()->GetEvent(nent-2+cathode-1);
1085 gAlice->TreeR()->GetEvent(cathode-1);
1088 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1089 if (nrawcl == 0) return;
1090 if (fR2points == 0) fR2points = new TObjArray(nrawcl);
1092 iChamber = &(pMUON->Chamber(chamber-1));
1093 Float_t zpos=iChamber->Z();
1094 AliMUONRawCluster *mRaw;
1095 AliMUONPoints *points = 0;
1097 //loop over all raw clusters and store their position
1098 points = new AliMUONPoints(nrawcl);
1099 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1100 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1101 fR2points->AddAt(points,iraw);
1102 points->SetMarkerColor(51);
1103 points->SetMarkerStyle(4);
1104 points->SetMarkerSize(1.3);
1105 points->SetParticle(-1);
1106 points->SetHitIndex(-1);
1107 points->SetTrackIndex(-1);
1108 points->SetDigitIndex(-1);
1109 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1112 //___________________________________________
1113 void AliMUONDisplay::LoadHits(Int_t chamber)
1115 // Read hits info and store x,y,z info in arrays fPhits
1116 // Loop on all detectors
1118 if (chamber > 14) return;
1125 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1126 AliMUONChamber* iChamber;
1128 iChamber = &(pMUON->Chamber(chamber-1));
1129 Float_t zpos=iChamber->Z();
1131 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1133 for (track = 0; track < ntracks; track++) {
1134 gAlice->ResetHits();
1135 gAlice->TreeH()->GetEvent(track);
1136 TClonesArray *muonHits = pMUON->Hits();
1137 if (muonHits == 0) return;
1138 nthits += muonHits->GetEntriesFast();
1140 if (fPhits == 0) fPhits = new TObjArray(nthits);
1142 for (track=0; track<ntracks;track++) {
1143 gAlice->ResetHits();
1144 gAlice->TreeH()->GetEvent(track);
1145 TClonesArray *muonHits = pMUON->Hits();
1146 if (muonHits == 0) return;
1147 Int_t nhits = muonHits->GetEntriesFast();
1148 if (nhits == 0) continue;
1150 AliMUONPoints *points = 0;
1152 for (Int_t hit=0;hit<nhits;hit++) {
1153 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1154 Int_t nch = mHit->Chamber(); // chamber number
1155 if (nch != chamber) continue;
1157 // Retrieve info and set the objects
1159 points = new AliMUONPoints(npoints);
1160 fPhits->AddAt(points,nhold+hit);
1161 points->SetMarkerColor(kRed);
1162 points->SetMarkerStyle(5);
1163 points->SetMarkerSize(1.);
1164 points->SetParticle(mHit->Track());
1165 points->SetHitIndex(hit);
1166 points->SetTrackIndex(track);
1167 points->SetDigitIndex(-1);
1168 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
1174 //_____________________________________________________________________________
1175 void AliMUONDisplay::Paint(Option_t *)
1177 // Paint miscellaneous items
1180 //_____________________________________________________________________________
1181 void AliMUONDisplay::SetPickMode()
1183 // Set parameters for pick mode.
1187 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1188 fTrigPad->Modified();
1191 //_____________________________________________________________________________
1192 void AliMUONDisplay::SetZoomMode()
1194 // Set parameters for zoom mode
1197 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1198 fTrigPad->Modified();
1201 //_____________________________________________________________________________
1202 void AliMUONDisplay::NextChamber(Int_t delta)
1204 // to go from chamber to next chamber if delta = 1
1205 // or previous chamber otherwise
1207 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1209 if (fChamber > 1) fChamber--;
1213 LoadDigits(fChamber, fCathode);
1217 //_____________________________________________________________________________
1218 void AliMUONDisplay::NextCathode()
1220 // to switch to other cathode plane
1223 if (fCathode == 1) {
1224 LoadDigits(fChamber, 2);
1226 LoadDigits(fChamber, 1);
1228 fNextCathode = kTRUE; // to keep the same zoom
1230 fNextCathode = kFALSE;
1231 TPad *pad = (TPad*)gPad->GetPadSave();
1232 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1233 fZoomX1[fZooms], fZoomY1[fZooms]);
1239 //_____________________________________________________________________________
1240 void AliMUONDisplay::Trigger()
1242 // returns Trigger Decision for current event
1243 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1244 decision->Trigger();
1248 //_____________________________________________________________________________
1249 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1251 // Set chamber and cathode number
1257 LoadDigits(chamber,cathode);
1261 void AliMUONDisplay::SetEvent(Int_t newevent)
1264 gAlice->GetEvent(newevent);
1266 if (!gAlice->TreeD()) return;
1269 LoadDigits(fChamber,fCathode);
1273 //_____________________________________________________________________________
1274 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1276 // Set view range along R and Z
1285 //_____________________________________________________________________________
1286 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1288 // change viewing angles for current event
1296 TView *view = gPad->GetView();
1297 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1302 //_____________________________________________________________________________
1303 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1305 // Display (current event_number + delta)
1306 // delta = 1 shown next event
1307 // delta = -1 show previous event
1310 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1311 Int_t newEvent = currentEvent + delta;
1312 gAlice->GetEvent(newEvent);
1314 if (!gAlice->TreeD()) return;
1317 LoadDigits(fChamber, fCathode);
1322 //______________________________________________________________________________
1323 void AliMUONDisplay::UnZoom()
1326 if (fZooms <= 0) return;
1328 TPad *pad = (TPad*)gPad->GetPadSave();
1329 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1333 //_____________________________________________________________________________
1334 void AliMUONDisplay::ResetPoints()
1337 // Reset array of points
1345 //_____________________________________________________________________________
1346 void AliMUONDisplay::ResetPhits()
1349 // Reset array of points
1357 //_____________________________________________________________________________
1358 void AliMUONDisplay::ResetRpoints()
1361 // Reset array of points
1369 //_____________________________________________________________________________
1370 void AliMUONDisplay::ResetR2points()
1373 // Reset array of points
1376 fR2points->Delete();
1381 //_____________________________________________________________________________
1382 void AliMUONDisplay::ResetCpoints()
1385 // Reset array of points
1395 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1397 // Dummy assignment operator