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>
36 #include <TPolyMarker.h>
37 #include <TPaveLabel.h>
38 #include <TPaveText.h>
45 #include <TGeometry.h>
46 #include <TSliderBox.h>
48 #include <TVirtualX.h>
51 #include <X3DBuffer.h>
52 #include <TParticle.h>
56 #include "AliDetector.h"
58 #include "AliRICHConst.h"
59 #include "AliRICHDisplay.h"
60 #include "AliRICHPoints.h"
61 #include "AliHeader.h"
63 #include "AliRICHSDigit.h"
64 #include "AliRICHDigit.h"
65 #include "AliRICHRawCluster.h"
68 ClassImp(AliRICHDisplay)
71 //____________________________________________________________________________
72 AliRICHDisplay::AliRICHDisplay()
75 // default constructor
85 //_____________________________________________________________________________
86 AliRICHDisplay::AliRICHDisplay(Int_t size)
88 // Create an event display object.
89 // A canvas named "edisplay" is created with a vertical size in pixels
91 // A QUICK Overview of the Event Display functions
92 // ===============================================
94 // The event display can ve invoked by executing the macro "display.C"
95 // A canvas like in the picture below will appear.
97 // On the left side of the canvas, the following buttons appear:
98 // *Next* to move to the next event
99 // *Previous* to move to the previous event
101 // *Pick* Select this option to be able to point on a track with the
102 // mouse. Once on the track, use the right button to select
103 // an action. For example, select SetMarkerAttributes to
104 // change the marker type/color/size for the track.
105 // *Zoom* Select this option (default) if you want to zoom.
106 // To zoom, simply select the selected area with the left button.
107 // *UnZoom* To revert to the previous picture size.
109 // slider R On the left side, the vertical slider can be used to
110 // set the default picture size.
112 // When you are in Zoom mode, you can click on the black part of the canvas
113 // to select special options with the right mouse button.
116 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
117 // When you are on a track, select the menu item "InspectParticle"
118 // to display the current particle attributes.
120 // You can activate the Root browser by selecting the Inspect menu
121 // in the canvas tool bar menu. Then select "Start Browser"
122 // This will open a new canvas with the browser. At this point, you may want
123 // to display some histograms (from the Trees). Go to the "File" menu
124 // of the browser and click on "New canvas".
125 // In the browser, click on item "ROOT files" in the left pane.
126 // Click on galice.root.
128 // Click on TPC for example
129 // Click on any variable (eg TPC.fX) to histogram the variable.
131 // If you are lost, you can click on HELP in any Root canvas or browser.
134 <img src="gif/AliRICHDisplay.gif">
141 gAlice->SetDisplay(this);
143 // Initialize display default parameters
146 // Set front view by default
147 fTheta = 90; //inclined HMPID
148 fPhi = 30; //inclined HMPID
149 //fTheta = 90; //normal HMPID
150 //fPhi = 90; //normal HMPID
155 fDrawClusters = kTRUE;
157 fDrawRecHits = kTRUE;
168 // Create display canvas
170 if (ysize < 100) ysize = 750;
171 Int_t xsize = Int_t(size*830./ysize);
172 fCanvas = new TCanvas("Canvas", "RICH Clusters Display",14,47,xsize,ysize);
173 fCanvas->ToggleEventStatus();
175 // Create main display pad
176 fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1);
179 fPad->SetFillColor(1);
180 fPad->SetBorderSize(2);
185 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
188 fColPad->SetFillColor(19);
189 fColPad->SetBorderSize(2);
195 // Create user interface control pad
199 // Create Range and mode pad
202 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
205 fTrigPad->SetFillColor(22);
206 fTrigPad->SetBorderSize(2);
207 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
208 fRangeSlider->SetObject(this);
209 char pickmode[] = "gAlice->Display()->SetPickMode()";
211 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
212 fPickButton->SetFillColor(38);
214 char zoommode[] = "gAlice->Display()->SetZoomMode()";
215 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
216 fZoomButton->SetFillColor(38);
218 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
219 fArcButton->SetFillColor(kGreen);
221 char butUnzoom[] = "gAlice->Display()->UnZoom()";
222 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
223 button->SetFillColor(38);
225 AppendPad(); // append display object as last object to force selection
227 fTrigPad->SetEditable(kFALSE);
228 fButtons->SetEditable(kFALSE);
234 //_____________________________________________________________________________
235 AliRICHDisplay::~AliRICHDisplay()
237 // Delete space point structure
238 if (fPoints) fPoints->Delete();
242 if (fPhits) fPhits->Delete();
246 if (fRpoints) fRpoints->Delete();
250 if (fRecpoints) fRecpoints->Delete();
254 if (fPCerenkovs) fPCerenkovs->Delete();
259 //_____________________________________________________________________________
260 void AliRICHDisplay::Clear(Option_t *)
262 // Delete graphics temporary objects
265 //_____________________________________________________________________________
266 void AliRICHDisplay::DisplayButtons()
268 // Create the user interface buttons
271 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
273 fButtons->SetFillColor(38);
274 fButtons->SetBorderSize(2);
277 // Int_t butcolor = 33;
278 Float_t dbutton = 0.08;
285 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
286 button = new TButton("Next",but1,x0,y-dbutton,x1,y);
287 button->SetFillColor(38);
291 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
292 button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
293 button->SetFillColor(38);
297 char but7[] = "gAlice->Display()->DrawViewGL()";
298 button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
299 button->SetFillColor(38);
303 char but8[] = "gAlice->Display()->DrawViewX3D()";
304 button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
305 button->SetFillColor(38);
309 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
310 diamond->SetFillColor(50);
311 diamond->SetTextAlign(22);
312 diamond->SetTextColor(5);
313 diamond->SetTextSize(0.11);
315 diamond->AddText(".. ");
316 diamond->AddText("ROOT");
317 diamond->AddText("RICH");
318 diamond->AddText("... ");
319 diamond->AddText(" ");
322 //_____________________________________________________________________________
323 void AliRICHDisplay::CreateColors()
325 // Create the colors palette used to display clusters
340 new TColor(color,r,g,b);
350 new TColor(color,r,g,b);
360 new TColor(color,r,g,b);
370 new TColor(color,r,g,b);
380 new TColor(color,r,g,b);
387 //_____________________________________________________________________________
388 void AliRICHDisplay::DisplayColorScale()
391 // Draw the color scale in the RICH display canvas
395 Float_t xlow, ylow, xup, yup, hs;
396 Float_t x1, y1, x2, y2;
400 gPad->SetFillColor(0);
402 gPad->Range(x1,y1,x2,y2);
403 TText *text = new TText(0,0,"");
404 text->SetTextFont(61);
405 text->SetTextSize(0.2);
406 text->SetTextAlign(22);
410 //*-* draw colortable boxes
411 hs = (y2-y1)/Float_t(22);
415 ylow = y1 + hs*(Float_t(i));
416 yup = y1 + hs*(Float_t(i+1));
418 Double_t logscale=Double_t(i+1)*(TMath::Log(kadc_satm)/22);
419 Int_t scale=(Int_t)TMath::Exp(logscale);
420 sprintf(label,"%d",scale);
421 box = new TBox(xlow, ylow, xup, yup);
422 box->SetFillColor(color);
424 text->DrawText(xup+4, 0.5*(ylow+yup),label);
428 //______________________________________________________________________________
429 Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
431 // Compute distance from point px,py to objects in event
433 gPad->SetCursor(kCross);
435 if (gPad == fTrigPad) return 9999;
437 const Int_t kBig = 9999;
439 Float_t xmin = gPad->GetX1();
440 Float_t xmax = gPad->GetX2();
441 Float_t dx = 0.02*(xmax - xmin);
442 Float_t x = gPad->AbsPixeltoX(px);
443 if (x < xmin+dx || x > xmax-dx) return dist;
444 if (fZoomMode) return 0;
448 //_____________________________________________________________________________
449 void AliRICHDisplay::Draw(Option_t *)
451 // Display current event
455 DrawView(fTheta, fPhi, fPsi); // see how to draw PGON+inner frames
457 // Display the event number and title
462 //_____________________________________________________________________________
463 void AliRICHDisplay::DrawCoG()
465 // Draw hits for RICH chambers
467 if (!fDrawCoG) return;
469 for (Int_t chamber=0;chamber<kNCH;chamber++) {
478 ncog = points->GetEntriesFast();
479 for (icog=0; icog < ncog; icog++) {
480 pm = (AliRICHPoints*)points->UncheckedAt(icog);
486 void AliRICHDisplay::DrawRecHits()
488 // Draw rec hits for RICH chambers
490 if (!fDrawRecHits) return;
492 for (Int_t chamber=0;chamber<kNCH;chamber++) {
493 LoadRecHits(chamber,1);
501 nrec = points->GetEntriesFast();
502 //printf("Nrec %d\n",nrec);
503 for (irec=0; irec < nrec; irec++) {
504 pm = (AliRICHPoints*)points->UncheckedAt(irec);
510 //_____________________________________________________________________________
512 void AliRICHDisplay::DrawCerenkovs()
514 // Draw cerenkovs hits for RICH chambers
516 LoadCerenkovs(fChamber);
517 //printf("\nDrawCerenkovs\n");
519 Int_t ntracks, track;
524 cpoints = fPCerenkovs;
525 //printf ("Cpoints: %p",cpoints);
526 if (!cpoints) return;
527 ntracks = cpoints->GetEntriesFast();
528 //printf("DrawCerenkovs - ntracks %d \n",ntracks);
529 for (track=0;track<ntracks;track++) {
530 pm = (AliRICHPoints*)cpoints->UncheckedAt(track);
533 fHitsCuts += pm->GetN();
537 //_____________________________________________________________________________
539 void AliRICHDisplay::DrawClusters()
541 // Draw clusterss for RICH chambers
543 Int_t ndigits, digit;
550 ndigits = points->GetEntriesFast();
551 for (digit=0;digit<ndigits;digit++){
552 pm = (AliRICHPoints*)points->UncheckedAt(digit);
557 for (Int_t im=0;im<3;im++) {
558 TMarker3DBox *marker=pm->GetMarker(im);
562 fClustersCuts +=pm->GetN();
566 //_____________________________________________________________________________
567 void AliRICHDisplay::DrawHits()
569 // Draw hits for RICH chambers
573 Int_t ntracks, track;
580 // ntracks = points->GetEntriesFast();
581 ntracks = fPhits->GetEntriesFast();
583 //printf("DrawHits - ntracks %d \n",ntracks);
584 for (track=0;track<ntracks;track++) {
585 pm = (AliRICHPoints*)fPhits->UncheckedAt(track);
588 fHitsCuts += pm->GetN();
593 //_____________________________________________________________________________
594 void AliRICHDisplay::DrawTitle(Option_t *option)
596 // Draw the event title
598 Float_t xmin = gPad->GetX1();
599 Float_t xmax = gPad->GetX2();
600 Float_t ymin = gPad->GetY1();
601 Float_t ymax = gPad->GetY2();
602 Float_t dx = xmax-xmin;
603 Float_t dy = ymax-ymin;
605 if (strlen(option) == 0) {
606 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
607 title->SetBit(kCanDelete);
608 title->SetFillColor(42);
611 sprintf(ptitle,"Alice event: %d, Run:%d",
612 gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
613 title->AddText(ptitle);
614 Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast();
615 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
616 nparticles, fHitsCuts,fClustersCuts);
617 title->AddText(ptitle);
620 new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
621 label->SetBit(kCanDelete);
622 label->SetFillColor(42);
627 //_____________________________________________________________________________
628 void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
630 // Draw a view of RICH clusters
632 gPad->SetCursor(kWatch);
633 gPad->SetFillColor(1);
637 TView *view = new TView(1);
638 Float_t range = fRrange*fRangeSlider->GetMaximum();
639 view->SetRange(-range,-range,-range,range, range, range);
646 //Display RICH Chamber Geometry
647 gAlice->GetGeometry()->Draw("same");
649 //add clusters to the pad
655 //printf("Calling DrawCoG\n");
657 //printf("Calling DrawRecHits\n");
660 /*for (Int_t i=0;i<7;i++)
663 // add itself to the list (must be last)
666 view->SetView(phi, theta, psi, iret);
669 //______________________________________________________________________________
670 void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
672 // Execute action corresponding to the mouse event
674 static Float_t x0, y0, x1, y1;
676 static Int_t pxold, pyold;
677 static Int_t px0, py0;
678 static Int_t linedrawn;
681 if (px == 0 && py == 0) { //when called by sliders
682 if (event == kButton1Up) {
683 printf("Drawing event %d\n",event);
688 if (!fZoomMode && gPad->GetView()) {
689 gPad->GetView()->ExecuteRotateView(event, px, py);
693 // something to zoom ?
694 gPad->SetCursor(kCross);
699 gVirtualX->SetLineColor(-1);
700 gPad->TAttLine::Modify(); //Change line attributes only if necessary
701 x0 = gPad->AbsPixeltoX(px);
702 y0 = gPad->AbsPixeltoY(py);
704 pxold = px; pyold = py;
709 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
713 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
717 gPad->GetCanvas()->FeedbackMode(kFALSE);
718 if (px == px0) return;
719 if (py == py0) return;
720 x1 = gPad->AbsPixeltoX(px);
721 y1 = gPad->AbsPixeltoY(py);
723 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
724 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
725 gPad->Range(x0,y0,x1,y1);
726 if (fZooms < kMAXZOOM-1) {
728 fZoomX0[fZooms] = x0;
729 fZoomY0[fZooms] = y0;
730 fZoomX1[fZooms] = x1;
731 fZoomY1[fZooms] = y1;
733 gPad->Modified(kTRUE);
738 //___________________________________________
739 void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
741 // Read raw clusters info and store x,y,z info in arrays fRpoints
742 // Loop on all detectors
744 if (chamber > 6) return;
746 //printf("Entering LoadCoG\n");
749 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
750 AliRICHChamber* iChamber;
752 TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber);
753 //printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
754 if (pRICHrawclust == 0) return;
756 pRICH->ResetRawClusters();
759 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
760 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
761 Int_t nrawcl = pRICHrawclust->GetEntriesFast();
762 //printf ("nrawcl:%d\n",nrawcl);
763 if (nrawcl == 0) return;
764 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
766 iChamber = &(pRICH->Chamber(chamber));
767 AliRICHRawCluster *mRaw;
768 AliRICHPoints *points = 0;
770 //loop over all raw clusters and store their position
771 points = new AliRICHPoints(nrawcl);
772 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
773 mRaw = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw);
774 fRpoints->AddAt(points,iraw);
775 points->SetMarkerColor(3);
776 points->SetMarkerStyle(3);
777 points->SetMarkerSize(1.);
778 points->SetParticle(-1);
779 points->SetHitIndex(-1);
780 points->SetTrackIndex(-1);
781 points->SetDigitIndex(-1);
782 Float_t vectorLoc[3]={mRaw->fX,5,mRaw->fY};
783 Float_t vectorGlob[3];
784 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
785 points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
788 //___________________________________________
789 void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
793 //___________________________________________
794 void AliRICHDisplay::LoadDigits()
796 // Read digits info and store x,y,z info in arrays fPoints
797 // Loop on all detectors
800 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
801 AliRICHChamber* iChamber;
802 AliSegmentation* segmentation;
806 //printf("Entering LoadDigits\n");
811 for (ich=0; ich<kNCH; ich++) {
812 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
813 //printf ("Chamber:%d has adress:%p\n", ich, pRICHdigits );
814 if (pRICHdigits == 0) continue;
815 gAlice->ResetDigits();
816 gAlice->TreeD()->GetEvent(0);
817 Int_t ndigits = pRICHdigits->GetEntriesFast();
818 //printf("ndigits:%d\n",ndigits);
822 if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
824 for (ich=0; ich<kNCH; ich++) {
825 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
826 if (pRICHdigits == 0) continue;
827 gAlice->ResetDigits();
828 gAlice->TreeD()->GetEvent(0);
829 Int_t ndigits = pRICHdigits->GetEntriesFast();
830 if (ndigits == 0) continue;
831 iChamber = &(pRICH->Chamber(ich));
832 segmentation=iChamber->GetSegmentationModel();
833 Float_t dpx = segmentation->Dpx();
834 Float_t dpy = segmentation->Dpy();
836 //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
839 AliRICHPoints *points = 0;
840 TMarker3DBox *marker = 0;
842 //loop over all digits and store their position
845 for (Int_t digit=0;digit<ndigits;digit++) {
846 mdig = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
847 points = new AliRICHPoints(npoints);
848 fPoints->AddAt(points,counter);
850 Int_t charge=mdig->Signal();
851 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(kadc_satm)/22));
852 Int_t color=701+index;
853 if (color>722) color=722;
854 points->SetMarkerColor(color);
855 points->SetMarkerStyle(21);
856 points->SetMarkerSize(0.5);
857 Float_t xpad, ypad, zpad;
858 segmentation->GetPadC(mdig->PadX(), mdig->PadY(),xpad, ypad, zpad);
859 Float_t vectorLoc[3]={xpad,5,ypad};
860 Float_t vectorGlob[3];
861 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
862 points->SetParticle(-1);
863 points->SetHitIndex(-1);
864 points->SetTrackIndex(-1);
865 points->SetDigitIndex(digit);
866 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
867 //printf("Y position (digit): %f\n", vectorGlob[1]);
869 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
870 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
871 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
872 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
873 dpy/2,0,dpx/2,theta,phi);
874 marker->SetLineColor(2);
875 marker->SetFillStyle(1001);
876 marker->SetFillColor(color);
877 marker->SetRefObject((TObject*)points);
878 points->Set3DMarker(0, marker);
879 } // loop over digits
880 } // loop over chambers
885 //___________________________________________
886 void AliRICHDisplay::LoadHits(Int_t chamber)
888 // Read hits info and store x,y,z info in arrays fPhits
889 // Loop on all detectors
895 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
896 AliRICHChamber* iChamber;
898 iChamber = &(pRICH->Chamber(chamber-1));
899 Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries();
902 if (fPhits == 0) fPhits = new TObjArray(ntracks);
903 //TVector *xp = new TVector(1000);
904 //TVector *yp = new TVector(1000);
905 //TVector *zp = new TVector(1000);
906 //TVector *ptrk = new TVector(1000);
907 //TVector *phit = new TVector(1000);
909 for (track=0; track<ntracks;track++) {
911 pRICH->TreeH()->GetEvent(track);
912 TClonesArray *pRICHhits = pRICH->Hits();
913 if (pRICHhits == 0) return;
914 Int_t nhits = pRICHhits->GetEntriesFast();
918 fPhits = new TObjArray(nAllHits);
921 for (track=0; track<ntracks;track++) {
923 pRICH->TreeH()->GetEvent(track);
924 TClonesArray *pRICHhits = pRICH->Hits();
925 if (pRICHhits == 0) return;
926 Int_t nhits = pRICHhits->GetEntriesFast();
927 if (nhits == 0) continue;
929 AliRICHPoints *points = 0;
930 for (Int_t hit=0;hit<nhits;hit++) {
931 points = new AliRICHPoints(1);
932 fPhits->AddAt(points,npoints);
933 mHit = (AliRICHhit*)pRICHhits->UncheckedAt(hit);
934 TParticle *current = (TParticle*)gAlice->GetMCApp()->Particle(mHit->Track());
935 if (current->GetPdgCode() == 50000050) {
936 points->SetMarkerColor(kBlue);
937 } else if (current->GetPdgCode() == 50000051) {
938 points->SetMarkerColor(kYellow);
940 points->SetMarkerColor(kRed);
942 points->SetMarkerStyle(5);
943 points->SetMarkerSize(1.);
944 points->SetParticle(mHit->Track());
945 points->SetHitIndex(hit);
946 points->SetTrackIndex(track);
947 points->SetDigitIndex(-1);
948 points->SetPoint(0,mHit->X(), mHit->Y(), mHit->Z());
954 //_____________________________________________________________________________
956 void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
958 // Read cerenkov hits info and store x,y,z info in array fPCerenkovs
959 // Loop on all detectors
964 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
965 AliRICHChamber* iChamber;
967 iChamber = &(pRICH->Chamber(chamber-1));
969 pRICH->SetTreeAddress();
970 Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries();
972 if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
973 TVector *xp = new TVector(1000);
974 TVector *yp = new TVector(1000);
975 TVector *zp = new TVector(1000);
976 TVector *ptrk = new TVector(1000);
977 TVector *phit = new TVector(1000);
978 for (Int_t track=0; track<ntracks;track++) {
980 pRICH->TreeH()->GetEvent(track);
981 TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs();
982 if (pRICHCerenkovs == 0) return;
983 Int_t nhits = pRICHCerenkovs->GetEntriesFast();
984 if (nhits == 0) continue;
985 AliRICHCerenkov *mCerenkov;
986 AliRICHPoints *cpoints = 0;
990 //Display Cerenkov hits in blue
992 for (Int_t hit=0;hit<nhits;hit++) {
993 mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
994 (*xp)(npoints)=mCerenkov->X();
995 (*yp)(npoints)=mCerenkov->Y();
996 (*zp)(npoints)=mCerenkov->Z();
997 (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
998 (*phit)(npoints)=Float_t(hit);
1001 if (npoints == 0) continue;
1002 cpoints = new AliRICHPoints(npoints);
1003 for (Int_t p=0;p<npoints;p++) {
1004 cpoints->SetMarkerColor(kBlue);
1005 cpoints->SetMarkerStyle(5);
1006 cpoints->SetMarkerSize(1.);
1007 cpoints->SetParticle(Int_t((*ptrk)(p)));
1008 cpoints->SetHitIndex(Int_t((*phit)(p)));
1009 cpoints->SetTrackIndex(track);
1010 cpoints->SetDigitIndex(-1);
1011 cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
1017 fPCerenkovs->AddAt(cpoints,track);
1021 //_____________________________________________________________________________
1022 void AliRICHDisplay::Paint(Option_t *)
1024 // Paint miscellaneous items
1028 //_____________________________________________________________________________
1029 void AliRICHDisplay::SetPickMode()
1036 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1037 fTrigPad->Modified();
1040 //_____________________________________________________________________________
1041 void AliRICHDisplay::SetZoomMode()
1048 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1049 fTrigPad->Modified();
1052 //_____________________________________________________________________________
1053 void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1055 // Set chamber and cathode number
1059 //printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
1066 //_____________________________________________________________________________
1067 void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange)
1069 // Set view range along R and Z
1078 //_____________________________________________________________________________
1079 void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1081 // change viewing angles for current event
1089 TView *view = gPad->GetView();
1090 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1096 //_____________________________________________________________________________
1097 void AliRICHDisplay::ShowNextEvent(Int_t delta)
1099 // Display (current event_number+delta)
1100 // delta = 1 shown next event
1101 // delta = -1 show previous event
1105 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1106 Int_t newEvent = currentEvent + delta;
1107 gAlice->GetEvent(newEvent);
1108 if (!gAlice->TreeD()) return;
1118 //______________________________________________________________________________
1119 void AliRICHDisplay::UnZoom()
1122 // Return to previous zoom factor
1124 if (fZooms <= 0) return;
1126 TPad *pad = (TPad*)gPad->GetPadSave();
1127 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1131 //_____________________________________________________________________________
1132 void AliRICHDisplay::ResetPoints()
1135 // Reset array of points
1143 //_____________________________________________________________________________
1144 void AliRICHDisplay::ResetRpoints()
1147 // Reset array of points
1155 //_____________________________________________________________________________
1156 void AliRICHDisplay::ResetRecpoints()
1159 // Reset array of points
1162 fRecpoints->Delete();
1167 //_____________________________________________________________________________
1168 void AliRICHDisplay::ResetPhits()
1171 // Reset array of points
1179 //_____________________________________________________________________________
1180 void AliRICHDisplay::ResetPCerenkovs()
1183 // Reset array of points
1186 fPCerenkovs->Delete();
1192 //_____________________________________________________________________________
1194 void AliRICHDisplay::DrawViewGL()
1196 // Draw current view using OPENGL
1198 TPad *pad = (TPad*)gPad->GetPadSave();
1200 TView *view = pad->GetView();
1205 //_____________________________________________________________________________
1206 void AliRICHDisplay::DrawViewX3D()
1208 // Draw current view using X3D
1210 TPad *pad = (TPad*)gPad->GetPadSave();
1212 TView *view = pad->GetView();