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.11 2001/01/26 21:41:55 morsch
19 Use access functions to AliMUONDigit member data.
21 Revision 1.10 2001/01/25 20:41:56 morsch
22 Protect against empty TreeD and TreeR.
24 Revision 1.9 2001/01/23 18:58:19 hristov
25 Initialisation of some pointers
27 Revision 1.8 2000/10/06 09:09:01 morsch
28 Pad colour according to z-position (slats).
30 Revision 1.7 2000/10/02 21:28:09 fca
31 Removal of useless dependecies via forward declarations
33 Revision 1.6 2000/07/03 11:54:57 morsch
34 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
35 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
37 Revision 1.5 2000/06/28 15:16:35 morsch
38 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
39 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
40 framework. The changes should have no side effects (mostly dummy arguments).
41 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
42 of chambers with overlapping modules (MakePadHits, Disintegration).
44 Revision 1.4 2000/06/27 09:46:57 morsch
45 kMAXZOOM global constant now in AliMUONConstants
47 Revision 1.3 2000/06/26 14:02:38 morsch
48 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
50 Revision 1.2 2000/06/15 07:58:48 morsch
51 Code from MUON-dev joined
53 Revision 1.1.2.15 2000/06/14 14:37:53 morsch
54 method Trigger() modified
56 Revision 1.1.2.14 2000/06/09 21:57:09 morsch
57 Bug in color scale diplay corrected.
58 Most coding rule violations corrected.
60 Revision 1.1.2.13 2000/05/02 11:57:27 morsch
61 Coding rules RN3, RN13, RN17 violations corrected.
63 Revision 1.1.2.12 2000/04/26 12:27:33 morsch
64 Mods for trigger display (P. Crochet):
65 - color code versus time for pad hits in trigger chambers
66 - call to TriggerDecision corrected
68 Revision 1.1.2.11 2000/04/26 09:04:46 morsch
69 Obsolete cathode correlation related code removed.
71 Revision 1.1.2.10 2000/04/19 19:43:47 morsch
72 change NCH to kNCH as in AliMUON.h
73 no more TreeC related methods
75 Revision 1.1.2.9 2000/03/20 18:10:33 morsch
76 Trigger method for "online" trigger decission added
78 Revision 1.1.2.8 2000/02/23 10:12:01 morsch
79 Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
80 General clean-up of commented code.
82 Revision 1.1.2.7 2000/02/17 14:36:55 morsch
83 Display of Trigger hits and clusters added.
84 Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
86 Revision 1.1.2.6 2000/02/15 10:19:42 morsch
87 Previous log messages included
89 Revision 1.1.2.5 2000/02/15 10:09:09 morsch
92 Revision 1.1.2.4 2000/02/08 09:17:16 gosset
93 One more improvement of MUON display:
94 same zoom for both cathode planes in a chamber
96 Revision 1.1.2.3 2000/02/07 15:37:21 gosset
97 A few improvements of the MUON display:
98 new buttons to change either chamber or cathode,
99 added to the more complicated way
100 (right mouse click and explicit filling of chamber and cathode)
102 Revision 1.1.2.2 2000/02/04 10:57:34 gosset
103 Z position of the chambers:
104 it was the Z position of the stations;
105 it is now really the Z position of the chambers.
106 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
107 !!!! AND "AliMUONChamber::ZPosition"
108 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
109 !!!! AND "AliMUONChamber::Z"
112 //////////////////////////////////////////////////////////////////////////
116 // Utility class to display ALICE outline, tracks, hits,.. //
118 //////////////////////////////////////////////////////////////////////////
127 #include <TPolyMarker3D.h>
128 #include <TPaveLabel.h>
129 #include <TPaveText.h>
131 #include <TDiamond.h>
136 #include <TSliderBox.h>
138 #include <TVirtualX.h>
141 #include <TGeometry.h>
142 #include <X3DBuffer.h>
143 #include <TMarker3DBox.h>
146 #include "AliDetector.h"
148 #include "AliMUONDisplay.h"
149 #include "AliMUONPoints.h"
150 #include "TParticle.h"
151 #include "AliMUONTriggerDecision.h"
153 #include "AliMUONHit.h"
154 #include "AliMUONPadHit.h"
155 #include "AliMUONDigit.h"
156 #include "AliMUONRawCluster.h"
158 #include "AliSegmentation.h"
159 #include "AliMUONResponse.h"
160 #include "AliMUONChamber.h"
161 #include "AliMUONConstants.h"
162 // to manage the same zoom on both cathodes
166 ClassImp(AliMUONDisplay)
169 //_____________________________________________________________________________
170 AliMUONDisplay::AliMUONDisplay()
179 fNextCathode = kFALSE;
183 //_____________________________________________________________________________
184 AliMUONDisplay::AliMUONDisplay(Int_t size)
186 // Create an event display object.
187 // A canvas named "edisplay" is created with a vertical size in pixels
189 // A QUICK Overview of the Event Display functions
190 // ===============================================
192 // The event display can ve invoked by executing the macro "display.C"
193 // A canvas like in the picture below will appear.
195 // On the left side of the canvas, the following buttons appear:
196 // *Next* to move to the next event
197 // *Previous* to move to the previous event
199 // *Pick* Select this option to be able to point on a track with the
200 // mouse. Once on the track, use the right button to select
201 // an action. For example, select SetMarkerAttributes to
202 // change the marker type/color/size for the track.
203 // *Zoom* Select this option (default) if you want to zoom.
204 // To zoom, simply select the selected area with the left button.
205 // *UnZoom* To revert to the previous picture size.
207 // slider R On the left side, the vertical slider can be used to
208 // set the default picture size.
210 // When you are in Zoom mode, you can click on the black part of the canvas
211 // to select special options with the right mouse button.
214 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
215 // When you are on a track, select the menu item "InspectParticle"
216 // to display the current particle attributes.
218 // You can activate the Root browser by selecting the Inspect menu
219 // in the canvas tool bar menu. Then select "Start Browser"
220 // This will open a new canvas with the browser. At this point, you may want
221 // to display some histograms (from the Trees). Go to the "File" menu
222 // of the browser and click on "New canvas".
223 // In the browser, click on item "ROOT files" in the left pane.
224 // Click on galice.root.
226 // Click on TPC for example
227 // Click on any variable (eg TPC.fX) to histogram the variable.
229 // If you are lost, you can click on HELP in any Root canvas or browser.
232 <img src="gif/AliMUONDisplay.gif">
239 gAlice->SetDisplay(this);
241 // Initialize display default parameters
243 // Set front view by default
250 fDrawClusters = kTRUE;
263 // Create display canvas
265 if (ysize < 100) ysize = 750;
266 Int_t xsize = Int_t(size*830./ysize);
267 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
268 fCanvas->ToggleEventStatus();
270 // Create main display pad
271 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
274 fPad->SetFillColor(30);
275 fPad->SetBorderSize(2);
280 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
282 fColPad->SetFillColor(17);
283 fColPad->SetBorderSize(2);
288 // Create user interface control pad
292 // Create Range and mode pad
295 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
296 fTrigPad->SetEditable(kFALSE);
299 fTrigPad->SetFillColor(22);
300 fTrigPad->SetBorderSize(2);
301 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
302 fRangeSlider->SetObject(this);
303 char pickmode[] = "gAlice->Display()->SetPickMode()";
305 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
306 fPickButton->SetFillColor(38);
308 char zoommode[] = "gAlice->Display()->SetZoomMode()";
309 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
310 fZoomButton->SetFillColor(38);
312 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
313 fArcButton->SetFillColor(kGreen);
315 char butUnzoom[] = "gAlice->Display()->UnZoom()";
316 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
317 button->SetFillColor(38);
319 AppendPad(); // append display object as last object to force selection
323 fNextCathode = kFALSE;
326 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
328 // Dummy copy constructor
334 //_____________________________________________________________________________
335 AliMUONDisplay::~AliMUONDisplay()
337 // Delete space point structure
338 if (fPoints) fPoints->Delete();
342 if (fPhits) fPhits->Delete();
346 if (fRpoints) fRpoints->Delete();
350 if (fR2points) fR2points->Delete();
354 if (fCpoints) fCpoints->Delete();
359 //_____________________________________________________________________________
360 void AliMUONDisplay::Clear(Option_t *)
362 // Delete graphics temporary objects
365 //_____________________________________________________________________________
366 void AliMUONDisplay::DisplayButtons()
368 // Create the user interface buttons
371 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
372 fButtons->SetEditable(kFALSE);
374 fButtons->SetFillColor(38);
375 fButtons->SetBorderSize(2);
378 // Int_t butcolor = 33;
379 Float_t dbutton = 0.08;
386 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
387 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
388 button->SetFillColor(38);
392 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
393 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
394 button->SetFillColor(38);
398 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
399 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
400 button->SetFillColor(38);
404 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
405 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
406 button->SetFillColor(38);
410 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
411 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
412 button->SetFillColor(38);
416 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
417 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
418 button->SetFillColor(38);
422 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
423 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
424 button->SetFillColor(38);
428 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
429 diamond->SetFillColor(50);
430 diamond->SetTextAlign(22);
431 diamond->SetTextColor(5);
432 diamond->SetTextSize(0.11);
434 diamond->AddText(".. ");
435 diamond->AddText("ROOT");
436 diamond->AddText("MUON");
437 diamond->AddText("... ");
438 diamond->AddText(" ");
441 //_____________________________________________________________________________
442 void AliMUONDisplay::CreateColors()
444 // Create the colors palette used to display clusters
459 new TColor(color,r,g,b);
469 new TColor(color,r,g,b);
479 new TColor(color,r,g,b);
489 new TColor(color,r,g,b);
499 new TColor(color,r,g,b);
506 //_____________________________________________________________________________
507 void AliMUONDisplay::DisplayColorScale()
509 // Display pulse height color scale
512 Float_t xlow, ylow, xup, yup, hs;
513 Float_t x1, y1, x2, y2;
517 TText *text = new TText(0,0,"");
518 text->SetTextFont(61);
519 text->SetTextSize(0.2);
520 text->SetTextAlign(22);
522 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
523 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
524 AliMUONResponse * response=iChamber->ResponseModel();
526 if (response) adcmax = (Int_t) response->MaxAdc();
531 //*-* draw colortable boxes
532 hs = (y2-y1)/Float_t(22);
536 ylow = y1 + hs*(Float_t(i));
537 yup = y1 + hs*(Float_t(i+1));
539 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
540 Int_t scale=(Int_t)TMath::Exp(logscale);
541 sprintf(label,"%d",scale);
542 box = new TBox(xlow, ylow, xup, yup);
544 box->SetFillColor(color);
545 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
549 //______________________________________________________________________________
550 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
552 // Compute distance from point px,py to objects in event
554 gPad->SetCursor(kCross);
556 if (gPad == fTrigPad) return 9999;
558 const Int_t kBig = 9999;
560 Float_t xmin = gPad->GetX1();
561 Float_t xmax = gPad->GetX2();
562 Float_t dx = 0.02*(xmax - xmin);
563 Float_t x = gPad->AbsPixeltoX(px);
564 if (x < xmin+dx || x > xmax-dx) return dist;
566 if (fZoomMode) return 0;
570 //_____________________________________________________________________________
571 void AliMUONDisplay::Draw(Option_t *)
573 // Display current event
577 DrawView(fTheta, fPhi, fPsi);
578 // Display the event number and title
583 void AliMUONDisplay::DrawSegmentation()
585 // Draw graphical representation of segmenatation
586 // Attention: still experimental code
589 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
590 AliMUONChamber* iChamber;
591 AliSegmentation* seg;
592 iChamber = &(pMUON->Chamber(fChamber));
593 seg=iChamber->SegmentationModel(icat);
594 Float_t zpos=iChamber->Z();
595 Float_t r=iChamber->ROuter();
597 TMarker3DBox *marker;
599 for (Int_t j=0; j<seg->Npy(); j++) {
601 y0=j*seg->Dpy()-seg->Dpy()/2.;
602 for (seg->FirstPad(0.,y0,0,300,0.);
606 if (seg->ISector()==0) continue;
608 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
609 Float_t dpx=seg->Dpx(seg->ISector())/2;
610 Float_t dpy=seg->Dpy(seg->ISector())/2;
611 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
612 marker->SetLineColor(seg->ISector()+1);
613 marker->SetFillStyle(1001);
614 marker->SetFillColor(0);
619 for (Int_t j=0; j<250; j++) {
620 Float_t x0=j*seg->Dpx();
621 Float_t y0=TMath::Sqrt(r*r-x0*x0);
623 for (seg->FirstPad(x0,0,0,0,y0);
627 if (seg->ISector()==0) continue;
630 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
631 Float_t dpx=seg->Dpx(seg->ISector())/2;
632 Float_t dpy=seg->Dpy(seg->ISector())/2;
633 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
634 marker->SetLineColor(seg->ISector()+1);
635 marker->SetFillStyle(1001);
636 marker->SetFillColor(0);
643 //_____________________________________________________________________________
644 void AliMUONDisplay::DrawClusters()
646 // Draw clusters for MUON chambers
648 Int_t ndigits, digit;
656 ndigits = points->GetEntriesFast();
657 for (digit=0;digit<ndigits;digit++){
658 pm = (AliMUONPoints*)points->UncheckedAt(digit);
662 for (Int_t im=0;im<3;im++) {
663 TMarker3DBox *marker=pm->GetMarker(im);
668 fClustersCuts +=pm->GetN();
672 //_____________________________________________________________________________
673 void AliMUONDisplay::DrawHits()
675 // Draw hits for MUON chambers
679 Int_t ntracks, track;
686 ntracks = points->GetEntriesFast();
687 for (track=0;track<ntracks;track++) {
688 pm = (AliMUONPoints*)points->UncheckedAt(track);
691 fHitsCuts += pm->GetN();
696 //_____________________________________________________________________________
697 void AliMUONDisplay::DrawCoG()
699 // Draw hits for MUON chambers
700 if (!fDrawCoG) return;
701 if (fChamber > 10) return;
702 LoadCoG(fChamber,fCathode);
710 ncog = points->GetEntriesFast();
711 for (icog=0;icog<ncog;icog++) {
712 pm = (AliMUONPoints*)points->UncheckedAt(icog);
717 void AliMUONDisplay::DrawCoG2()
719 // Draw hits for MUON chambers
721 if (!fDrawCoG) return;
722 if (fChamber > 10) return;
725 LoadCoG2(fChamber,2);
726 } else if (fCathode==2) {
727 LoadCoG2(fChamber,1);
736 ncog = points->GetEntriesFast();
737 for (icog=0;icog<ncog;icog++) {
738 pm = (AliMUONPoints*)points->UncheckedAt(icog);
743 //_____________________________________________________________________________
745 void AliMUONDisplay::DrawTitle(Option_t *option)
747 // Draw the event title
749 Float_t xmin = gPad->GetX1();
750 Float_t xmax = gPad->GetX2();
751 Float_t ymin = gPad->GetY1();
752 Float_t ymax = gPad->GetY2();
753 Float_t dx = xmax-xmin;
754 Float_t dy = ymax-ymin;
756 if (strlen(option) == 0) {
757 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
758 // title->SetTextSize(0.023932);
759 title->SetTextSize(0.02);
760 title->SetBit(kCanDelete);
761 title->SetFillColor(42);
764 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
765 gAlice->GetHeader()->GetEvent(),
766 gAlice->GetHeader()->GetRun(),
769 title->AddText(ptitle);
770 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
771 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
772 nparticles, fHitsCuts,fClustersCuts);
773 title->AddText(ptitle);
775 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
776 label->SetBit(kCanDelete);
777 label->SetFillColor(42);
782 //_____________________________________________________________________________
783 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
785 // Draw a view of MUON clusters
786 printf("\n Draw View");
788 gPad->SetCursor(kWatch);
789 // gPad->SetFillColor(39);
790 gPad->SetFillColor(1);
792 // gPad->SetFillColor(39);
793 gPad->SetFillColor(1);
797 TView *view = new TView(1);
799 Float_t range = fRrange*fRangeSlider->GetMaximum();
800 view->SetRange(-range,-range,-range,range, range, range);
801 // zoom back to full scale only if DrawView not called from NextCathode
810 // Display MUON Chamber Geometry
812 sprintf(nodeName,"MUON%d",100+fChamber);
814 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
815 if (node1) node1->Draw("same");
816 //add clusters to the pad
821 // DrawSegmentation();
822 // add itself to the list (must be last)
824 view->SetView(phi, theta, psi, iret);
828 //______________________________________________________________________________
829 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
831 // Execute action corresponding to the mouse event
833 static Float_t x0, y0, x1, y1;
835 static Int_t pxold, pyold;
836 static Int_t px0, py0;
837 static Int_t linedrawn;
840 if (px == 0 && py == 0) { //when called by sliders
841 if (event == kButton1Up) {
846 if (!fZoomMode && gPad->GetView()) {
847 gPad->GetView()->ExecuteRotateView(event, px, py);
851 // something to zoom ?
852 gPad->SetCursor(kCross);
857 gVirtualX->SetLineColor(-1);
858 gPad->TAttLine::Modify(); //Change line attributes only if necessary
859 x0 = gPad->AbsPixeltoX(px);
860 y0 = gPad->AbsPixeltoY(py);
862 pxold = px; pyold = py;
867 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
871 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
875 gPad->GetCanvas()->FeedbackMode(kFALSE);
876 if (px == px0) return;
877 if (py == py0) return;
878 x1 = gPad->AbsPixeltoX(px);
879 y1 = gPad->AbsPixeltoY(py);
881 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
882 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
883 gPad->Range(x0,y0,x1,y1);
884 if (fZooms < AliMUONConstants::MaxZoom()-1) {
886 fZoomX0[fZooms] = x0;
887 fZoomY0[fZooms] = y0;
888 fZoomX1[fZooms] = x1;
889 fZoomY1[fZooms] = y1;
891 gPad->Modified(kTRUE);
896 //___________________________________________
897 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
899 // Read digits info and store x,y,z info in arrays fPoints
900 // Loop on all detectors
902 if (chamber > 14) return;
903 printf(" chamber %d \n",chamber);
909 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
910 AliMUONChamber* iChamber;
911 AliSegmentation* segmentation;
912 AliMUONResponse* response;
914 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
915 if (muonDigits == 0) return;
917 gAlice->ResetDigits();
920 if (gAlice->TreeD()) {
921 nent = (Int_t) gAlice->TreeD()->GetEntries();
922 printf(" entries %d \n", nent);
923 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
924 gAlice->TreeD()->GetEvent(cathode-1);
927 Int_t ndigits = muonDigits->GetEntriesFast();
928 if (ndigits == 0) return;
929 if (fPoints == 0) fPoints = new TObjArray(ndigits);
931 iChamber = &(pMUON->Chamber(chamber-1));
933 segmentation = iChamber->SegmentationModel(cathode);
934 response = iChamber->ResponseModel();
935 Float_t zpos = iChamber->Z();
938 AliMUONPoints *points = 0;
939 TMarker3DBox *marker = 0;
941 //loop over all digits and store their position
944 Float_t adcmax = 1024;
945 if (response) adcmax = response->MaxAdc();
947 for (Int_t digit = 0; digit < ndigits; digit++) {
948 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
949 if (mdig->Cathode() != cathode-1) continue;
952 // First get all needed parameters
954 Int_t charge = mdig->Signal();
955 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
956 Int_t color = 261+index;
957 Int_t colorTrigger = 2;
958 if (color > 282) color = 282;
960 if (chamber > 10) { // trigger chamber
962 for (Int_t icharge = 0; icharge < 10; icharge++) {
963 sumCharge = sumCharge+mdig->TrackCharge(icharge);
965 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
966 if(sumCharge <= 10 || testCharge > 0) {
967 colorTrigger = color;
973 // get the center of the pad - add on x and y half of pad size
974 Float_t xpad, ypad, zpad;
975 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
977 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
978 Float_t dpx = segmentation->Dpx(isec)/2;
979 Float_t dpy = segmentation->Dpy(isec)/2;
981 // segmentation->Dump();
984 // Then set the objects
986 points = new AliMUONPoints(npoints);
987 fPoints->AddAt(points,digit);
989 points->SetMarkerColor(colorTrigger);
991 points->SetMarkerColor(color);
993 points->SetMarkerStyle(21);
994 points->SetMarkerSize(0.5);
995 points->SetParticle(-1);
996 points->SetHitIndex(-1);
997 points->SetTrackIndex(-1);
998 points->SetDigitIndex(digit);
999 points->SetPoint(0,xpad,ypad,zpos);
1001 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
1002 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
1005 marker->SetLineColor(lineColor);
1006 marker->SetFillStyle(1001);
1007 marker->SetFillColor(color);
1008 marker->SetRefObject((TObject*)points);
1009 points->Set3DMarker(0, marker);
1012 //___________________________________________
1013 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
1015 // Read raw clusters info and store x,y,z info in arrays fRpoints
1016 // Loop on all detectors
1018 if (chamber > 10) return;
1022 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1023 AliMUONChamber* iChamber;
1025 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1026 if (muonRawClusters == 0) return;
1028 pMUON->ResetRawClusters();
1031 if (gAlice->TreeR()) {
1032 nent=(Int_t)gAlice->TreeR()->GetEntries();
1033 gAlice->TreeR()->GetEvent(cathode-1);
1036 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1037 if (nrawcl == 0) return;
1038 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
1040 iChamber = &(pMUON->Chamber(chamber-1));
1041 Float_t zpos=iChamber->Z();
1042 AliMUONRawCluster *mRaw;
1043 AliMUONPoints *points = 0;
1045 //loop over all raw clusters and store their position
1046 points = new AliMUONPoints(nrawcl);
1047 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1048 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1049 fRpoints->AddAt(points,iraw);
1050 points->SetMarkerColor(51);
1051 points->SetMarkerStyle(2);
1052 points->SetMarkerSize(1.);
1053 points->SetParticle(-1);
1054 points->SetHitIndex(-1);
1055 points->SetTrackIndex(-1);
1056 points->SetDigitIndex(-1);
1057 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1060 //___________________________________________
1061 void AliMUONDisplay::LoadCoG2(Int_t chamber, Int_t cathode)
1063 // Read raw clusters info and store x,y,z info in arrays fRpoints
1064 // Loop on all detectors
1066 if (chamber > 10) return;
1070 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1071 AliMUONChamber* iChamber;
1073 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1074 if (muonRawClusters == 0) return;
1076 pMUON->ResetRawClusters();
1079 if (gAlice->TreeR()) {
1080 nent=(Int_t)gAlice->TreeR()->GetEntries();
1081 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
1084 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1085 if (nrawcl == 0) return;
1086 if (fR2points == 0) fR2points = new TObjArray(nrawcl);
1088 iChamber = &(pMUON->Chamber(chamber-1));
1089 Float_t zpos=iChamber->Z();
1090 AliMUONRawCluster *mRaw;
1091 AliMUONPoints *points = 0;
1093 //loop over all raw clusters and store their position
1094 points = new AliMUONPoints(nrawcl);
1095 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1096 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1097 fR2points->AddAt(points,iraw);
1098 points->SetMarkerColor(51);
1099 points->SetMarkerStyle(4);
1100 points->SetMarkerSize(1.3);
1101 points->SetParticle(-1);
1102 points->SetHitIndex(-1);
1103 points->SetTrackIndex(-1);
1104 points->SetDigitIndex(-1);
1105 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1108 //___________________________________________
1109 void AliMUONDisplay::LoadHits(Int_t chamber)
1111 // Read hits info and store x,y,z info in arrays fPhits
1112 // Loop on all detectors
1114 if (chamber > 14) return;
1121 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1122 AliMUONChamber* iChamber;
1124 iChamber = &(pMUON->Chamber(chamber-1));
1125 Float_t zpos=iChamber->Z();
1127 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1129 for (track = 0; track < ntracks; track++) {
1130 gAlice->ResetHits();
1131 gAlice->TreeH()->GetEvent(track);
1132 TClonesArray *muonHits = pMUON->Hits();
1133 if (muonHits == 0) return;
1134 nthits += muonHits->GetEntriesFast();
1136 if (fPhits == 0) fPhits = new TObjArray(nthits);
1138 for (track=0; track<ntracks;track++) {
1139 gAlice->ResetHits();
1140 gAlice->TreeH()->GetEvent(track);
1141 TClonesArray *muonHits = pMUON->Hits();
1142 if (muonHits == 0) return;
1143 Int_t nhits = muonHits->GetEntriesFast();
1144 if (nhits == 0) continue;
1146 AliMUONPoints *points = 0;
1148 for (Int_t hit=0;hit<nhits;hit++) {
1149 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1150 Int_t nch = mHit->Chamber(); // chamber number
1151 if (nch != chamber) continue;
1153 // Retrieve info and set the objects
1155 points = new AliMUONPoints(npoints);
1156 fPhits->AddAt(points,nhold+hit);
1157 points->SetMarkerColor(kRed);
1158 points->SetMarkerStyle(5);
1159 points->SetMarkerSize(1.);
1160 points->SetParticle(mHit->Track());
1161 points->SetHitIndex(hit);
1162 points->SetTrackIndex(track);
1163 points->SetDigitIndex(-1);
1164 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
1170 //_____________________________________________________________________________
1171 void AliMUONDisplay::Paint(Option_t *)
1173 // Paint miscellaneous items
1176 //_____________________________________________________________________________
1177 void AliMUONDisplay::SetPickMode()
1179 // Set parameters for pick mode.
1183 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1184 fTrigPad->Modified();
1187 //_____________________________________________________________________________
1188 void AliMUONDisplay::SetZoomMode()
1190 // Set parameters for zoom mode
1193 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1194 fTrigPad->Modified();
1197 //_____________________________________________________________________________
1198 void AliMUONDisplay::NextChamber(Int_t delta)
1200 // to go from chamber to next chamber if delta = 1
1201 // or previous chamber otherwise
1203 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1205 if (fChamber > 1) fChamber--;
1209 LoadDigits(fChamber, fCathode);
1213 //_____________________________________________________________________________
1214 void AliMUONDisplay::NextCathode()
1216 // to switch to other cathode plane
1219 if (fCathode == 1) {
1220 LoadDigits(fChamber, 2);
1222 LoadDigits(fChamber, 1);
1224 fNextCathode = kTRUE; // to keep the same zoom
1226 fNextCathode = kFALSE;
1227 TPad *pad = (TPad*)gPad->GetPadSave();
1228 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1229 fZoomX1[fZooms], fZoomY1[fZooms]);
1235 //_____________________________________________________________________________
1236 void AliMUONDisplay::Trigger()
1238 // returns Trigger Decision for current event
1239 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1240 decision->Trigger();
1244 //_____________________________________________________________________________
1245 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1247 // Set chamber and cathode number
1253 LoadDigits(chamber,cathode);
1257 void AliMUONDisplay::SetEvent(Int_t newevent)
1260 gAlice->GetEvent(newevent);
1262 if (!gAlice->TreeD()) return;
1265 LoadDigits(fChamber,fCathode);
1269 //_____________________________________________________________________________
1270 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1272 // Set view range along R and Z
1281 //_____________________________________________________________________________
1282 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1284 // change viewing angles for current event
1292 TView *view = gPad->GetView();
1293 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1298 //_____________________________________________________________________________
1299 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1301 // Display (current event_number + delta)
1302 // delta = 1 shown next event
1303 // delta = -1 show previous event
1306 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1307 Int_t newEvent = currentEvent + delta;
1308 gAlice->GetEvent(newEvent);
1310 if (!gAlice->TreeD()) return;
1313 LoadDigits(fChamber, fCathode);
1318 //______________________________________________________________________________
1319 void AliMUONDisplay::UnZoom()
1322 if (fZooms <= 0) return;
1324 TPad *pad = (TPad*)gPad->GetPadSave();
1325 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1329 //_____________________________________________________________________________
1330 void AliMUONDisplay::ResetPoints()
1333 // Reset array of points
1341 //_____________________________________________________________________________
1342 void AliMUONDisplay::ResetPhits()
1345 // Reset array of points
1353 //_____________________________________________________________________________
1354 void AliMUONDisplay::ResetRpoints()
1357 // Reset array of points
1365 //_____________________________________________________________________________
1366 void AliMUONDisplay::ResetR2points()
1369 // Reset array of points
1372 fR2points->Delete();
1377 //_____________________________________________________________________________
1378 void AliMUONDisplay::ResetCpoints()
1381 // Reset array of points
1391 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1393 // Dummy assignment operator