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 //////////////////////////////////////////////////////////////////////////
22 // Utility class to display ALICE outline, tracks, hits,.. //
24 //////////////////////////////////////////////////////////////////////////
31 #include <TPaveLabel.h>
32 #include <TPaveText.h>
37 #include <TVirtualX.h>
39 #include <TGeometry.h>
40 #include <TMarker3DBox.h>
42 #include "AliMUONDisplay.h"
45 #include "AliMUONPoints.h"
46 #include "AliMUONGlobalTrigger.h"
47 #include "AliHeader.h"
49 #include "AliMUONHit.h"
50 #include "AliMUONDigit.h"
51 #include "AliMUONRawCluster.h"
53 #include "AliSegmentation.h"
54 #include "AliMUONResponse.h"
55 #include "AliMUONChamber.h"
56 #include "AliMUONConstants.h"
58 // to manage the same zoom on both cathodes
62 ClassImp(AliMUONDisplay)
65 //_____________________________________________________________________________
66 AliMUONDisplay::AliMUONDisplay()
74 fNextCathode = kFALSE;
78 //_____________________________________________________________________________
79 AliMUONDisplay::AliMUONDisplay(Int_t size, AliLoader * loader)
82 // Create an event display object.
83 // A canvas named "edisplay" is created with a vertical size in pixels
85 // A QUICK Overview of the Event Display functions
86 // ===============================================
88 // The event display can ve invoked by executing the macro "display.C"
89 // A canvas like in the picture below will appear.
91 // On the left side of the canvas, the following buttons appear:
92 // *Next* to move to the next event
93 // *Previous* to move to the previous event
95 // *Pick* Select this option to be able to point on a track with the
96 // mouse. Once on the track, use the right button to select
97 // an action. For example, select SetMarkerAttributes to
98 // change the marker type/color/size for the track.
99 // *Zoom* Select this option (default) if you want to zoom.
100 // To zoom, simply select the selected area with the left button.
101 // *UnZoom* To revert to the previous picture size.
103 // slider R On the left side, the vertical slider can be used to
104 // set the default picture size.
106 // When you are in Zoom mode, you can click on the black part of the canvas
107 // to select special options with the right mouse button.
110 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
111 // When you are on a track, select the menu item "InspectParticle"
112 // to display the current particle attributes.
114 // You can activate the Root browser by selecting the Inspect menu
115 // in the canvas tool bar menu. Then select "Start Browser"
116 // This will open a new canvas with the browser. At this point, you may want
117 // to display some histograms (from the Trees). Go to the "File" menu
118 // of the browser and click on "New canvas".
119 // In the browser, click on item "ROOT files" in the left pane.
120 // Click on galice.root.
122 // Click on TPC for example
123 // Click on any variable (eg TPC.fX) to histogram the variable.
125 // If you are lost, you can click on HELP in any Root canvas or browser.
128 <img src="gif/AliMUONDisplay.gif">
135 gAlice->SetDisplay(this);
137 // Initialize display default parameters
139 // Set front view by default
146 fDrawClusters = kTRUE;
156 // Create display canvas
158 if (ysize < 100) ysize = 750;
159 Int_t xsize = Int_t(size*830./ysize);
160 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
161 fCanvas->ToggleEventStatus();
163 // Create main display pad
164 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
167 fPad->SetFillColor(30);
168 fPad->SetBorderSize(2);
173 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
175 fColPad->SetFillColor(17);
176 fColPad->SetBorderSize(2);
181 // Create user interface control pad
185 // Create Range and mode pad
188 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
191 fTrigPad->SetFillColor(22);
192 fTrigPad->SetBorderSize(2);
193 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
194 fRangeSlider->SetObject(this);
195 char pickmode[] = "gAlice->Display()->SetPickMode()";
197 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
198 fPickButton->SetFillColor(38);
200 char zoommode[] = "gAlice->Display()->SetZoomMode()";
201 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
202 fZoomButton->SetFillColor(38);
204 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
205 fArcButton->SetFillColor(kGreen);
207 char butUnzoom[] = "gAlice->Display()->UnZoom()";
208 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
209 button->SetFillColor(38);
211 AppendPad(); // append display object as last object to force selection
214 fTrigPad->SetEditable(kFALSE);
215 fButtons->SetEditable(kFALSE);
217 fNextCathode = kFALSE;
219 // initialize container
221 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
226 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display)
227 : AliDisplay(display)
229 // Protected copy constructor
231 Fatal("AliMUONDisplay", "Not implemented.");
236 //_____________________________________________________________________________
237 AliMUONDisplay::~AliMUONDisplay()
239 // Delete space point structure
240 if (fPoints) fPoints->Delete();
244 if (fPhits) fPhits->Delete();
248 if (fRpoints) fRpoints->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);
267 fButtons->SetFillColor(38);
268 fButtons->SetBorderSize(2);
271 // Int_t butcolor = 33;
272 Float_t dbutton = 0.08;
279 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
280 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
281 button->SetFillColor(38);
285 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
286 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
287 button->SetFillColor(38);
291 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
292 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
293 button->SetFillColor(38);
297 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
298 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
299 button->SetFillColor(38);
303 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
304 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
305 button->SetFillColor(38);
309 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
310 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
311 button->SetFillColor(38);
315 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
316 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
317 button->SetFillColor(38);
321 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
322 diamond->SetFillColor(50);
323 diamond->SetTextAlign(22);
324 diamond->SetTextColor(5);
325 diamond->SetTextSize(0.11);
327 diamond->AddText(".. ");
328 diamond->AddText("ROOT");
329 diamond->AddText("MUON");
330 diamond->AddText("... ");
331 diamond->AddText(" ");
334 //_____________________________________________________________________________
335 void AliMUONDisplay::CreateColors() const
337 // Create the colors palette used to display clusters
352 new TColor(color,r,g,b);
362 new TColor(color,r,g,b);
372 new TColor(color,r,g,b);
382 new TColor(color,r,g,b);
392 new TColor(color,r,g,b);
399 //_____________________________________________________________________________
400 void AliMUONDisplay::DisplayColorScale()
402 // Display pulse height color scale
405 Float_t xlow, ylow, xup, yup, hs;
406 Float_t x1, y1, x2, y2;
410 TText *text = new TText(0,0,"");
411 text->SetTextFont(61);
412 text->SetTextSize(0.2);
413 text->SetTextAlign(22);
415 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
416 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
417 AliMUONResponse * response=iChamber->ResponseModel();
419 if (response) adcmax = (Int_t) response->MaxAdc();
424 //*-* draw colortable boxes
425 hs = (y2-y1)/Float_t(22);
429 ylow = y1 + hs*(Float_t(i));
430 yup = y1 + hs*(Float_t(i+1));
432 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
433 Int_t scale=(Int_t)TMath::Exp(logscale);
434 sprintf(label,"%d",scale);
435 box = new TBox(xlow, ylow, xup, yup);
437 box->SetFillColor(color);
438 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
442 //______________________________________________________________________________
443 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
445 // Compute distance from point px,py to objects in event
447 gPad->SetCursor(kCross);
449 if (gPad == fTrigPad) return 9999;
451 const Int_t kBig = 9999;
453 Float_t xmin = gPad->GetX1();
454 Float_t xmax = gPad->GetX2();
455 Float_t dx = 0.02*(xmax - xmin);
456 Float_t x = gPad->AbsPixeltoX(px);
457 if (x < xmin+dx || x > xmax-dx) return dist;
459 if (fZoomMode) return 0;
463 //_____________________________________________________________________________
464 void AliMUONDisplay::Draw(Option_t *)
466 // Display current event
470 DrawView(fTheta, fPhi, fPsi);
471 // Display the event number and title
476 void AliMUONDisplay::DrawSegmentation()
478 // Draw graphical representation of segmenatation
479 // Attention: still experimental code
482 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
483 AliMUONChamber* iChamber;
484 AliSegmentation* seg;
485 iChamber = &(pMUON->Chamber(fChamber));
486 seg=iChamber->SegmentationModel(icat);
487 Float_t zpos=iChamber->Z();
488 Float_t r=iChamber->ROuter();
490 TMarker3DBox *marker;
492 for (Int_t j=0; j<seg->Npy(); j++) {
494 y0=j*seg->Dpy()-seg->Dpy()/2.;
495 for (seg->FirstPad(0.,y0,0,300,0.);
499 if (seg->ISector()==0) continue;
501 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
502 Float_t dpx=seg->Dpx(seg->ISector())/2;
503 Float_t dpy=seg->Dpy(seg->ISector())/2;
504 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
505 marker->SetLineColor(seg->ISector()+1);
506 marker->SetFillStyle(1001);
507 marker->SetFillColor(0);
512 for (Int_t j=0; j<250; j++) {
513 Float_t x0=j*seg->Dpx();
514 Float_t y0=TMath::Sqrt(r*r-x0*x0);
516 for (seg->FirstPad(x0,0,0,0,y0);
520 if (seg->ISector()==0) continue;
523 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
524 Float_t dpx=seg->Dpx(seg->ISector())/2;
525 Float_t dpy=seg->Dpy(seg->ISector())/2;
526 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
527 marker->SetLineColor(seg->ISector()+1);
528 marker->SetFillStyle(1001);
529 marker->SetFillColor(0);
536 //_____________________________________________________________________________
537 void AliMUONDisplay::DrawClusters()
539 // Draw clusters for MUON chambers
541 Int_t ndigits, digit;
549 ndigits = points->GetEntriesFast();
550 for (digit=0;digit<ndigits;digit++){
551 pm = (AliMUONPoints*)points->UncheckedAt(digit);
555 for (Int_t im=0;im<3;im++) {
556 TMarker3DBox *marker=pm->GetMarker(im);
561 fClustersCuts +=pm->GetN();
565 //_____________________________________________________________________________
566 void AliMUONDisplay::DrawHits()
568 // Draw hits for MUON chambers
572 Int_t ntracks, track;
579 ntracks = points->GetEntriesFast();
580 for (track=0;track<ntracks;track++) {
581 pm = (AliMUONPoints*)points->UncheckedAt(track);
584 fHitsCuts += pm->GetN();
589 //_____________________________________________________________________________
590 void AliMUONDisplay::DrawCoG()
592 // Draw hits for MUON chambers
593 if (!fDrawCoG) return;
594 if (fChamber > 10) return;
595 LoadCoG(fChamber,fCathode);
603 ncog = points->GetEntriesFast();
604 for (icog=0;icog<ncog;icog++) {
605 pm = (AliMUONPoints*)points->UncheckedAt(icog);
610 //_____________________________________________________________________________
612 void AliMUONDisplay::DrawTitle(Option_t *option)
614 // Draw the event title
616 Float_t xmin = gPad->GetX1();
617 Float_t xmax = gPad->GetX2();
618 Float_t ymin = gPad->GetY1();
619 Float_t ymax = gPad->GetY2();
620 Float_t dx = xmax-xmin;
621 Float_t dy = ymax-ymin;
623 AliRunLoader * runLoader;
625 runLoader = fLoader->GetRunLoader();
630 if (strlen(option) == 0) {
631 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
632 // title->SetTextSize(0.023932);
633 title->SetTextSize(0.02);
634 title->SetBit(kCanDelete);
635 title->SetFillColor(42);
638 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
639 runLoader->GetEventNumber(),
640 gAlice->GetHeader()->GetRun(),
643 title->AddText(ptitle);
644 Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast();
645 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
646 nparticles, fHitsCuts,fClustersCuts);
647 title->AddText(ptitle);
649 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
650 label->SetBit(kCanDelete);
651 label->SetFillColor(42);
656 //_____________________________________________________________________________
657 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
659 // Draw a view of MUON clusters
660 printf("\n Draw View\n");
662 gPad->SetCursor(kWatch);
663 // gPad->SetFillColor(39);
664 gPad->SetFillColor(1);
666 // gPad->SetFillColor(39);
667 gPad->SetFillColor(1);
671 TView *view = new TView(1);
673 Float_t range = fRrange*fRangeSlider->GetMaximum();
674 view->SetRange(-range,-range,-range,range, range, range);
675 // zoom back to full scale only if DrawView not called from NextCathode
684 // Display MUON Chamber Geometry
686 sprintf(nodeName,"MUON%d",100+fChamber);
688 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
689 if (node1) node1->Draw("same");
690 //add clusters to the pad
694 // DrawSegmentation();
695 // add itself to the list (must be last)
697 view->SetView(phi, theta, psi, iret);
701 //______________________________________________________________________________
702 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
704 // Execute action corresponding to the mouse event
706 static Float_t x0, y0, x1, y1;
708 static Int_t pxold, pyold;
709 static Int_t px0, py0;
710 static Int_t linedrawn;
713 if (px == 0 && py == 0) { //when called by sliders
714 if (event == kButton1Up) {
719 if (!fZoomMode && gPad->GetView()) {
720 gPad->GetView()->ExecuteRotateView(event, px, py);
724 // something to zoom ?
725 gPad->SetCursor(kCross);
730 gVirtualX->SetLineColor(-1);
731 gPad->TAttLine::Modify(); //Change line attributes only if necessary
732 x0 = gPad->AbsPixeltoX(px);
733 y0 = gPad->AbsPixeltoY(py);
735 pxold = px; pyold = py;
740 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
744 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
748 gPad->GetCanvas()->FeedbackMode(kFALSE);
749 if (px == px0) return;
750 if (py == py0) return;
751 x1 = gPad->AbsPixeltoX(px);
752 y1 = gPad->AbsPixeltoY(py);
754 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
755 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
756 gPad->Range(x0,y0,x1,y1);
757 if (fZooms < AliMUONConstants::MaxZoom()-1) {
759 fZoomX0[fZooms] = x0;
760 fZoomY0[fZooms] = y0;
761 fZoomX1[fZooms] = x1;
762 fZoomY1[fZooms] = y1;
764 gPad->Modified(kTRUE);
769 //___________________________________________
770 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
772 // Read digits info and store x,y,z info in arrays fPoints
773 // Loop on all detectors
775 if (chamber > 14) return;
776 printf(" chamber %d \n",chamber);
782 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
783 AliMUONChamber* iChamber;
784 AliSegmentation* segmentation;
785 AliMUONResponse* response;
787 GetMUONData()->SetTreeAddress("D");
789 TClonesArray *muonDigits = GetMUONData()->Digits(chamber-1);
790 if (muonDigits == 0) return;
792 gAlice->ResetDigits();
795 if (GetLoader()->TreeD()) {
796 nent = (Int_t) GetLoader()->TreeD()->GetEntries();
797 printf(" entries %d \n", nent);
798 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
799 GetMUONData()->GetCathode(cathode-1);
802 Int_t ndigits = muonDigits->GetEntriesFast();
803 if (ndigits == 0) return;
804 if (fPoints == 0) fPoints = new TObjArray(ndigits);
806 iChamber = &(pMUON->Chamber(chamber-1));
808 segmentation = iChamber->SegmentationModel(cathode);
809 response = iChamber->ResponseModel();
810 Float_t zpos = iChamber->Z();
813 AliMUONPoints *points = 0;
814 TMarker3DBox *marker = 0;
816 //loop over all digits and store their position
819 Float_t adcmax = 1024;
820 if (response&&chamber<11) adcmax = response->MaxAdc();
822 for (Int_t digit = 0; digit < ndigits; digit++) {
823 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
824 if (mdig->Cathode() != cathode-1) continue;
827 // First get all needed parameters
829 Int_t charge = mdig->Signal();
830 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
831 Int_t color = 261+index;
832 Int_t colorTrigger = 2;
833 if (color > 282) color = 282;
835 if (chamber > 10) { // trigger chamber
838 for (Int_t icharge = 0; icharge < 10; icharge++) {
839 sumCharge = sumCharge+mdig->TrackCharge(icharge);
841 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
842 if(sumCharge <= 10 || testCharge > 0) {
843 colorTrigger = color;
849 // get the center of the pad - add on x and y half of pad size
850 Float_t xpad, ypad, zpad;
851 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
853 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
854 Float_t dpx = segmentation->Dpx(isec)/2;
855 Float_t dpy = segmentation->Dpy(isec)/2;
857 // segmentation->Dump();
860 // Then set the objects
862 points = new AliMUONPoints(npoints);
863 fPoints->AddAt(points,digit);
865 points->SetMarkerColor(colorTrigger);
867 points->SetMarkerColor(color);
869 points->SetMarkerStyle(21);
870 points->SetMarkerSize(0.5);
871 points->SetParticle(-1);
872 points->SetHitIndex(-1);
873 points->SetTrackIndex(-1);
874 points->SetDigitIndex(digit);
875 points->SetPoint(0,xpad,ypad,zpos);
877 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
878 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
881 marker->SetLineColor(lineColor);
882 marker->SetFillStyle(1001);
883 marker->SetFillColor(color);
884 marker->SetRefObject((TObject*)points);
885 points->Set3DMarker(0, marker);
888 //___________________________________________
889 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/)
891 // Read raw clusters info and store x,y,z info in arrays fRpoints
892 // Loop on all detectors
894 if (chamber > 10) return;
898 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
899 AliMUONChamber* iChamber;
901 GetMUONData()->SetTreeAddress("RC");
902 TClonesArray *muonRawClusters = GetMUONData()->RawClusters(chamber-1);
904 if (muonRawClusters == 0) return;
907 if (GetMUONData()->TreeR()) {
908 nent=(Int_t) GetMUONData()->TreeR()->GetEntries();
909 GetMUONData()->TreeR()->GetEvent(0);
912 Int_t nrawcl = muonRawClusters->GetEntriesFast();
913 if (nrawcl == 0) return;
914 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
916 iChamber = &(pMUON->Chamber(chamber-1));
917 Float_t zpos=iChamber->Z();
918 AliMUONRawCluster *mRaw;
919 AliMUONPoints *points = 0;
921 //loop over all raw clusters and store their position
922 points = new AliMUONPoints(nrawcl);
923 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
924 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
925 points->SetMarkerColor(51);
926 points->SetMarkerStyle(2);
927 points->SetMarkerSize(1.);
928 points->SetParticle(-1);
929 points->SetHitIndex(-1);
930 points->SetTrackIndex(-1);
931 points->SetDigitIndex(-1);
932 points->SetPoint(iraw,mRaw->GetX(0),mRaw->GetY(0),zpos);
933 fRpoints->AddAt(points,iraw);
934 // printf("%f and %f and %f\n",mRaw->GetX(0),mRaw->GetY(0),mRaw->GetZ(0));
937 //___________________________________________
938 void AliMUONDisplay::LoadHits(Int_t chamber)
940 // Read hits info and store x,y,z info in arrays fPhits
941 // Loop on all detectors
943 if (chamber > 14) return;
950 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
951 AliMUONChamber* iChamber;
953 iChamber = &(pMUON->Chamber(chamber-1));
954 Float_t zpos=iChamber->Z();
957 if (GetMUONData()->TreeH()) {
958 GetMUONData()->SetTreeAddress("H");
959 Int_t ntracks = (Int_t)GetMUONData()->TreeH()->GetEntries(); //skowron
961 for (track = 0; track < ntracks; track++) {
962 GetMUONData()->ResetHits();
963 GetMUONData()->GetTrack(track);//skowron
964 TClonesArray *muonHits = GetMUONData()->Hits();
965 if (muonHits == 0) return;
966 nthits += muonHits->GetEntriesFast();
968 if (fPhits == 0) fPhits = new TObjArray(nthits);
970 for (track=0; track<ntracks;track++) {
971 GetMUONData()->ResetHits();
972 GetMUONData()->GetTrack(track);//skowron
973 TClonesArray *muonHits = GetMUONData()->Hits();
974 if (muonHits == 0) return;
975 Int_t nhits = muonHits->GetEntriesFast();
976 if (nhits == 0) continue;
978 AliMUONPoints *points = 0;
980 for (Int_t hit=0;hit<nhits;hit++) {
981 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
982 Int_t nch = mHit->Chamber(); // chamber number
983 if (nch != chamber) continue;
985 // Retrieve info and set the objects
987 points = new AliMUONPoints(npoints);
988 fPhits->AddAt(points,nhold+hit);
989 points->SetMarkerColor(kRed);
990 points->SetMarkerStyle(5);
991 points->SetMarkerSize(1.);
992 points->SetParticle(mHit->Track());
993 points->SetHitIndex(hit);
994 points->SetTrackIndex(track);
995 points->SetDigitIndex(-1);
996 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
997 // printf("%f and %f and %f\n",mHit->X(),mHit->Y(),mHit->Z());
1004 //_____________________________________________________________________________
1005 void AliMUONDisplay::Paint(Option_t *)
1007 // Paint miscellaneous items
1010 //_____________________________________________________________________________
1011 void AliMUONDisplay::SetPickMode()
1013 // Set parameters for pick mode.
1017 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1018 fTrigPad->Modified();
1021 //_____________________________________________________________________________
1022 void AliMUONDisplay::SetZoomMode()
1024 // Set parameters for zoom mode
1027 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1028 fTrigPad->Modified();
1031 //_____________________________________________________________________________
1032 void AliMUONDisplay::NextChamber(Int_t delta)
1034 // to go from chamber to next chamber if delta = 1
1035 // or previous chamber otherwise
1037 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1039 if (fChamber > 1) fChamber--;
1043 LoadDigits(fChamber, fCathode);
1047 //_____________________________________________________________________________
1048 void AliMUONDisplay::NextCathode()
1050 // to switch to other cathode plane
1053 if (fCathode == 1) {
1054 LoadDigits(fChamber, 2);
1056 LoadDigits(fChamber, 1);
1058 fNextCathode = kTRUE; // to keep the same zoom
1060 fNextCathode = kFALSE;
1061 TPad *pad = (TPad*)gPad->GetPadSave();
1062 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1063 fZoomX1[fZooms], fZoomY1[fZooms]);
1069 //_____________________________________________________________________________
1070 void AliMUONDisplay::Trigger()
1073 AliMUONGlobalTrigger* globalTrig;
1075 GetMUONData()->SetTreeAddress("GLT");
1076 GetMUONData()->GetTrigger();
1078 globalTrig = (AliMUONGlobalTrigger*)GetMUONData()->GlobalTrigger()->UncheckedAt(0);
1079 if (globalTrig == 0) return;
1081 printf("===================================================\n");
1082 printf(" Global Trigger output Low pt High pt All\n");
1084 printf(" number of Single Plus :\t");
1085 printf("%i\t",globalTrig->SinglePlusLpt());
1086 printf("%i\t",globalTrig->SinglePlusHpt());
1087 printf("%i\t",globalTrig->SinglePlusApt());
1090 printf(" number of Single Minus :\t");
1091 printf("%i\t",globalTrig->SingleMinusLpt());
1092 printf("%i\t",globalTrig->SingleMinusHpt());
1093 printf("%i\t",globalTrig->SingleMinusApt());
1096 printf(" number of Single Undefined :\t");
1097 printf("%i\t",globalTrig->SingleUndefLpt());
1098 printf("%i\t",globalTrig->SingleUndefHpt());
1099 printf("%i\t",globalTrig->SingleUndefApt());
1102 printf(" number of UnlikeSign pair :\t");
1103 printf("%i\t",globalTrig->PairUnlikeLpt());
1104 printf("%i\t",globalTrig->PairUnlikeHpt());
1105 printf("%i\t",globalTrig->PairUnlikeApt());
1108 printf(" number of LikeSign pair :\t");
1109 printf("%i\t",globalTrig->PairLikeLpt());
1110 printf("%i\t",globalTrig->PairLikeHpt());
1111 printf("%i\t",globalTrig->PairLikeApt());
1113 printf("===================================================\n");
1117 // // returns Trigger Decision for current event
1118 // AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(GetLoader(),1);
1120 // // AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1121 // AliMUONData* muonData = decision->GetMUONData();
1122 // muonData->SetTreeAddress("D");
1123 // decision->Trigger();
1125 //_____________________________________________________________________________
1126 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1128 // Set chamber and cathode number
1134 LoadDigits(chamber,cathode);
1138 void AliMUONDisplay::SetEvent(Int_t newevent)
1141 gAlice->GetEvent(newevent);
1143 if (!gAlice->TreeD()) return;
1146 LoadDigits(fChamber,fCathode);
1150 //_____________________________________________________________________________
1151 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1153 // Set view range along R and Z
1162 //_____________________________________________________________________________
1163 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1165 // change viewing angles for current event
1173 TView *view = gPad->GetView();
1174 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1179 //_____________________________________________________________________________
1180 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1182 AliRunLoader * runLoader;
1184 runLoader = fLoader->GetRunLoader();
1188 // Display (current event_number + delta)
1189 // delta = 1 shown next event
1190 // delta = -1 show previous event
1192 //runLoader->CleanDetectors();
1193 //runLoader->CleanKinematics();
1194 Int_t currentEvent = runLoader->GetEventNumber();
1195 Int_t newEvent = currentEvent + delta;
1196 runLoader->GetEvent(newEvent);
1199 LoadDigits(fChamber, fCathode);
1204 //______________________________________________________________________________
1205 void AliMUONDisplay::UnZoom()
1208 if (fZooms <= 0) return;
1210 TPad *pad = (TPad*)gPad->GetPadSave();
1211 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1215 //_____________________________________________________________________________
1216 void AliMUONDisplay::ResetPoints()
1219 // Reset array of points
1227 //_____________________________________________________________________________
1228 void AliMUONDisplay::ResetPhits()
1231 // Reset array of points
1239 //_____________________________________________________________________________
1240 void AliMUONDisplay::ResetRpoints()
1243 // Reset array of points
1252 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay & rhs)
1254 // Protected assignement operator
1256 if (this == &rhs) return *this;
1258 Fatal("operator=", "Not implemented.");