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.2 2000/06/15 07:58:48 morsch
19 Code from MUON-dev joined
21 Revision 1.1.2.15 2000/06/14 14:37:53 morsch
22 method Trigger() modified
24 Revision 1.1.2.14 2000/06/09 21:57:09 morsch
25 Bug in color scale diplay corrected.
26 Most coding rule violations corrected.
28 Revision 1.1.2.13 2000/05/02 11:57:27 morsch
29 Coding rules RN3, RN13, RN17 violations corrected.
31 Revision 1.1.2.12 2000/04/26 12:27:33 morsch
32 Mods for trigger display (P. Crochet):
33 - color code versus time for pad hits in trigger chambers
34 - call to TriggerDecision corrected
36 Revision 1.1.2.11 2000/04/26 09:04:46 morsch
37 Obsolete cathode correlation related code removed.
39 Revision 1.1.2.10 2000/04/19 19:43:47 morsch
40 change NCH to kNCH as in AliMUON.h
41 no more TreeC related methods
43 Revision 1.1.2.9 2000/03/20 18:10:33 morsch
44 Trigger method for "online" trigger decission added
46 Revision 1.1.2.8 2000/02/23 10:12:01 morsch
47 Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
48 General clean-up of commented code.
50 Revision 1.1.2.7 2000/02/17 14:36:55 morsch
51 Display of Trigger hits and clusters added.
52 Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
54 Revision 1.1.2.6 2000/02/15 10:19:42 morsch
55 Previous log messages included
57 Revision 1.1.2.5 2000/02/15 10:09:09 morsch
60 Revision 1.1.2.4 2000/02/08 09:17:16 gosset
61 One more improvement of MUON display:
62 same zoom for both cathode planes in a chamber
64 Revision 1.1.2.3 2000/02/07 15:37:21 gosset
65 A few improvements of the MUON display:
66 new buttons to change either chamber or cathode,
67 added to the more complicated way
68 (right mouse click and explicit filling of chamber and cathode)
70 Revision 1.1.2.2 2000/02/04 10:57:34 gosset
71 Z position of the chambers:
72 it was the Z position of the stations;
73 it is now really the Z position of the chambers.
74 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
75 !!!! AND "AliMUONChamber::ZPosition"
76 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
77 !!!! AND "AliMUONChamber::Z"
80 //////////////////////////////////////////////////////////////////////////
84 // Utility class to display ALICE outline, tracks, hits,.. //
86 //////////////////////////////////////////////////////////////////////////
95 #include <TPolyMarker3D.h>
96 #include <TPaveLabel.h>
97 #include <TPaveText.h>
104 #include <TSliderBox.h>
106 #include <TVirtualX.h>
109 #include <X3DBuffer.h>
110 #include <TMarker3DBox.h>
113 #include "AliDetector.h"
115 #include "AliMUONDisplay.h"
116 #include "AliMUONPoints.h"
117 #include "TParticle.h"
118 #include "AliMUONTriggerDecision.h"
120 #include "AliMUONHit.h"
121 #include "AliMUONPadHit.h"
122 #include "AliMUONDigit.h"
123 #include "AliMUONRawCluster.h"
125 #include "AliMUONSegmentation.h"
126 #include "AliMUONResponse.h"
127 #include "AliMUONChamber.h"
128 #include "AliMUONConstants.h"
129 // to manage the same zoom on both cathodes
133 ClassImp(AliMUONDisplay)
136 //_____________________________________________________________________________
137 AliMUONDisplay::AliMUONDisplay()
146 fNextCathode = kFALSE;
149 //_____________________________________________________________________________
150 AliMUONDisplay::AliMUONDisplay(Int_t size)
152 // Create an event display object.
153 // A canvas named "edisplay" is created with a vertical size in pixels
155 // A QUICK Overview of the Event Display functions
156 // ===============================================
158 // The event display can ve invoked by executing the macro "display.C"
159 // A canvas like in the picture below will appear.
161 // On the left side of the canvas, the following buttons appear:
162 // *Next* to move to the next event
163 // *Previous* to move to the previous event
165 // *Pick* Select this option to be able to point on a track with the
166 // mouse. Once on the track, use the right button to select
167 // an action. For example, select SetMarkerAttributes to
168 // change the marker type/color/size for the track.
169 // *Zoom* Select this option (default) if you want to zoom.
170 // To zoom, simply select the selected area with the left button.
171 // *UnZoom* To revert to the previous picture size.
173 // slider R On the left side, the vertical slider can be used to
174 // set the default picture size.
176 // When you are in Zoom mode, you can click on the black part of the canvas
177 // to select special options with the right mouse button.
180 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
181 // When you are on a track, select the menu item "InspectParticle"
182 // to display the current particle attributes.
184 // You can activate the Root browser by selecting the Inspect menu
185 // in the canvas tool bar menu. Then select "Start Browser"
186 // This will open a new canvas with the browser. At this point, you may want
187 // to display some histograms (from the Trees). Go to the "File" menu
188 // of the browser and click on "New canvas".
189 // In the browser, click on item "ROOT files" in the left pane.
190 // Click on galice.root.
192 // Click on TPC for example
193 // Click on any variable (eg TPC.fX) to histogram the variable.
195 // If you are lost, you can click on HELP in any Root canvas or browser.
198 <img src="gif/AliMUONDisplay.gif">
205 gAlice->SetDisplay(this);
207 // Initialize display default parameters
209 // Set front view by default
216 fDrawClusters = kTRUE;
229 // Create display canvas
231 if (ysize < 100) ysize = 750;
232 Int_t xsize = Int_t(size*830./ysize);
233 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
234 fCanvas->ToggleEventStatus();
236 // Create main display pad
237 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
240 fPad->SetFillColor(30);
241 fPad->SetBorderSize(2);
246 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
248 fColPad->SetFillColor(17);
249 fColPad->SetBorderSize(2);
254 // Create user interface control pad
258 // Create Range and mode pad
261 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
262 fTrigPad->SetEditable(kFALSE);
265 fTrigPad->SetFillColor(22);
266 fTrigPad->SetBorderSize(2);
267 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
268 fRangeSlider->SetObject(this);
269 char pickmode[] = "gAlice->Display()->SetPickMode()";
271 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
272 fPickButton->SetFillColor(38);
274 char zoommode[] = "gAlice->Display()->SetZoomMode()";
275 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
276 fZoomButton->SetFillColor(38);
278 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
279 fArcButton->SetFillColor(kGreen);
281 char butUnzoom[] = "gAlice->Display()->UnZoom()";
282 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
283 button->SetFillColor(38);
285 AppendPad(); // append display object as last object to force selection
289 fNextCathode = kFALSE;
292 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
294 // Dummy copy constructor
300 //_____________________________________________________________________________
301 AliMUONDisplay::~AliMUONDisplay()
303 // Delete space point structure
304 if (fPoints) fPoints->Delete();
308 if (fPhits) fPhits->Delete();
312 if (fRpoints) fRpoints->Delete();
316 if (fR2points) fR2points->Delete();
320 if (fCpoints) fCpoints->Delete();
325 //_____________________________________________________________________________
326 void AliMUONDisplay::Clear(Option_t *)
328 // Delete graphics temporary objects
331 //_____________________________________________________________________________
332 void AliMUONDisplay::DisplayButtons()
334 // Create the user interface buttons
337 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
338 fButtons->SetEditable(kFALSE);
340 fButtons->SetFillColor(38);
341 fButtons->SetBorderSize(2);
344 // Int_t butcolor = 33;
345 Float_t dbutton = 0.08;
352 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
353 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
354 button->SetFillColor(38);
358 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
359 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
360 button->SetFillColor(38);
364 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
365 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
366 button->SetFillColor(38);
370 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
371 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
372 button->SetFillColor(38);
376 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
377 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
378 button->SetFillColor(38);
382 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
383 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
384 button->SetFillColor(38);
388 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
389 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
390 button->SetFillColor(38);
394 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
395 diamond->SetFillColor(50);
396 diamond->SetTextAlign(22);
397 diamond->SetTextColor(5);
398 diamond->SetTextSize(0.11);
400 diamond->AddText(".. ");
401 diamond->AddText("ROOT");
402 diamond->AddText("MUON");
403 diamond->AddText("... ");
404 diamond->AddText(" ");
407 //_____________________________________________________________________________
408 void AliMUONDisplay::CreateColors()
410 // Create the colors palette used to display clusters
425 new TColor(color,r,g,b);
435 new TColor(color,r,g,b);
445 new TColor(color,r,g,b);
455 new TColor(color,r,g,b);
465 new TColor(color,r,g,b);
472 //_____________________________________________________________________________
473 void AliMUONDisplay::DisplayColorScale()
475 // Display pulse height color scale
478 Float_t xlow, ylow, xup, yup, hs;
479 Float_t x1, y1, x2, y2;
483 TText *text = new TText(0,0,"");
484 text->SetTextFont(61);
485 text->SetTextSize(0.2);
486 text->SetTextAlign(22);
488 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
489 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
490 AliMUONResponse * response=iChamber->ResponseModel();
492 if (response) adcmax= (Int_t) response->MaxAdc();
497 //*-* draw colortable boxes
498 hs = (y2-y1)/Float_t(22);
502 ylow = y1 + hs*(Float_t(i));
503 yup = y1 + hs*(Float_t(i+1));
505 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
506 Int_t scale=(Int_t)TMath::Exp(logscale);
507 sprintf(label,"%d",scale);
508 box = new TBox(xlow, ylow, xup, yup);
510 box->SetFillColor(color);
511 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
515 //______________________________________________________________________________
516 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
518 // Compute distance from point px,py to objects in event
520 gPad->SetCursor(kCross);
522 if (gPad == fTrigPad) return 9999;
524 const Int_t kBig = 9999;
526 Float_t xmin = gPad->GetX1();
527 Float_t xmax = gPad->GetX2();
528 Float_t dx = 0.02*(xmax - xmin);
529 Float_t x = gPad->AbsPixeltoX(px);
530 if (x < xmin+dx || x > xmax-dx) return dist;
532 if (fZoomMode) return 0;
536 //_____________________________________________________________________________
537 void AliMUONDisplay::Draw(Option_t *)
539 // Display current event
543 DrawView(fTheta, fPhi, fPsi);
544 // Display the event number and title
549 void AliMUONDisplay::DrawSegmentation()
551 // Draw graphical representation of segmenatation
552 // Attention: still experimental code
555 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
556 AliMUONChamber* iChamber;
557 AliMUONSegmentation* seg;
558 iChamber = &(pMUON->Chamber(fChamber));
559 seg=iChamber->SegmentationModel(icat);
560 Float_t zpos=iChamber->Z();
561 Float_t r=iChamber->ROuter();
563 TMarker3DBox *marker;
565 for (Int_t j=0; j<seg->Npy(); j++) {
567 y0=j*seg->Dpy()-seg->Dpy()/2.;
568 for (seg->FirstPad(0.,y0,300,0.);
572 if (seg->ISector()==0) continue;
574 seg->GetPadCxy(seg->Ix(), seg->Iy(), x, y);
575 Float_t dpx=seg->Dpx(seg->ISector())/2;
576 Float_t dpy=seg->Dpy(seg->ISector())/2;
577 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
578 marker->SetLineColor(seg->ISector()+1);
579 marker->SetFillStyle(1001);
580 marker->SetFillColor(0);
585 for (Int_t j=0; j<250; j++) {
586 Float_t x0=j*seg->Dpx();
587 Float_t y0=TMath::Sqrt(r*r-x0*x0);
589 for (seg->FirstPad(x0,0,0,y0);
593 if (seg->ISector()==0) continue;
596 seg->GetPadCxy(seg->Ix(), seg->Iy(), x, y);
597 Float_t dpx=seg->Dpx(seg->ISector())/2;
598 Float_t dpy=seg->Dpy(seg->ISector())/2;
599 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
600 marker->SetLineColor(seg->ISector()+1);
601 marker->SetFillStyle(1001);
602 marker->SetFillColor(0);
609 //_____________________________________________________________________________
610 void AliMUONDisplay::DrawClusters()
612 // Draw clusters for MUON chambers
614 Int_t ndigits, digit;
622 ndigits = points->GetEntriesFast();
623 for (digit=0;digit<ndigits;digit++){
624 pm = (AliMUONPoints*)points->UncheckedAt(digit);
628 for (Int_t im=0;im<3;im++) {
629 TMarker3DBox *marker=pm->GetMarker(im);
634 fClustersCuts +=pm->GetN();
638 //_____________________________________________________________________________
639 void AliMUONDisplay::DrawHits()
641 // Draw hits for MUON chambers
645 Int_t ntracks, track;
652 ntracks = points->GetEntriesFast();
653 for (track=0;track<ntracks;track++) {
654 pm = (AliMUONPoints*)points->UncheckedAt(track);
657 fHitsCuts += pm->GetN();
662 //_____________________________________________________________________________
663 void AliMUONDisplay::DrawCoG()
665 // Draw hits for MUON chambers
666 if (!fDrawCoG) return;
667 if (fChamber > 10) return;
668 LoadCoG(fChamber,fCathode);
676 ncog = points->GetEntriesFast();
677 for (icog=0;icog<ncog;icog++) {
678 pm = (AliMUONPoints*)points->UncheckedAt(icog);
683 void AliMUONDisplay::DrawCoG2()
685 // Draw hits for MUON chambers
687 if (!fDrawCoG) return;
688 if (fChamber > 10) return;
691 LoadCoG2(fChamber,2);
692 } else if (fCathode==2) {
693 LoadCoG2(fChamber,1);
702 ncog = points->GetEntriesFast();
703 for (icog=0;icog<ncog;icog++) {
704 pm = (AliMUONPoints*)points->UncheckedAt(icog);
709 //_____________________________________________________________________________
711 void AliMUONDisplay::DrawTitle(Option_t *option)
713 // Draw the event title
715 Float_t xmin = gPad->GetX1();
716 Float_t xmax = gPad->GetX2();
717 Float_t ymin = gPad->GetY1();
718 Float_t ymax = gPad->GetY2();
719 Float_t dx = xmax-xmin;
720 Float_t dy = ymax-ymin;
722 if (strlen(option) == 0) {
723 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
724 // title->SetTextSize(0.023932);
725 title->SetTextSize(0.02);
726 title->SetBit(kCanDelete);
727 title->SetFillColor(42);
730 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
731 gAlice->GetHeader()->GetEvent(),
732 gAlice->GetHeader()->GetRun(),
735 title->AddText(ptitle);
736 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
737 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
738 nparticles, fHitsCuts,fClustersCuts);
739 title->AddText(ptitle);
741 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
742 label->SetBit(kCanDelete);
743 label->SetFillColor(42);
748 //_____________________________________________________________________________
749 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
751 // Draw a view of MUON clusters
752 printf("\n Draw View");
754 gPad->SetCursor(kWatch);
755 // gPad->SetFillColor(39);
756 gPad->SetFillColor(1);
758 // gPad->SetFillColor(39);
759 gPad->SetFillColor(1);
763 TView *view = new TView(1);
765 Float_t range = fRrange*fRangeSlider->GetMaximum();
766 view->SetRange(-range,-range,-range,range, range, range);
767 // zoom back to full scale only if DrawView not called from NextCathode
776 // Display MUON Chamber Geometry
777 // gAlice->GetGeometry()->Draw("same");
779 sprintf(nodeName,"MUON%d",100+fChamber);
780 printf("\n Node name %s", nodeName);
782 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
783 if (node1) node1->Draw("same");
784 //add clusters to the pad
786 printf("Node name %s", nodeName);
790 // DrawSegmentation();
791 // add itself to the list (must be last)
793 view->SetView(phi, theta, psi, iret);
797 //______________________________________________________________________________
798 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
800 // Execute action corresponding to the mouse event
802 static Float_t x0, y0, x1, y1;
804 static Int_t pxold, pyold;
805 static Int_t px0, py0;
806 static Int_t linedrawn;
809 if (px == 0 && py == 0) { //when called by sliders
810 if (event == kButton1Up) {
815 if (!fZoomMode && gPad->GetView()) {
816 gPad->GetView()->ExecuteRotateView(event, px, py);
820 // something to zoom ?
821 gPad->SetCursor(kCross);
826 gVirtualX->SetLineColor(-1);
827 gPad->TAttLine::Modify(); //Change line attributes only if necessary
828 x0 = gPad->AbsPixeltoX(px);
829 y0 = gPad->AbsPixeltoY(py);
831 pxold = px; pyold = py;
836 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
840 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
844 gPad->GetCanvas()->FeedbackMode(kFALSE);
845 if (px == px0) return;
846 if (py == py0) return;
847 x1 = gPad->AbsPixeltoX(px);
848 y1 = gPad->AbsPixeltoY(py);
850 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
851 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
852 gPad->Range(x0,y0,x1,y1);
853 if (fZooms < kMAXZOOM-1) {
855 fZoomX0[fZooms] = x0;
856 fZoomY0[fZooms] = y0;
857 fZoomX1[fZooms] = x1;
858 fZoomY1[fZooms] = y1;
860 gPad->Modified(kTRUE);
865 //___________________________________________
866 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
868 // Read digits info and store x,y,z info in arrays fPoints
869 // Loop on all detectors
871 if (chamber > 14) return;
872 printf(" chamber %d \n",chamber);
878 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
879 AliMUONChamber* iChamber;
880 AliMUONSegmentation* segmentation;
881 AliMUONResponse* response;
883 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
884 if (muonDigits == 0) return;
886 gAlice->ResetDigits();
888 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
889 gAlice->TreeD()->GetEvent(nent-2+cathode-1);
890 Int_t ndigits = muonDigits->GetEntriesFast();
891 if (ndigits == 0) return;
892 if (fPoints == 0) fPoints = new TObjArray(ndigits);
894 iChamber = &(pMUON->Chamber(chamber-1));
896 segmentation = iChamber->SegmentationModel(cathode);
897 response = iChamber->ResponseModel();
898 Float_t zpos=iChamber->Z();
900 AliMUONPoints *points = 0;
901 TMarker3DBox *marker=0;
903 //loop over all digits and store their position
907 if (response) adcmax= response->MaxAdc();
909 for (Int_t digit=0;digit<ndigits;digit++) {
910 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
912 // First get all needed parameters
914 Int_t charge=mdig->fSignal;
915 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
916 Int_t color=261+index;
917 Int_t colorTrigger=2;
918 if (color>282) color=282;
920 if (chamber > 10) { // trigger chamber
922 for (Int_t icharge=0; icharge<10; icharge++) {
923 sumCharge=sumCharge+mdig->fTcharges[icharge];
925 Int_t testCharge=sumCharge-(Int_t(sumCharge/10))*10;
926 if(sumCharge<=10||testCharge>0) {
933 // get the center of the pad - add on x and y half of pad size
935 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
937 Int_t isec=segmentation->Sector(mdig->fPadX, mdig->fPadY);
938 Float_t dpx=segmentation->Dpx(isec)/2;
939 Float_t dpy=segmentation->Dpy(isec)/2;
941 segmentation->GetNParallelAndOffset(mdig->fPadX,mdig->fPadY,
944 // Then set the objects
946 points = new AliMUONPoints(npoints);
947 fPoints->AddAt(points,digit);
949 points->SetMarkerColor(colorTrigger);
951 points->SetMarkerColor(color);
953 points->SetMarkerStyle(21);
954 points->SetMarkerSize(0.5);
955 points->SetParticle(-1);
956 points->SetHitIndex(-1);
957 points->SetTrackIndex(-1);
958 points->SetDigitIndex(digit);
959 points->SetPoint(0,xpad,ypad,zpos);
960 for (Int_t imark=0;imark<nPara; imark++)
962 segmentation->GetPadCxy(mdig->fPadX + imark*offset, mdig->fPadY,xpad, ypad);
963 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
964 marker->SetLineColor(2);
965 marker->SetFillStyle(1001);
966 marker->SetFillColor(color);
967 marker->SetRefObject((TObject*)points);
968 points->Set3DMarker(imark, marker);
972 //___________________________________________
973 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
975 // Read raw clusters info and store x,y,z info in arrays fRpoints
976 // Loop on all detectors
978 if (chamber > 10) return;
982 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
983 AliMUONChamber* iChamber;
985 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
986 if (muonRawClusters == 0) return;
988 pMUON->ResetRawClusters();
991 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
992 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
993 Int_t nrawcl = muonRawClusters->GetEntriesFast();
994 if (nrawcl == 0) return;
995 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
997 iChamber = &(pMUON->Chamber(chamber-1));
998 Float_t zpos=iChamber->Z();
999 AliMUONRawCluster *mRaw;
1000 AliMUONPoints *points = 0;
1002 //loop over all raw clusters and store their position
1003 points = new AliMUONPoints(nrawcl);
1004 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1005 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1006 fRpoints->AddAt(points,iraw);
1007 points->SetMarkerColor(51);
1008 points->SetMarkerStyle(2);
1009 points->SetMarkerSize(1.);
1010 points->SetParticle(-1);
1011 points->SetHitIndex(-1);
1012 points->SetTrackIndex(-1);
1013 points->SetDigitIndex(-1);
1014 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1017 //___________________________________________
1018 void AliMUONDisplay::LoadCoG2(Int_t chamber, Int_t cathode)
1020 // Read raw clusters info and store x,y,z info in arrays fRpoints
1021 // Loop on all detectors
1023 if (chamber > 10) return;
1027 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1028 AliMUONChamber* iChamber;
1030 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1031 if (muonRawClusters == 0) return;
1033 pMUON->ResetRawClusters();
1035 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
1036 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
1037 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1038 if (nrawcl == 0) return;
1039 if (fR2points == 0) fR2points = new TObjArray(nrawcl);
1041 iChamber = &(pMUON->Chamber(chamber-1));
1042 Float_t zpos=iChamber->Z();
1043 AliMUONRawCluster *mRaw;
1044 AliMUONPoints *points = 0;
1046 //loop over all raw clusters and store their position
1047 points = new AliMUONPoints(nrawcl);
1048 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1049 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1050 fR2points->AddAt(points,iraw);
1051 points->SetMarkerColor(51);
1052 points->SetMarkerStyle(4);
1053 points->SetMarkerSize(1.3);
1054 points->SetParticle(-1);
1055 points->SetHitIndex(-1);
1056 points->SetTrackIndex(-1);
1057 points->SetDigitIndex(-1);
1058 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1061 //___________________________________________
1062 void AliMUONDisplay::LoadHits(Int_t chamber)
1064 // Read hits info and store x,y,z info in arrays fPhits
1065 // Loop on all detectors
1067 if (chamber > 14) return;
1074 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1075 AliMUONChamber* iChamber;
1077 iChamber = &(pMUON->Chamber(chamber-1));
1078 Float_t zpos=iChamber->Z();
1080 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1082 for (track=0; track<ntracks;track++) {
1083 gAlice->ResetHits();
1084 gAlice->TreeH()->GetEvent(track);
1085 TClonesArray *muonHits = pMUON->Hits();
1086 if (muonHits == 0) return;
1087 nthits += muonHits->GetEntriesFast();
1089 if (fPhits == 0) fPhits = new TObjArray(nthits);
1091 for (track=0; track<ntracks;track++) {
1092 gAlice->ResetHits();
1093 gAlice->TreeH()->GetEvent(track);
1094 TClonesArray *muonHits = pMUON->Hits();
1095 if (muonHits == 0) return;
1096 Int_t nhits = muonHits->GetEntriesFast();
1097 if (nhits == 0) continue;
1099 AliMUONPoints *points = 0;
1101 for (Int_t hit=0;hit<nhits;hit++) {
1102 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1103 Int_t nch = mHit->fChamber; // chamber number
1104 if (nch != chamber) continue;
1106 // Retrieve info and set the objects
1108 points = new AliMUONPoints(npoints);
1109 fPhits->AddAt(points,nhold+hit);
1110 points->SetMarkerColor(kRed);
1111 points->SetMarkerStyle(5);
1112 points->SetMarkerSize(1.);
1113 points->SetParticle(mHit->fTrack);
1114 points->SetHitIndex(hit);
1115 points->SetTrackIndex(track);
1116 points->SetDigitIndex(-1);
1117 points->SetPoint(0,mHit->fX,mHit->fY,zpos);
1123 //_____________________________________________________________________________
1124 void AliMUONDisplay::Paint(Option_t *)
1126 // Paint miscellaneous items
1129 //_____________________________________________________________________________
1130 void AliMUONDisplay::SetPickMode()
1132 // Set parameters for pick mode.
1136 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1137 fTrigPad->Modified();
1140 //_____________________________________________________________________________
1141 void AliMUONDisplay::SetZoomMode()
1143 // Set parameters for zoom mode
1146 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1147 fTrigPad->Modified();
1150 //_____________________________________________________________________________
1151 void AliMUONDisplay::NextChamber(Int_t delta)
1153 // to go from chamber to next chamber if delta = 1
1154 // or previous chamber otherwise
1156 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1158 if (fChamber > 1) fChamber--;
1162 LoadDigits(fChamber, fCathode);
1166 //_____________________________________________________________________________
1167 void AliMUONDisplay::NextCathode()
1169 // to switch to other cathode plane
1172 if (fCathode == 1) {
1173 LoadDigits(fChamber, 2);
1175 LoadDigits(fChamber, 1);
1177 fNextCathode = kTRUE; // to keep the same zoom
1179 fNextCathode = kFALSE;
1180 TPad *pad = (TPad*)gPad->GetPadSave();
1181 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1182 fZoomX1[fZooms], fZoomY1[fZooms]);
1188 //_____________________________________________________________________________
1189 void AliMUONDisplay::Trigger()
1191 // returns Trigger Decision for current event
1192 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1193 decision->Trigger();
1197 //_____________________________________________________________________________
1198 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1200 // Set chamber and cathode number
1206 LoadDigits(chamber,cathode);
1210 void AliMUONDisplay::SetEvent(Int_t newevent)
1213 gAlice->GetEvent(newevent);
1215 if (!gAlice->TreeD()) return;
1218 LoadDigits(fChamber,fCathode);
1222 //_____________________________________________________________________________
1223 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1225 // Set view range along R and Z
1234 //_____________________________________________________________________________
1235 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1237 // change viewing angles for current event
1245 TView *view = gPad->GetView();
1246 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1251 //_____________________________________________________________________________
1252 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1254 // Display (current event_number + delta)
1255 // delta = 1 shown next event
1256 // delta = -1 show previous event
1259 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1260 Int_t newEvent = currentEvent + delta;
1261 gAlice->GetEvent(newEvent);
1263 if (!gAlice->TreeD()) return;
1266 LoadDigits(fChamber, fCathode);
1271 //______________________________________________________________________________
1272 void AliMUONDisplay::UnZoom()
1275 if (fZooms <= 0) return;
1277 TPad *pad = (TPad*)gPad->GetPadSave();
1278 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1282 //_____________________________________________________________________________
1283 void AliMUONDisplay::ResetPoints()
1286 // Reset array of points
1294 //_____________________________________________________________________________
1295 void AliMUONDisplay::ResetPhits()
1298 // Reset array of points
1306 //_____________________________________________________________________________
1307 void AliMUONDisplay::ResetRpoints()
1310 // Reset array of points
1318 //_____________________________________________________________________________
1319 void AliMUONDisplay::ResetR2points()
1322 // Reset array of points
1325 fR2points->Delete();
1330 //_____________________________________________________________________________
1331 void AliMUONDisplay::ResetCpoints()
1334 // Reset array of points
1344 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1346 // Dummy assignment operator