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.7 2000/10/02 21:28:09 fca
19 Removal of useless dependecies via forward declarations
21 Revision 1.6 2000/07/03 11:54:57 morsch
22 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
23 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
25 Revision 1.5 2000/06/28 15:16:35 morsch
26 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
27 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
28 framework. The changes should have no side effects (mostly dummy arguments).
29 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
30 of chambers with overlapping modules (MakePadHits, Disintegration).
32 Revision 1.4 2000/06/27 09:46:57 morsch
33 kMAXZOOM global constant now in AliMUONConstants
35 Revision 1.3 2000/06/26 14:02:38 morsch
36 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
38 Revision 1.2 2000/06/15 07:58:48 morsch
39 Code from MUON-dev joined
41 Revision 1.1.2.15 2000/06/14 14:37:53 morsch
42 method Trigger() modified
44 Revision 1.1.2.14 2000/06/09 21:57:09 morsch
45 Bug in color scale diplay corrected.
46 Most coding rule violations corrected.
48 Revision 1.1.2.13 2000/05/02 11:57:27 morsch
49 Coding rules RN3, RN13, RN17 violations corrected.
51 Revision 1.1.2.12 2000/04/26 12:27:33 morsch
52 Mods for trigger display (P. Crochet):
53 - color code versus time for pad hits in trigger chambers
54 - call to TriggerDecision corrected
56 Revision 1.1.2.11 2000/04/26 09:04:46 morsch
57 Obsolete cathode correlation related code removed.
59 Revision 1.1.2.10 2000/04/19 19:43:47 morsch
60 change NCH to kNCH as in AliMUON.h
61 no more TreeC related methods
63 Revision 1.1.2.9 2000/03/20 18:10:33 morsch
64 Trigger method for "online" trigger decission added
66 Revision 1.1.2.8 2000/02/23 10:12:01 morsch
67 Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
68 General clean-up of commented code.
70 Revision 1.1.2.7 2000/02/17 14:36:55 morsch
71 Display of Trigger hits and clusters added.
72 Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
74 Revision 1.1.2.6 2000/02/15 10:19:42 morsch
75 Previous log messages included
77 Revision 1.1.2.5 2000/02/15 10:09:09 morsch
80 Revision 1.1.2.4 2000/02/08 09:17:16 gosset
81 One more improvement of MUON display:
82 same zoom for both cathode planes in a chamber
84 Revision 1.1.2.3 2000/02/07 15:37:21 gosset
85 A few improvements of the MUON display:
86 new buttons to change either chamber or cathode,
87 added to the more complicated way
88 (right mouse click and explicit filling of chamber and cathode)
90 Revision 1.1.2.2 2000/02/04 10:57:34 gosset
91 Z position of the chambers:
92 it was the Z position of the stations;
93 it is now really the Z position of the chambers.
94 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
95 !!!! AND "AliMUONChamber::ZPosition"
96 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
97 !!!! AND "AliMUONChamber::Z"
100 //////////////////////////////////////////////////////////////////////////
104 // Utility class to display ALICE outline, tracks, hits,.. //
106 //////////////////////////////////////////////////////////////////////////
115 #include <TPolyMarker3D.h>
116 #include <TPaveLabel.h>
117 #include <TPaveText.h>
119 #include <TDiamond.h>
124 #include <TSliderBox.h>
126 #include <TVirtualX.h>
129 #include <TGeometry.h>
130 #include <X3DBuffer.h>
131 #include <TMarker3DBox.h>
134 #include "AliDetector.h"
136 #include "AliMUONDisplay.h"
137 #include "AliMUONPoints.h"
138 #include "TParticle.h"
139 #include "AliMUONTriggerDecision.h"
141 #include "AliMUONHit.h"
142 #include "AliMUONPadHit.h"
143 #include "AliMUONDigit.h"
144 #include "AliMUONRawCluster.h"
146 #include "AliSegmentation.h"
147 #include "AliMUONResponse.h"
148 #include "AliMUONChamber.h"
149 #include "AliMUONConstants.h"
150 // to manage the same zoom on both cathodes
154 ClassImp(AliMUONDisplay)
157 //_____________________________________________________________________________
158 AliMUONDisplay::AliMUONDisplay()
167 fNextCathode = kFALSE;
170 //_____________________________________________________________________________
171 AliMUONDisplay::AliMUONDisplay(Int_t size)
173 // Create an event display object.
174 // A canvas named "edisplay" is created with a vertical size in pixels
176 // A QUICK Overview of the Event Display functions
177 // ===============================================
179 // The event display can ve invoked by executing the macro "display.C"
180 // A canvas like in the picture below will appear.
182 // On the left side of the canvas, the following buttons appear:
183 // *Next* to move to the next event
184 // *Previous* to move to the previous event
186 // *Pick* Select this option to be able to point on a track with the
187 // mouse. Once on the track, use the right button to select
188 // an action. For example, select SetMarkerAttributes to
189 // change the marker type/color/size for the track.
190 // *Zoom* Select this option (default) if you want to zoom.
191 // To zoom, simply select the selected area with the left button.
192 // *UnZoom* To revert to the previous picture size.
194 // slider R On the left side, the vertical slider can be used to
195 // set the default picture size.
197 // When you are in Zoom mode, you can click on the black part of the canvas
198 // to select special options with the right mouse button.
201 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
202 // When you are on a track, select the menu item "InspectParticle"
203 // to display the current particle attributes.
205 // You can activate the Root browser by selecting the Inspect menu
206 // in the canvas tool bar menu. Then select "Start Browser"
207 // This will open a new canvas with the browser. At this point, you may want
208 // to display some histograms (from the Trees). Go to the "File" menu
209 // of the browser and click on "New canvas".
210 // In the browser, click on item "ROOT files" in the left pane.
211 // Click on galice.root.
213 // Click on TPC for example
214 // Click on any variable (eg TPC.fX) to histogram the variable.
216 // If you are lost, you can click on HELP in any Root canvas or browser.
219 <img src="gif/AliMUONDisplay.gif">
226 gAlice->SetDisplay(this);
228 // Initialize display default parameters
230 // Set front view by default
237 fDrawClusters = kTRUE;
250 // Create display canvas
252 if (ysize < 100) ysize = 750;
253 Int_t xsize = Int_t(size*830./ysize);
254 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
255 fCanvas->ToggleEventStatus();
257 // Create main display pad
258 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
261 fPad->SetFillColor(30);
262 fPad->SetBorderSize(2);
267 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
269 fColPad->SetFillColor(17);
270 fColPad->SetBorderSize(2);
275 // Create user interface control pad
279 // Create Range and mode pad
282 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
283 fTrigPad->SetEditable(kFALSE);
286 fTrigPad->SetFillColor(22);
287 fTrigPad->SetBorderSize(2);
288 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
289 fRangeSlider->SetObject(this);
290 char pickmode[] = "gAlice->Display()->SetPickMode()";
292 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
293 fPickButton->SetFillColor(38);
295 char zoommode[] = "gAlice->Display()->SetZoomMode()";
296 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
297 fZoomButton->SetFillColor(38);
299 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
300 fArcButton->SetFillColor(kGreen);
302 char butUnzoom[] = "gAlice->Display()->UnZoom()";
303 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
304 button->SetFillColor(38);
306 AppendPad(); // append display object as last object to force selection
310 fNextCathode = kFALSE;
313 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
315 // Dummy copy constructor
321 //_____________________________________________________________________________
322 AliMUONDisplay::~AliMUONDisplay()
324 // Delete space point structure
325 if (fPoints) fPoints->Delete();
329 if (fPhits) fPhits->Delete();
333 if (fRpoints) fRpoints->Delete();
337 if (fR2points) fR2points->Delete();
341 if (fCpoints) fCpoints->Delete();
346 //_____________________________________________________________________________
347 void AliMUONDisplay::Clear(Option_t *)
349 // Delete graphics temporary objects
352 //_____________________________________________________________________________
353 void AliMUONDisplay::DisplayButtons()
355 // Create the user interface buttons
358 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
359 fButtons->SetEditable(kFALSE);
361 fButtons->SetFillColor(38);
362 fButtons->SetBorderSize(2);
365 // Int_t butcolor = 33;
366 Float_t dbutton = 0.08;
373 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
374 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
375 button->SetFillColor(38);
379 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
380 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
381 button->SetFillColor(38);
385 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
386 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
387 button->SetFillColor(38);
391 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
392 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
393 button->SetFillColor(38);
397 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
398 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
399 button->SetFillColor(38);
403 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
404 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
405 button->SetFillColor(38);
409 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
410 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
411 button->SetFillColor(38);
415 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
416 diamond->SetFillColor(50);
417 diamond->SetTextAlign(22);
418 diamond->SetTextColor(5);
419 diamond->SetTextSize(0.11);
421 diamond->AddText(".. ");
422 diamond->AddText("ROOT");
423 diamond->AddText("MUON");
424 diamond->AddText("... ");
425 diamond->AddText(" ");
428 //_____________________________________________________________________________
429 void AliMUONDisplay::CreateColors()
431 // Create the colors palette used to display clusters
446 new TColor(color,r,g,b);
456 new TColor(color,r,g,b);
466 new TColor(color,r,g,b);
476 new TColor(color,r,g,b);
486 new TColor(color,r,g,b);
493 //_____________________________________________________________________________
494 void AliMUONDisplay::DisplayColorScale()
496 // Display pulse height color scale
499 Float_t xlow, ylow, xup, yup, hs;
500 Float_t x1, y1, x2, y2;
504 TText *text = new TText(0,0,"");
505 text->SetTextFont(61);
506 text->SetTextSize(0.2);
507 text->SetTextAlign(22);
509 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
510 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
511 AliMUONResponse * response=iChamber->ResponseModel();
513 if (response) adcmax= (Int_t) response->MaxAdc();
518 //*-* draw colortable boxes
519 hs = (y2-y1)/Float_t(22);
523 ylow = y1 + hs*(Float_t(i));
524 yup = y1 + hs*(Float_t(i+1));
526 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
527 Int_t scale=(Int_t)TMath::Exp(logscale);
528 sprintf(label,"%d",scale);
529 box = new TBox(xlow, ylow, xup, yup);
531 box->SetFillColor(color);
532 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
536 //______________________________________________________________________________
537 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
539 // Compute distance from point px,py to objects in event
541 gPad->SetCursor(kCross);
543 if (gPad == fTrigPad) return 9999;
545 const Int_t kBig = 9999;
547 Float_t xmin = gPad->GetX1();
548 Float_t xmax = gPad->GetX2();
549 Float_t dx = 0.02*(xmax - xmin);
550 Float_t x = gPad->AbsPixeltoX(px);
551 if (x < xmin+dx || x > xmax-dx) return dist;
553 if (fZoomMode) return 0;
557 //_____________________________________________________________________________
558 void AliMUONDisplay::Draw(Option_t *)
560 // Display current event
564 DrawView(fTheta, fPhi, fPsi);
565 // Display the event number and title
570 void AliMUONDisplay::DrawSegmentation()
572 // Draw graphical representation of segmenatation
573 // Attention: still experimental code
576 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
577 AliMUONChamber* iChamber;
578 AliSegmentation* seg;
579 iChamber = &(pMUON->Chamber(fChamber));
580 seg=iChamber->SegmentationModel(icat);
581 Float_t zpos=iChamber->Z();
582 Float_t r=iChamber->ROuter();
584 TMarker3DBox *marker;
586 for (Int_t j=0; j<seg->Npy(); j++) {
588 y0=j*seg->Dpy()-seg->Dpy()/2.;
589 for (seg->FirstPad(0.,y0,0,300,0.);
593 if (seg->ISector()==0) continue;
595 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
596 Float_t dpx=seg->Dpx(seg->ISector())/2;
597 Float_t dpy=seg->Dpy(seg->ISector())/2;
598 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
599 marker->SetLineColor(seg->ISector()+1);
600 marker->SetFillStyle(1001);
601 marker->SetFillColor(0);
606 for (Int_t j=0; j<250; j++) {
607 Float_t x0=j*seg->Dpx();
608 Float_t y0=TMath::Sqrt(r*r-x0*x0);
610 for (seg->FirstPad(x0,0,0,0,y0);
614 if (seg->ISector()==0) continue;
617 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
618 Float_t dpx=seg->Dpx(seg->ISector())/2;
619 Float_t dpy=seg->Dpy(seg->ISector())/2;
620 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
621 marker->SetLineColor(seg->ISector()+1);
622 marker->SetFillStyle(1001);
623 marker->SetFillColor(0);
630 //_____________________________________________________________________________
631 void AliMUONDisplay::DrawClusters()
633 // Draw clusters for MUON chambers
635 Int_t ndigits, digit;
643 ndigits = points->GetEntriesFast();
644 for (digit=0;digit<ndigits;digit++){
645 pm = (AliMUONPoints*)points->UncheckedAt(digit);
649 for (Int_t im=0;im<3;im++) {
650 TMarker3DBox *marker=pm->GetMarker(im);
655 fClustersCuts +=pm->GetN();
659 //_____________________________________________________________________________
660 void AliMUONDisplay::DrawHits()
662 // Draw hits for MUON chambers
666 Int_t ntracks, track;
673 ntracks = points->GetEntriesFast();
674 for (track=0;track<ntracks;track++) {
675 pm = (AliMUONPoints*)points->UncheckedAt(track);
678 fHitsCuts += pm->GetN();
683 //_____________________________________________________________________________
684 void AliMUONDisplay::DrawCoG()
686 // Draw hits for MUON chambers
687 if (!fDrawCoG) return;
688 if (fChamber > 10) return;
689 LoadCoG(fChamber,fCathode);
697 ncog = points->GetEntriesFast();
698 for (icog=0;icog<ncog;icog++) {
699 pm = (AliMUONPoints*)points->UncheckedAt(icog);
704 void AliMUONDisplay::DrawCoG2()
706 // Draw hits for MUON chambers
708 if (!fDrawCoG) return;
709 if (fChamber > 10) return;
712 LoadCoG2(fChamber,2);
713 } else if (fCathode==2) {
714 LoadCoG2(fChamber,1);
723 ncog = points->GetEntriesFast();
724 for (icog=0;icog<ncog;icog++) {
725 pm = (AliMUONPoints*)points->UncheckedAt(icog);
730 //_____________________________________________________________________________
732 void AliMUONDisplay::DrawTitle(Option_t *option)
734 // Draw the event title
736 Float_t xmin = gPad->GetX1();
737 Float_t xmax = gPad->GetX2();
738 Float_t ymin = gPad->GetY1();
739 Float_t ymax = gPad->GetY2();
740 Float_t dx = xmax-xmin;
741 Float_t dy = ymax-ymin;
743 if (strlen(option) == 0) {
744 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
745 // title->SetTextSize(0.023932);
746 title->SetTextSize(0.02);
747 title->SetBit(kCanDelete);
748 title->SetFillColor(42);
751 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
752 gAlice->GetHeader()->GetEvent(),
753 gAlice->GetHeader()->GetRun(),
756 title->AddText(ptitle);
757 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
758 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
759 nparticles, fHitsCuts,fClustersCuts);
760 title->AddText(ptitle);
762 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
763 label->SetBit(kCanDelete);
764 label->SetFillColor(42);
769 //_____________________________________________________________________________
770 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
772 // Draw a view of MUON clusters
773 printf("\n Draw View");
775 gPad->SetCursor(kWatch);
776 // gPad->SetFillColor(39);
777 gPad->SetFillColor(1);
779 // gPad->SetFillColor(39);
780 gPad->SetFillColor(1);
784 TView *view = new TView(1);
786 Float_t range = fRrange*fRangeSlider->GetMaximum();
787 view->SetRange(-range,-range,-range,range, range, range);
788 // zoom back to full scale only if DrawView not called from NextCathode
797 // Display MUON Chamber Geometry
798 // gAlice->GetGeometry()->Draw("same");
800 sprintf(nodeName,"MUON%d",100+fChamber);
801 printf("\n Node name %s", nodeName);
803 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
804 if (node1) node1->Draw("same");
805 //add clusters to the pad
807 printf("Node name %s", nodeName);
811 // DrawSegmentation();
812 // add itself to the list (must be last)
814 view->SetView(phi, theta, psi, iret);
818 //______________________________________________________________________________
819 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
821 // Execute action corresponding to the mouse event
823 static Float_t x0, y0, x1, y1;
825 static Int_t pxold, pyold;
826 static Int_t px0, py0;
827 static Int_t linedrawn;
830 if (px == 0 && py == 0) { //when called by sliders
831 if (event == kButton1Up) {
836 if (!fZoomMode && gPad->GetView()) {
837 gPad->GetView()->ExecuteRotateView(event, px, py);
841 // something to zoom ?
842 gPad->SetCursor(kCross);
847 gVirtualX->SetLineColor(-1);
848 gPad->TAttLine::Modify(); //Change line attributes only if necessary
849 x0 = gPad->AbsPixeltoX(px);
850 y0 = gPad->AbsPixeltoY(py);
852 pxold = px; pyold = py;
857 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
861 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
865 gPad->GetCanvas()->FeedbackMode(kFALSE);
866 if (px == px0) return;
867 if (py == py0) return;
868 x1 = gPad->AbsPixeltoX(px);
869 y1 = gPad->AbsPixeltoY(py);
871 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
872 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
873 gPad->Range(x0,y0,x1,y1);
874 if (fZooms < AliMUONConstants::MaxZoom()-1) {
876 fZoomX0[fZooms] = x0;
877 fZoomY0[fZooms] = y0;
878 fZoomX1[fZooms] = x1;
879 fZoomY1[fZooms] = y1;
881 gPad->Modified(kTRUE);
886 //___________________________________________
887 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
889 // Read digits info and store x,y,z info in arrays fPoints
890 // Loop on all detectors
892 if (chamber > 14) return;
893 printf(" chamber %d \n",chamber);
899 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
900 AliMUONChamber* iChamber;
901 AliSegmentation* segmentation;
902 AliMUONResponse* response;
904 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
905 if (muonDigits == 0) return;
907 gAlice->ResetDigits();
909 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
910 gAlice->TreeD()->GetEvent(nent-2+cathode-1);
911 Int_t ndigits = muonDigits->GetEntriesFast();
912 if (ndigits == 0) return;
913 if (fPoints == 0) fPoints = new TObjArray(ndigits);
915 iChamber = &(pMUON->Chamber(chamber-1));
917 segmentation = iChamber->SegmentationModel(cathode);
918 response = iChamber->ResponseModel();
919 Float_t zpos=iChamber->Z();
921 AliMUONPoints *points = 0;
922 TMarker3DBox *marker=0;
924 //loop over all digits and store their position
928 if (response) adcmax= response->MaxAdc();
930 for (Int_t digit=0;digit<ndigits;digit++) {
931 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
933 // First get all needed parameters
935 Int_t charge=mdig->fSignal;
936 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
937 Int_t color=261+index;
938 Int_t colorTrigger=2;
939 if (color>282) color=282;
941 if (chamber > 10) { // trigger chamber
943 for (Int_t icharge=0; icharge<10; icharge++) {
944 sumCharge=sumCharge+mdig->fTcharges[icharge];
946 Int_t testCharge=sumCharge-(Int_t(sumCharge/10))*10;
947 if(sumCharge<=10||testCharge>0) {
954 // get the center of the pad - add on x and y half of pad size
955 Float_t xpad, ypad, zpad;
956 segmentation->GetPadC(mdig->fPadX, mdig->fPadY,xpad, ypad, zpad);
958 Int_t isec=segmentation->Sector(mdig->fPadX, mdig->fPadY);
959 Float_t dpx=segmentation->Dpx(isec)/2;
960 Float_t dpy=segmentation->Dpy(isec)/2;
962 segmentation->GetNParallelAndOffset(mdig->fPadX,mdig->fPadY,
965 // Then set the objects
967 points = new AliMUONPoints(npoints);
968 fPoints->AddAt(points,digit);
970 points->SetMarkerColor(colorTrigger);
972 points->SetMarkerColor(color);
974 points->SetMarkerStyle(21);
975 points->SetMarkerSize(0.5);
976 points->SetParticle(-1);
977 points->SetHitIndex(-1);
978 points->SetTrackIndex(-1);
979 points->SetDigitIndex(digit);
980 points->SetPoint(0,xpad,ypad,zpos);
981 for (Int_t imark=0;imark<nPara; imark++)
983 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
984 segmentation->GetPadC(mdig->fPadX + imark*offset, mdig->fPadY,xpad, ypad, zpad);
985 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
986 marker->SetLineColor(lineColor);
987 marker->SetFillStyle(1001);
988 marker->SetFillColor(color);
989 marker->SetRefObject((TObject*)points);
990 points->Set3DMarker(imark, marker);
994 //___________________________________________
995 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
997 // Read raw clusters info and store x,y,z info in arrays fRpoints
998 // Loop on all detectors
1000 if (chamber > 10) return;
1004 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1005 AliMUONChamber* iChamber;
1007 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1008 if (muonRawClusters == 0) return;
1010 pMUON->ResetRawClusters();
1013 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
1014 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
1015 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1016 if (nrawcl == 0) return;
1017 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
1019 iChamber = &(pMUON->Chamber(chamber-1));
1020 Float_t zpos=iChamber->Z();
1021 AliMUONRawCluster *mRaw;
1022 AliMUONPoints *points = 0;
1024 //loop over all raw clusters and store their position
1025 points = new AliMUONPoints(nrawcl);
1026 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1027 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1028 fRpoints->AddAt(points,iraw);
1029 points->SetMarkerColor(51);
1030 points->SetMarkerStyle(2);
1031 points->SetMarkerSize(1.);
1032 points->SetParticle(-1);
1033 points->SetHitIndex(-1);
1034 points->SetTrackIndex(-1);
1035 points->SetDigitIndex(-1);
1036 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1039 //___________________________________________
1040 void AliMUONDisplay::LoadCoG2(Int_t chamber, Int_t cathode)
1042 // Read raw clusters info and store x,y,z info in arrays fRpoints
1043 // Loop on all detectors
1045 if (chamber > 10) return;
1049 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1050 AliMUONChamber* iChamber;
1052 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1053 if (muonRawClusters == 0) return;
1055 pMUON->ResetRawClusters();
1057 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
1058 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
1059 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1060 if (nrawcl == 0) return;
1061 if (fR2points == 0) fR2points = new TObjArray(nrawcl);
1063 iChamber = &(pMUON->Chamber(chamber-1));
1064 Float_t zpos=iChamber->Z();
1065 AliMUONRawCluster *mRaw;
1066 AliMUONPoints *points = 0;
1068 //loop over all raw clusters and store their position
1069 points = new AliMUONPoints(nrawcl);
1070 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1071 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1072 fR2points->AddAt(points,iraw);
1073 points->SetMarkerColor(51);
1074 points->SetMarkerStyle(4);
1075 points->SetMarkerSize(1.3);
1076 points->SetParticle(-1);
1077 points->SetHitIndex(-1);
1078 points->SetTrackIndex(-1);
1079 points->SetDigitIndex(-1);
1080 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1083 //___________________________________________
1084 void AliMUONDisplay::LoadHits(Int_t chamber)
1086 // Read hits info and store x,y,z info in arrays fPhits
1087 // Loop on all detectors
1089 if (chamber > 14) return;
1096 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1097 AliMUONChamber* iChamber;
1099 iChamber = &(pMUON->Chamber(chamber-1));
1100 Float_t zpos=iChamber->Z();
1102 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1104 for (track=0; track<ntracks;track++) {
1105 gAlice->ResetHits();
1106 gAlice->TreeH()->GetEvent(track);
1107 TClonesArray *muonHits = pMUON->Hits();
1108 if (muonHits == 0) return;
1109 nthits += muonHits->GetEntriesFast();
1111 if (fPhits == 0) fPhits = new TObjArray(nthits);
1113 for (track=0; track<ntracks;track++) {
1114 gAlice->ResetHits();
1115 gAlice->TreeH()->GetEvent(track);
1116 TClonesArray *muonHits = pMUON->Hits();
1117 if (muonHits == 0) return;
1118 Int_t nhits = muonHits->GetEntriesFast();
1119 if (nhits == 0) continue;
1121 AliMUONPoints *points = 0;
1123 for (Int_t hit=0;hit<nhits;hit++) {
1124 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1125 Int_t nch = mHit->fChamber; // chamber number
1126 if (nch != chamber) continue;
1128 // Retrieve info and set the objects
1130 points = new AliMUONPoints(npoints);
1131 fPhits->AddAt(points,nhold+hit);
1132 points->SetMarkerColor(kRed);
1133 points->SetMarkerStyle(5);
1134 points->SetMarkerSize(1.);
1135 points->SetParticle(mHit->Track());
1136 points->SetHitIndex(hit);
1137 points->SetTrackIndex(track);
1138 points->SetDigitIndex(-1);
1139 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
1145 //_____________________________________________________________________________
1146 void AliMUONDisplay::Paint(Option_t *)
1148 // Paint miscellaneous items
1151 //_____________________________________________________________________________
1152 void AliMUONDisplay::SetPickMode()
1154 // Set parameters for pick mode.
1158 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1159 fTrigPad->Modified();
1162 //_____________________________________________________________________________
1163 void AliMUONDisplay::SetZoomMode()
1165 // Set parameters for zoom mode
1168 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1169 fTrigPad->Modified();
1172 //_____________________________________________________________________________
1173 void AliMUONDisplay::NextChamber(Int_t delta)
1175 // to go from chamber to next chamber if delta = 1
1176 // or previous chamber otherwise
1178 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1180 if (fChamber > 1) fChamber--;
1184 LoadDigits(fChamber, fCathode);
1188 //_____________________________________________________________________________
1189 void AliMUONDisplay::NextCathode()
1191 // to switch to other cathode plane
1194 if (fCathode == 1) {
1195 LoadDigits(fChamber, 2);
1197 LoadDigits(fChamber, 1);
1199 fNextCathode = kTRUE; // to keep the same zoom
1201 fNextCathode = kFALSE;
1202 TPad *pad = (TPad*)gPad->GetPadSave();
1203 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1204 fZoomX1[fZooms], fZoomY1[fZooms]);
1210 //_____________________________________________________________________________
1211 void AliMUONDisplay::Trigger()
1213 // returns Trigger Decision for current event
1214 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1215 decision->Trigger();
1219 //_____________________________________________________________________________
1220 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1222 // Set chamber and cathode number
1228 LoadDigits(chamber,cathode);
1232 void AliMUONDisplay::SetEvent(Int_t newevent)
1235 gAlice->GetEvent(newevent);
1237 if (!gAlice->TreeD()) return;
1240 LoadDigits(fChamber,fCathode);
1244 //_____________________________________________________________________________
1245 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1247 // Set view range along R and Z
1256 //_____________________________________________________________________________
1257 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1259 // change viewing angles for current event
1267 TView *view = gPad->GetView();
1268 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1273 //_____________________________________________________________________________
1274 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1276 // Display (current event_number + delta)
1277 // delta = 1 shown next event
1278 // delta = -1 show previous event
1281 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1282 Int_t newEvent = currentEvent + delta;
1283 gAlice->GetEvent(newEvent);
1285 if (!gAlice->TreeD()) return;
1288 LoadDigits(fChamber, fCathode);
1293 //______________________________________________________________________________
1294 void AliMUONDisplay::UnZoom()
1297 if (fZooms <= 0) return;
1299 TPad *pad = (TPad*)gPad->GetPadSave();
1300 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1304 //_____________________________________________________________________________
1305 void AliMUONDisplay::ResetPoints()
1308 // Reset array of points
1316 //_____________________________________________________________________________
1317 void AliMUONDisplay::ResetPhits()
1320 // Reset array of points
1328 //_____________________________________________________________________________
1329 void AliMUONDisplay::ResetRpoints()
1332 // Reset array of points
1340 //_____________________________________________________________________________
1341 void AliMUONDisplay::ResetR2points()
1344 // Reset array of points
1347 fR2points->Delete();
1352 //_____________________________________________________________________________
1353 void AliMUONDisplay::ResetCpoints()
1356 // Reset array of points
1366 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1368 // Dummy assignment operator