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.6 2000/07/03 11:54:57 morsch
19 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
20 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
22 Revision 1.5 2000/06/28 15:16:35 morsch
23 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
24 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
25 framework. The changes should have no side effects (mostly dummy arguments).
26 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
27 of chambers with overlapping modules (MakePadHits, Disintegration).
29 Revision 1.4 2000/06/27 09:46:57 morsch
30 kMAXZOOM global constant now in AliMUONConstants
32 Revision 1.3 2000/06/26 14:02:38 morsch
33 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
35 Revision 1.2 2000/06/15 07:58:48 morsch
36 Code from MUON-dev joined
38 Revision 1.1.2.15 2000/06/14 14:37:53 morsch
39 method Trigger() modified
41 Revision 1.1.2.14 2000/06/09 21:57:09 morsch
42 Bug in color scale diplay corrected.
43 Most coding rule violations corrected.
45 Revision 1.1.2.13 2000/05/02 11:57:27 morsch
46 Coding rules RN3, RN13, RN17 violations corrected.
48 Revision 1.1.2.12 2000/04/26 12:27:33 morsch
49 Mods for trigger display (P. Crochet):
50 - color code versus time for pad hits in trigger chambers
51 - call to TriggerDecision corrected
53 Revision 1.1.2.11 2000/04/26 09:04:46 morsch
54 Obsolete cathode correlation related code removed.
56 Revision 1.1.2.10 2000/04/19 19:43:47 morsch
57 change NCH to kNCH as in AliMUON.h
58 no more TreeC related methods
60 Revision 1.1.2.9 2000/03/20 18:10:33 morsch
61 Trigger method for "online" trigger decission added
63 Revision 1.1.2.8 2000/02/23 10:12:01 morsch
64 Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
65 General clean-up of commented code.
67 Revision 1.1.2.7 2000/02/17 14:36:55 morsch
68 Display of Trigger hits and clusters added.
69 Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
71 Revision 1.1.2.6 2000/02/15 10:19:42 morsch
72 Previous log messages included
74 Revision 1.1.2.5 2000/02/15 10:09:09 morsch
77 Revision 1.1.2.4 2000/02/08 09:17:16 gosset
78 One more improvement of MUON display:
79 same zoom for both cathode planes in a chamber
81 Revision 1.1.2.3 2000/02/07 15:37:21 gosset
82 A few improvements of the MUON display:
83 new buttons to change either chamber or cathode,
84 added to the more complicated way
85 (right mouse click and explicit filling of chamber and cathode)
87 Revision 1.1.2.2 2000/02/04 10:57:34 gosset
88 Z position of the chambers:
89 it was the Z position of the stations;
90 it is now really the Z position of the chambers.
91 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
92 !!!! AND "AliMUONChamber::ZPosition"
93 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
94 !!!! AND "AliMUONChamber::Z"
97 //////////////////////////////////////////////////////////////////////////
101 // Utility class to display ALICE outline, tracks, hits,.. //
103 //////////////////////////////////////////////////////////////////////////
112 #include <TPolyMarker3D.h>
113 #include <TPaveLabel.h>
114 #include <TPaveText.h>
116 #include <TDiamond.h>
121 #include <TSliderBox.h>
123 #include <TVirtualX.h>
126 #include <TGeometry.h>
127 #include <X3DBuffer.h>
128 #include <TMarker3DBox.h>
131 #include "AliDetector.h"
133 #include "AliMUONDisplay.h"
134 #include "AliMUONPoints.h"
135 #include "TParticle.h"
136 #include "AliMUONTriggerDecision.h"
138 #include "AliMUONHit.h"
139 #include "AliMUONPadHit.h"
140 #include "AliMUONDigit.h"
141 #include "AliMUONRawCluster.h"
143 #include "AliSegmentation.h"
144 #include "AliMUONResponse.h"
145 #include "AliMUONChamber.h"
146 #include "AliMUONConstants.h"
147 // to manage the same zoom on both cathodes
151 ClassImp(AliMUONDisplay)
154 //_____________________________________________________________________________
155 AliMUONDisplay::AliMUONDisplay()
164 fNextCathode = kFALSE;
167 //_____________________________________________________________________________
168 AliMUONDisplay::AliMUONDisplay(Int_t size)
170 // Create an event display object.
171 // A canvas named "edisplay" is created with a vertical size in pixels
173 // A QUICK Overview of the Event Display functions
174 // ===============================================
176 // The event display can ve invoked by executing the macro "display.C"
177 // A canvas like in the picture below will appear.
179 // On the left side of the canvas, the following buttons appear:
180 // *Next* to move to the next event
181 // *Previous* to move to the previous event
183 // *Pick* Select this option to be able to point on a track with the
184 // mouse. Once on the track, use the right button to select
185 // an action. For example, select SetMarkerAttributes to
186 // change the marker type/color/size for the track.
187 // *Zoom* Select this option (default) if you want to zoom.
188 // To zoom, simply select the selected area with the left button.
189 // *UnZoom* To revert to the previous picture size.
191 // slider R On the left side, the vertical slider can be used to
192 // set the default picture size.
194 // When you are in Zoom mode, you can click on the black part of the canvas
195 // to select special options with the right mouse button.
198 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
199 // When you are on a track, select the menu item "InspectParticle"
200 // to display the current particle attributes.
202 // You can activate the Root browser by selecting the Inspect menu
203 // in the canvas tool bar menu. Then select "Start Browser"
204 // This will open a new canvas with the browser. At this point, you may want
205 // to display some histograms (from the Trees). Go to the "File" menu
206 // of the browser and click on "New canvas".
207 // In the browser, click on item "ROOT files" in the left pane.
208 // Click on galice.root.
210 // Click on TPC for example
211 // Click on any variable (eg TPC.fX) to histogram the variable.
213 // If you are lost, you can click on HELP in any Root canvas or browser.
216 <img src="gif/AliMUONDisplay.gif">
223 gAlice->SetDisplay(this);
225 // Initialize display default parameters
227 // Set front view by default
234 fDrawClusters = kTRUE;
247 // Create display canvas
249 if (ysize < 100) ysize = 750;
250 Int_t xsize = Int_t(size*830./ysize);
251 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
252 fCanvas->ToggleEventStatus();
254 // Create main display pad
255 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
258 fPad->SetFillColor(30);
259 fPad->SetBorderSize(2);
264 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
266 fColPad->SetFillColor(17);
267 fColPad->SetBorderSize(2);
272 // Create user interface control pad
276 // Create Range and mode pad
279 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
280 fTrigPad->SetEditable(kFALSE);
283 fTrigPad->SetFillColor(22);
284 fTrigPad->SetBorderSize(2);
285 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
286 fRangeSlider->SetObject(this);
287 char pickmode[] = "gAlice->Display()->SetPickMode()";
289 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
290 fPickButton->SetFillColor(38);
292 char zoommode[] = "gAlice->Display()->SetZoomMode()";
293 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
294 fZoomButton->SetFillColor(38);
296 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
297 fArcButton->SetFillColor(kGreen);
299 char butUnzoom[] = "gAlice->Display()->UnZoom()";
300 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
301 button->SetFillColor(38);
303 AppendPad(); // append display object as last object to force selection
307 fNextCathode = kFALSE;
310 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
312 // Dummy copy constructor
318 //_____________________________________________________________________________
319 AliMUONDisplay::~AliMUONDisplay()
321 // Delete space point structure
322 if (fPoints) fPoints->Delete();
326 if (fPhits) fPhits->Delete();
330 if (fRpoints) fRpoints->Delete();
334 if (fR2points) fR2points->Delete();
338 if (fCpoints) fCpoints->Delete();
343 //_____________________________________________________________________________
344 void AliMUONDisplay::Clear(Option_t *)
346 // Delete graphics temporary objects
349 //_____________________________________________________________________________
350 void AliMUONDisplay::DisplayButtons()
352 // Create the user interface buttons
355 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
356 fButtons->SetEditable(kFALSE);
358 fButtons->SetFillColor(38);
359 fButtons->SetBorderSize(2);
362 // Int_t butcolor = 33;
363 Float_t dbutton = 0.08;
370 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
371 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
372 button->SetFillColor(38);
376 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
377 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
378 button->SetFillColor(38);
382 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
383 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
384 button->SetFillColor(38);
388 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
389 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
390 button->SetFillColor(38);
394 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
395 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
396 button->SetFillColor(38);
400 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
401 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
402 button->SetFillColor(38);
406 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
407 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
408 button->SetFillColor(38);
412 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
413 diamond->SetFillColor(50);
414 diamond->SetTextAlign(22);
415 diamond->SetTextColor(5);
416 diamond->SetTextSize(0.11);
418 diamond->AddText(".. ");
419 diamond->AddText("ROOT");
420 diamond->AddText("MUON");
421 diamond->AddText("... ");
422 diamond->AddText(" ");
425 //_____________________________________________________________________________
426 void AliMUONDisplay::CreateColors()
428 // Create the colors palette used to display clusters
443 new TColor(color,r,g,b);
453 new TColor(color,r,g,b);
463 new TColor(color,r,g,b);
473 new TColor(color,r,g,b);
483 new TColor(color,r,g,b);
490 //_____________________________________________________________________________
491 void AliMUONDisplay::DisplayColorScale()
493 // Display pulse height color scale
496 Float_t xlow, ylow, xup, yup, hs;
497 Float_t x1, y1, x2, y2;
501 TText *text = new TText(0,0,"");
502 text->SetTextFont(61);
503 text->SetTextSize(0.2);
504 text->SetTextAlign(22);
506 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
507 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
508 AliMUONResponse * response=iChamber->ResponseModel();
510 if (response) adcmax= (Int_t) response->MaxAdc();
515 //*-* draw colortable boxes
516 hs = (y2-y1)/Float_t(22);
520 ylow = y1 + hs*(Float_t(i));
521 yup = y1 + hs*(Float_t(i+1));
523 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
524 Int_t scale=(Int_t)TMath::Exp(logscale);
525 sprintf(label,"%d",scale);
526 box = new TBox(xlow, ylow, xup, yup);
528 box->SetFillColor(color);
529 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
533 //______________________________________________________________________________
534 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
536 // Compute distance from point px,py to objects in event
538 gPad->SetCursor(kCross);
540 if (gPad == fTrigPad) return 9999;
542 const Int_t kBig = 9999;
544 Float_t xmin = gPad->GetX1();
545 Float_t xmax = gPad->GetX2();
546 Float_t dx = 0.02*(xmax - xmin);
547 Float_t x = gPad->AbsPixeltoX(px);
548 if (x < xmin+dx || x > xmax-dx) return dist;
550 if (fZoomMode) return 0;
554 //_____________________________________________________________________________
555 void AliMUONDisplay::Draw(Option_t *)
557 // Display current event
561 DrawView(fTheta, fPhi, fPsi);
562 // Display the event number and title
567 void AliMUONDisplay::DrawSegmentation()
569 // Draw graphical representation of segmenatation
570 // Attention: still experimental code
573 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
574 AliMUONChamber* iChamber;
575 AliSegmentation* seg;
576 iChamber = &(pMUON->Chamber(fChamber));
577 seg=iChamber->SegmentationModel(icat);
578 Float_t zpos=iChamber->Z();
579 Float_t r=iChamber->ROuter();
581 TMarker3DBox *marker;
583 for (Int_t j=0; j<seg->Npy(); j++) {
585 y0=j*seg->Dpy()-seg->Dpy()/2.;
586 for (seg->FirstPad(0.,y0,0,300,0.);
590 if (seg->ISector()==0) continue;
592 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
593 Float_t dpx=seg->Dpx(seg->ISector())/2;
594 Float_t dpy=seg->Dpy(seg->ISector())/2;
595 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
596 marker->SetLineColor(seg->ISector()+1);
597 marker->SetFillStyle(1001);
598 marker->SetFillColor(0);
603 for (Int_t j=0; j<250; j++) {
604 Float_t x0=j*seg->Dpx();
605 Float_t y0=TMath::Sqrt(r*r-x0*x0);
607 for (seg->FirstPad(x0,0,0,0,y0);
611 if (seg->ISector()==0) continue;
614 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
615 Float_t dpx=seg->Dpx(seg->ISector())/2;
616 Float_t dpy=seg->Dpy(seg->ISector())/2;
617 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
618 marker->SetLineColor(seg->ISector()+1);
619 marker->SetFillStyle(1001);
620 marker->SetFillColor(0);
627 //_____________________________________________________________________________
628 void AliMUONDisplay::DrawClusters()
630 // Draw clusters for MUON chambers
632 Int_t ndigits, digit;
640 ndigits = points->GetEntriesFast();
641 for (digit=0;digit<ndigits;digit++){
642 pm = (AliMUONPoints*)points->UncheckedAt(digit);
646 for (Int_t im=0;im<3;im++) {
647 TMarker3DBox *marker=pm->GetMarker(im);
652 fClustersCuts +=pm->GetN();
656 //_____________________________________________________________________________
657 void AliMUONDisplay::DrawHits()
659 // Draw hits for MUON chambers
663 Int_t ntracks, track;
670 ntracks = points->GetEntriesFast();
671 for (track=0;track<ntracks;track++) {
672 pm = (AliMUONPoints*)points->UncheckedAt(track);
675 fHitsCuts += pm->GetN();
680 //_____________________________________________________________________________
681 void AliMUONDisplay::DrawCoG()
683 // Draw hits for MUON chambers
684 if (!fDrawCoG) return;
685 if (fChamber > 10) return;
686 LoadCoG(fChamber,fCathode);
694 ncog = points->GetEntriesFast();
695 for (icog=0;icog<ncog;icog++) {
696 pm = (AliMUONPoints*)points->UncheckedAt(icog);
701 void AliMUONDisplay::DrawCoG2()
703 // Draw hits for MUON chambers
705 if (!fDrawCoG) return;
706 if (fChamber > 10) return;
709 LoadCoG2(fChamber,2);
710 } else if (fCathode==2) {
711 LoadCoG2(fChamber,1);
720 ncog = points->GetEntriesFast();
721 for (icog=0;icog<ncog;icog++) {
722 pm = (AliMUONPoints*)points->UncheckedAt(icog);
727 //_____________________________________________________________________________
729 void AliMUONDisplay::DrawTitle(Option_t *option)
731 // Draw the event title
733 Float_t xmin = gPad->GetX1();
734 Float_t xmax = gPad->GetX2();
735 Float_t ymin = gPad->GetY1();
736 Float_t ymax = gPad->GetY2();
737 Float_t dx = xmax-xmin;
738 Float_t dy = ymax-ymin;
740 if (strlen(option) == 0) {
741 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
742 // title->SetTextSize(0.023932);
743 title->SetTextSize(0.02);
744 title->SetBit(kCanDelete);
745 title->SetFillColor(42);
748 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
749 gAlice->GetHeader()->GetEvent(),
750 gAlice->GetHeader()->GetRun(),
753 title->AddText(ptitle);
754 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
755 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
756 nparticles, fHitsCuts,fClustersCuts);
757 title->AddText(ptitle);
759 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
760 label->SetBit(kCanDelete);
761 label->SetFillColor(42);
766 //_____________________________________________________________________________
767 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
769 // Draw a view of MUON clusters
770 printf("\n Draw View");
772 gPad->SetCursor(kWatch);
773 // gPad->SetFillColor(39);
774 gPad->SetFillColor(1);
776 // gPad->SetFillColor(39);
777 gPad->SetFillColor(1);
781 TView *view = new TView(1);
783 Float_t range = fRrange*fRangeSlider->GetMaximum();
784 view->SetRange(-range,-range,-range,range, range, range);
785 // zoom back to full scale only if DrawView not called from NextCathode
794 // Display MUON Chamber Geometry
795 // gAlice->GetGeometry()->Draw("same");
797 sprintf(nodeName,"MUON%d",100+fChamber);
798 printf("\n Node name %s", nodeName);
800 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
801 if (node1) node1->Draw("same");
802 //add clusters to the pad
804 printf("Node name %s", nodeName);
808 // DrawSegmentation();
809 // add itself to the list (must be last)
811 view->SetView(phi, theta, psi, iret);
815 //______________________________________________________________________________
816 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
818 // Execute action corresponding to the mouse event
820 static Float_t x0, y0, x1, y1;
822 static Int_t pxold, pyold;
823 static Int_t px0, py0;
824 static Int_t linedrawn;
827 if (px == 0 && py == 0) { //when called by sliders
828 if (event == kButton1Up) {
833 if (!fZoomMode && gPad->GetView()) {
834 gPad->GetView()->ExecuteRotateView(event, px, py);
838 // something to zoom ?
839 gPad->SetCursor(kCross);
844 gVirtualX->SetLineColor(-1);
845 gPad->TAttLine::Modify(); //Change line attributes only if necessary
846 x0 = gPad->AbsPixeltoX(px);
847 y0 = gPad->AbsPixeltoY(py);
849 pxold = px; pyold = py;
854 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
858 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
862 gPad->GetCanvas()->FeedbackMode(kFALSE);
863 if (px == px0) return;
864 if (py == py0) return;
865 x1 = gPad->AbsPixeltoX(px);
866 y1 = gPad->AbsPixeltoY(py);
868 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
869 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
870 gPad->Range(x0,y0,x1,y1);
871 if (fZooms < AliMUONConstants::MaxZoom()-1) {
873 fZoomX0[fZooms] = x0;
874 fZoomY0[fZooms] = y0;
875 fZoomX1[fZooms] = x1;
876 fZoomY1[fZooms] = y1;
878 gPad->Modified(kTRUE);
883 //___________________________________________
884 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
886 // Read digits info and store x,y,z info in arrays fPoints
887 // Loop on all detectors
889 if (chamber > 14) return;
890 printf(" chamber %d \n",chamber);
896 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
897 AliMUONChamber* iChamber;
898 AliSegmentation* segmentation;
899 AliMUONResponse* response;
901 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
902 if (muonDigits == 0) return;
904 gAlice->ResetDigits();
906 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
907 gAlice->TreeD()->GetEvent(nent-2+cathode-1);
908 Int_t ndigits = muonDigits->GetEntriesFast();
909 if (ndigits == 0) return;
910 if (fPoints == 0) fPoints = new TObjArray(ndigits);
912 iChamber = &(pMUON->Chamber(chamber-1));
914 segmentation = iChamber->SegmentationModel(cathode);
915 response = iChamber->ResponseModel();
916 Float_t zpos=iChamber->Z();
918 AliMUONPoints *points = 0;
919 TMarker3DBox *marker=0;
921 //loop over all digits and store their position
925 if (response) adcmax= response->MaxAdc();
927 for (Int_t digit=0;digit<ndigits;digit++) {
928 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
930 // First get all needed parameters
932 Int_t charge=mdig->fSignal;
933 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
934 Int_t color=261+index;
935 Int_t colorTrigger=2;
936 if (color>282) color=282;
938 if (chamber > 10) { // trigger chamber
940 for (Int_t icharge=0; icharge<10; icharge++) {
941 sumCharge=sumCharge+mdig->fTcharges[icharge];
943 Int_t testCharge=sumCharge-(Int_t(sumCharge/10))*10;
944 if(sumCharge<=10||testCharge>0) {
951 // get the center of the pad - add on x and y half of pad size
952 Float_t xpad, ypad, zpad;
953 segmentation->GetPadC(mdig->fPadX, mdig->fPadY,xpad, ypad, zpad);
955 Int_t isec=segmentation->Sector(mdig->fPadX, mdig->fPadY);
956 Float_t dpx=segmentation->Dpx(isec)/2;
957 Float_t dpy=segmentation->Dpy(isec)/2;
959 segmentation->GetNParallelAndOffset(mdig->fPadX,mdig->fPadY,
962 // Then set the objects
964 points = new AliMUONPoints(npoints);
965 fPoints->AddAt(points,digit);
967 points->SetMarkerColor(colorTrigger);
969 points->SetMarkerColor(color);
971 points->SetMarkerStyle(21);
972 points->SetMarkerSize(0.5);
973 points->SetParticle(-1);
974 points->SetHitIndex(-1);
975 points->SetTrackIndex(-1);
976 points->SetDigitIndex(digit);
977 points->SetPoint(0,xpad,ypad,zpos);
978 for (Int_t imark=0;imark<nPara; imark++)
980 segmentation->GetPadC(mdig->fPadX + imark*offset, mdig->fPadY,xpad, ypad, zpad);
981 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
982 marker->SetLineColor(2);
983 marker->SetFillStyle(1001);
984 marker->SetFillColor(color);
985 marker->SetRefObject((TObject*)points);
986 points->Set3DMarker(imark, marker);
990 //___________________________________________
991 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
993 // Read raw clusters info and store x,y,z info in arrays fRpoints
994 // Loop on all detectors
996 if (chamber > 10) return;
1000 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1001 AliMUONChamber* iChamber;
1003 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1004 if (muonRawClusters == 0) return;
1006 pMUON->ResetRawClusters();
1009 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
1010 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
1011 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1012 if (nrawcl == 0) return;
1013 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
1015 iChamber = &(pMUON->Chamber(chamber-1));
1016 Float_t zpos=iChamber->Z();
1017 AliMUONRawCluster *mRaw;
1018 AliMUONPoints *points = 0;
1020 //loop over all raw clusters and store their position
1021 points = new AliMUONPoints(nrawcl);
1022 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1023 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1024 fRpoints->AddAt(points,iraw);
1025 points->SetMarkerColor(51);
1026 points->SetMarkerStyle(2);
1027 points->SetMarkerSize(1.);
1028 points->SetParticle(-1);
1029 points->SetHitIndex(-1);
1030 points->SetTrackIndex(-1);
1031 points->SetDigitIndex(-1);
1032 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1035 //___________________________________________
1036 void AliMUONDisplay::LoadCoG2(Int_t chamber, Int_t cathode)
1038 // Read raw clusters info and store x,y,z info in arrays fRpoints
1039 // Loop on all detectors
1041 if (chamber > 10) return;
1045 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1046 AliMUONChamber* iChamber;
1048 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1049 if (muonRawClusters == 0) return;
1051 pMUON->ResetRawClusters();
1053 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
1054 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
1055 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1056 if (nrawcl == 0) return;
1057 if (fR2points == 0) fR2points = new TObjArray(nrawcl);
1059 iChamber = &(pMUON->Chamber(chamber-1));
1060 Float_t zpos=iChamber->Z();
1061 AliMUONRawCluster *mRaw;
1062 AliMUONPoints *points = 0;
1064 //loop over all raw clusters and store their position
1065 points = new AliMUONPoints(nrawcl);
1066 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1067 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1068 fR2points->AddAt(points,iraw);
1069 points->SetMarkerColor(51);
1070 points->SetMarkerStyle(4);
1071 points->SetMarkerSize(1.3);
1072 points->SetParticle(-1);
1073 points->SetHitIndex(-1);
1074 points->SetTrackIndex(-1);
1075 points->SetDigitIndex(-1);
1076 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1079 //___________________________________________
1080 void AliMUONDisplay::LoadHits(Int_t chamber)
1082 // Read hits info and store x,y,z info in arrays fPhits
1083 // Loop on all detectors
1085 if (chamber > 14) return;
1092 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1093 AliMUONChamber* iChamber;
1095 iChamber = &(pMUON->Chamber(chamber-1));
1096 Float_t zpos=iChamber->Z();
1098 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1100 for (track=0; track<ntracks;track++) {
1101 gAlice->ResetHits();
1102 gAlice->TreeH()->GetEvent(track);
1103 TClonesArray *muonHits = pMUON->Hits();
1104 if (muonHits == 0) return;
1105 nthits += muonHits->GetEntriesFast();
1107 if (fPhits == 0) fPhits = new TObjArray(nthits);
1109 for (track=0; track<ntracks;track++) {
1110 gAlice->ResetHits();
1111 gAlice->TreeH()->GetEvent(track);
1112 TClonesArray *muonHits = pMUON->Hits();
1113 if (muonHits == 0) return;
1114 Int_t nhits = muonHits->GetEntriesFast();
1115 if (nhits == 0) continue;
1117 AliMUONPoints *points = 0;
1119 for (Int_t hit=0;hit<nhits;hit++) {
1120 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1121 Int_t nch = mHit->fChamber; // chamber number
1122 if (nch != chamber) continue;
1124 // Retrieve info and set the objects
1126 points = new AliMUONPoints(npoints);
1127 fPhits->AddAt(points,nhold+hit);
1128 points->SetMarkerColor(kRed);
1129 points->SetMarkerStyle(5);
1130 points->SetMarkerSize(1.);
1131 points->SetParticle(mHit->Track());
1132 points->SetHitIndex(hit);
1133 points->SetTrackIndex(track);
1134 points->SetDigitIndex(-1);
1135 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
1141 //_____________________________________________________________________________
1142 void AliMUONDisplay::Paint(Option_t *)
1144 // Paint miscellaneous items
1147 //_____________________________________________________________________________
1148 void AliMUONDisplay::SetPickMode()
1150 // Set parameters for pick mode.
1154 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1155 fTrigPad->Modified();
1158 //_____________________________________________________________________________
1159 void AliMUONDisplay::SetZoomMode()
1161 // Set parameters for zoom mode
1164 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1165 fTrigPad->Modified();
1168 //_____________________________________________________________________________
1169 void AliMUONDisplay::NextChamber(Int_t delta)
1171 // to go from chamber to next chamber if delta = 1
1172 // or previous chamber otherwise
1174 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1176 if (fChamber > 1) fChamber--;
1180 LoadDigits(fChamber, fCathode);
1184 //_____________________________________________________________________________
1185 void AliMUONDisplay::NextCathode()
1187 // to switch to other cathode plane
1190 if (fCathode == 1) {
1191 LoadDigits(fChamber, 2);
1193 LoadDigits(fChamber, 1);
1195 fNextCathode = kTRUE; // to keep the same zoom
1197 fNextCathode = kFALSE;
1198 TPad *pad = (TPad*)gPad->GetPadSave();
1199 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1200 fZoomX1[fZooms], fZoomY1[fZooms]);
1206 //_____________________________________________________________________________
1207 void AliMUONDisplay::Trigger()
1209 // returns Trigger Decision for current event
1210 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1211 decision->Trigger();
1215 //_____________________________________________________________________________
1216 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1218 // Set chamber and cathode number
1224 LoadDigits(chamber,cathode);
1228 void AliMUONDisplay::SetEvent(Int_t newevent)
1231 gAlice->GetEvent(newevent);
1233 if (!gAlice->TreeD()) return;
1236 LoadDigits(fChamber,fCathode);
1240 //_____________________________________________________________________________
1241 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1243 // Set view range along R and Z
1252 //_____________________________________________________________________________
1253 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1255 // change viewing angles for current event
1263 TView *view = gPad->GetView();
1264 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1269 //_____________________________________________________________________________
1270 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1272 // Display (current event_number + delta)
1273 // delta = 1 shown next event
1274 // delta = -1 show previous event
1277 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1278 Int_t newEvent = currentEvent + delta;
1279 gAlice->GetEvent(newEvent);
1281 if (!gAlice->TreeD()) return;
1284 LoadDigits(fChamber, fCathode);
1289 //______________________________________________________________________________
1290 void AliMUONDisplay::UnZoom()
1293 if (fZooms <= 0) return;
1295 TPad *pad = (TPad*)gPad->GetPadSave();
1296 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1300 //_____________________________________________________________________________
1301 void AliMUONDisplay::ResetPoints()
1304 // Reset array of points
1312 //_____________________________________________________________________________
1313 void AliMUONDisplay::ResetPhits()
1316 // Reset array of points
1324 //_____________________________________________________________________________
1325 void AliMUONDisplay::ResetRpoints()
1328 // Reset array of points
1336 //_____________________________________________________________________________
1337 void AliMUONDisplay::ResetR2points()
1340 // Reset array of points
1343 fR2points->Delete();
1348 //_____________________________________________________________________________
1349 void AliMUONDisplay::ResetCpoints()
1352 // Reset array of points
1362 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1364 // Dummy assignment operator