1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.3 2000/06/09 14:52:08 jbarbosa
19 New tentative ellipse drawing routine
21 Revision 1.1 2000/04/19 13:07:45 morsch
22 Digits, clusters and reconstruction results added.
27 //////////////////////////////////////////////////////////////////////////
31 // Utility class to display ALICE outline, tracks, hits,.. //
33 //////////////////////////////////////////////////////////////////////////
42 #include <TPolyMarker3D.h>
43 #include <TPolyMarker.h>
44 #include <TPaveLabel.h>
45 #include <TPaveText.h>
52 #include <TSliderBox.h>
54 #include <TVirtualX.h>
57 #include <X3DBuffer.h>
58 #include <TParticle.h>
62 #include "AliDetector.h"
64 #include "AliRICHConst.h"
65 #include "AliRICHDisplay.h"
66 #include "AliRICHPoints.h"
68 #include "AliRICHHit.h"
69 #include "AliRICHCerenkov.h"
70 #include "AliRICHPadHit.h"
71 #include "AliRICHDigit.h"
72 #include "AliRICHRawCluster.h"
73 #include "AliRICHRecHit.h"
74 #include "AliRICHEllipse.h"
76 ClassImp(AliRICHDisplay)
79 //____________________________________________________________________________
80 AliRICHDisplay::AliRICHDisplay()
83 // default constructor
93 //_____________________________________________________________________________
94 AliRICHDisplay::AliRICHDisplay(Int_t size)
96 // Create an event display object.
97 // A canvas named "edisplay" is created with a vertical size in pixels
99 // A QUICK Overview of the Event Display functions
100 // ===============================================
102 // The event display can ve invoked by executing the macro "display.C"
103 // A canvas like in the picture below will appear.
105 // On the left side of the canvas, the following buttons appear:
106 // *Next* to move to the next event
107 // *Previous* to move to the previous event
109 // *Pick* Select this option to be able to point on a track with the
110 // mouse. Once on the track, use the right button to select
111 // an action. For example, select SetMarkerAttributes to
112 // change the marker type/color/size for the track.
113 // *Zoom* Select this option (default) if you want to zoom.
114 // To zoom, simply select the selected area with the left button.
115 // *UnZoom* To revert to the previous picture size.
117 // slider R On the left side, the vertical slider can be used to
118 // set the default picture size.
120 // When you are in Zoom mode, you can click on the black part of the canvas
121 // to select special options with the right mouse button.
124 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
125 // When you are on a track, select the menu item "InspectParticle"
126 // to display the current particle attributes.
128 // You can activate the Root browser by selecting the Inspect menu
129 // in the canvas tool bar menu. Then select "Start Browser"
130 // This will open a new canvas with the browser. At this point, you may want
131 // to display some histograms (from the Trees). Go to the "File" menu
132 // of the browser and click on "New canvas".
133 // In the browser, click on item "ROOT files" in the left pane.
134 // Click on galice.root.
136 // Click on TPC for example
137 // Click on any variable (eg TPC.fX) to histogram the variable.
139 // If you are lost, you can click on HELP in any Root canvas or browser.
142 <img src="gif/AliRICHDisplay.gif">
149 gAlice->SetDisplay(this);
151 // Initialize display default parameters
154 // Set front view by default
161 fDrawClusters = kTRUE;
163 fDrawRecHits = kTRUE;
174 // Create display canvas
176 if (ysize < 100) ysize = 750;
177 Int_t xsize = Int_t(size*830./ysize);
178 fCanvas = new TCanvas("Canvas", "RICH Clusters Display",14,47,xsize,ysize);
179 fCanvas->ToggleEventStatus();
181 // Create main display pad
182 fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1);
185 fPad->SetFillColor(1);
186 fPad->SetBorderSize(2);
191 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
194 fColPad->SetFillColor(19);
195 fColPad->SetBorderSize(2);
201 // Create user interface control pad
205 // Create Range and mode pad
208 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
209 fTrigPad->SetEditable(kFALSE);
212 fTrigPad->SetFillColor(22);
213 fTrigPad->SetBorderSize(2);
214 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
215 fRangeSlider->SetObject(this);
216 char pickmode[] = "gAlice->Display()->SetPickMode()";
218 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
219 fPickButton->SetFillColor(38);
221 char zoommode[] = "gAlice->Display()->SetZoomMode()";
222 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
223 fZoomButton->SetFillColor(38);
225 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
226 fArcButton->SetFillColor(kGreen);
228 char butUnzoom[] = "gAlice->Display()->UnZoom()";
229 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
230 button->SetFillColor(38);
232 AppendPad(); // append display object as last object to force selection
239 //_____________________________________________________________________________
240 AliRICHDisplay::~AliRICHDisplay()
242 // Delete space point structure
243 if (fPoints) fPoints->Delete();
247 if (fPhits) fPhits->Delete();
251 if (fRpoints) fRpoints->Delete();
255 if (fRecpoints) fRecpoints->Delete();
259 if (fPCerenkovs) fPCerenkovs->Delete();
264 //_____________________________________________________________________________
265 void AliRICHDisplay::Clear(Option_t *)
267 // Delete graphics temporary objects
270 //_____________________________________________________________________________
271 void AliRICHDisplay::DisplayButtons()
273 // Create the user interface buttons
276 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
277 fButtons->SetEditable(kFALSE);
279 fButtons->SetFillColor(38);
280 fButtons->SetBorderSize(2);
283 // Int_t butcolor = 33;
284 Float_t dbutton = 0.08;
291 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
292 button = new TButton("Next",but1,x0,y-dbutton,x1,y);
293 button->SetFillColor(38);
297 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
298 button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
299 button->SetFillColor(38);
303 char but7[] = "gAlice->Display()->DrawViewGL()";
304 button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
305 button->SetFillColor(38);
309 char but8[] = "gAlice->Display()->DrawViewX3D()";
310 button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
311 button->SetFillColor(38);
315 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
316 diamond->SetFillColor(50);
317 diamond->SetTextAlign(22);
318 diamond->SetTextColor(5);
319 diamond->SetTextSize(0.11);
321 diamond->AddText(".. ");
322 diamond->AddText("ROOT");
323 diamond->AddText("RICH");
324 diamond->AddText("... ");
325 diamond->AddText(" ");
328 //_____________________________________________________________________________
329 void AliRICHDisplay::CreateColors()
331 // Create the colors palette used to display clusters
346 new TColor(color,r,g,b);
356 new TColor(color,r,g,b);
366 new TColor(color,r,g,b);
376 new TColor(color,r,g,b);
386 new TColor(color,r,g,b);
393 //_____________________________________________________________________________
394 void AliRICHDisplay::DisplayColorScale()
397 // Draw the color scale in the RICH display canvas
401 Float_t xlow, ylow, xup, yup, hs;
402 Float_t x1, y1, x2, y2;
406 gPad->SetFillColor(0);
408 gPad->Range(x1,y1,x2,y2);
409 TText *text = new TText(0,0,"");
410 text->SetTextFont(61);
411 text->SetTextSize(0.03);
412 text->SetTextAlign(22);
416 //*-* draw colortable boxes
417 hs = (y2-y1)/Float_t(22);
421 ylow = y1 + hs*(Float_t(i));
422 yup = y1 + hs*(Float_t(i+1));
424 Double_t logscale=Double_t(i+1)*(TMath::Log(adc_satm)/22);
425 Int_t scale=(Int_t)TMath::Exp(logscale);
426 sprintf(label,"%d",scale);
427 box = new TBox(xlow, ylow, xup, yup);
428 box->SetFillColor(color);
430 text->DrawText(xup+4, 0.5*(ylow+yup),label);
434 //______________________________________________________________________________
435 Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
437 // Compute distance from point px,py to objects in event
439 gPad->SetCursor(kCross);
441 if (gPad == fTrigPad) return 9999;
443 const Int_t kBig = 9999;
445 Float_t xmin = gPad->GetX1();
446 Float_t xmax = gPad->GetX2();
447 Float_t dx = 0.02*(xmax - xmin);
448 Float_t x = gPad->AbsPixeltoX(px);
449 if (x < xmin+dx || x > xmax-dx) return dist;
450 if (fZoomMode) return 0;
454 //_____________________________________________________________________________
455 void AliRICHDisplay::Draw(Option_t *)
457 // Display current event
461 DrawView(fTheta, fPhi, fPsi); // see how to draw PGON+inner frames
463 // Display the event number and title
468 //_____________________________________________________________________________
469 void AliRICHDisplay::DrawCoG()
471 // Draw hits for RICH chambers
473 if (!fDrawCoG) return;
475 for (Int_t chamber=0;chamber<kNCH;chamber++) {
484 ncog = points->GetEntriesFast();
485 for (icog=0; icog < ncog; icog++) {
486 pm = (AliRICHPoints*)points->UncheckedAt(icog);
492 void AliRICHDisplay::DrawRecHits()
494 // Draw rec hits for RICH chambers
496 if (!fDrawRecHits) return;
498 for (Int_t chamber=0;chamber<kNCH;chamber++) {
499 LoadRecHits(chamber,1);
507 nrec = points->GetEntriesFast();
508 printf("Nrec %d\n",nrec);
509 for (irec=0; irec < nrec; irec++) {
510 pm = (AliRICHPoints*)points->UncheckedAt(irec);
516 //_____________________________________________________________________________
518 void AliRICHDisplay::DrawCerenkovs()
520 // Draw cerenkovs hits for RICH chambers
522 LoadCerenkovs(fChamber);
523 //printf("\nDrawCerenkovs\n");
525 Int_t ntracks, track;
530 cpoints = fPCerenkovs;
531 //printf ("Cpoints: %p",cpoints);
532 if (!cpoints) return;
533 ntracks = cpoints->GetEntriesFast();
534 //printf("DrawCerenkovs - ntracks %d \n",ntracks);
535 for (track=0;track<ntracks;track++) {
536 pm = (AliRICHPoints*)cpoints->UncheckedAt(track);
539 fHitsCuts += pm->GetN();
543 //_____________________________________________________________________________
545 void AliRICHDisplay::DrawClusters()
547 // Draw clusterss for RICH chambers
549 Int_t ndigits, digit;
556 ndigits = points->GetEntriesFast();
557 for (digit=0;digit<ndigits;digit++){
558 pm = (AliRICHPoints*)points->UncheckedAt(digit);
563 for (Int_t im=0;im<3;im++) {
564 TMarker3DBox *marker=pm->GetMarker(im);
568 fClustersCuts +=pm->GetN();
572 //_____________________________________________________________________________
573 void AliRICHDisplay::DrawHits()
575 // Draw hits for RICH chambers
579 Int_t ntracks, track;
586 // ntracks = points->GetEntriesFast();
587 ntracks = fPhits->GetEntriesFast();
589 //printf("DrawHits - ntracks %d \n",ntracks);
590 for (track=0;track<ntracks;track++) {
591 pm = (AliRICHPoints*)fPhits->UncheckedAt(track);
594 fHitsCuts += pm->GetN();
599 //_____________________________________________________________________________
600 void AliRICHDisplay::DrawTitle(Option_t *option)
602 // Draw the event title
604 Float_t xmin = gPad->GetX1();
605 Float_t xmax = gPad->GetX2();
606 Float_t ymin = gPad->GetY1();
607 Float_t ymax = gPad->GetY2();
608 Float_t dx = xmax-xmin;
609 Float_t dy = ymax-ymin;
611 if (strlen(option) == 0) {
612 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
613 title->SetBit(kCanDelete);
614 title->SetFillColor(42);
617 sprintf(ptitle,"Alice event: %d, Run:%d",
618 gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
619 title->AddText(ptitle);
620 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
621 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
622 nparticles, fHitsCuts,fClustersCuts);
623 title->AddText(ptitle);
626 new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
627 label->SetBit(kCanDelete);
628 label->SetFillColor(42);
633 //_____________________________________________________________________________
634 void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
636 // Draw a view of RICH clusters
638 gPad->SetCursor(kWatch);
639 gPad->SetFillColor(1);
643 TView *view = new TView(1);
644 Float_t range = fRrange*fRangeSlider->GetMaximum();
645 view->SetRange(-range,-range,-range,range, range, range);
652 //Display RICH Chamber Geometry
653 gAlice->GetGeometry()->Draw("same");
655 //add clusters to the pad
659 printf("Calling DrawCoG\n");
661 printf("Calling DrawRecHits\n");
663 /*for (Int_t i=0;i<7;i++)
666 // add itself to the list (must be last)
669 view->SetView(phi, theta, psi, iret);
672 //______________________________________________________________________________
673 void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
675 // Execute action corresponding to the mouse event
677 static Float_t x0, y0, x1, y1;
679 static Int_t pxold, pyold;
680 static Int_t px0, py0;
681 static Int_t linedrawn;
684 if (px == 0 && py == 0) { //when called by sliders
685 if (event == kButton1Up) {
690 if (!fZoomMode && gPad->GetView()) {
691 gPad->GetView()->ExecuteRotateView(event, px, py);
695 // something to zoom ?
696 gPad->SetCursor(kCross);
701 gVirtualX->SetLineColor(-1);
702 gPad->TAttLine::Modify(); //Change line attributes only if necessary
703 x0 = gPad->AbsPixeltoX(px);
704 y0 = gPad->AbsPixeltoY(py);
706 pxold = px; pyold = py;
711 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
715 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
719 gPad->GetCanvas()->FeedbackMode(kFALSE);
720 if (px == px0) return;
721 if (py == py0) return;
722 x1 = gPad->AbsPixeltoX(px);
723 y1 = gPad->AbsPixeltoY(py);
725 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
726 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
727 gPad->Range(x0,y0,x1,y1);
728 if (fZooms < kMAXZOOM-1) {
730 fZoomX0[fZooms] = x0;
731 fZoomY0[fZooms] = y0;
732 fZoomX1[fZooms] = x1;
733 fZoomY1[fZooms] = y1;
735 gPad->Modified(kTRUE);
740 //___________________________________________
741 void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
743 // Read raw clusters info and store x,y,z info in arrays fRpoints
744 // Loop on all detectors
746 if (chamber > 6) return;
748 printf("Entering LoadCoG\n");
751 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
752 AliRICHChamber* iChamber;
754 TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber);
755 printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
756 if (pRICHrawclust == 0) return;
758 pRICH->ResetRawClusters();
761 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
762 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
763 Int_t nrawcl = pRICHrawclust->GetEntriesFast();
764 printf ("nrawcl:%d\n",nrawcl);
765 if (nrawcl == 0) return;
766 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
768 iChamber = &(pRICH->Chamber(chamber));
769 AliRICHRawCluster *mRaw;
770 AliRICHPoints *points = 0;
772 //loop over all raw clusters and store their position
773 points = new AliRICHPoints(nrawcl);
774 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
775 mRaw = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw);
776 fRpoints->AddAt(points,iraw);
777 points->SetMarkerColor(3);
778 points->SetMarkerStyle(3);
779 points->SetMarkerSize(1.);
780 points->SetParticle(-1);
781 points->SetHitIndex(-1);
782 points->SetTrackIndex(-1);
783 points->SetDigitIndex(-1);
784 Float_t vectorLoc[3]={mRaw->fX,6.276,mRaw->fY};
785 Float_t vectorGlob[3];
786 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
787 points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
790 //___________________________________________
791 void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
793 // Read rec. hits info
794 // Loop on all detectors
796 if (chamber > 6) return;
798 printf("Entering LoadRecHits\n");
801 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
802 AliRICHChamber* iChamber;
804 TClonesArray *pRICHrechits = pRICH->RecHitsAddress(chamber);
805 printf ("Chamber:%d has adress:%p\n", chamber, pRICHrechits );
806 if (pRICHrechits == 0) return;
808 //RICH->ResetRecHits();
811 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
812 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
813 Int_t nrechits = pRICHrechits->GetEntriesFast();
814 printf ("nrechits:%d\n",nrechits);
815 if (nrechits == 0) return;
816 if (fRecpoints == 0) fRecpoints = new TObjArray(50);
818 iChamber = &(pRICH->Chamber(chamber));
820 AliRICHPoints *points = 0;
821 //AliRICHEllipse *ellipse = 0;
823 //loop over all rechits and store their position
825 points = new AliRICHPoints(nrechits);
826 for (Int_t irec=0;irec<nrechits;irec++) {
827 mRec = (AliRICHRecHit*)pRICHrechits->UncheckedAt(irec);
828 fRecpoints->AddAt(points,irec);
829 points->SetMarkerColor(38);
830 points->SetMarkerStyle(8);
831 points->SetMarkerSize(1.);
832 points->SetParticle(-1);
833 points->SetHitIndex(-1);
834 points->SetTrackIndex(-1);
835 points->SetDigitIndex(-1);
836 Float_t vectorLoc[3]={mRec->fX,6.276,mRec->fY};
837 Float_t vectorGlob[3];
838 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
839 points->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
840 //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
841 //Float_t phi = iChamber->GetRotMatrix()->GetPhi();
842 //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi);
843 printf("Generating ellipse %d\n",irec);
844 AliRICHEllipse *ellipse=new AliRICHEllipse(mRec->fX,mRec->fY,mRec->fOmega,mRec->fTheta,mRec->fPhi);
845 ellipse->CreatePoints(chamber);
846 //ellipse->SetFillStyle(1001);
847 ellipse->SetMarkerColor(38);
849 //marker->SetRefObject((TObject*)points);
850 //points->Set3DMarker(0, marker);
853 //___________________________________________
854 void AliRICHDisplay::LoadDigits()
856 // Read digits info and store x,y,z info in arrays fPoints
857 // Loop on all detectors
860 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
861 AliRICHChamber* iChamber;
862 AliRICHSegmentation* segmentation;
866 for (ich=0; ich<kNCH; ich++) {
867 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
868 if (pRICHdigits == 0) continue;
869 gAlice->ResetDigits();
870 gAlice->TreeD()->GetEvent(1);
871 Int_t ndigits = pRICHdigits->GetEntriesFast();
874 if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
876 for (ich=0; ich<kNCH; ich++) {
877 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
878 if (pRICHdigits == 0) continue;
879 gAlice->ResetDigits();
880 gAlice->TreeD()->GetEvent(1);
881 Int_t ndigits = pRICHdigits->GetEntriesFast();
882 if (ndigits == 0) continue;
883 iChamber = &(pRICH->Chamber(ich));
884 segmentation=iChamber->GetSegmentationModel();
885 Float_t dpx = segmentation->Dpx();
886 Float_t dpy = segmentation->Dpy();
888 //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
891 AliRICHPoints *points = 0;
892 TMarker3DBox *marker = 0;
894 //loop over all digits and store their position
897 for (Int_t digit=0;digit<ndigits;digit++) {
898 mdig = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
899 points = new AliRICHPoints(npoints);
900 fPoints->AddAt(points,counter);
902 Int_t charge=mdig->fSignal;
903 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
904 Int_t color=701+index;
905 if (color>722) color=722;
906 points->SetMarkerColor(color);
907 points->SetMarkerStyle(21);
908 points->SetMarkerSize(0.5);
910 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
911 Float_t vectorLoc[3]={xpad,6.276,ypad};
912 Float_t vectorGlob[3];
913 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
914 points->SetParticle(-1);
915 points->SetHitIndex(-1);
916 points->SetTrackIndex(-1);
917 points->SetDigitIndex(digit);
918 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
920 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad);
921 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
922 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
923 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
924 dpy/2,0,dpx/2,theta,phi);
925 marker->SetLineColor(2);
926 marker->SetFillStyle(1001);
927 marker->SetFillColor(color);
928 marker->SetRefObject((TObject*)points);
929 points->Set3DMarker(0, marker);
930 } // loop over digits
931 } // loop over chambers
935 //___________________________________________
936 void AliRICHDisplay::LoadHits(Int_t chamber)
938 // Read hits info and store x,y,z info in arrays fPhits
939 // Loop on all detectors
945 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
946 AliRICHChamber* iChamber;
948 iChamber = &(pRICH->Chamber(chamber-1));
949 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
952 if (fPhits == 0) fPhits = new TObjArray(ntracks);
953 //TVector *xp = new TVector(1000);
954 //TVector *yp = new TVector(1000);
955 //TVector *zp = new TVector(1000);
956 //TVector *ptrk = new TVector(1000);
957 //TVector *phit = new TVector(1000);
959 for (track=0; track<ntracks;track++) {
961 gAlice->TreeH()->GetEvent(track);
962 TClonesArray *pRICHhits = pRICH->Hits();
963 if (pRICHhits == 0) return;
964 Int_t nhits = pRICHhits->GetEntriesFast();
968 fPhits = new TObjArray(nAllHits);
971 for (track=0; track<ntracks;track++) {
973 gAlice->TreeH()->GetEvent(track);
974 TClonesArray *pRICHhits = pRICH->Hits();
975 if (pRICHhits == 0) return;
976 Int_t nhits = pRICHhits->GetEntriesFast();
977 if (nhits == 0) continue;
979 AliRICHPoints *points = 0;
980 for (Int_t hit=0;hit<nhits;hit++) {
981 points = new AliRICHPoints(1);
982 fPhits->AddAt(points,npoints);
983 mHit = (AliRICHHit*)pRICHhits->UncheckedAt(hit);
985 (TParticle*)(*gAlice->Particles())[mHit->fTrack];
986 if (current->GetPdgCode() == 50000050) {
987 points->SetMarkerColor(kBlue);
988 } else if (current->GetPdgCode() == 50000051) {
989 points->SetMarkerColor(kYellow);
991 points->SetMarkerColor(kRed);
993 points->SetMarkerStyle(5);
994 points->SetMarkerSize(1.);
995 points->SetParticle(mHit->fTrack);
996 points->SetHitIndex(hit);
997 points->SetTrackIndex(track);
998 points->SetDigitIndex(-1);
999 points->SetPoint(hit,mHit->fX, mHit->fY, mHit->fZ);
1005 //_____________________________________________________________________________
1007 void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
1009 // Read cerenkov hits info and store x,y,z info in array fPCerenkovs
1010 // Loop on all detectors
1015 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1016 AliRICHChamber* iChamber;
1018 iChamber = &(pRICH->Chamber(chamber-1));
1020 pRICH->SetTreeAddress();
1021 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1023 if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
1024 TVector *xp = new TVector(1000);
1025 TVector *yp = new TVector(1000);
1026 TVector *zp = new TVector(1000);
1027 TVector *ptrk = new TVector(1000);
1028 TVector *phit = new TVector(1000);
1029 for (Int_t track=0; track<ntracks;track++) {
1030 gAlice->ResetHits();
1031 gAlice->TreeH()->GetEvent(track);
1032 TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs();
1033 if (pRICHCerenkovs == 0) return;
1034 Int_t nhits = pRICHCerenkovs->GetEntriesFast();
1035 if (nhits == 0) continue;
1036 AliRICHCerenkov *mCerenkov;
1037 AliRICHPoints *cpoints = 0;
1041 //Display Cerenkov hits in blue
1043 for (Int_t hit=0;hit<nhits;hit++) {
1044 mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
1045 (*xp)(npoints)=mCerenkov->fX;
1046 (*yp)(npoints)=mCerenkov->fY;
1047 (*zp)(npoints)=mCerenkov->fZ;
1048 (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
1049 (*phit)(npoints)=Float_t(hit);
1052 if (npoints == 0) continue;
1053 cpoints = new AliRICHPoints(npoints);
1054 for (Int_t p=0;p<npoints;p++) {
1055 cpoints->SetMarkerColor(kBlue);
1056 cpoints->SetMarkerStyle(5);
1057 cpoints->SetMarkerSize(1.);
1058 cpoints->SetParticle(Int_t((*ptrk)(p)));
1059 cpoints->SetHitIndex(Int_t((*phit)(p)));
1060 cpoints->SetTrackIndex(track);
1061 cpoints->SetDigitIndex(-1);
1062 cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
1068 fPCerenkovs->AddAt(cpoints,track);
1072 //_____________________________________________________________________________
1073 void AliRICHDisplay::Paint(Option_t *)
1075 // Paint miscellaneous items
1079 //_____________________________________________________________________________
1080 void AliRICHDisplay::SetPickMode()
1087 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1088 fTrigPad->Modified();
1091 //_____________________________________________________________________________
1092 void AliRICHDisplay::SetZoomMode()
1099 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1100 fTrigPad->Modified();
1103 //_____________________________________________________________________________
1104 void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1106 // Set chamber and cathode number
1110 printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
1117 //_____________________________________________________________________________
1118 void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange)
1120 // Set view range along R and Z
1129 //_____________________________________________________________________________
1130 void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1132 // change viewing angles for current event
1140 TView *view = gPad->GetView();
1141 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1147 //_____________________________________________________________________________
1148 void AliRICHDisplay::ShowNextEvent(Int_t delta)
1150 // Display (current event_number+delta)
1151 // delta = 1 shown next event
1152 // delta = -1 show previous event
1156 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1157 Int_t newEvent = currentEvent + delta;
1158 gAlice->GetEvent(newEvent);
1159 if (!gAlice->TreeD()) return;
1169 //______________________________________________________________________________
1170 void AliRICHDisplay::UnZoom()
1173 // Return to previous zoom factor
1175 if (fZooms <= 0) return;
1177 TPad *pad = (TPad*)gPad->GetPadSave();
1178 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1182 //_____________________________________________________________________________
1183 void AliRICHDisplay::ResetPoints()
1186 // Reset array of points
1194 //_____________________________________________________________________________
1195 void AliRICHDisplay::ResetRpoints()
1198 // Reset array of points
1206 //_____________________________________________________________________________
1207 void AliRICHDisplay::ResetRecpoints()
1210 // Reset array of points
1213 fRecpoints->Delete();
1218 //_____________________________________________________________________________
1219 void AliRICHDisplay::ResetPhits()
1222 // Reset array of points
1230 //_____________________________________________________________________________
1231 void AliRICHDisplay::ResetPCerenkovs()
1234 // Reset array of points
1237 fPCerenkovs->Delete();
1243 //_____________________________________________________________________________
1245 void AliRICHDisplay::DrawViewGL()
1247 // Draw current view using OPENGL
1249 TPad *pad = (TPad*)gPad->GetPadSave();
1251 TView *view = pad->GetView();
1256 //_____________________________________________________________________________
1257 void AliRICHDisplay::DrawViewX3D()
1259 // Draw current view using X3D
1261 TPad *pad = (TPad*)gPad->GetPadSave();
1263 TView *view = pad->GetView();