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.3 2000/06/26 14:02:38 morsch
19 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
21 Revision 1.2 2000/06/15 07:58:48 morsch
22 Code from MUON-dev joined
24 Revision 1.1.2.15 2000/06/14 14:37:53 morsch
25 method Trigger() modified
27 Revision 1.1.2.14 2000/06/09 21:57:09 morsch
28 Bug in color scale diplay corrected.
29 Most coding rule violations corrected.
31 Revision 1.1.2.13 2000/05/02 11:57:27 morsch
32 Coding rules RN3, RN13, RN17 violations corrected.
34 Revision 1.1.2.12 2000/04/26 12:27:33 morsch
35 Mods for trigger display (P. Crochet):
36 - color code versus time for pad hits in trigger chambers
37 - call to TriggerDecision corrected
39 Revision 1.1.2.11 2000/04/26 09:04:46 morsch
40 Obsolete cathode correlation related code removed.
42 Revision 1.1.2.10 2000/04/19 19:43:47 morsch
43 change NCH to kNCH as in AliMUON.h
44 no more TreeC related methods
46 Revision 1.1.2.9 2000/03/20 18:10:33 morsch
47 Trigger method for "online" trigger decission added
49 Revision 1.1.2.8 2000/02/23 10:12:01 morsch
50 Dont't try to draw reconstructed hit coordinates for Trigger Chambers.
51 General clean-up of commented code.
53 Revision 1.1.2.7 2000/02/17 14:36:55 morsch
54 Display of Trigger hits and clusters added.
55 Displacement between clusters and hits has to be investigated and corrected ! (A.M.)
57 Revision 1.1.2.6 2000/02/15 10:19:42 morsch
58 Previous log messages included
60 Revision 1.1.2.5 2000/02/15 10:09:09 morsch
63 Revision 1.1.2.4 2000/02/08 09:17:16 gosset
64 One more improvement of MUON display:
65 same zoom for both cathode planes in a chamber
67 Revision 1.1.2.3 2000/02/07 15:37:21 gosset
68 A few improvements of the MUON display:
69 new buttons to change either chamber or cathode,
70 added to the more complicated way
71 (right mouse click and explicit filling of chamber and cathode)
73 Revision 1.1.2.2 2000/02/04 10:57:34 gosset
74 Z position of the chambers:
75 it was the Z position of the stations;
76 it is now really the Z position of the chambers.
77 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
78 !!!! AND "AliMUONChamber::ZPosition"
79 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
80 !!!! AND "AliMUONChamber::Z"
83 //////////////////////////////////////////////////////////////////////////
87 // Utility class to display ALICE outline, tracks, hits,.. //
89 //////////////////////////////////////////////////////////////////////////
98 #include <TPolyMarker3D.h>
99 #include <TPaveLabel.h>
100 #include <TPaveText.h>
102 #include <TDiamond.h>
107 #include <TSliderBox.h>
109 #include <TVirtualX.h>
112 #include <X3DBuffer.h>
113 #include <TMarker3DBox.h>
116 #include "AliDetector.h"
118 #include "AliMUONDisplay.h"
119 #include "AliMUONPoints.h"
120 #include "TParticle.h"
121 #include "AliMUONTriggerDecision.h"
123 #include "AliMUONHit.h"
124 #include "AliMUONPadHit.h"
125 #include "AliMUONDigit.h"
126 #include "AliMUONRawCluster.h"
128 #include "AliMUONSegmentation.h"
129 #include "AliMUONResponse.h"
130 #include "AliMUONChamber.h"
131 #include "AliMUONConstants.h"
132 // to manage the same zoom on both cathodes
136 ClassImp(AliMUONDisplay)
139 //_____________________________________________________________________________
140 AliMUONDisplay::AliMUONDisplay()
149 fNextCathode = kFALSE;
152 //_____________________________________________________________________________
153 AliMUONDisplay::AliMUONDisplay(Int_t size)
155 // Create an event display object.
156 // A canvas named "edisplay" is created with a vertical size in pixels
158 // A QUICK Overview of the Event Display functions
159 // ===============================================
161 // The event display can ve invoked by executing the macro "display.C"
162 // A canvas like in the picture below will appear.
164 // On the left side of the canvas, the following buttons appear:
165 // *Next* to move to the next event
166 // *Previous* to move to the previous event
168 // *Pick* Select this option to be able to point on a track with the
169 // mouse. Once on the track, use the right button to select
170 // an action. For example, select SetMarkerAttributes to
171 // change the marker type/color/size for the track.
172 // *Zoom* Select this option (default) if you want to zoom.
173 // To zoom, simply select the selected area with the left button.
174 // *UnZoom* To revert to the previous picture size.
176 // slider R On the left side, the vertical slider can be used to
177 // set the default picture size.
179 // When you are in Zoom mode, you can click on the black part of the canvas
180 // to select special options with the right mouse button.
183 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
184 // When you are on a track, select the menu item "InspectParticle"
185 // to display the current particle attributes.
187 // You can activate the Root browser by selecting the Inspect menu
188 // in the canvas tool bar menu. Then select "Start Browser"
189 // This will open a new canvas with the browser. At this point, you may want
190 // to display some histograms (from the Trees). Go to the "File" menu
191 // of the browser and click on "New canvas".
192 // In the browser, click on item "ROOT files" in the left pane.
193 // Click on galice.root.
195 // Click on TPC for example
196 // Click on any variable (eg TPC.fX) to histogram the variable.
198 // If you are lost, you can click on HELP in any Root canvas or browser.
201 <img src="gif/AliMUONDisplay.gif">
208 gAlice->SetDisplay(this);
210 // Initialize display default parameters
212 // Set front view by default
219 fDrawClusters = kTRUE;
232 // Create display canvas
234 if (ysize < 100) ysize = 750;
235 Int_t xsize = Int_t(size*830./ysize);
236 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
237 fCanvas->ToggleEventStatus();
239 // Create main display pad
240 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
243 fPad->SetFillColor(30);
244 fPad->SetBorderSize(2);
249 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
251 fColPad->SetFillColor(17);
252 fColPad->SetBorderSize(2);
257 // Create user interface control pad
261 // Create Range and mode pad
264 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
265 fTrigPad->SetEditable(kFALSE);
268 fTrigPad->SetFillColor(22);
269 fTrigPad->SetBorderSize(2);
270 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
271 fRangeSlider->SetObject(this);
272 char pickmode[] = "gAlice->Display()->SetPickMode()";
274 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
275 fPickButton->SetFillColor(38);
277 char zoommode[] = "gAlice->Display()->SetZoomMode()";
278 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
279 fZoomButton->SetFillColor(38);
281 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
282 fArcButton->SetFillColor(kGreen);
284 char butUnzoom[] = "gAlice->Display()->UnZoom()";
285 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
286 button->SetFillColor(38);
288 AppendPad(); // append display object as last object to force selection
292 fNextCathode = kFALSE;
295 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
297 // Dummy copy constructor
303 //_____________________________________________________________________________
304 AliMUONDisplay::~AliMUONDisplay()
306 // Delete space point structure
307 if (fPoints) fPoints->Delete();
311 if (fPhits) fPhits->Delete();
315 if (fRpoints) fRpoints->Delete();
319 if (fR2points) fR2points->Delete();
323 if (fCpoints) fCpoints->Delete();
328 //_____________________________________________________________________________
329 void AliMUONDisplay::Clear(Option_t *)
331 // Delete graphics temporary objects
334 //_____________________________________________________________________________
335 void AliMUONDisplay::DisplayButtons()
337 // Create the user interface buttons
340 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
341 fButtons->SetEditable(kFALSE);
343 fButtons->SetFillColor(38);
344 fButtons->SetBorderSize(2);
347 // Int_t butcolor = 33;
348 Float_t dbutton = 0.08;
355 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
356 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
357 button->SetFillColor(38);
361 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
362 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
363 button->SetFillColor(38);
367 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
368 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
369 button->SetFillColor(38);
373 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
374 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
375 button->SetFillColor(38);
379 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
380 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
381 button->SetFillColor(38);
385 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
386 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
387 button->SetFillColor(38);
391 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
392 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
393 button->SetFillColor(38);
397 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
398 diamond->SetFillColor(50);
399 diamond->SetTextAlign(22);
400 diamond->SetTextColor(5);
401 diamond->SetTextSize(0.11);
403 diamond->AddText(".. ");
404 diamond->AddText("ROOT");
405 diamond->AddText("MUON");
406 diamond->AddText("... ");
407 diamond->AddText(" ");
410 //_____________________________________________________________________________
411 void AliMUONDisplay::CreateColors()
413 // Create the colors palette used to display clusters
428 new TColor(color,r,g,b);
438 new TColor(color,r,g,b);
448 new TColor(color,r,g,b);
458 new TColor(color,r,g,b);
468 new TColor(color,r,g,b);
475 //_____________________________________________________________________________
476 void AliMUONDisplay::DisplayColorScale()
478 // Display pulse height color scale
481 Float_t xlow, ylow, xup, yup, hs;
482 Float_t x1, y1, x2, y2;
486 TText *text = new TText(0,0,"");
487 text->SetTextFont(61);
488 text->SetTextSize(0.2);
489 text->SetTextAlign(22);
491 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
492 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
493 AliMUONResponse * response=iChamber->ResponseModel();
495 if (response) adcmax= (Int_t) response->MaxAdc();
500 //*-* draw colortable boxes
501 hs = (y2-y1)/Float_t(22);
505 ylow = y1 + hs*(Float_t(i));
506 yup = y1 + hs*(Float_t(i+1));
508 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
509 Int_t scale=(Int_t)TMath::Exp(logscale);
510 sprintf(label,"%d",scale);
511 box = new TBox(xlow, ylow, xup, yup);
513 box->SetFillColor(color);
514 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
518 //______________________________________________________________________________
519 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
521 // Compute distance from point px,py to objects in event
523 gPad->SetCursor(kCross);
525 if (gPad == fTrigPad) return 9999;
527 const Int_t kBig = 9999;
529 Float_t xmin = gPad->GetX1();
530 Float_t xmax = gPad->GetX2();
531 Float_t dx = 0.02*(xmax - xmin);
532 Float_t x = gPad->AbsPixeltoX(px);
533 if (x < xmin+dx || x > xmax-dx) return dist;
535 if (fZoomMode) return 0;
539 //_____________________________________________________________________________
540 void AliMUONDisplay::Draw(Option_t *)
542 // Display current event
546 DrawView(fTheta, fPhi, fPsi);
547 // Display the event number and title
552 void AliMUONDisplay::DrawSegmentation()
554 // Draw graphical representation of segmenatation
555 // Attention: still experimental code
558 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
559 AliMUONChamber* iChamber;
560 AliMUONSegmentation* seg;
561 iChamber = &(pMUON->Chamber(fChamber));
562 seg=iChamber->SegmentationModel(icat);
563 Float_t zpos=iChamber->Z();
564 Float_t r=iChamber->ROuter();
566 TMarker3DBox *marker;
568 for (Int_t j=0; j<seg->Npy(); j++) {
570 y0=j*seg->Dpy()-seg->Dpy()/2.;
571 for (seg->FirstPad(0.,y0,300,0.);
575 if (seg->ISector()==0) continue;
577 seg->GetPadCxy(seg->Ix(), seg->Iy(), x, y);
578 Float_t dpx=seg->Dpx(seg->ISector())/2;
579 Float_t dpy=seg->Dpy(seg->ISector())/2;
580 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
581 marker->SetLineColor(seg->ISector()+1);
582 marker->SetFillStyle(1001);
583 marker->SetFillColor(0);
588 for (Int_t j=0; j<250; j++) {
589 Float_t x0=j*seg->Dpx();
590 Float_t y0=TMath::Sqrt(r*r-x0*x0);
592 for (seg->FirstPad(x0,0,0,y0);
596 if (seg->ISector()==0) continue;
599 seg->GetPadCxy(seg->Ix(), seg->Iy(), x, y);
600 Float_t dpx=seg->Dpx(seg->ISector())/2;
601 Float_t dpy=seg->Dpy(seg->ISector())/2;
602 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
603 marker->SetLineColor(seg->ISector()+1);
604 marker->SetFillStyle(1001);
605 marker->SetFillColor(0);
612 //_____________________________________________________________________________
613 void AliMUONDisplay::DrawClusters()
615 // Draw clusters for MUON chambers
617 Int_t ndigits, digit;
625 ndigits = points->GetEntriesFast();
626 for (digit=0;digit<ndigits;digit++){
627 pm = (AliMUONPoints*)points->UncheckedAt(digit);
631 for (Int_t im=0;im<3;im++) {
632 TMarker3DBox *marker=pm->GetMarker(im);
637 fClustersCuts +=pm->GetN();
641 //_____________________________________________________________________________
642 void AliMUONDisplay::DrawHits()
644 // Draw hits for MUON chambers
648 Int_t ntracks, track;
655 ntracks = points->GetEntriesFast();
656 for (track=0;track<ntracks;track++) {
657 pm = (AliMUONPoints*)points->UncheckedAt(track);
660 fHitsCuts += pm->GetN();
665 //_____________________________________________________________________________
666 void AliMUONDisplay::DrawCoG()
668 // Draw hits for MUON chambers
669 if (!fDrawCoG) return;
670 if (fChamber > 10) return;
671 LoadCoG(fChamber,fCathode);
679 ncog = points->GetEntriesFast();
680 for (icog=0;icog<ncog;icog++) {
681 pm = (AliMUONPoints*)points->UncheckedAt(icog);
686 void AliMUONDisplay::DrawCoG2()
688 // Draw hits for MUON chambers
690 if (!fDrawCoG) return;
691 if (fChamber > 10) return;
694 LoadCoG2(fChamber,2);
695 } else if (fCathode==2) {
696 LoadCoG2(fChamber,1);
705 ncog = points->GetEntriesFast();
706 for (icog=0;icog<ncog;icog++) {
707 pm = (AliMUONPoints*)points->UncheckedAt(icog);
712 //_____________________________________________________________________________
714 void AliMUONDisplay::DrawTitle(Option_t *option)
716 // Draw the event title
718 Float_t xmin = gPad->GetX1();
719 Float_t xmax = gPad->GetX2();
720 Float_t ymin = gPad->GetY1();
721 Float_t ymax = gPad->GetY2();
722 Float_t dx = xmax-xmin;
723 Float_t dy = ymax-ymin;
725 if (strlen(option) == 0) {
726 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
727 // title->SetTextSize(0.023932);
728 title->SetTextSize(0.02);
729 title->SetBit(kCanDelete);
730 title->SetFillColor(42);
733 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
734 gAlice->GetHeader()->GetEvent(),
735 gAlice->GetHeader()->GetRun(),
738 title->AddText(ptitle);
739 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
740 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
741 nparticles, fHitsCuts,fClustersCuts);
742 title->AddText(ptitle);
744 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
745 label->SetBit(kCanDelete);
746 label->SetFillColor(42);
751 //_____________________________________________________________________________
752 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
754 // Draw a view of MUON clusters
755 printf("\n Draw View");
757 gPad->SetCursor(kWatch);
758 // gPad->SetFillColor(39);
759 gPad->SetFillColor(1);
761 // gPad->SetFillColor(39);
762 gPad->SetFillColor(1);
766 TView *view = new TView(1);
768 Float_t range = fRrange*fRangeSlider->GetMaximum();
769 view->SetRange(-range,-range,-range,range, range, range);
770 // zoom back to full scale only if DrawView not called from NextCathode
779 // Display MUON Chamber Geometry
780 // gAlice->GetGeometry()->Draw("same");
782 sprintf(nodeName,"MUON%d",100+fChamber);
783 printf("\n Node name %s", nodeName);
785 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
786 if (node1) node1->Draw("same");
787 //add clusters to the pad
789 printf("Node name %s", nodeName);
793 // DrawSegmentation();
794 // add itself to the list (must be last)
796 view->SetView(phi, theta, psi, iret);
800 //______________________________________________________________________________
801 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
803 // Execute action corresponding to the mouse event
805 static Float_t x0, y0, x1, y1;
807 static Int_t pxold, pyold;
808 static Int_t px0, py0;
809 static Int_t linedrawn;
812 if (px == 0 && py == 0) { //when called by sliders
813 if (event == kButton1Up) {
818 if (!fZoomMode && gPad->GetView()) {
819 gPad->GetView()->ExecuteRotateView(event, px, py);
823 // something to zoom ?
824 gPad->SetCursor(kCross);
829 gVirtualX->SetLineColor(-1);
830 gPad->TAttLine::Modify(); //Change line attributes only if necessary
831 x0 = gPad->AbsPixeltoX(px);
832 y0 = gPad->AbsPixeltoY(py);
834 pxold = px; pyold = py;
839 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
843 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
847 gPad->GetCanvas()->FeedbackMode(kFALSE);
848 if (px == px0) return;
849 if (py == py0) return;
850 x1 = gPad->AbsPixeltoX(px);
851 y1 = gPad->AbsPixeltoY(py);
853 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
854 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
855 gPad->Range(x0,y0,x1,y1);
856 if (fZooms < AliMUONConstants::MaxZoom()-1) {
858 fZoomX0[fZooms] = x0;
859 fZoomY0[fZooms] = y0;
860 fZoomX1[fZooms] = x1;
861 fZoomY1[fZooms] = y1;
863 gPad->Modified(kTRUE);
868 //___________________________________________
869 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
871 // Read digits info and store x,y,z info in arrays fPoints
872 // Loop on all detectors
874 if (chamber > 14) return;
875 printf(" chamber %d \n",chamber);
881 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
882 AliMUONChamber* iChamber;
883 AliMUONSegmentation* segmentation;
884 AliMUONResponse* response;
886 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
887 if (muonDigits == 0) return;
889 gAlice->ResetDigits();
891 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
892 gAlice->TreeD()->GetEvent(nent-2+cathode-1);
893 Int_t ndigits = muonDigits->GetEntriesFast();
894 if (ndigits == 0) return;
895 if (fPoints == 0) fPoints = new TObjArray(ndigits);
897 iChamber = &(pMUON->Chamber(chamber-1));
899 segmentation = iChamber->SegmentationModel(cathode);
900 response = iChamber->ResponseModel();
901 Float_t zpos=iChamber->Z();
903 AliMUONPoints *points = 0;
904 TMarker3DBox *marker=0;
906 //loop over all digits and store their position
910 if (response) adcmax= response->MaxAdc();
912 for (Int_t digit=0;digit<ndigits;digit++) {
913 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
915 // First get all needed parameters
917 Int_t charge=mdig->fSignal;
918 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
919 Int_t color=261+index;
920 Int_t colorTrigger=2;
921 if (color>282) color=282;
923 if (chamber > 10) { // trigger chamber
925 for (Int_t icharge=0; icharge<10; icharge++) {
926 sumCharge=sumCharge+mdig->fTcharges[icharge];
928 Int_t testCharge=sumCharge-(Int_t(sumCharge/10))*10;
929 if(sumCharge<=10||testCharge>0) {
936 // get the center of the pad - add on x and y half of pad size
938 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
940 Int_t isec=segmentation->Sector(mdig->fPadX, mdig->fPadY);
941 Float_t dpx=segmentation->Dpx(isec)/2;
942 Float_t dpy=segmentation->Dpy(isec)/2;
944 segmentation->GetNParallelAndOffset(mdig->fPadX,mdig->fPadY,
947 // Then set the objects
949 points = new AliMUONPoints(npoints);
950 fPoints->AddAt(points,digit);
952 points->SetMarkerColor(colorTrigger);
954 points->SetMarkerColor(color);
956 points->SetMarkerStyle(21);
957 points->SetMarkerSize(0.5);
958 points->SetParticle(-1);
959 points->SetHitIndex(-1);
960 points->SetTrackIndex(-1);
961 points->SetDigitIndex(digit);
962 points->SetPoint(0,xpad,ypad,zpos);
963 for (Int_t imark=0;imark<nPara; imark++)
965 segmentation->GetPadCxy(mdig->fPadX + imark*offset, mdig->fPadY,xpad, ypad);
966 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
967 marker->SetLineColor(2);
968 marker->SetFillStyle(1001);
969 marker->SetFillColor(color);
970 marker->SetRefObject((TObject*)points);
971 points->Set3DMarker(imark, marker);
975 //___________________________________________
976 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t cathode)
978 // Read raw clusters info and store x,y,z info in arrays fRpoints
979 // Loop on all detectors
981 if (chamber > 10) return;
985 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
986 AliMUONChamber* iChamber;
988 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
989 if (muonRawClusters == 0) return;
991 pMUON->ResetRawClusters();
994 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
995 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
996 Int_t nrawcl = muonRawClusters->GetEntriesFast();
997 if (nrawcl == 0) return;
998 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
1000 iChamber = &(pMUON->Chamber(chamber-1));
1001 Float_t zpos=iChamber->Z();
1002 AliMUONRawCluster *mRaw;
1003 AliMUONPoints *points = 0;
1005 //loop over all raw clusters and store their position
1006 points = new AliMUONPoints(nrawcl);
1007 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1008 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1009 fRpoints->AddAt(points,iraw);
1010 points->SetMarkerColor(51);
1011 points->SetMarkerStyle(2);
1012 points->SetMarkerSize(1.);
1013 points->SetParticle(-1);
1014 points->SetHitIndex(-1);
1015 points->SetTrackIndex(-1);
1016 points->SetDigitIndex(-1);
1017 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1020 //___________________________________________
1021 void AliMUONDisplay::LoadCoG2(Int_t chamber, Int_t cathode)
1023 // Read raw clusters info and store x,y,z info in arrays fRpoints
1024 // Loop on all detectors
1026 if (chamber > 10) return;
1030 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1031 AliMUONChamber* iChamber;
1033 TClonesArray *muonRawClusters = pMUON->RawClustAddress(chamber-1);
1034 if (muonRawClusters == 0) return;
1036 pMUON->ResetRawClusters();
1038 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
1039 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
1040 Int_t nrawcl = muonRawClusters->GetEntriesFast();
1041 if (nrawcl == 0) return;
1042 if (fR2points == 0) fR2points = new TObjArray(nrawcl);
1044 iChamber = &(pMUON->Chamber(chamber-1));
1045 Float_t zpos=iChamber->Z();
1046 AliMUONRawCluster *mRaw;
1047 AliMUONPoints *points = 0;
1049 //loop over all raw clusters and store their position
1050 points = new AliMUONPoints(nrawcl);
1051 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
1052 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
1053 fR2points->AddAt(points,iraw);
1054 points->SetMarkerColor(51);
1055 points->SetMarkerStyle(4);
1056 points->SetMarkerSize(1.3);
1057 points->SetParticle(-1);
1058 points->SetHitIndex(-1);
1059 points->SetTrackIndex(-1);
1060 points->SetDigitIndex(-1);
1061 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
1064 //___________________________________________
1065 void AliMUONDisplay::LoadHits(Int_t chamber)
1067 // Read hits info and store x,y,z info in arrays fPhits
1068 // Loop on all detectors
1070 if (chamber > 14) return;
1077 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1078 AliMUONChamber* iChamber;
1080 iChamber = &(pMUON->Chamber(chamber-1));
1081 Float_t zpos=iChamber->Z();
1083 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1085 for (track=0; track<ntracks;track++) {
1086 gAlice->ResetHits();
1087 gAlice->TreeH()->GetEvent(track);
1088 TClonesArray *muonHits = pMUON->Hits();
1089 if (muonHits == 0) return;
1090 nthits += muonHits->GetEntriesFast();
1092 if (fPhits == 0) fPhits = new TObjArray(nthits);
1094 for (track=0; track<ntracks;track++) {
1095 gAlice->ResetHits();
1096 gAlice->TreeH()->GetEvent(track);
1097 TClonesArray *muonHits = pMUON->Hits();
1098 if (muonHits == 0) return;
1099 Int_t nhits = muonHits->GetEntriesFast();
1100 if (nhits == 0) continue;
1102 AliMUONPoints *points = 0;
1104 for (Int_t hit=0;hit<nhits;hit++) {
1105 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
1106 Int_t nch = mHit->fChamber; // chamber number
1107 if (nch != chamber) continue;
1109 // Retrieve info and set the objects
1111 points = new AliMUONPoints(npoints);
1112 fPhits->AddAt(points,nhold+hit);
1113 points->SetMarkerColor(kRed);
1114 points->SetMarkerStyle(5);
1115 points->SetMarkerSize(1.);
1116 points->SetParticle(mHit->fTrack);
1117 points->SetHitIndex(hit);
1118 points->SetTrackIndex(track);
1119 points->SetDigitIndex(-1);
1120 points->SetPoint(0,mHit->fX,mHit->fY,zpos);
1126 //_____________________________________________________________________________
1127 void AliMUONDisplay::Paint(Option_t *)
1129 // Paint miscellaneous items
1132 //_____________________________________________________________________________
1133 void AliMUONDisplay::SetPickMode()
1135 // Set parameters for pick mode.
1139 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1140 fTrigPad->Modified();
1143 //_____________________________________________________________________________
1144 void AliMUONDisplay::SetZoomMode()
1146 // Set parameters for zoom mode
1149 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1150 fTrigPad->Modified();
1153 //_____________________________________________________________________________
1154 void AliMUONDisplay::NextChamber(Int_t delta)
1156 // to go from chamber to next chamber if delta = 1
1157 // or previous chamber otherwise
1159 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1161 if (fChamber > 1) fChamber--;
1165 LoadDigits(fChamber, fCathode);
1169 //_____________________________________________________________________________
1170 void AliMUONDisplay::NextCathode()
1172 // to switch to other cathode plane
1175 if (fCathode == 1) {
1176 LoadDigits(fChamber, 2);
1178 LoadDigits(fChamber, 1);
1180 fNextCathode = kTRUE; // to keep the same zoom
1182 fNextCathode = kFALSE;
1183 TPad *pad = (TPad*)gPad->GetPadSave();
1184 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1185 fZoomX1[fZooms], fZoomY1[fZooms]);
1191 //_____________________________________________________________________________
1192 void AliMUONDisplay::Trigger()
1194 // returns Trigger Decision for current event
1195 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1196 decision->Trigger();
1200 //_____________________________________________________________________________
1201 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1203 // Set chamber and cathode number
1209 LoadDigits(chamber,cathode);
1213 void AliMUONDisplay::SetEvent(Int_t newevent)
1216 gAlice->GetEvent(newevent);
1218 if (!gAlice->TreeD()) return;
1221 LoadDigits(fChamber,fCathode);
1225 //_____________________________________________________________________________
1226 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1228 // Set view range along R and Z
1237 //_____________________________________________________________________________
1238 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1240 // change viewing angles for current event
1248 TView *view = gPad->GetView();
1249 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1254 //_____________________________________________________________________________
1255 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1257 // Display (current event_number + delta)
1258 // delta = 1 shown next event
1259 // delta = -1 show previous event
1262 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1263 Int_t newEvent = currentEvent + delta;
1264 gAlice->GetEvent(newEvent);
1266 if (!gAlice->TreeD()) return;
1269 LoadDigits(fChamber, fCathode);
1274 //______________________________________________________________________________
1275 void AliMUONDisplay::UnZoom()
1278 if (fZooms <= 0) return;
1280 TPad *pad = (TPad*)gPad->GetPadSave();
1281 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1285 //_____________________________________________________________________________
1286 void AliMUONDisplay::ResetPoints()
1289 // Reset array of points
1297 //_____________________________________________________________________________
1298 void AliMUONDisplay::ResetPhits()
1301 // Reset array of points
1309 //_____________________________________________________________________________
1310 void AliMUONDisplay::ResetRpoints()
1313 // Reset array of points
1321 //_____________________________________________________________________________
1322 void AliMUONDisplay::ResetR2points()
1325 // Reset array of points
1328 fR2points->Delete();
1333 //_____________________________________________________________________________
1334 void AliMUONDisplay::ResetCpoints()
1337 // Reset array of points
1347 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1349 // Dummy assignment operator