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.9 1999/11/09 07:38:51 fca
19 Changes for compatibility with version 2.23 of ROOT
21 Revision 1.8 1999/09/29 09:24:23 fca
22 Introduction of the Copyright and cvs Log
27 //////////////////////////////////////////////////////////////////////////
31 // Utility class to display ALICE outline, tracks, hits,.. //
33 //////////////////////////////////////////////////////////////////////////
42 #include <TPolyMarker3D.h>
43 #include <TPaveLabel.h>
44 #include <TPaveText.h>
51 #include <TSliderBox.h>
53 #include <TVirtualX.h>
56 #include <X3DBuffer.h>
59 #include "AliDetector.h"
61 #include "AliMUONConst.h"
62 #include "AliMUONdisplay.h"
63 #include "AliMUONpoints.h"
64 #include "TParticle.h"
68 ClassImp(AliMUONdisplay)
71 //_____________________________________________________________________________
72 AliMUONdisplay::AliMUONdisplay()
82 //_____________________________________________________________________________
83 AliMUONdisplay::AliMUONdisplay(Int_t size)
85 // Create an event display object.
86 // A canvas named "edisplay" is created with a vertical size in pixels
88 // A QUICK Overview of the Event Display functions
89 // ===============================================
91 // The event display can ve invoked by executing the macro "display.C"
92 // A canvas like in the picture below will appear.
94 // On the left side of the canvas, the following buttons appear:
95 // *Next* to move to the next event
96 // *Previous* to move to the previous event
98 // *Pick* Select this option to be able to point on a track with the
99 // mouse. Once on the track, use the right button to select
100 // an action. For example, select SetMarkerAttributes to
101 // change the marker type/color/size for the track.
102 // *Zoom* Select this option (default) if you want to zoom.
103 // To zoom, simply select the selected area with the left button.
104 // *UnZoom* To revert to the previous picture size.
106 // slider R On the left side, the vertical slider can be used to
107 // set the default picture size.
109 // When you are in Zoom mode, you can click on the black part of the canvas
110 // to select special options with the right mouse button.
113 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
114 // When you are on a track, select the menu item "InspectParticle"
115 // to display the current particle attributes.
117 // You can activate the Root browser by selecting the Inspect menu
118 // in the canvas tool bar menu. Then select "Start Browser"
119 // This will open a new canvas with the browser. At this point, you may want
120 // to display some histograms (from the Trees). Go to the "File" menu
121 // of the browser and click on "New canvas".
122 // In the browser, click on item "ROOT files" in the left pane.
123 // Click on galice.root.
125 // Click on TPC for example
126 // Click on any variable (eg TPC.fX) to histogram the variable.
128 // If you are lost, you can click on HELP in any Root canvas or browser.
131 <img src="gif/aliMUONdisplay.gif">
138 gAlice->SetDisplay(this);
140 // Initialize display default parameters
142 // Set front view by default
149 fDrawClusters = kTRUE;
152 fDrawCathCor = kTRUE;
163 // Create display canvas
165 if (ysize < 100) ysize = 750;
166 Int_t xsize = Int_t(size*830./ysize);
167 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
168 fCanvas->ToggleEventStatus();
170 // Create main display pad
171 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
174 fPad->SetFillColor(1);
175 fPad->SetBorderSize(2);
180 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
183 fColPad->SetFillColor(19);
184 fColPad->SetBorderSize(2);
190 // Create user interface control pad
194 // Create Range and mode pad
197 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
198 fTrigPad->SetEditable(kFALSE);
201 fTrigPad->SetFillColor(22);
202 fTrigPad->SetBorderSize(2);
203 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
204 fRangeSlider->SetObject(this);
205 char pickmode[] = "gAlice->Display()->SetPickMode()";
207 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
208 fPickButton->SetFillColor(38);
210 char zoommode[] = "gAlice->Display()->SetZoomMode()";
211 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
212 fZoomButton->SetFillColor(38);
214 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
215 fArcButton->SetFillColor(kGreen);
217 char butUnzoom[] = "gAlice->Display()->UnZoom()";
218 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
219 button->SetFillColor(38);
221 AppendPad(); // append display object as last object to force selection
228 //_____________________________________________________________________________
229 AliMUONdisplay::~AliMUONdisplay()
231 // Delete space point structure
232 if (fPoints) fPoints->Delete();
236 if (fPhits) fPhits->Delete();
240 if (fRpoints) fRpoints->Delete();
244 if (fR2points) fR2points->Delete();
248 if (fCpoints) fCpoints->Delete();
253 //_____________________________________________________________________________
254 void AliMUONdisplay::Clear(Option_t *)
256 // Delete graphics temporary objects
259 //_____________________________________________________________________________
260 void AliMUONdisplay::DisplayButtons()
262 // Create the user interface buttons
265 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
266 fButtons->SetEditable(kFALSE);
268 fButtons->SetFillColor(38);
269 fButtons->SetBorderSize(2);
272 // Int_t butcolor = 33;
273 Float_t dbutton = 0.08;
280 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
281 button = new TButton("Next",but1,x0,y-dbutton,x1,y);
282 button->SetFillColor(38);
286 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
287 button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
288 button->SetFillColor(38);
292 char but3[] = "gAlice->Display()->SetChamberAndCathode(1,1)";
293 button = new TButton("Cham&Cath",but3,x0,y-dbutton,x1,y);
294 button->SetFillColor(butcolor);
298 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
299 diamond->SetFillColor(50);
300 diamond->SetTextAlign(22);
301 diamond->SetTextColor(5);
302 diamond->SetTextSize(0.11);
304 diamond->AddText(".. ");
305 diamond->AddText("ROOT");
306 diamond->AddText("MUON");
307 diamond->AddText("... ");
308 diamond->AddText(" ");
311 //_____________________________________________________________________________
312 void AliMUONdisplay::CreateColors()
314 // Create the colors palette used to display clusters
329 new TColor(color,r,g,b);
339 new TColor(color,r,g,b);
349 new TColor(color,r,g,b);
359 new TColor(color,r,g,b);
369 new TColor(color,r,g,b);
378 //_____________________________________________________________________________
379 void AliMUONdisplay::DisplayColorScale()
384 Float_t xlow, ylow, xup, yup, hs;
385 Float_t x1, y1, x2, y2;
389 gPad->SetFillColor(0);
391 gPad->Range(x1,y1,x2,y2);
393 TText *text = new TText(0,0,"");
394 text->SetTextFont(61);
395 text->SetTextSize(0.2);
396 text->SetTextAlign(22);
398 AliMUON *MUON = (AliMUON*)gAlice->GetModule("MUON");
399 AliMUONchamber *iChamber = &(MUON->Chamber(fChamber-1));
400 AliMUONresponse * response=iChamber->GetResponseModel();
401 Int_t adcmax= (Int_t) response->MaxAdc();
406 //*-* draw colortable boxes
407 hs = (y2-y1)/Float_t(22);
411 ylow = y1 + hs*(Float_t(i));
412 yup = y1 + hs*(Float_t(i+1));
414 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
415 Int_t scale=(Int_t)TMath::Exp(logscale);
416 sprintf(label,"%d",scale);
417 box = new TBox(xlow, ylow, xup, yup);
418 box->SetFillColor(color);
420 text->DrawText(xup+4, 0.5*(ylow+yup),label);
424 //______________________________________________________________________________
425 Int_t AliMUONdisplay::DistancetoPrimitive(Int_t px, Int_t)
427 // Compute distance from point px,py to objects in event
429 gPad->SetCursor(kCross);
431 if (gPad == fTrigPad) return 9999;
433 const Int_t big = 9999;
435 Float_t xmin = gPad->GetX1();
436 Float_t xmax = gPad->GetX2();
437 Float_t dx = 0.02*(xmax - xmin);
438 Float_t x = gPad->AbsPixeltoX(px);
439 if (x < xmin+dx || x > xmax-dx) return dist;
441 if (fZoomMode) return 0;
445 //_____________________________________________________________________________
446 void AliMUONdisplay::Draw(Option_t *)
448 // Display current event
452 DrawView(fTheta, fPhi, fPsi);
453 // Display the event number and title
459 //_____________________________________________________________________________
460 void AliMUONdisplay::DrawClusters()
462 // Draw clusterss for MUON chambers
464 Int_t ndigits, digit;
472 ndigits = points->GetEntriesFast();
473 for (digit=0;digit<ndigits;digit++){
474 pm = (AliMUONpoints*)points->UncheckedAt(digit);
478 for (Int_t im=0;im<3;im++) {
479 TMarker3DBox *marker=pm->GetMarker(im);
484 fClustersCuts +=pm->GetN();
489 //_____________________________________________________________________________
490 void AliMUONdisplay::DrawHits()
492 // Draw hits for MUON chambers
496 Int_t ntracks, track;
503 ntracks = points->GetEntriesFast();
504 for (track=0;track<ntracks;track++) {
505 pm = (AliMUONpoints*)points->UncheckedAt(track);
508 fHitsCuts += pm->GetN();
513 //_____________________________________________________________________________
514 void AliMUONdisplay::DrawCoG()
516 // Draw hits for MUON chambers
517 if (!fDrawCoG) return;
518 LoadCoG(fChamber,fCathode);
526 ncog = points->GetEntriesFast();
527 for (icog=0;icog<ncog;icog++) {
528 pm = (AliMUONpoints*)points->UncheckedAt(icog);
533 void AliMUONdisplay::DrawCoG2()
535 // Draw hits for MUON chambers
537 if (!fDrawCoG) return;
541 LoadCoG2(fChamber,2);
542 } else if (fCathode==2) {
543 LoadCoG2(fChamber,1);
552 ncog = points->GetEntriesFast();
553 for (icog=0;icog<ncog;icog++) {
554 pm = (AliMUONpoints*)points->UncheckedAt(icog);
560 //_____________________________________________________________________________
561 void AliMUONdisplay::DrawCathCor()
563 // Draw hits for MUON chambers
565 if (!fDrawCathCor) return;
567 LoadCathCor(fChamber);
575 ncog = points->GetEntriesFast();
576 for (icog=0;icog<ncog;icog++) {
577 pm = (AliMUONpoints*)points->UncheckedAt(icog);
582 //_____________________________________________________________________________
583 //_____________________________________________________________________________
584 void AliMUONdisplay::DrawTitle(Option_t *option)
586 // Draw the event title
588 Float_t xmin = gPad->GetX1();
589 Float_t xmax = gPad->GetX2();
590 Float_t ymin = gPad->GetY1();
591 Float_t ymax = gPad->GetY2();
592 Float_t dx = xmax-xmin;
593 Float_t dy = ymax-ymin;
595 if (strlen(option) == 0) {
596 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
597 title->SetBit(kCanDelete);
598 title->SetFillColor(42);
601 sprintf(ptitle,"Alice event: %d, Run:%d",gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
602 title->AddText(ptitle);
603 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
604 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",nparticles, fHitsCuts,fClustersCuts);
605 title->AddText(ptitle);
607 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
608 label->SetBit(kCanDelete);
609 label->SetFillColor(42);
614 //_____________________________________________________________________________
615 void AliMUONdisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
617 // Draw a view of MUON clusters
619 gPad->SetCursor(kWatch);
620 gPad->SetFillColor(1);
624 TView *view = new TView(1);
626 Float_t range = fRrange*fRangeSlider->GetMaximum();
627 view->SetRange(-range,-range,-range,range, range, range);
634 // Display MUON Chamber Geometry
635 // gAlice->GetGeometry()->Draw("same");
637 sprintf(NodeName,"MUON%d",100+fChamber);
638 printf("Node name %s", NodeName);
640 TNode *node1=gAlice->GetGeometry()->GetNode(NodeName);
641 if (node1) node1->Draw("same");
642 // ok if I rotate the chamber in a proper way
644 //add clusters to the pad
650 // add itself to the list (must be last)
652 view->SetView(phi, theta, psi, iret);
656 //______________________________________________________________________________
657 void AliMUONdisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
659 // Execute action corresponding to the mouse event
661 static Float_t x0, y0, x1, y1;
663 static Int_t pxold, pyold;
664 static Int_t px0, py0;
665 static Int_t linedrawn;
668 if (px == 0 && py == 0) { //when called by sliders
669 if (event == kButton1Up) {
674 if (!fZoomMode && gPad->GetView()) {
675 gPad->GetView()->ExecuteRotateView(event, px, py);
679 // something to zoom ?
680 gPad->SetCursor(kCross);
685 gVirtualX->SetLineColor(-1);
686 gPad->TAttLine::Modify(); //Change line attributes only if necessary
687 x0 = gPad->AbsPixeltoX(px);
688 y0 = gPad->AbsPixeltoY(py);
690 pxold = px; pyold = py;
695 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
699 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
703 gPad->GetCanvas()->FeedbackMode(kFALSE);
704 if (px == px0) return;
705 if (py == py0) return;
706 x1 = gPad->AbsPixeltoX(px);
707 y1 = gPad->AbsPixeltoY(py);
709 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
710 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
711 gPad->Range(x0,y0,x1,y1);
712 if (fZooms < kMAXZOOM-1) {
714 fZoomX0[fZooms] = x0;
715 fZoomY0[fZooms] = y0;
716 fZoomX1[fZooms] = x1;
717 fZoomY1[fZooms] = y1;
719 gPad->Modified(kTRUE);
725 //___________________________________________
726 void AliMUONdisplay::LoadDigits(Int_t chamber, Int_t cathode)
728 // Read digits info and store x,y,z info in arrays fPoints
729 // Loop on all detectors
731 if (chamber > 10) return;
738 AliMUON *MUON = (AliMUON*)gAlice->GetModule("MUON");
739 AliMUONchamber* iChamber;
740 AliMUONsegmentation* segmentation;
742 TClonesArray *MUONdigits = MUON->DigitsAddress(chamber-1);
743 if (MUONdigits == 0) return;
745 gAlice->ResetDigits();
747 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
748 gAlice->TreeD()->GetEvent(nent-2+cathode-1);
749 //gAlice->TreeD()->GetEvent(cathode);
750 Int_t ndigits = MUONdigits->GetEntriesFast();
751 if (ndigits == 0) return;
752 if (fPoints == 0) fPoints = new TObjArray(ndigits);
754 iChamber = &(MUON->Chamber(chamber-1));
755 segmentation=iChamber->GetSegmentationModel(cathode);
756 //Float_t dpxbig = segmentation->Dpx()/2.;
757 // Float_t dpy = segmentation->Dpy()/2.;
758 Float_t zpos=iChamber->ZPosition();
760 AliMUONpoints *points = 0;
761 TMarker3DBox *marker=0;
764 //loop over all digits and store their position
765 // points = new AliMUONpoints(ndigits);
767 for (Int_t digit=0;digit<ndigits;digit++) {
768 mdig = (AliMUONdigit*)MUONdigits->UncheckedAt(digit);
770 // First get all needed parameters
772 Int_t charge=mdig->fSignal;
773 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
774 Int_t color=261+index;
775 if (color>282) color=282;
776 // get the center of the pad - add on x and y half of pad size
778 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
779 // printf("xpad,ypad,zpos,dpx,dpy %f %f %f %f %f\n",xpad,ypad,zpos,dpx,dpy);
780 Int_t isec=segmentation->Sector(mdig->fPadX, mdig->fPadY);
781 // printf(" isec %d \n",isec);
782 Float_t dpx=segmentation->Dpx(isec)/2;
783 Float_t dpy=segmentation->Dpy(isec)/2;
784 // printf(" dpx %f \n",dpx);
786 segmentation->GetNParallelAndOffset(mdig->fPadX,mdig->fPadY,
789 // Then set the objects
791 points = new AliMUONpoints(npoints);
792 fPoints->AddAt(points,digit);
794 points->SetMarkerColor(color);
795 points->SetMarkerStyle(21);
796 points->SetMarkerSize(0.5);
797 points->SetParticle(-1);
798 points->SetHitIndex(-1);
799 points->SetTrackIndex(-1);
800 points->SetDigitIndex(digit);
801 points->SetPoint(0,xpad,ypad,zpos);
802 for (Int_t imark=0;imark<nPara; imark++)
804 segmentation->GetPadCxy(mdig->fPadX + imark*offset, mdig->fPadY,xpad, ypad);
805 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
806 marker->SetLineColor(2);
807 marker->SetFillStyle(1001);
808 marker->SetFillColor(color);
809 marker->SetRefObject((TObject*)points);
810 points->Set3DMarker(imark, marker);
815 //___________________________________________
816 void AliMUONdisplay::LoadCoG(Int_t chamber, Int_t cathode)
818 // Read raw clusters info and store x,y,z info in arrays fRpoints
819 // Loop on all detectors
821 if (chamber > 10) return;
825 AliMUON *MUON = (AliMUON*)gAlice->GetModule("MUON");
826 AliMUONchamber* iChamber;
828 TClonesArray *MUONrawclust = MUON->RawClustAddress(chamber-1);
829 if (MUONrawclust == 0) return;
831 MUON->ResetRawClusters();
834 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
835 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
836 //gAlice->TreeR()->GetEvent(cathode);
837 Int_t nrawcl = MUONrawclust->GetEntriesFast();
838 if (nrawcl == 0) return;
839 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
841 iChamber = &(MUON->Chamber(chamber-1));
842 Float_t zpos=iChamber->ZPosition();
843 AliMUONRawCluster *mRaw;
844 AliMUONpoints *points = 0;
846 //loop over all raw clusters and store their position
847 points = new AliMUONpoints(nrawcl);
848 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
849 mRaw = (AliMUONRawCluster*)MUONrawclust->UncheckedAt(iraw);
850 fRpoints->AddAt(points,iraw);
851 points->SetMarkerColor(51);
852 points->SetMarkerStyle(2);
853 points->SetMarkerSize(1.);
854 points->SetParticle(-1);
855 points->SetHitIndex(-1);
856 points->SetTrackIndex(-1);
857 points->SetDigitIndex(-1);
858 points->SetPoint(iraw,mRaw->fX,mRaw->fY,zpos);
861 //___________________________________________
862 void AliMUONdisplay::LoadCoG2(Int_t chamber, Int_t cathode)
864 // Read raw clusters info and store x,y,z info in arrays fRpoints
865 // Loop on all detectors
867 if (chamber > 10) return;
871 AliMUON *MUON = (AliMUON*)gAlice->GetModule("MUON");
872 AliMUONchamber* iChamber;
874 TClonesArray *MUONrawclust = MUON->RawClustAddress(chamber-1);
875 if (MUONrawclust == 0) return;
877 MUON->ResetRawClusters();
879 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
880 gAlice->TreeR()->GetEvent(nent-2+cathode-1);
881 //gAlice->TreeR()->GetEvent(cathode);
882 Int_t nrawcl = MUONrawclust->GetEntriesFast();
883 if (nrawcl == 0) return;
884 if (fR2points == 0) fR2points = new TObjArray(nrawcl);
886 iChamber = &(MUON->Chamber(chamber-1));
887 Float_t zpos=iChamber->ZPosition();
888 AliMUONRawCluster *mRaw;
889 AliMUONpoints *points = 0;
891 //loop over all raw clusters and store their position
892 points = new AliMUONpoints(nrawcl);
893 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
894 mRaw = (AliMUONRawCluster*)MUONrawclust->UncheckedAt(iraw);
895 fR2points->AddAt(points,iraw);
896 points->SetMarkerColor(51);
897 points->SetMarkerStyle(4);
898 points->SetMarkerSize(1.3);
899 points->SetParticle(-1);
900 points->SetHitIndex(-1);
901 points->SetTrackIndex(-1);
902 points->SetDigitIndex(-1);
903 points->SetPoint(iraw,mRaw->fX,mRaw->fY,zpos);
906 //___________________________________________
907 void AliMUONdisplay::LoadCathCor(Int_t chamber)
909 // Read correlation info and store x,y,z info in arrays fCpoints
910 // Loop on all detectors
912 if (chamber > 10) return;
916 AliMUON *MUON = (AliMUON*)gAlice->GetModule("MUON");
917 AliMUONchamber* iChamber;
918 iChamber = &(MUON->Chamber(chamber-1));
919 Float_t zpos=iChamber->ZPosition(); // check with Andreas
923 MUON->GetTreeC(fEvent);
924 TTree *TC=MUON->TreeC();
926 // Int_t nent=(Int_t)TC->GetEntries();
928 TClonesArray *MUONcorrel = MUON->CathCorrelAddress(chamber-1);
929 if (MUONcorrel == 0) return;
931 MUON->ResetCorrelation();
934 Int_t ncor = MUONcorrel->GetEntries();
936 if (!fCpoints) fCpoints = new TObjArray(ncor);
938 AliMUONcorrelation *mCor;
939 AliMUONpoints *points = 0;
941 //loop over all raw clusters and store their position
942 points = new AliMUONpoints(ncor);
943 for (Int_t icor=0;icor<ncor;icor++) {
944 mCor = (AliMUONcorrelation*)MUONcorrel->UncheckedAt(icor);
945 fCpoints->AddAt(points,icor);
946 points->SetMarkerColor(4);
947 points->SetMarkerStyle(4);
948 points->SetMarkerSize(0.8);
949 points->SetParticle(-1);
950 points->SetHitIndex(-1);
951 points->SetTrackIndex(-1);
952 points->SetDigitIndex(-1);
953 points->SetPoint(icor,mCor->fX[0],mCor->fY[0],zpos);
957 //___________________________________________
958 void AliMUONdisplay::LoadHits(Int_t chamber)
960 // Read hits info and store x,y,z info in arrays fPhits
961 // Loop on all detectors
963 if (chamber > 10) return;
970 AliMUON *MUON = (AliMUON*)gAlice->GetModule("MUON");
971 AliMUONchamber* iChamber;
973 iChamber = &(MUON->Chamber(chamber-1));
974 Float_t zpos=iChamber->ZPosition();
976 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
977 //Int_t ntrks = gAlice->GetNtrack();
981 for (track=0; track<ntracks;track++) {
983 gAlice->TreeH()->GetEvent(track);
984 TClonesArray *MUONhits = MUON->Hits();
985 if (MUONhits == 0) return;
986 nthits += MUONhits->GetEntriesFast();
988 if (fPhits == 0) fPhits = new TObjArray(nthits);
989 //printf("nthits %d \n",nthits);
993 //if (fPhits == 0) fPhits = new TObjArray(ntracks);
995 TVector *xp = new TVector(20);
996 TVector *yp = new TVector(20);
997 // TVector *zp = new TVector(20);
998 TVector *ptrk = new TVector(20);
999 TVector *phit = new TVector(20);
1004 for (track=0; track<ntracks;track++) {
1005 gAlice->ResetHits();
1006 gAlice->TreeH()->GetEvent(track);
1007 TClonesArray *MUONhits = MUON->Hits();
1008 if (MUONhits == 0) return;
1009 Int_t nhits = MUONhits->GetEntriesFast();
1010 if (nhits == 0) continue;
1012 AliMUONpoints *points = 0;
1014 for (Int_t hit=0;hit<nhits;hit++) {
1015 mHit = (AliMUONhit*)MUONhits->UncheckedAt(hit);
1016 Int_t nch = mHit->fChamber; // chamber number
1017 if (nch != chamber) continue;
1019 // Retrieve info and set the objects
1021 points = new AliMUONpoints(npoints);
1022 fPhits->AddAt(points,nhold+hit);
1023 points->SetMarkerColor(kRed);
1024 points->SetMarkerStyle(5);
1025 points->SetMarkerSize(1.);
1026 points->SetParticle(mHit->fTrack);
1027 points->SetHitIndex(hit);
1028 points->SetTrackIndex(track);
1029 points->SetDigitIndex(-1);
1030 points->SetPoint(0,mHit->fX,mHit->fY,zpos);
1038 for (Int_t hit=0;hit<nhits;hit++) {
1039 mHit = (AliMUONhit*)MUONhits->UncheckedAt(hit);
1040 Int_t nch = mHit->fChamber; // chamber number
1041 if (nch != chamber) continue;
1043 (*xp)(npoints)=mHit->fX;
1044 (*yp)(npoints)=mHit->fY;
1045 // (*zp)(npoints)=mHit->fZ;
1046 (*ptrk)(npoints)=Float_t(mHit->GetTrack());
1047 //(*ptrk)(npoints)=Float_t(mHit->fTrack);
1048 (*phit)(npoints)=Float_t(hit);
1049 printf("hit,(*phit)(npoints), track, trk, fTrack ipart %d %f %d %d %d %f\n",hit,(*phit)(npoints),track,mHit->GetTrack(),mHit->fTrack,mHit->fParticle);
1052 if (npoints == 0) continue;
1053 // printf("npoints %d \n",npoints);
1054 points = new AliMUONpoints(npoints);
1055 for (Int_t p=0;p<npoints;p++) {
1056 points->SetMarkerColor(kRed);
1057 points->SetMarkerStyle(5);
1058 points->SetMarkerSize(1.);
1059 points->SetParticle(Int_t((*ptrk)(p)));
1060 Int_t index=points->GetIndex();
1061 points->SetHitIndex(Int_t((*phit)(p)));
1062 points->SetTrackIndex(track);
1063 printf("p, index, Int_t((*ptrk)(p)), hit, track %d %d %d %d %d \n",p, index,Int_t((*ptrk)(p)),Int_t((*phit)(p)),track);
1064 points->SetDigitIndex(-1);
1065 points->SetPoint(p,(*xp)(p),(*yp)(p),zpos);
1066 // points->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
1073 fPhits->AddAt(points,track);
1074 // Int_t np=points->GetN();
1075 // printf("np %d \n",np);
1085 //_____________________________________________________________________________
1086 void AliMUONdisplay::Paint(Option_t *)
1088 // Paint miscellaneous items
1092 //_____________________________________________________________________________
1093 void AliMUONdisplay::SetPickMode()
1097 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1098 fTrigPad->Modified();
1101 //_____________________________________________________________________________
1102 void AliMUONdisplay::SetZoomMode()
1106 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1107 fTrigPad->Modified();
1110 //_____________________________________________________________________________
1111 void AliMUONdisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1113 // Set chamber and cathode number
1119 LoadDigits(chamber,cathode);
1123 //_____________________________________________________________________________
1124 void AliMUONdisplay::SetRange(Float_t rrange, Float_t zrange)
1126 // Set view range along R and Z
1135 //_____________________________________________________________________________
1136 void AliMUONdisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1138 // change viewing angles for current event
1146 TView *view = gPad->GetView();
1147 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1153 //_____________________________________________________________________________
1154 void AliMUONdisplay::ShowNextEvent(Int_t delta)
1156 // Display (current event_number+delta)
1157 // delta = 1 shown next event
1158 // delta = -1 show previous event
1161 Int_t current_event = gAlice->GetHeader()->GetEvent();
1162 Int_t new_event = current_event + delta;
1163 gAlice->GetEvent(new_event);
1165 if (!gAlice->TreeD()) return;
1167 LoadDigits(fChamber,fCathode);
1172 //______________________________________________________________________________
1173 void AliMUONdisplay::UnZoom()
1175 if (fZooms <= 0) return;
1177 TPad *pad = (TPad*)gPad->GetPadSave();
1178 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1182 //_____________________________________________________________________________
1183 void AliMUONdisplay::ResetPoints()
1186 // Reset array of points
1194 //_____________________________________________________________________________
1195 void AliMUONdisplay::ResetPhits()
1198 // Reset array of points
1206 //_____________________________________________________________________________
1207 void AliMUONdisplay::ResetRpoints()
1210 // Reset array of points
1218 //_____________________________________________________________________________
1219 void AliMUONdisplay::ResetR2points()
1222 // Reset array of points
1225 fR2points->Delete();
1230 //_____________________________________________________________________________
1231 void AliMUONdisplay::ResetCpoints()
1234 // Reset array of points