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.16 2001/08/31 08:18:43 jchudoba
19 Changes needed to run with Root 3.01
21 Revision 1.15 2001/05/16 14:57:17 alibrary
22 New files for folders and Stack
24 Revision 1.14 2001/04/05 08:30:48 gosset
25 Cleaning: suppression of Cpoints and (R2points + CoG2)
26 Correction: TreeR->GetEvent(0) for raw clusters
28 Revision 1.13 2001/03/30 13:01:50 gosset
29 Centroid of raw clusters displayed for each cathode plane
31 Revision 1.12 2001/03/05 23:50:08 morsch
32 Correct access to digit and recpoint data.
34 Revision 1.11 2001/01/26 21:41:55 morsch
35 Use access functions to AliMUONDigit member data.
37 Revision 1.10 2001/01/25 20:41:56 morsch
38 Protect against empty TreeD and TreeR.
40 Revision 1.9 2001/01/23 18:58:19 hristov
41 Initialisation of some pointers
43 Revision 1.8 2000/10/06 09:09:01 morsch
44 Pad colour according to z-position (slats).
46 Revision 1.7 2000/10/02 21:28:09 fca
47 Removal of useless dependecies via forward declarations
49 Revision 1.6 2000/07/03 11:54:57 morsch
50 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
51 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
53 Revision 1.5 2000/06/28 15:16:35 morsch
54 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
55 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
56 framework. The changes should have no side effects (mostly dummy arguments).
57 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
58 of chambers with overlapping modules (MakePadHits, Disintegration).
60 Revision 1.4 2000/06/27 09:46:57 morsch
61 kMAXZOOM global constant now in AliMUONConstants
63 Revision 1.3 2000/06/26 14:02:38 morsch
64 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
66 Revision 1.2 2000/06/15 07:58:48 morsch
67 Code from MUON-dev joined
69 Revision 1.1.2.15 2000/06/14 14:37:53 morsch
70 method Trigger() modified
72 Revision 1.1.2.14 2000/06/09 21:57:09 morsch
73 Bug in color scale diplay corrected.
74 Most coding rule violations corrected.
76 Revision 1.1.2.13 2000/05/02 11:57:27 morsch
77 Coding rules RN3, RN13, RN17 violations corrected.
79 Revision 1.1.2.12 2000/04/26 12:27:33 morsch
80 Mods for trigger display (P. Crochet):
81 - color code versus time for pad hits in trigger chambers
82 - call to TriggerDecision corrected
84 Revision 1.1.2.11 2000/04/26 09:04:46 morsch
85 Obsolete cathode correlation related code removed.
87 Revision 1.1.2.10 2000/04/19 19:43:47 morsch
88 change NCH to kNCH as in AliMUON.h
89 no more TreeC related methods
91 Revision 1.1.2.9 2000/03/20 18:10:33 morsch
92 Trigger method for "online" trigger decission added
94 Revision 1.1.2.8 2000/02/23 10:12:01 morsch
95 Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
96 General clean-up of commented code.
98 Revision 1.1.2.7 2000/02/17 14:36:55 morsch
99 Display of Trigger hits and clusters added.
100 Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
102 Revision 1.1.2.6 2000/02/15 10:19:42 morsch
103 Previous log messages included
105 Revision 1.1.2.5 2000/02/15 10:09:09 morsch
108 Revision 1.1.2.4 2000/02/08 09:17:16 gosset
109 One more improvement of MUON display:
110 same zoom for both cathode planes in a chamber
112 Revision 1.1.2.3 2000/02/07 15:37:21 gosset
113 A few improvements of the MUON display:
114 new buttons to change either chamber or cathode,
115 added to the more complicated way
116 (right mouse click and explicit filling of chamber and cathode)
118 Revision 1.1.2.2 2000/02/04 10:57:34 gosset
119 Z position of the chambers:
120 it was the Z position of the stations;
121 it is now really the Z position of the chambers.
122 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
123 !!!! AND "AliMUONChamber::ZPosition"
124 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
125 !!!! AND "AliMUONChamber::Z"
128 //////////////////////////////////////////////////////////////////////////
132 // Utility class to display ALICE outline, tracks, hits,.. //
134 //////////////////////////////////////////////////////////////////////////
143 #include <TPolyMarker3D.h>
144 #include <TPaveLabel.h>
145 #include <TPaveText.h>
147 #include <TDiamond.h>
152 #include <TSliderBox.h>
154 #include <TVirtualX.h>
157 #include <TGeometry.h>
158 #include <X3DBuffer.h>
159 #include <TMarker3DBox.h>
162 #include "AliDetector.h"
164 #include "AliMUONDisplay.h"
165 #include "AliMUONPoints.h"
166 #include "TParticle.h"
167 #include "AliMUONTriggerDecision.h"
168 #include "AliHeader.h"
170 #include "AliMUONHit.h"
171 #include "AliMUONPadHit.h"
172 #include "AliMUONDigit.h"
173 #include "AliMUONRawCluster.h"
175 #include "AliSegmentation.h"
176 #include "AliMUONResponse.h"
177 #include "AliMUONChamber.h"
178 #include "AliMUONConstants.h"
179 // to manage the same zoom on both cathodes
183 ClassImp(AliMUONDisplay)
186 //_____________________________________________________________________________
187 AliMUONDisplay::AliMUONDisplay()
194 fNextCathode = kFALSE;
198 //_____________________________________________________________________________
199 AliMUONDisplay::AliMUONDisplay(Int_t size)
201 // Create an event display object.
202 // A canvas named "edisplay" is created with a vertical size in pixels
204 // A QUICK Overview of the Event Display functions
205 // ===============================================
207 // The event display can ve invoked by executing the macro "display.C"
208 // A canvas like in the picture below will appear.
210 // On the left side of the canvas, the following buttons appear:
211 // *Next* to move to the next event
212 // *Previous* to move to the previous event
214 // *Pick* Select this option to be able to point on a track with the
215 // mouse. Once on the track, use the right button to select
216 // an action. For example, select SetMarkerAttributes to
217 // change the marker type/color/size for the track.
218 // *Zoom* Select this option (default) if you want to zoom.
219 // To zoom, simply select the selected area with the left button.
220 // *UnZoom* To revert to the previous picture size.
222 // slider R On the left side, the vertical slider can be used to
223 // set the default picture size.
225 // When you are in Zoom mode, you can click on the black part of the canvas
226 // to select special options with the right mouse button.
229 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
230 // When you are on a track, select the menu item "InspectParticle"
231 // to display the current particle attributes.
233 // You can activate the Root browser by selecting the Inspect menu
234 // in the canvas tool bar menu. Then select "Start Browser"
235 // This will open a new canvas with the browser. At this point, you may want
236 // to display some histograms (from the Trees). Go to the "File" menu
237 // of the browser and click on "New canvas".
238 // In the browser, click on item "ROOT files" in the left pane.
239 // Click on galice.root.
241 // Click on TPC for example
242 // Click on any variable (eg TPC.fX) to histogram the variable.
244 // If you are lost, you can click on HELP in any Root canvas or browser.
247 <img src="gif/AliMUONDisplay.gif">
254 gAlice->SetDisplay(this);
256 // Initialize display default parameters
258 // Set front view by default
265 fDrawClusters = kTRUE;
275 // Create display canvas
277 if (ysize < 100) ysize = 750;
278 Int_t xsize = Int_t(size*830./ysize);
279 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
280 fCanvas->ToggleEventStatus();
282 // Create main display pad
283 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
286 fPad->SetFillColor(30);
287 fPad->SetBorderSize(2);
292 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
294 fColPad->SetFillColor(17);
295 fColPad->SetBorderSize(2);
300 // Create user interface control pad
304 // Create Range and mode pad
307 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
310 fTrigPad->SetFillColor(22);
311 fTrigPad->SetBorderSize(2);
312 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
313 fRangeSlider->SetObject(this);
314 char pickmode[] = "gAlice->Display()->SetPickMode()";
316 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
317 fPickButton->SetFillColor(38);
319 char zoommode[] = "gAlice->Display()->SetZoomMode()";
320 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
321 fZoomButton->SetFillColor(38);
323 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
324 fArcButton->SetFillColor(kGreen);
326 char butUnzoom[] = "gAlice->Display()->UnZoom()";
327 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
328 button->SetFillColor(38);
330 AppendPad(); // append display object as last object to force selection
333 fTrigPad->SetEditable(kFALSE);
334 fButtons->SetEditable(kFALSE);
336 fNextCathode = kFALSE;
339 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
341 // Dummy copy constructor
347 //_____________________________________________________________________________
348 AliMUONDisplay::~AliMUONDisplay()
350 // Delete space point structure
351 if (fPoints) fPoints->Delete();
355 if (fPhits) fPhits->Delete();
359 if (fRpoints) fRpoints->Delete();
364 //_____________________________________________________________________________
365 void AliMUONDisplay::Clear(Option_t *)
367 // Delete graphics temporary objects
370 //_____________________________________________________________________________
371 void AliMUONDisplay::DisplayButtons()
373 // Create the user interface buttons
376 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
378 fButtons->SetFillColor(38);
379 fButtons->SetBorderSize(2);
382 // Int_t butcolor = 33;
383 Float_t dbutton = 0.08;
390 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
391 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
392 button->SetFillColor(38);
396 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
397 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
398 button->SetFillColor(38);
402 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
403 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
404 button->SetFillColor(38);
408 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
409 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
410 button->SetFillColor(38);
414 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
415 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
416 button->SetFillColor(38);
420 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
421 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
422 button->SetFillColor(38);
426 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
427 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
428 button->SetFillColor(38);
432 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
433 diamond->SetFillColor(50);
434 diamond->SetTextAlign(22);
435 diamond->SetTextColor(5);
436 diamond->SetTextSize(0.11);
438 diamond->AddText(".. ");
439 diamond->AddText("ROOT");
440 diamond->AddText("MUON");
441 diamond->AddText("... ");
442 diamond->AddText(" ");
445 //_____________________________________________________________________________
446 void AliMUONDisplay::CreateColors()
448 // Create the colors palette used to display clusters
463 new TColor(color,r,g,b);
473 new TColor(color,r,g,b);
483 new TColor(color,r,g,b);
493 new TColor(color,r,g,b);
503 new TColor(color,r,g,b);
510 //_____________________________________________________________________________
511 void AliMUONDisplay::DisplayColorScale()
513 // Display pulse height color scale
516 Float_t xlow, ylow, xup, yup, hs;
517 Float_t x1, y1, x2, y2;
521 TText *text = new TText(0,0,"");
522 text->SetTextFont(61);
523 text->SetTextSize(0.2);
524 text->SetTextAlign(22);
526 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
527 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
528 AliMUONResponse * response=iChamber->ResponseModel();
530 if (response) adcmax = (Int_t) response->MaxAdc();
535 //*-* draw colortable boxes
536 hs = (y2-y1)/Float_t(22);
540 ylow = y1 + hs*(Float_t(i));
541 yup = y1 + hs*(Float_t(i+1));
543 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
544 Int_t scale=(Int_t)TMath::Exp(logscale);
545 sprintf(label,"%d",scale);
546 box = new TBox(xlow, ylow, xup, yup);
548 box->SetFillColor(color);
549 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
553 //______________________________________________________________________________
554 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
556 // Compute distance from point px,py to objects in event
558 gPad->SetCursor(kCross);
560 if (gPad == fTrigPad) return 9999;
562 const Int_t kBig = 9999;
564 Float_t xmin = gPad->GetX1();
565 Float_t xmax = gPad->GetX2();
566 Float_t dx = 0.02*(xmax - xmin);
567 Float_t x = gPad->AbsPixeltoX(px);
568 if (x < xmin+dx || x > xmax-dx) return dist;
570 if (fZoomMode) return 0;
574 //_____________________________________________________________________________
575 void AliMUONDisplay::Draw(Option_t *)
577 // Display current event
581 DrawView(fTheta, fPhi, fPsi);
582 // Display the event number and title
587 void AliMUONDisplay::DrawSegmentation()
589 // Draw graphical representation of segmenatation
590 // Attention: still experimental code
593 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
594 AliMUONChamber* iChamber;
595 AliSegmentation* seg;
596 iChamber = &(pMUON->Chamber(fChamber));
597 seg=iChamber->SegmentationModel(icat);
598 Float_t zpos=iChamber->Z();
599 Float_t r=iChamber->ROuter();
601 TMarker3DBox *marker;
603 for (Int_t j=0; j<seg->Npy(); j++) {
605 y0=j*seg->Dpy()-seg->Dpy()/2.;
606 for (seg->FirstPad(0.,y0,0,300,0.);
610 if (seg->ISector()==0) continue;
612 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
613 Float_t dpx=seg->Dpx(seg->ISector())/2;
614 Float_t dpy=seg->Dpy(seg->ISector())/2;
615 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
616 marker->SetLineColor(seg->ISector()+1);
617 marker->SetFillStyle(1001);
618 marker->SetFillColor(0);
623 for (Int_t j=0; j<250; j++) {
624 Float_t x0=j*seg->Dpx();
625 Float_t y0=TMath::Sqrt(r*r-x0*x0);
627 for (seg->FirstPad(x0,0,0,0,y0);
631 if (seg->ISector()==0) continue;
634 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
635 Float_t dpx=seg->Dpx(seg->ISector())/2;
636 Float_t dpy=seg->Dpy(seg->ISector())/2;
637 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
638 marker->SetLineColor(seg->ISector()+1);
639 marker->SetFillStyle(1001);
640 marker->SetFillColor(0);
647 //_____________________________________________________________________________
648 void AliMUONDisplay::DrawClusters()
650 // Draw clusters for MUON chambers
652 Int_t ndigits, digit;
660 ndigits = points->GetEntriesFast();
661 for (digit=0;digit<ndigits;digit++){
662 pm = (AliMUONPoints*)points->UncheckedAt(digit);
666 for (Int_t im=0;im<3;im++) {
667 TMarker3DBox *marker=pm->GetMarker(im);
672 fClustersCuts +=pm->GetN();
676 //_____________________________________________________________________________
677 void AliMUONDisplay::DrawHits()
679 // Draw hits for MUON chambers
683 Int_t ntracks, track;
690 ntracks = points->GetEntriesFast();
691 for (track=0;track<ntracks;track++) {
692 pm = (AliMUONPoints*)points->UncheckedAt(track);
695 fHitsCuts += pm->GetN();
700 //_____________________________________________________________________________
701 void AliMUONDisplay::DrawCoG()
703 // Draw hits for MUON chambers
704 if (!fDrawCoG) return;
705 if (fChamber > 10) return;
706 LoadCoG(fChamber,fCathode);
714 ncog = points->GetEntriesFast();
715 for (icog=0;icog<ncog;icog++) {
716 pm = (AliMUONPoints*)points->UncheckedAt(icog);
721 //_____________________________________________________________________________
723 void AliMUONDisplay::DrawTitle(Option_t *option)
725 // Draw the event title
727 Float_t xmin = gPad->GetX1();
728 Float_t xmax = gPad->GetX2();
729 Float_t ymin = gPad->GetY1();
730 Float_t ymax = gPad->GetY2();
731 Float_t dx = xmax-xmin;
732 Float_t dy = ymax-ymin;
734 if (strlen(option) == 0) {
735 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
736 // title->SetTextSize(0.023932);
737 title->SetTextSize(0.02);
738 title->SetBit(kCanDelete);
739 title->SetFillColor(42);
742 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
743 gAlice->GetHeader()->GetEvent(),
744 gAlice->GetHeader()->GetRun(),
747 title->AddText(ptitle);
748 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
749 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
750 nparticles, fHitsCuts,fClustersCuts);
751 title->AddText(ptitle);
753 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
754 label->SetBit(kCanDelete);
755 label->SetFillColor(42);
760 //_____________________________________________________________________________
761 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
763 // Draw a view of MUON clusters
764 printf("\n Draw View");
766 gPad->SetCursor(kWatch);
767 // gPad->SetFillColor(39);
768 gPad->SetFillColor(1);
770 // gPad->SetFillColor(39);
771 gPad->SetFillColor(1);
775 TView *view = new TView(1);
777 Float_t range = fRrange*fRangeSlider->GetMaximum();
778 view->SetRange(-range,-range,-range,range, range, range);
779 // zoom back to full scale only if DrawView not called from NextCathode
788 // Display MUON Chamber Geometry
790 sprintf(nodeName,"MUON%d",100+fChamber);
792 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
793 if (node1) node1->Draw("same");
794 //add clusters to the pad
798 // DrawSegmentation();
799 // add itself to the list (must be last)
801 view->SetView(phi, theta, psi, iret);
805 //______________________________________________________________________________
806 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
808 // Execute action corresponding to the mouse event
810 static Float_t x0, y0, x1, y1;
812 static Int_t pxold, pyold;
813 static Int_t px0, py0;
814 static Int_t linedrawn;
817 if (px == 0 && py == 0) { //when called by sliders
818 if (event == kButton1Up) {
823 if (!fZoomMode && gPad->GetView()) {
824 gPad->GetView()->ExecuteRotateView(event, px, py);
828 // something to zoom ?
829 gPad->SetCursor(kCross);
834 gVirtualX->SetLineColor(-1);
835 gPad->TAttLine::Modify(); //Change line attributes only if necessary
836 x0 = gPad->AbsPixeltoX(px);
837 y0 = gPad->AbsPixeltoY(py);
839 pxold = px; pyold = py;
844 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
848 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
852 gPad->GetCanvas()->FeedbackMode(kFALSE);
853 if (px == px0) return;
854 if (py == py0) return;
855 x1 = gPad->AbsPixeltoX(px);
856 y1 = gPad->AbsPixeltoY(py);
858 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
859 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
860 gPad->Range(x0,y0,x1,y1);
861 if (fZooms < AliMUONConstants::MaxZoom()-1) {
863 fZoomX0[fZooms] = x0;
864 fZoomY0[fZooms] = y0;
865 fZoomX1[fZooms] = x1;
866 fZoomY1[fZooms] = y1;
868 gPad->Modified(kTRUE);
873 //___________________________________________
874 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
876 // Read digits info and store x,y,z info in arrays fPoints
877 // Loop on all detectors
879 if (chamber > 14) return;
880 printf(" chamber %d \n",chamber);
886 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
887 AliMUONChamber* iChamber;
888 AliSegmentation* segmentation;
889 AliMUONResponse* response;
891 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
892 if (muonDigits == 0) return;
894 // gAlice->ResetDigits();
897 if (gAlice->TreeD()) {
898 nent = (Int_t) gAlice->TreeD()->GetEntries();
899 printf(" entries %d \n", nent);
900 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
901 gAlice->TreeD()->GetEvent(cathode-1);
904 Int_t ndigits = muonDigits->GetEntriesFast();
905 if (ndigits == 0) return;
906 if (fPoints == 0) fPoints = new TObjArray(ndigits);
908 iChamber = &(pMUON->Chamber(chamber-1));
910 segmentation = iChamber->SegmentationModel(cathode);
911 response = iChamber->ResponseModel();
912 Float_t zpos = iChamber->Z();
915 AliMUONPoints *points = 0;
916 TMarker3DBox *marker = 0;
918 //loop over all digits and store their position
921 Float_t adcmax = 1024;
922 if (response) adcmax = response->MaxAdc();
924 for (Int_t digit = 0; digit < ndigits; digit++) {
925 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
926 if (mdig->Cathode() != cathode-1) continue;
929 // First get all needed parameters
931 Int_t charge = mdig->Signal();
932 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
933 Int_t color = 261+index;
934 Int_t colorTrigger = 2;
935 if (color > 282) color = 282;
937 if (chamber > 10) { // trigger chamber
939 for (Int_t icharge = 0; icharge < 10; icharge++) {
940 sumCharge = sumCharge+mdig->TrackCharge(icharge);
942 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
943 if(sumCharge <= 10 || testCharge > 0) {
944 colorTrigger = color;
950 // get the center of the pad - add on x and y half of pad size
951 Float_t xpad, ypad, zpad;
952 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
954 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
955 Float_t dpx = segmentation->Dpx(isec)/2;
956 Float_t dpy = segmentation->Dpy(isec)/2;
958 // segmentation->Dump();
961 // Then set the objects
963 points = new AliMUONPoints(npoints);
964 fPoints->AddAt(points,digit);
966 points->SetMarkerColor(colorTrigger);
968 points->SetMarkerColor(color);
970 points->SetMarkerStyle(21);
971 points->SetMarkerSize(0.5);
972 points->SetParticle(-1);
973 points->SetHitIndex(-1);
974 points->SetTrackIndex(-1);
975 points->SetDigitIndex(digit);
976 points->SetPoint(0,xpad,ypad,zpos);
978 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
979 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
982 marker->SetLineColor(lineColor);
983 marker->SetFillStyle(1001);
984 marker->SetFillColor(color);
985 marker->SetRefObject((TObject*)points);
986 points->Set3DMarker(0, marker);
989 //___________________________________________
990 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
992 // Read raw clusters info and store x,y,z info in arrays fRpoints
993 // Loop on all detectors
995 if (chamber > 10) return;
999 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1000 AliMUONChamber* iChamber;
1002 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1003 if (muonRawClusters == 0) return;
1005 // pMUON->ResetRawClusters();
1008 if (gAlice->TreeR()) {
1009 nent=(Int_t)gAlice->TreeR()->GetEntries();
1010 gAlice->TreeR()->GetEvent(0);
1013 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1014 if (nrawcl == 0) return;
1015 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
1017 iChamber = &(pMUON->Chamber(chamber-1));
1018 Float_t zpos=iChamber->Z();
1019 AliMUONRawCluster *mRaw;
1020 AliMUONPoints *points = 0;
1022 //loop over all raw clusters and store their position
1023 points = new AliMUONPoints(nrawcl);
1024 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1025 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1026 fRpoints->AddAt(points,iraw);
1027 points->SetMarkerColor(51);
1028 points->SetMarkerStyle(2);
1029 points->SetMarkerSize(1.);
1030 points->SetParticle(-1);
1031 points->SetHitIndex(-1);
1032 points->SetTrackIndex(-1);
1033 points->SetDigitIndex(-1);
1034 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1037 //___________________________________________
1038 void AliMUONDisplay::LoadHits(Int_t chamber)
1040 // Read hits info and store x,y,z info in arrays fPhits
1041 // Loop on all detectors
1043 if (chamber > 14) return;
1050 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1051 AliMUONChamber* iChamber;
1053 iChamber = &(pMUON->Chamber(chamber-1));
1054 Float_t zpos=iChamber->Z();
1056 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1058 for (track = 0; track < ntracks; track++) {
1059 gAlice->ResetHits();
1060 gAlice->TreeH()->GetEvent(track);
1061 TClonesArray *muonHits = pMUON->Hits();
1062 if (muonHits == 0) return;
1063 nthits += muonHits->GetEntriesFast();
1065 if (fPhits == 0) fPhits = new TObjArray(nthits);
1067 for (track=0; track<ntracks;track++) {
1068 gAlice->ResetHits();
1069 gAlice->TreeH()->GetEvent(track);
1070 TClonesArray *muonHits = pMUON->Hits();
1071 if (muonHits == 0) return;
1072 Int_t nhits = muonHits->GetEntriesFast();
1073 if (nhits == 0) continue;
1075 AliMUONPoints *points = 0;
1077 for (Int_t hit=0;hit<nhits;hit++) {
1078 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1079 Int_t nch = mHit->Chamber(); // chamber number
1080 if (nch != chamber) continue;
1082 // Retrieve info and set the objects
1084 points = new AliMUONPoints(npoints);
1085 fPhits->AddAt(points,nhold+hit);
1086 points->SetMarkerColor(kRed);
1087 points->SetMarkerStyle(5);
1088 points->SetMarkerSize(1.);
1089 points->SetParticle(mHit->Track());
1090 points->SetHitIndex(hit);
1091 points->SetTrackIndex(track);
1092 points->SetDigitIndex(-1);
1093 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
1099 //_____________________________________________________________________________
1100 void AliMUONDisplay::Paint(Option_t *)
1102 // Paint miscellaneous items
1105 //_____________________________________________________________________________
1106 void AliMUONDisplay::SetPickMode()
1108 // Set parameters for pick mode.
1112 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1113 fTrigPad->Modified();
1116 //_____________________________________________________________________________
1117 void AliMUONDisplay::SetZoomMode()
1119 // Set parameters for zoom mode
1122 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1123 fTrigPad->Modified();
1126 //_____________________________________________________________________________
1127 void AliMUONDisplay::NextChamber(Int_t delta)
1129 // to go from chamber to next chamber if delta = 1
1130 // or previous chamber otherwise
1132 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1134 if (fChamber > 1) fChamber--;
1138 LoadDigits(fChamber, fCathode);
1142 //_____________________________________________________________________________
1143 void AliMUONDisplay::NextCathode()
1145 // to switch to other cathode plane
1148 if (fCathode == 1) {
1149 LoadDigits(fChamber, 2);
1151 LoadDigits(fChamber, 1);
1153 fNextCathode = kTRUE; // to keep the same zoom
1155 fNextCathode = kFALSE;
1156 TPad *pad = (TPad*)gPad->GetPadSave();
1157 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1158 fZoomX1[fZooms], fZoomY1[fZooms]);
1164 //_____________________________________________________________________________
1165 void AliMUONDisplay::Trigger()
1167 // returns Trigger Decision for current event
1168 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1169 decision->Trigger();
1173 //_____________________________________________________________________________
1174 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1176 // Set chamber and cathode number
1182 LoadDigits(chamber,cathode);
1186 void AliMUONDisplay::SetEvent(Int_t newevent)
1189 gAlice->GetEvent(newevent);
1191 if (!gAlice->TreeD()) return;
1194 LoadDigits(fChamber,fCathode);
1198 //_____________________________________________________________________________
1199 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1201 // Set view range along R and Z
1210 //_____________________________________________________________________________
1211 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1213 // change viewing angles for current event
1221 TView *view = gPad->GetView();
1222 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1227 //_____________________________________________________________________________
1228 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1230 // Display (current event_number + delta)
1231 // delta = 1 shown next event
1232 // delta = -1 show previous event
1235 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1236 Int_t newEvent = currentEvent + delta;
1237 gAlice->GetEvent(newEvent);
1239 if (!gAlice->TreeD()) return;
1242 LoadDigits(fChamber, fCathode);
1247 //______________________________________________________________________________
1248 void AliMUONDisplay::UnZoom()
1251 if (fZooms <= 0) return;
1253 TPad *pad = (TPad*)gPad->GetPadSave();
1254 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1258 //_____________________________________________________________________________
1259 void AliMUONDisplay::ResetPoints()
1262 // Reset array of points
1270 //_____________________________________________________________________________
1271 void AliMUONDisplay::ResetPhits()
1274 // Reset array of points
1282 //_____________________________________________________________________________
1283 void AliMUONDisplay::ResetRpoints()
1286 // Reset array of points
1295 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1297 // Dummy assignment operator