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 **************************************************************************/
17 //////////////////////////////////////////////////////////////////////////
21 // Utility class to display ALICE outline, tracks, hits,.. //
23 //////////////////////////////////////////////////////////////////////////
32 #include <TPolyMarker3D.h>
35 #include <TPolyMarker.h>
36 #include <TPaveLabel.h>
37 #include <TPaveText.h>
44 #include <TGeometry.h>
45 #include <TSliderBox.h>
47 #include <TVirtualX.h>
50 #include <X3DBuffer.h>
51 #include <TParticle.h>
55 #include "AliDetector.h"
57 #include "AliRICHConst.h"
58 #include "AliRICHDisplay.h"
59 #include "AliRICHPoints.h"
60 #include "AliHeader.h"
62 #include "AliRICHSDigit.h"
65 ClassImp(AliRICHDisplay)
68 //____________________________________________________________________________
69 AliRICHDisplay::AliRICHDisplay()
72 // default constructor
82 //_____________________________________________________________________________
83 AliRICHDisplay::AliRICHDisplay(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/AliRICHDisplay.gif">
138 gAlice->SetDisplay(this);
140 // Initialize display default parameters
143 // Set front view by default
144 fTheta = 90; //inclined HMPID
145 fPhi = 30; //inclined HMPID
146 //fTheta = 90; //normal HMPID
147 //fPhi = 90; //normal HMPID
152 fDrawClusters = kTRUE;
154 fDrawRecHits = kTRUE;
165 // Create display canvas
167 if (ysize < 100) ysize = 750;
168 Int_t xsize = Int_t(size*830./ysize);
169 fCanvas = new TCanvas("Canvas", "RICH Clusters Display",14,47,xsize,ysize);
170 fCanvas->ToggleEventStatus();
172 // Create main display pad
173 fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1);
176 fPad->SetFillColor(1);
177 fPad->SetBorderSize(2);
182 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
185 fColPad->SetFillColor(19);
186 fColPad->SetBorderSize(2);
192 // Create user interface control pad
196 // Create Range and mode pad
199 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
202 fTrigPad->SetFillColor(22);
203 fTrigPad->SetBorderSize(2);
204 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
205 fRangeSlider->SetObject(this);
206 char pickmode[] = "gAlice->Display()->SetPickMode()";
208 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
209 fPickButton->SetFillColor(38);
211 char zoommode[] = "gAlice->Display()->SetZoomMode()";
212 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
213 fZoomButton->SetFillColor(38);
215 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
216 fArcButton->SetFillColor(kGreen);
218 char butUnzoom[] = "gAlice->Display()->UnZoom()";
219 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
220 button->SetFillColor(38);
222 AppendPad(); // append display object as last object to force selection
224 fTrigPad->SetEditable(kFALSE);
225 fButtons->SetEditable(kFALSE);
231 //_____________________________________________________________________________
232 AliRICHDisplay::~AliRICHDisplay()
234 // Delete space point structure
235 if (fPoints) fPoints->Delete();
239 if (fPhits) fPhits->Delete();
243 if (fRpoints) fRpoints->Delete();
247 if (fRecpoints) fRecpoints->Delete();
251 if (fPCerenkovs) fPCerenkovs->Delete();
256 //_____________________________________________________________________________
257 void AliRICHDisplay::Clear(Option_t *)
259 // Delete graphics temporary objects
262 //_____________________________________________________________________________
263 void AliRICHDisplay::DisplayButtons()
265 // Create the user interface buttons
268 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
270 fButtons->SetFillColor(38);
271 fButtons->SetBorderSize(2);
274 // Int_t butcolor = 33;
275 Float_t dbutton = 0.08;
282 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
283 button = new TButton("Next",but1,x0,y-dbutton,x1,y);
284 button->SetFillColor(38);
288 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
289 button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
290 button->SetFillColor(38);
294 char but7[] = "gAlice->Display()->DrawViewGL()";
295 button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
296 button->SetFillColor(38);
300 char but8[] = "gAlice->Display()->DrawViewX3D()";
301 button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
302 button->SetFillColor(38);
306 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
307 diamond->SetFillColor(50);
308 diamond->SetTextAlign(22);
309 diamond->SetTextColor(5);
310 diamond->SetTextSize(0.11);
312 diamond->AddText(".. ");
313 diamond->AddText("ROOT");
314 diamond->AddText("RICH");
315 diamond->AddText("... ");
316 diamond->AddText(" ");
319 //_____________________________________________________________________________
320 void AliRICHDisplay::CreateColors()
322 // Create the colors palette used to display clusters
337 new TColor(color,r,g,b);
347 new TColor(color,r,g,b);
357 new TColor(color,r,g,b);
367 new TColor(color,r,g,b);
377 new TColor(color,r,g,b);
384 //_____________________________________________________________________________
385 void AliRICHDisplay::DisplayColorScale()
388 // Draw the color scale in the RICH display canvas
392 Float_t xlow, ylow, xup, yup, hs;
393 Float_t x1, y1, x2, y2;
397 gPad->SetFillColor(0);
399 gPad->Range(x1,y1,x2,y2);
400 TText *text = new TText(0,0,"");
401 text->SetTextFont(61);
402 text->SetTextSize(0.2);
403 text->SetTextAlign(22);
407 //*-* draw colortable boxes
408 hs = (y2-y1)/Float_t(22);
412 ylow = y1 + hs*(Float_t(i));
413 yup = y1 + hs*(Float_t(i+1));
415 Double_t logscale=Double_t(i+1)*(TMath::Log(kadc_satm)/22);
416 Int_t scale=(Int_t)TMath::Exp(logscale);
417 sprintf(label,"%d",scale);
418 box = new TBox(xlow, ylow, xup, yup);
419 box->SetFillColor(color);
421 text->DrawText(xup+4, 0.5*(ylow+yup),label);
425 //______________________________________________________________________________
426 Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
428 // Compute distance from point px,py to objects in event
430 gPad->SetCursor(kCross);
432 if (gPad == fTrigPad) return 9999;
434 const Int_t kBig = 9999;
436 Float_t xmin = gPad->GetX1();
437 Float_t xmax = gPad->GetX2();
438 Float_t dx = 0.02*(xmax - xmin);
439 Float_t x = gPad->AbsPixeltoX(px);
440 if (x < xmin+dx || x > xmax-dx) return dist;
441 if (fZoomMode) return 0;
445 //_____________________________________________________________________________
446 void AliRICHDisplay::Draw(Option_t *)
448 // Display current event
452 DrawView(fTheta, fPhi, fPsi); // see how to draw PGON+inner frames
454 // Display the event number and title
459 //_____________________________________________________________________________
460 void AliRICHDisplay::DrawCoG()
462 // Draw hits for RICH chambers
464 if (!fDrawCoG) return;
466 for (Int_t chamber=0;chamber<kNCH;chamber++) {
475 ncog = points->GetEntriesFast();
476 for (icog=0; icog < ncog; icog++) {
477 pm = (AliRICHPoints*)points->UncheckedAt(icog);
483 void AliRICHDisplay::DrawRecHits()
485 // Draw rec hits for RICH chambers
487 if (!fDrawRecHits) return;
489 for (Int_t chamber=0;chamber<kNCH;chamber++) {
490 LoadRecHits(chamber,1);
498 nrec = points->GetEntriesFast();
499 //printf("Nrec %d\n",nrec);
500 for (irec=0; irec < nrec; irec++) {
501 pm = (AliRICHPoints*)points->UncheckedAt(irec);
507 //_____________________________________________________________________________
509 void AliRICHDisplay::DrawCerenkovs()
511 // Draw cerenkovs hits for RICH chambers
513 LoadCerenkovs(fChamber);
514 //printf("\nDrawCerenkovs\n");
516 Int_t ntracks, track;
521 cpoints = fPCerenkovs;
522 //printf ("Cpoints: %p",cpoints);
523 if (!cpoints) return;
524 ntracks = cpoints->GetEntriesFast();
525 //printf("DrawCerenkovs - ntracks %d \n",ntracks);
526 for (track=0;track<ntracks;track++) {
527 pm = (AliRICHPoints*)cpoints->UncheckedAt(track);
530 fHitsCuts += pm->GetN();
534 //_____________________________________________________________________________
536 void AliRICHDisplay::DrawClusters()
538 // Draw clusterss for RICH chambers
540 Int_t ndigits, digit;
547 ndigits = points->GetEntriesFast();
548 for (digit=0;digit<ndigits;digit++){
549 pm = (AliRICHPoints*)points->UncheckedAt(digit);
554 for (Int_t im=0;im<3;im++) {
555 TMarker3DBox *marker=pm->GetMarker(im);
559 fClustersCuts +=pm->GetN();
563 //_____________________________________________________________________________
564 void AliRICHDisplay::DrawHits()
566 // Draw hits for RICH chambers
570 Int_t ntracks, track;
577 // ntracks = points->GetEntriesFast();
578 ntracks = fPhits->GetEntriesFast();
580 //printf("DrawHits - ntracks %d \n",ntracks);
581 for (track=0;track<ntracks;track++) {
582 pm = (AliRICHPoints*)fPhits->UncheckedAt(track);
585 fHitsCuts += pm->GetN();
590 //_____________________________________________________________________________
591 void AliRICHDisplay::DrawTitle(Option_t *option)
593 // Draw the event title
595 Float_t xmin = gPad->GetX1();
596 Float_t xmax = gPad->GetX2();
597 Float_t ymin = gPad->GetY1();
598 Float_t ymax = gPad->GetY2();
599 Float_t dx = xmax-xmin;
600 Float_t dy = ymax-ymin;
602 if (strlen(option) == 0) {
603 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
604 title->SetBit(kCanDelete);
605 title->SetFillColor(42);
608 sprintf(ptitle,"Alice event: %d, Run:%d",
609 gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
610 title->AddText(ptitle);
611 Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast();
612 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
613 nparticles, fHitsCuts,fClustersCuts);
614 title->AddText(ptitle);
617 new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
618 label->SetBit(kCanDelete);
619 label->SetFillColor(42);
624 //_____________________________________________________________________________
625 void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
627 // Draw a view of RICH clusters
629 gPad->SetCursor(kWatch);
630 gPad->SetFillColor(1);
634 TView *view = new TView(1);
635 Float_t range = fRrange*fRangeSlider->GetMaximum();
636 view->SetRange(-range,-range,-range,range, range, range);
643 //Display RICH Chamber Geometry
644 gAlice->GetGeometry()->Draw("same");
646 //add clusters to the pad
652 //printf("Calling DrawCoG\n");
654 //printf("Calling DrawRecHits\n");
657 /*for (Int_t i=0;i<7;i++)
660 // add itself to the list (must be last)
663 view->SetView(phi, theta, psi, iret);
666 //______________________________________________________________________________
667 void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
669 // Execute action corresponding to the mouse event
671 static Float_t x0, y0, x1, y1;
673 static Int_t pxold, pyold;
674 static Int_t px0, py0;
675 static Int_t linedrawn;
678 if (px == 0 && py == 0) { //when called by sliders
679 if (event == kButton1Up) {
680 printf("Drawing event %d\n",event);
685 if (!fZoomMode && gPad->GetView()) {
686 gPad->GetView()->ExecuteRotateView(event, px, py);
690 // something to zoom ?
691 gPad->SetCursor(kCross);
696 gVirtualX->SetLineColor(-1);
697 gPad->TAttLine::Modify(); //Change line attributes only if necessary
698 x0 = gPad->AbsPixeltoX(px);
699 y0 = gPad->AbsPixeltoY(py);
701 pxold = px; pyold = py;
706 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
710 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
714 gPad->GetCanvas()->FeedbackMode(kFALSE);
715 if (px == px0) return;
716 if (py == py0) return;
717 x1 = gPad->AbsPixeltoX(px);
718 y1 = gPad->AbsPixeltoY(py);
720 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
721 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
722 gPad->Range(x0,y0,x1,y1);
723 if (fZooms < kMAXZOOM-1) {
725 fZoomX0[fZooms] = x0;
726 fZoomY0[fZooms] = y0;
727 fZoomX1[fZooms] = x1;
728 fZoomY1[fZooms] = y1;
730 gPad->Modified(kTRUE);
735 //___________________________________________
736 void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
738 // Read raw clusters info and store x,y,z info in arrays fRpoints
739 // Loop on all detectors
741 if (chamber > 7) return;
743 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
744 AliRICHChamber* iChamber;
746 TClonesArray *pRICHrawclust = pRICH->Clusters(chamber);
747 if (pRICHrawclust == 0) return;
749 pRICH->ResetClusters();
752 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
753 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
754 Int_t nrawcl = pRICHrawclust->GetEntriesFast();
755 //printf ("nrawcl:%d\n",nrawcl);
756 if (nrawcl == 0) return;
757 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
759 iChamber = &(pRICH->Chamber(chamber));
760 AliRICHcluster *mRaw;
761 AliRICHPoints *points = 0;
763 //loop over all raw clusters and store their position
764 points = new AliRICHPoints(nrawcl);
765 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
766 mRaw = (AliRICHcluster*)pRICHrawclust->UncheckedAt(iraw);
767 fRpoints->AddAt(points,iraw);
768 points->SetMarkerColor(3);
769 points->SetMarkerStyle(3);
770 points->SetMarkerSize(1.);
771 points->SetParticle(-1);
772 points->SetHitIndex(-1);
773 points->SetTrackIndex(-1);
774 points->SetDigitIndex(-1);
775 Float_t vectorLoc[3]={mRaw->X(),5,mRaw->Y()};
776 Float_t vectorGlob[3];
777 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
778 points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
781 //___________________________________________
782 void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
786 //___________________________________________
787 void AliRICHDisplay::LoadDigits()
789 // Read digits info and store x,y,z info in arrays fPoints
790 // Loop on all detectors
793 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
794 AliRICHChamber* iChamber;
795 AliSegmentation* segmentation;
799 //printf("Entering LoadDigits\n");
804 for (ich=1; ich<=kNCH; ich++) {
805 TClonesArray *pRICHdigits = pRICH->Digits(ich);
806 if (pRICHdigits == 0) continue;
807 gAlice->ResetDigits();
808 gAlice->TreeD()->GetEvent(0);
809 Int_t ndigits = pRICHdigits->GetEntriesFast();
813 if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
815 for (ich=1; ich<=kNCH; ich++) {
816 TClonesArray *pRICHdigits = pRICH->Digits(ich);
817 if (pRICHdigits == 0) continue;
818 gAlice->ResetDigits();
819 gAlice->TreeD()->GetEvent(0);
820 Int_t ndigits = pRICHdigits->GetEntriesFast();
821 if (ndigits == 0) continue;
822 iChamber = &(pRICH->Chamber(ich));
823 segmentation=iChamber->GetSegmentationModel();
824 Float_t dpx = segmentation->Dpx();
825 Float_t dpy = segmentation->Dpy();
827 //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
830 AliRICHPoints *points = 0;
831 TMarker3DBox *marker = 0;
833 //loop over all digits and store their position
836 for (Int_t digit=0;digit<ndigits;digit++) {
837 mdig = (AliRICHdigit*)pRICHdigits->UncheckedAt(digit);
838 points = new AliRICHPoints(npoints);
839 fPoints->AddAt(points,counter);
841 Int_t charge=(Int_t)mdig->Q();
842 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(kadc_satm)/22));
843 Int_t color=701+index;
844 if (color>722) color=722;
845 points->SetMarkerColor(color);
846 points->SetMarkerStyle(21);
847 points->SetMarkerSize(0.5);
848 Float_t xpad, ypad, zpad;
849 segmentation->GetPadC(mdig->X(), mdig->Y(),xpad, ypad, zpad);
850 Float_t vectorLoc[3]={xpad,5,ypad};
851 Float_t vectorGlob[3];
852 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
853 points->SetParticle(-1);
854 points->SetHitIndex(-1);
855 points->SetTrackIndex(-1);
856 points->SetDigitIndex(digit);
857 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
858 //printf("Y position (digit): %f\n", vectorGlob[1]);
860 segmentation->GetPadC(mdig->X(), mdig->Y(), xpad, ypad, zpad);
861 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
862 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
863 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
864 dpy/2,0,dpx/2,theta,phi);
865 marker->SetLineColor(2);
866 marker->SetFillStyle(1001);
867 marker->SetFillColor(color);
868 marker->SetRefObject((TObject*)points);
869 points->Set3DMarker(0, marker);
870 } // loop over digits
871 } // loop over chambers
874 //__________________________________________________________________________________________________
875 void AliRICHDisplay::LoadHits(Int_t chamber)
877 // Read hits info and store x,y,z info in arrays fPhits
878 // Loop on all detectors
884 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
885 AliRICHChamber* iChamber;
887 iChamber = &(pRICH->Chamber(chamber-1));
888 Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries();
891 if (fPhits == 0) fPhits = new TObjArray(ntracks);
892 //TVector *xp = new TVector(1000);
893 //TVector *yp = new TVector(1000);
894 //TVector *zp = new TVector(1000);
895 //TVector *ptrk = new TVector(1000);
896 //TVector *phit = new TVector(1000);
898 for (track=0; track<ntracks;track++) {
900 pRICH->TreeH()->GetEvent(track);
901 TClonesArray *pRICHhits = pRICH->Hits();
902 if (pRICHhits == 0) return;
903 Int_t nhits = pRICHhits->GetEntriesFast();
907 fPhits = new TObjArray(nAllHits);
910 for (track=0; track<ntracks;track++) {
912 pRICH->TreeH()->GetEvent(track);
913 TClonesArray *pRICHhits = pRICH->Hits();
914 if (pRICHhits == 0) return;
915 Int_t nhits = pRICHhits->GetEntriesFast();
916 if (nhits == 0) continue;
918 AliRICHPoints *points = 0;
919 for (Int_t hit=0;hit<nhits;hit++) {
920 points = new AliRICHPoints(1);
921 fPhits->AddAt(points,npoints);
922 mHit = (AliRICHhit*)pRICHhits->UncheckedAt(hit);
923 TParticle *current = (TParticle*)gAlice->GetMCApp()->Particle(mHit->Track());
924 if (current->GetPdgCode() == 50000050) {
925 points->SetMarkerColor(kBlue);
926 } else if (current->GetPdgCode() == 50000051) {
927 points->SetMarkerColor(kYellow);
929 points->SetMarkerColor(kRed);
931 points->SetMarkerStyle(5);
932 points->SetMarkerSize(1.);
933 points->SetParticle(mHit->Track());
934 points->SetHitIndex(hit);
935 points->SetTrackIndex(track);
936 points->SetDigitIndex(-1);
937 points->SetPoint(0,mHit->X(), mHit->Y(), mHit->Z());
942 //__________________________________________________________________________________________________
943 void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
945 // Read cerenkov hits info and store x,y,z info in array fPCerenkovs
946 // Loop on all detectors
951 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
952 AliRICHChamber* iChamber;
954 iChamber = &(pRICH->Chamber(chamber-1));
956 pRICH->SetTreeAddress();
957 Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries();
959 if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
960 TVector *xp = new TVector(1000);
961 TVector *yp = new TVector(1000);
962 TVector *zp = new TVector(1000);
963 TVector *ptrk = new TVector(1000);
964 TVector *phit = new TVector(1000);
965 for (Int_t track=0; track<ntracks;track++) {
967 pRICH->TreeH()->GetEvent(track);
968 TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs();
969 if (pRICHCerenkovs == 0) return;
970 Int_t nhits = pRICHCerenkovs->GetEntriesFast();
971 if (nhits == 0) continue;
972 AliRICHCerenkov *mCerenkov;
973 AliRICHPoints *cpoints = 0;
977 //Display Cerenkov hits in blue
979 for (Int_t hit=0;hit<nhits;hit++) {
980 mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
981 (*xp)(npoints)=mCerenkov->X();
982 (*yp)(npoints)=mCerenkov->Y();
983 (*zp)(npoints)=mCerenkov->Z();
984 (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
985 (*phit)(npoints)=Float_t(hit);
988 if (npoints == 0) continue;
989 cpoints = new AliRICHPoints(npoints);
990 for (Int_t p=0;p<npoints;p++) {
991 cpoints->SetMarkerColor(kBlue);
992 cpoints->SetMarkerStyle(5);
993 cpoints->SetMarkerSize(1.);
994 cpoints->SetParticle(Int_t((*ptrk)(p)));
995 cpoints->SetHitIndex(Int_t((*phit)(p)));
996 cpoints->SetTrackIndex(track);
997 cpoints->SetDigitIndex(-1);
998 cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
1004 fPCerenkovs->AddAt(cpoints,track);
1008 //_____________________________________________________________________________
1009 void AliRICHDisplay::Paint(Option_t *)
1011 // Paint miscellaneous items
1015 //_____________________________________________________________________________
1016 void AliRICHDisplay::SetPickMode()
1023 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1024 fTrigPad->Modified();
1027 //_____________________________________________________________________________
1028 void AliRICHDisplay::SetZoomMode()
1035 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1036 fTrigPad->Modified();
1039 //_____________________________________________________________________________
1040 void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1042 // Set chamber and cathode number
1046 //printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
1053 //_____________________________________________________________________________
1054 void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange)
1056 // Set view range along R and Z
1065 //_____________________________________________________________________________
1066 void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1068 // change viewing angles for current event
1076 TView *view = gPad->GetView();
1077 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1083 //_____________________________________________________________________________
1084 void AliRICHDisplay::ShowNextEvent(Int_t delta)
1086 // Display (current event_number+delta)
1087 // delta = 1 shown next event
1088 // delta = -1 show previous event
1092 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1093 Int_t newEvent = currentEvent + delta;
1094 gAlice->GetEvent(newEvent);
1095 if (!gAlice->TreeD()) return;
1105 //______________________________________________________________________________
1106 void AliRICHDisplay::UnZoom()
1109 // Return to previous zoom factor
1111 if (fZooms <= 0) return;
1113 TPad *pad = (TPad*)gPad->GetPadSave();
1114 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1118 //_____________________________________________________________________________
1119 void AliRICHDisplay::ResetPoints()
1122 // Reset array of points
1130 //_____________________________________________________________________________
1131 void AliRICHDisplay::ResetRpoints()
1134 // Reset array of points
1142 //_____________________________________________________________________________
1143 void AliRICHDisplay::ResetRecpoints()
1146 // Reset array of points
1149 fRecpoints->Delete();
1154 //_____________________________________________________________________________
1155 void AliRICHDisplay::ResetPhits()
1158 // Reset array of points
1166 //_____________________________________________________________________________
1167 void AliRICHDisplay::ResetPCerenkovs()
1170 // Reset array of points
1173 fPCerenkovs->Delete();
1179 //_____________________________________________________________________________
1181 void AliRICHDisplay::DrawViewGL()
1183 // Draw current view using OPENGL
1185 TPad *pad = (TPad*)gPad->GetPadSave();
1187 TView *view = pad->GetView();
1192 //_____________________________________________________________________________
1193 void AliRICHDisplay::DrawViewX3D()
1195 // Draw current view using X3D
1197 TPad *pad = (TPad*)gPad->GetPadSave();
1199 TView *view = pad->GetView();