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 //////////////////////////////////////////////////////////////////////////
33 #include <TPolyMarker3D.h>
34 #include <TPaveLabel.h>
35 #include <TPaveText.h>
42 #include <TSliderBox.h>
44 #include <TVirtualX.h>
47 #include <TGeometry.h>
48 #include <X3DBuffer.h>
49 #include <TMarker3DBox.h>
52 #include "AliDetector.h"
54 #include "AliMUONDisplay.h"
55 #include "AliMUONPoints.h"
56 #include "TParticle.h"
57 #include "AliMUONGlobalTrigger.h"
58 #include "AliHeader.h"
60 #include "AliMUONHit.h"
61 #include "AliMUONPadHit.h"
62 #include "AliMUONDigit.h"
63 #include "AliMUONRawCluster.h"
65 #include "AliSegmentation.h"
66 #include "AliMUONResponse.h"
67 #include "AliMUONChamber.h"
68 #include "AliMUONConstants.h"
70 // to manage the same zoom on both cathodes
74 ClassImp(AliMUONDisplay)
77 //_____________________________________________________________________________
78 AliMUONDisplay::AliMUONDisplay()
85 fNextCathode = kFALSE;
89 //_____________________________________________________________________________
90 AliMUONDisplay::AliMUONDisplay(Int_t size, AliLoader * loader)
92 // Create an event display object.
93 // A canvas named "edisplay" is created with a vertical size in pixels
95 // A QUICK Overview of the Event Display functions
96 // ===============================================
98 // The event display can ve invoked by executing the macro "display.C"
99 // A canvas like in the picture below will appear.
101 // On the left side of the canvas, the following buttons appear:
102 // *Next* to move to the next event
103 // *Previous* to move to the previous event
105 // *Pick* Select this option to be able to point on a track with the
106 // mouse. Once on the track, use the right button to select
107 // an action. For example, select SetMarkerAttributes to
108 // change the marker type/color/size for the track.
109 // *Zoom* Select this option (default) if you want to zoom.
110 // To zoom, simply select the selected area with the left button.
111 // *UnZoom* To revert to the previous picture size.
113 // slider R On the left side, the vertical slider can be used to
114 // set the default picture size.
116 // When you are in Zoom mode, you can click on the black part of the canvas
117 // to select special options with the right mouse button.
120 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
121 // When you are on a track, select the menu item "InspectParticle"
122 // to display the current particle attributes.
124 // You can activate the Root browser by selecting the Inspect menu
125 // in the canvas tool bar menu. Then select "Start Browser"
126 // This will open a new canvas with the browser. At this point, you may want
127 // to display some histograms (from the Trees). Go to the "File" menu
128 // of the browser and click on "New canvas".
129 // In the browser, click on item "ROOT files" in the left pane.
130 // Click on galice.root.
132 // Click on TPC for example
133 // Click on any variable (eg TPC.fX) to histogram the variable.
135 // If you are lost, you can click on HELP in any Root canvas or browser.
138 <img src="gif/AliMUONDisplay.gif">
145 gAlice->SetDisplay(this);
147 // Initialize display default parameters
149 // Set front view by default
156 fDrawClusters = kTRUE;
166 // Create display canvas
168 if (ysize < 100) ysize = 750;
169 Int_t xsize = Int_t(size*830./ysize);
170 fCanvas = new TCanvas("Canvas", "MUON Clusters Display",14,47,xsize,ysize);
171 fCanvas->ToggleEventStatus();
173 // Create main display pad
174 fPad = new TPad("viewpad", "MUON display",0.15,0,0.9,1);
177 fPad->SetFillColor(30);
178 fPad->SetBorderSize(2);
183 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
185 fColPad->SetFillColor(17);
186 fColPad->SetBorderSize(2);
191 // Create user interface control pad
195 // Create Range and mode pad
198 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
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
224 fTrigPad->SetEditable(kFALSE);
225 fButtons->SetEditable(kFALSE);
227 fNextCathode = kFALSE;
229 // initialize container
231 fMUONData = new AliMUONData(fLoader,"MUON","MUON");
236 AliMUONDisplay::AliMUONDisplay(const AliMUONDisplay & display):AliDisplay(display)
238 // Dummy copy constructor
244 //_____________________________________________________________________________
245 AliMUONDisplay::~AliMUONDisplay()
247 // Delete space point structure
248 if (fPoints) fPoints->Delete();
252 if (fPhits) fPhits->Delete();
256 if (fRpoints) fRpoints->Delete();
261 //_____________________________________________________________________________
262 void AliMUONDisplay::Clear(Option_t *)
264 // Delete graphics temporary objects
267 //_____________________________________________________________________________
268 void AliMUONDisplay::DisplayButtons()
270 // Create the user interface buttons
273 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
275 fButtons->SetFillColor(38);
276 fButtons->SetBorderSize(2);
279 // Int_t butcolor = 33;
280 Float_t dbutton = 0.08;
287 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
288 button = new TButton("Event +", but1, x0, y - dbutton, x1, y);
289 button->SetFillColor(38);
293 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
294 button = new TButton("Event -", but2, x0, y - dbutton, x1, y);
295 button->SetFillColor(38);
299 char but3[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(1)";
300 button = new TButton("Chamber +", but3, x0, y - dbutton, x1, y);
301 button->SetFillColor(38);
305 char but4[] = "((AliMUONDisplay*)(gAlice->Display()))->NextChamber(-1)";
306 button = new TButton("Chamber -", but4, x0, y - dbutton, x1, y);
307 button->SetFillColor(38);
311 char but5[] = "((AliMUONDisplay*)(gAlice->Display()))->SetChamberAndCathode(1,1)";
312 button = new TButton("Chamber 1", but5, x0, y - dbutton, x1, y);
313 button->SetFillColor(38);
317 char but6[] = "((AliMUONDisplay*)(gAlice->Display()))->NextCathode()";
318 button = new TButton("Cathode <>", but6, x0, y - dbutton, x1, y);
319 button->SetFillColor(38);
323 char but7[] = "((AliMUONDisplay*)(gAlice->Display()))->Trigger()";
324 button = new TButton("Trigger", but7, x0, y - dbutton, x1, y);
325 button->SetFillColor(38);
329 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
330 diamond->SetFillColor(50);
331 diamond->SetTextAlign(22);
332 diamond->SetTextColor(5);
333 diamond->SetTextSize(0.11);
335 diamond->AddText(".. ");
336 diamond->AddText("ROOT");
337 diamond->AddText("MUON");
338 diamond->AddText("... ");
339 diamond->AddText(" ");
342 //_____________________________________________________________________________
343 void AliMUONDisplay::CreateColors()
345 // Create the colors palette used to display clusters
360 new TColor(color,r,g,b);
370 new TColor(color,r,g,b);
380 new TColor(color,r,g,b);
390 new TColor(color,r,g,b);
400 new TColor(color,r,g,b);
407 //_____________________________________________________________________________
408 void AliMUONDisplay::DisplayColorScale()
410 // Display pulse height color scale
413 Float_t xlow, ylow, xup, yup, hs;
414 Float_t x1, y1, x2, y2;
418 TText *text = new TText(0,0,"");
419 text->SetTextFont(61);
420 text->SetTextSize(0.2);
421 text->SetTextAlign(22);
423 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
424 AliMUONChamber *iChamber = &(pMUON->Chamber(fChamber-1));
425 AliMUONResponse * response=iChamber->ResponseModel();
427 if (response) adcmax = (Int_t) response->MaxAdc();
432 //*-* draw colortable boxes
433 hs = (y2-y1)/Float_t(22);
437 ylow = y1 + hs*(Float_t(i));
438 yup = y1 + hs*(Float_t(i+1));
440 Double_t logscale=Double_t(i+1)*(TMath::Log(adcmax)/22);
441 Int_t scale=(Int_t)TMath::Exp(logscale);
442 sprintf(label,"%d",scale);
443 box = new TBox(xlow, ylow, xup, yup);
445 box->SetFillColor(color);
446 text->DrawText(xlow+0.7, 0.5*(ylow+yup),label);
450 //______________________________________________________________________________
451 Int_t AliMUONDisplay::DistancetoPrimitive(Int_t px, Int_t)
453 // Compute distance from point px,py to objects in event
455 gPad->SetCursor(kCross);
457 if (gPad == fTrigPad) return 9999;
459 const Int_t kBig = 9999;
461 Float_t xmin = gPad->GetX1();
462 Float_t xmax = gPad->GetX2();
463 Float_t dx = 0.02*(xmax - xmin);
464 Float_t x = gPad->AbsPixeltoX(px);
465 if (x < xmin+dx || x > xmax-dx) return dist;
467 if (fZoomMode) return 0;
471 //_____________________________________________________________________________
472 void AliMUONDisplay::Draw(Option_t *)
474 // Display current event
478 DrawView(fTheta, fPhi, fPsi);
479 // Display the event number and title
484 void AliMUONDisplay::DrawSegmentation()
486 // Draw graphical representation of segmenatation
487 // Attention: still experimental code
490 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
491 AliMUONChamber* iChamber;
492 AliSegmentation* seg;
493 iChamber = &(pMUON->Chamber(fChamber));
494 seg=iChamber->SegmentationModel(icat);
495 Float_t zpos=iChamber->Z();
496 Float_t r=iChamber->ROuter();
498 TMarker3DBox *marker;
500 for (Int_t j=0; j<seg->Npy(); j++) {
502 y0=j*seg->Dpy()-seg->Dpy()/2.;
503 for (seg->FirstPad(0.,y0,0,300,0.);
507 if (seg->ISector()==0) continue;
509 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
510 Float_t dpx=seg->Dpx(seg->ISector())/2;
511 Float_t dpy=seg->Dpy(seg->ISector())/2;
512 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
513 marker->SetLineColor(seg->ISector()+1);
514 marker->SetFillStyle(1001);
515 marker->SetFillColor(0);
520 for (Int_t j=0; j<250; j++) {
521 Float_t x0=j*seg->Dpx();
522 Float_t y0=TMath::Sqrt(r*r-x0*x0);
524 for (seg->FirstPad(x0,0,0,0,y0);
528 if (seg->ISector()==0) continue;
531 seg->GetPadC(seg->Ix(), seg->Iy(), x, y, z);
532 Float_t dpx=seg->Dpx(seg->ISector())/2;
533 Float_t dpy=seg->Dpy(seg->ISector())/2;
534 marker=new TMarker3DBox(x,y,zpos,dpx,dpy,0,0,0);
535 marker->SetLineColor(seg->ISector()+1);
536 marker->SetFillStyle(1001);
537 marker->SetFillColor(0);
544 //_____________________________________________________________________________
545 void AliMUONDisplay::DrawClusters()
547 // Draw clusters for MUON chambers
549 Int_t ndigits, digit;
557 ndigits = points->GetEntriesFast();
558 for (digit=0;digit<ndigits;digit++){
559 pm = (AliMUONPoints*)points->UncheckedAt(digit);
563 for (Int_t im=0;im<3;im++) {
564 TMarker3DBox *marker=pm->GetMarker(im);
569 fClustersCuts +=pm->GetN();
573 //_____________________________________________________________________________
574 void AliMUONDisplay::DrawHits()
576 // Draw hits for MUON chambers
580 Int_t ntracks, track;
587 ntracks = points->GetEntriesFast();
588 for (track=0;track<ntracks;track++) {
589 pm = (AliMUONPoints*)points->UncheckedAt(track);
592 fHitsCuts += pm->GetN();
597 //_____________________________________________________________________________
598 void AliMUONDisplay::DrawCoG()
600 // Draw hits for MUON chambers
601 if (!fDrawCoG) return;
602 if (fChamber > 10) return;
603 LoadCoG(fChamber,fCathode);
611 ncog = points->GetEntriesFast();
612 for (icog=0;icog<ncog;icog++) {
613 pm = (AliMUONPoints*)points->UncheckedAt(icog);
618 //_____________________________________________________________________________
620 void AliMUONDisplay::DrawTitle(Option_t *option)
622 // Draw the event title
624 Float_t xmin = gPad->GetX1();
625 Float_t xmax = gPad->GetX2();
626 Float_t ymin = gPad->GetY1();
627 Float_t ymax = gPad->GetY2();
628 Float_t dx = xmax-xmin;
629 Float_t dy = ymax-ymin;
631 AliRunLoader * RunLoader;
633 RunLoader = fLoader->GetRunLoader();
638 if (strlen(option) == 0) {
639 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
640 // title->SetTextSize(0.023932);
641 title->SetTextSize(0.02);
642 title->SetBit(kCanDelete);
643 title->SetFillColor(42);
646 sprintf(ptitle, "Alice event:%d Run:%d Chamber:%d Cathode:%d",
647 RunLoader->GetEventNumber(),
648 gAlice->GetHeader()->GetRun(),
651 title->AddText(ptitle);
652 Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast();
653 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
654 nparticles, fHitsCuts,fClustersCuts);
655 title->AddText(ptitle);
657 TPaveLabel *label = new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
658 label->SetBit(kCanDelete);
659 label->SetFillColor(42);
664 //_____________________________________________________________________________
665 void AliMUONDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
667 // Draw a view of MUON clusters
668 printf("\n Draw View\n");
670 gPad->SetCursor(kWatch);
671 // gPad->SetFillColor(39);
672 gPad->SetFillColor(1);
674 // gPad->SetFillColor(39);
675 gPad->SetFillColor(1);
679 TView *view = new TView(1);
681 Float_t range = fRrange*fRangeSlider->GetMaximum();
682 view->SetRange(-range,-range,-range,range, range, range);
683 // zoom back to full scale only if DrawView not called from NextCathode
692 // Display MUON Chamber Geometry
694 sprintf(nodeName,"MUON%d",100+fChamber);
696 TNode *node1=gAlice->GetGeometry()->GetNode(nodeName);
697 if (node1) node1->Draw("same");
698 //add clusters to the pad
702 // DrawSegmentation();
703 // add itself to the list (must be last)
705 view->SetView(phi, theta, psi, iret);
709 //______________________________________________________________________________
710 void AliMUONDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
712 // Execute action corresponding to the mouse event
714 static Float_t x0, y0, x1, y1;
716 static Int_t pxold, pyold;
717 static Int_t px0, py0;
718 static Int_t linedrawn;
721 if (px == 0 && py == 0) { //when called by sliders
722 if (event == kButton1Up) {
727 if (!fZoomMode && gPad->GetView()) {
728 gPad->GetView()->ExecuteRotateView(event, px, py);
732 // something to zoom ?
733 gPad->SetCursor(kCross);
738 gVirtualX->SetLineColor(-1);
739 gPad->TAttLine::Modify(); //Change line attributes only if necessary
740 x0 = gPad->AbsPixeltoX(px);
741 y0 = gPad->AbsPixeltoY(py);
743 pxold = px; pyold = py;
748 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
752 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
756 gPad->GetCanvas()->FeedbackMode(kFALSE);
757 if (px == px0) return;
758 if (py == py0) return;
759 x1 = gPad->AbsPixeltoX(px);
760 y1 = gPad->AbsPixeltoY(py);
762 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
763 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
764 gPad->Range(x0,y0,x1,y1);
765 if (fZooms < AliMUONConstants::MaxZoom()-1) {
767 fZoomX0[fZooms] = x0;
768 fZoomY0[fZooms] = y0;
769 fZoomX1[fZooms] = x1;
770 fZoomY1[fZooms] = y1;
772 gPad->Modified(kTRUE);
777 //___________________________________________
778 void AliMUONDisplay::LoadDigits(Int_t chamber, Int_t cathode)
780 // Read digits info and store x,y,z info in arrays fPoints
781 // Loop on all detectors
783 if (chamber > 14) return;
784 printf(" chamber %d \n",chamber);
790 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
791 AliMUONChamber* iChamber;
792 AliSegmentation* segmentation;
793 AliMUONResponse* response;
795 GetMUONData()->SetTreeAddress("D");
797 TClonesArray *muonDigits = GetMUONData()->Digits(chamber-1);
798 if (muonDigits == 0) return;
800 gAlice->ResetDigits();
803 if (GetLoader()->TreeD()) {
804 nent = (Int_t) GetLoader()->TreeD()->GetEntries();
805 printf(" entries %d \n", nent);
806 // gAlice->TreeD()->GetEvent(nent-2+cathode-1);
807 GetMUONData()->GetCathode(cathode-1);
810 Int_t ndigits = muonDigits->GetEntriesFast();
811 if (ndigits == 0) return;
812 if (fPoints == 0) fPoints = new TObjArray(ndigits);
814 iChamber = &(pMUON->Chamber(chamber-1));
816 segmentation = iChamber->SegmentationModel(cathode);
817 response = iChamber->ResponseModel();
818 Float_t zpos = iChamber->Z();
821 AliMUONPoints *points = 0;
822 TMarker3DBox *marker = 0;
824 //loop over all digits and store their position
827 Float_t adcmax = 1024;
828 if (response&&chamber<11) adcmax = response->MaxAdc();
830 for (Int_t digit = 0; digit < ndigits; digit++) {
831 mdig = (AliMUONDigit*)muonDigits->UncheckedAt(digit);
832 if (mdig->Cathode() != cathode-1) continue;
835 // First get all needed parameters
837 Int_t charge = mdig->Signal();
838 Int_t index = Int_t(TMath::Log(charge)/(TMath::Log(adcmax)/22));
839 Int_t color = 261+index;
840 Int_t colorTrigger = 2;
841 if (color > 282) color = 282;
843 if (chamber > 10) { // trigger chamber
846 for (Int_t icharge = 0; icharge < 10; icharge++) {
847 sumCharge = sumCharge+mdig->TrackCharge(icharge);
849 Int_t testCharge = sumCharge-(Int_t(sumCharge/10))*10;
850 if(sumCharge <= 10 || testCharge > 0) {
851 colorTrigger = color;
857 // get the center of the pad - add on x and y half of pad size
858 Float_t xpad, ypad, zpad;
859 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
861 Int_t isec = segmentation->Sector(mdig->PadX(), mdig->PadY());
862 Float_t dpx = segmentation->Dpx(isec)/2;
863 Float_t dpy = segmentation->Dpy(isec)/2;
865 // segmentation->Dump();
868 // Then set the objects
870 points = new AliMUONPoints(npoints);
871 fPoints->AddAt(points,digit);
873 points->SetMarkerColor(colorTrigger);
875 points->SetMarkerColor(color);
877 points->SetMarkerStyle(21);
878 points->SetMarkerSize(0.5);
879 points->SetParticle(-1);
880 points->SetHitIndex(-1);
881 points->SetTrackIndex(-1);
882 points->SetDigitIndex(digit);
883 points->SetPoint(0,xpad,ypad,zpos);
885 Int_t lineColor = (zpad-zpos > 0) ? 2:3;
886 marker=new TMarker3DBox(xpad,ypad,zpos,dpx,dpy,0,0,0);
889 marker->SetLineColor(lineColor);
890 marker->SetFillStyle(1001);
891 marker->SetFillColor(color);
892 marker->SetRefObject((TObject*)points);
893 points->Set3DMarker(0, marker);
896 //___________________________________________
897 void AliMUONDisplay::LoadCoG(Int_t chamber, Int_t /*cathode*/)
899 // Read raw clusters info and store x,y,z info in arrays fRpoints
900 // Loop on all detectors
902 if (chamber > 10) return;
906 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
907 AliMUONChamber* iChamber;
909 GetMUONData()->SetTreeAddress("RC");
910 TClonesArray *muonRawClusters = GetMUONData()->RawClusters(chamber-1);
912 if (muonRawClusters == 0) return;
915 if (GetMUONData()->TreeR()) {
916 nent=(Int_t) GetMUONData()->TreeR()->GetEntries();
917 GetMUONData()->TreeR()->GetEvent(0);
920 Int_t nrawcl = muonRawClusters->GetEntriesFast();
921 if (nrawcl == 0) return;
922 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
924 iChamber = &(pMUON->Chamber(chamber-1));
925 Float_t zpos=iChamber->Z();
926 AliMUONRawCluster *mRaw;
927 AliMUONPoints *points = 0;
929 //loop over all raw clusters and store their position
930 points = new AliMUONPoints(nrawcl);
931 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
932 mRaw = (AliMUONRawCluster*)muonRawClusters->UncheckedAt(iraw);
933 points->SetMarkerColor(51);
934 points->SetMarkerStyle(2);
935 points->SetMarkerSize(1.);
936 points->SetParticle(-1);
937 points->SetHitIndex(-1);
938 points->SetTrackIndex(-1);
939 points->SetDigitIndex(-1);
940 points->SetPoint(iraw,mRaw->fX[0],mRaw->fY[0],zpos);
941 fRpoints->AddAt(points,iraw);
942 // printf("%f and %f and %f\n",mRaw->fX[0],mRaw->fY[0],mRaw->fZ[0]);
945 //___________________________________________
946 void AliMUONDisplay::LoadHits(Int_t chamber)
948 // Read hits info and store x,y,z info in arrays fPhits
949 // Loop on all detectors
951 if (chamber > 14) return;
958 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
959 AliMUONChamber* iChamber;
961 iChamber = &(pMUON->Chamber(chamber-1));
962 Float_t zpos=iChamber->Z();
965 if (GetMUONData()->TreeH()) {
966 GetMUONData()->SetTreeAddress("H");
967 Int_t ntracks = (Int_t)GetMUONData()->TreeH()->GetEntries(); //skowron
969 for (track = 0; track < ntracks; track++) {
970 GetMUONData()->ResetHits();
971 GetMUONData()->GetTrack(track);//skowron
972 TClonesArray *muonHits = GetMUONData()->Hits();
973 if (muonHits == 0) return;
974 nthits += muonHits->GetEntriesFast();
976 if (fPhits == 0) fPhits = new TObjArray(nthits);
978 for (track=0; track<ntracks;track++) {
979 GetMUONData()->ResetHits();
980 GetMUONData()->GetTrack(track);//skowron
981 TClonesArray *muonHits = GetMUONData()->Hits();
982 if (muonHits == 0) return;
983 Int_t nhits = muonHits->GetEntriesFast();
984 if (nhits == 0) continue;
986 AliMUONPoints *points = 0;
988 for (Int_t hit=0;hit<nhits;hit++) {
989 mHit = (AliMUONHit*)muonHits->UncheckedAt(hit);
990 Int_t nch = mHit->Chamber(); // chamber number
991 if (nch != chamber) continue;
993 // Retrieve info and set the objects
995 points = new AliMUONPoints(npoints);
996 fPhits->AddAt(points,nhold+hit);
997 points->SetMarkerColor(kRed);
998 points->SetMarkerStyle(5);
999 points->SetMarkerSize(1.);
1000 points->SetParticle(mHit->Track());
1001 points->SetHitIndex(hit);
1002 points->SetTrackIndex(track);
1003 points->SetDigitIndex(-1);
1004 points->SetPoint(0,mHit->X(),mHit->Y(),zpos);
1005 // printf("%f and %f and %f\n",mHit->X(),mHit->Y(),mHit->Z());
1012 //_____________________________________________________________________________
1013 void AliMUONDisplay::Paint(Option_t *)
1015 // Paint miscellaneous items
1018 //_____________________________________________________________________________
1019 void AliMUONDisplay::SetPickMode()
1021 // Set parameters for pick mode.
1025 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1026 fTrigPad->Modified();
1029 //_____________________________________________________________________________
1030 void AliMUONDisplay::SetZoomMode()
1032 // Set parameters for zoom mode
1035 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1036 fTrigPad->Modified();
1039 //_____________________________________________________________________________
1040 void AliMUONDisplay::NextChamber(Int_t delta)
1042 // to go from chamber to next chamber if delta = 1
1043 // or previous chamber otherwise
1045 if (fChamber < AliMUONConstants::NCh()) fChamber++;
1047 if (fChamber > 1) fChamber--;
1051 LoadDigits(fChamber, fCathode);
1055 //_____________________________________________________________________________
1056 void AliMUONDisplay::NextCathode()
1058 // to switch to other cathode plane
1061 if (fCathode == 1) {
1062 LoadDigits(fChamber, 2);
1064 LoadDigits(fChamber, 1);
1066 fNextCathode = kTRUE; // to keep the same zoom
1068 fNextCathode = kFALSE;
1069 TPad *pad = (TPad*)gPad->GetPadSave();
1070 pad->Range(fZoomX0[fZooms], fZoomY0[fZooms],
1071 fZoomX1[fZooms], fZoomY1[fZooms]);
1077 //_____________________________________________________________________________
1078 void AliMUONDisplay::Trigger()
1081 AliMUONGlobalTrigger* globalTrig;
1083 GetMUONData()->SetTreeAddress("GLT");
1084 GetMUONData()->GetTrigger();
1086 globalTrig = (AliMUONGlobalTrigger*)GetMUONData()->GlobalTrigger()->UncheckedAt(0);
1087 if (globalTrig == 0) return;
1089 printf("===================================================\n");
1090 printf(" Global Trigger output Low pt High pt All\n");
1092 printf(" number of Single Plus :\t");
1093 printf("%i\t",globalTrig->SinglePlusLpt());
1094 printf("%i\t",globalTrig->SinglePlusHpt());
1095 printf("%i\t",globalTrig->SinglePlusApt());
1098 printf(" number of Single Minus :\t");
1099 printf("%i\t",globalTrig->SingleMinusLpt());
1100 printf("%i\t",globalTrig->SingleMinusHpt());
1101 printf("%i\t",globalTrig->SingleMinusApt());
1104 printf(" number of Single Undefined :\t");
1105 printf("%i\t",globalTrig->SingleUndefLpt());
1106 printf("%i\t",globalTrig->SingleUndefHpt());
1107 printf("%i\t",globalTrig->SingleUndefApt());
1110 printf(" number of UnlikeSign pair :\t");
1111 printf("%i\t",globalTrig->PairUnlikeLpt());
1112 printf("%i\t",globalTrig->PairUnlikeHpt());
1113 printf("%i\t",globalTrig->PairUnlikeApt());
1116 printf(" number of LikeSign pair :\t");
1117 printf("%i\t",globalTrig->PairLikeLpt());
1118 printf("%i\t",globalTrig->PairLikeHpt());
1119 printf("%i\t",globalTrig->PairLikeApt());
1121 printf("===================================================\n");
1125 // // returns Trigger Decision for current event
1126 // AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(GetLoader(),1);
1128 // // AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1129 // AliMUONData* muonData = decision->GetMUONData();
1130 // muonData->SetTreeAddress("D");
1131 // decision->Trigger();
1133 //_____________________________________________________________________________
1134 void AliMUONDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1136 // Set chamber and cathode number
1142 LoadDigits(chamber,cathode);
1146 void AliMUONDisplay::SetEvent(Int_t newevent)
1149 gAlice->GetEvent(newevent);
1151 if (!gAlice->TreeD()) return;
1154 LoadDigits(fChamber,fCathode);
1158 //_____________________________________________________________________________
1159 void AliMUONDisplay::SetRange(Float_t rrange, Float_t zrange)
1161 // Set view range along R and Z
1170 //_____________________________________________________________________________
1171 void AliMUONDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1173 // change viewing angles for current event
1181 TView *view = gPad->GetView();
1182 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1187 //_____________________________________________________________________________
1188 void AliMUONDisplay::ShowNextEvent(Int_t delta)
1190 AliRunLoader * RunLoader;
1192 RunLoader = fLoader->GetRunLoader();
1196 // Display (current event_number + delta)
1197 // delta = 1 shown next event
1198 // delta = -1 show previous event
1200 //RunLoader->CleanDetectors();
1201 //RunLoader->CleanKinematics();
1202 Int_t currentEvent = RunLoader->GetEventNumber();
1203 Int_t newEvent = currentEvent + delta;
1204 RunLoader->GetEvent(newEvent);
1207 LoadDigits(fChamber, fCathode);
1212 //______________________________________________________________________________
1213 void AliMUONDisplay::UnZoom()
1216 if (fZooms <= 0) return;
1218 TPad *pad = (TPad*)gPad->GetPadSave();
1219 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1223 //_____________________________________________________________________________
1224 void AliMUONDisplay::ResetPoints()
1227 // Reset array of points
1235 //_____________________________________________________________________________
1236 void AliMUONDisplay::ResetPhits()
1239 // Reset array of points
1247 //_____________________________________________________________________________
1248 void AliMUONDisplay::ResetRpoints()
1251 // Reset array of points
1260 AliMUONDisplay & AliMUONDisplay::operator = (const AliMUONDisplay &)
1262 // Dummy assignment operator